@alanszp/express 12.0.2 → 13.0.0

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.
Files changed (180) hide show
  1. package/dist/helpers/getRequestBaseLog.d.ts +2 -0
  2. package/dist/helpers/getRequestBaseLog.js +9 -0
  3. package/dist/helpers/getRequestBaseLog.js.map +1 -0
  4. package/dist/helpers/renderErrorJson.d.ts +1 -0
  5. package/dist/helpers/renderErrorJson.js +10 -1
  6. package/dist/helpers/renderErrorJson.js.map +1 -1
  7. package/dist/index.d.ts +3 -1
  8. package/dist/index.js +3 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/middlewares/errorRequestHandlerMiddleware.d.ts +4 -0
  11. package/dist/middlewares/errorRequestHandlerMiddleware.js +68 -0
  12. package/dist/middlewares/errorRequestHandlerMiddleware.js.map +1 -0
  13. package/dist/middlewares/hasPermissions.d.ts +20 -0
  14. package/dist/middlewares/hasPermissions.js +90 -0
  15. package/dist/middlewares/hasPermissions.js.map +1 -0
  16. package/dist/middlewares/hasRoles.js +4 -4
  17. package/dist/middlewares/hasRoles.js.map +1 -1
  18. package/package.json +9 -10
  19. package/.gitignore +0 -3
  20. package/.npmignore +0 -3
  21. package/dist/middlewares/returnInternalServerError.d.ts +0 -4
  22. package/dist/middlewares/returnInternalServerError.js +0 -10
  23. package/dist/middlewares/returnInternalServerError.js.map +0 -1
  24. package/node_modules/@jest/expect-utils/LICENSE +0 -21
  25. package/node_modules/@jest/expect-utils/README.md +0 -5
  26. package/node_modules/@jest/expect-utils/build/index.d.ts +0 -93
  27. package/node_modules/@jest/expect-utils/build/index.js +0 -37
  28. package/node_modules/@jest/expect-utils/build/jasmineUtils.js +0 -282
  29. package/node_modules/@jest/expect-utils/build/types.js +0 -1
  30. package/node_modules/@jest/expect-utils/build/utils.js +0 -457
  31. package/node_modules/@jest/expect-utils/package.json +0 -33
  32. package/node_modules/@jest/types/LICENSE +0 -21
  33. package/node_modules/@jest/types/README.md +0 -30
  34. package/node_modules/@jest/types/build/Circus.js +0 -1
  35. package/node_modules/@jest/types/build/Config.js +0 -1
  36. package/node_modules/@jest/types/build/Global.js +0 -1
  37. package/node_modules/@jest/types/build/TestResult.js +0 -1
  38. package/node_modules/@jest/types/build/Transform.js +0 -1
  39. package/node_modules/@jest/types/build/index.d.ts +0 -1166
  40. package/node_modules/@jest/types/build/index.js +0 -1
  41. package/node_modules/@jest/types/package.json +0 -38
  42. package/node_modules/@types/jest/LICENSE +0 -21
  43. package/node_modules/@types/jest/README.md +0 -17
  44. package/node_modules/@types/jest/index.d.ts +0 -1608
  45. package/node_modules/@types/jest/package.json +0 -159
  46. package/node_modules/@types/node/LICENSE +0 -21
  47. package/node_modules/@types/node/README.md +0 -15
  48. package/node_modules/@types/node/assert/strict.d.ts +0 -8
  49. package/node_modules/@types/node/assert.d.ts +0 -996
  50. package/node_modules/@types/node/async_hooks.d.ts +0 -539
  51. package/node_modules/@types/node/buffer.d.ts +0 -2362
  52. package/node_modules/@types/node/child_process.d.ts +0 -1540
  53. package/node_modules/@types/node/cluster.d.ts +0 -432
  54. package/node_modules/@types/node/console.d.ts +0 -415
  55. package/node_modules/@types/node/constants.d.ts +0 -19
  56. package/node_modules/@types/node/crypto.d.ts +0 -4487
  57. package/node_modules/@types/node/dgram.d.ts +0 -596
  58. package/node_modules/@types/node/diagnostics_channel.d.ts +0 -545
  59. package/node_modules/@types/node/dns/promises.d.ts +0 -425
  60. package/node_modules/@types/node/dns.d.ts +0 -809
  61. package/node_modules/@types/node/dom-events.d.ts +0 -122
  62. package/node_modules/@types/node/domain.d.ts +0 -170
  63. package/node_modules/@types/node/events.d.ts +0 -879
  64. package/node_modules/@types/node/fs/promises.d.ts +0 -1239
  65. package/node_modules/@types/node/fs.d.ts +0 -4311
  66. package/node_modules/@types/node/globals.d.ts +0 -411
  67. package/node_modules/@types/node/globals.global.d.ts +0 -1
  68. package/node_modules/@types/node/http.d.ts +0 -1887
  69. package/node_modules/@types/node/http2.d.ts +0 -2382
  70. package/node_modules/@types/node/https.d.ts +0 -550
  71. package/node_modules/@types/node/index.d.ts +0 -88
  72. package/node_modules/@types/node/inspector.d.ts +0 -2747
  73. package/node_modules/@types/node/module.d.ts +0 -315
  74. package/node_modules/@types/node/net.d.ts +0 -949
  75. package/node_modules/@types/node/os.d.ts +0 -478
  76. package/node_modules/@types/node/package.json +0 -229
  77. package/node_modules/@types/node/path.d.ts +0 -191
  78. package/node_modules/@types/node/perf_hooks.d.ts +0 -645
  79. package/node_modules/@types/node/process.d.ts +0 -1561
  80. package/node_modules/@types/node/punycode.d.ts +0 -117
  81. package/node_modules/@types/node/querystring.d.ts +0 -141
  82. package/node_modules/@types/node/readline/promises.d.ts +0 -150
  83. package/node_modules/@types/node/readline.d.ts +0 -539
  84. package/node_modules/@types/node/repl.d.ts +0 -430
  85. package/node_modules/@types/node/stream/consumers.d.ts +0 -12
  86. package/node_modules/@types/node/stream/promises.d.ts +0 -83
  87. package/node_modules/@types/node/stream/web.d.ts +0 -366
  88. package/node_modules/@types/node/stream.d.ts +0 -1701
  89. package/node_modules/@types/node/string_decoder.d.ts +0 -67
  90. package/node_modules/@types/node/test.d.ts +0 -1465
  91. package/node_modules/@types/node/timers/promises.d.ts +0 -93
  92. package/node_modules/@types/node/timers.d.ts +0 -240
  93. package/node_modules/@types/node/tls.d.ts +0 -1210
  94. package/node_modules/@types/node/trace_events.d.ts +0 -182
  95. package/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  96. package/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  97. package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  98. package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2362
  99. package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  100. package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  101. package/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  102. package/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  103. package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4487
  104. package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -596
  105. package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -545
  106. package/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  107. package/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  108. package/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  109. package/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  110. package/node_modules/@types/node/ts4.8/events.d.ts +0 -879
  111. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1239
  112. package/node_modules/@types/node/ts4.8/fs.d.ts +0 -4311
  113. package/node_modules/@types/node/ts4.8/globals.d.ts +0 -411
  114. package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  115. package/node_modules/@types/node/ts4.8/http.d.ts +0 -1887
  116. package/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  117. package/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  118. package/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  119. package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  120. package/node_modules/@types/node/ts4.8/module.d.ts +0 -315
  121. package/node_modules/@types/node/ts4.8/net.d.ts +0 -949
  122. package/node_modules/@types/node/ts4.8/os.d.ts +0 -478
  123. package/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  124. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -645
  125. package/node_modules/@types/node/ts4.8/process.d.ts +0 -1561
  126. package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  127. package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  128. package/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  129. package/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  130. package/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  131. package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  132. package/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  133. package/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -366
  134. package/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  135. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  136. package/node_modules/@types/node/ts4.8/test.d.ts +0 -1465
  137. package/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  138. package/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  139. package/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  140. package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  141. package/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  142. package/node_modules/@types/node/ts4.8/url.d.ts +0 -927
  143. package/node_modules/@types/node/ts4.8/util.d.ts +0 -2183
  144. package/node_modules/@types/node/ts4.8/v8.d.ts +0 -764
  145. package/node_modules/@types/node/ts4.8/vm.d.ts +0 -903
  146. package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -179
  147. package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  148. package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  149. package/node_modules/@types/node/tty.d.ts +0 -208
  150. package/node_modules/@types/node/url.d.ts +0 -927
  151. package/node_modules/@types/node/util.d.ts +0 -2183
  152. package/node_modules/@types/node/v8.d.ts +0 -764
  153. package/node_modules/@types/node/vm.d.ts +0 -903
  154. package/node_modules/@types/node/wasi.d.ts +0 -179
  155. package/node_modules/@types/node/worker_threads.d.ts +0 -691
  156. package/node_modules/@types/node/zlib.d.ts +0 -517
  157. package/src/helpers/getIp.ts +0 -5
  158. package/src/helpers/getRequestLogger.ts +0 -6
  159. package/src/helpers/now.ts +0 -3
  160. package/src/helpers/renderErrorJson.ts +0 -29
  161. package/src/index.ts +0 -10
  162. package/src/middlewares/accessLogger.ts +0 -34
  163. package/src/middlewares/auditLog.ts +0 -52
  164. package/src/middlewares/authedForOrg.ts +0 -50
  165. package/src/middlewares/authenticateUser.test.ts +0 -403
  166. package/src/middlewares/authenticateUser.ts +0 -171
  167. package/src/middlewares/createContext.test.ts +0 -85
  168. package/src/middlewares/createContext.ts +0 -49
  169. package/src/middlewares/hasRoles.ts +0 -24
  170. package/src/middlewares/jsonBodyParser.ts +0 -22
  171. package/src/middlewares/returnInternalServerError.ts +0 -15
  172. package/src/middlewares/returnNotFound.ts +0 -11
  173. package/src/test/mocks/authOptionsMocks.ts +0 -35
  174. package/src/test/mocks/expressMocks.ts +0 -33
  175. package/src/test/mocks/jwtUserMocks.ts +0 -19
  176. package/src/test/setup.test.ts +0 -15
  177. package/src/test/setup.ts +0 -3
  178. package/src/types/AuthMethod.ts +0 -27
  179. package/src/types/GenericRequest.ts +0 -3
  180. package/src/types/custom.d.ts +0 -20
@@ -1,229 +0,0 @@
1
- {
2
- "name": "@types/node",
3
- "version": "20.11.17",
4
- "description": "TypeScript definitions for node",
5
- "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
- "license": "MIT",
7
- "contributors": [
8
- {
9
- "name": "Microsoft TypeScript",
10
- "githubUsername": "Microsoft",
11
- "url": "https://github.com/Microsoft"
12
- },
13
- {
14
- "name": "Alberto Schiabel",
15
- "githubUsername": "jkomyno",
16
- "url": "https://github.com/jkomyno"
17
- },
18
- {
19
- "name": "Alvis HT Tang",
20
- "githubUsername": "alvis",
21
- "url": "https://github.com/alvis"
22
- },
23
- {
24
- "name": "Andrew Makarov",
25
- "githubUsername": "r3nya",
26
- "url": "https://github.com/r3nya"
27
- },
28
- {
29
- "name": "Benjamin Toueg",
30
- "githubUsername": "btoueg",
31
- "url": "https://github.com/btoueg"
32
- },
33
- {
34
- "name": "Chigozirim C.",
35
- "githubUsername": "smac89",
36
- "url": "https://github.com/smac89"
37
- },
38
- {
39
- "name": "David Junger",
40
- "githubUsername": "touffy",
41
- "url": "https://github.com/touffy"
42
- },
43
- {
44
- "name": "Deividas Bakanas",
45
- "githubUsername": "DeividasBakanas",
46
- "url": "https://github.com/DeividasBakanas"
47
- },
48
- {
49
- "name": "Eugene Y. Q. Shen",
50
- "githubUsername": "eyqs",
51
- "url": "https://github.com/eyqs"
52
- },
53
- {
54
- "name": "Hannes Magnusson",
55
- "githubUsername": "Hannes-Magnusson-CK",
56
- "url": "https://github.com/Hannes-Magnusson-CK"
57
- },
58
- {
59
- "name": "Huw",
60
- "githubUsername": "hoo29",
61
- "url": "https://github.com/hoo29"
62
- },
63
- {
64
- "name": "Kelvin Jin",
65
- "githubUsername": "kjin",
66
- "url": "https://github.com/kjin"
67
- },
68
- {
69
- "name": "Klaus Meinhardt",
70
- "githubUsername": "ajafff",
71
- "url": "https://github.com/ajafff"
72
- },
73
- {
74
- "name": "Lishude",
75
- "githubUsername": "islishude",
76
- "url": "https://github.com/islishude"
77
- },
78
- {
79
- "name": "Mariusz Wiktorczyk",
80
- "githubUsername": "mwiktorczyk",
81
- "url": "https://github.com/mwiktorczyk"
82
- },
83
- {
84
- "name": "Mohsen Azimi",
85
- "githubUsername": "mohsen1",
86
- "url": "https://github.com/mohsen1"
87
- },
88
- {
89
- "name": "Nicolas Even",
90
- "githubUsername": "n-e",
91
- "url": "https://github.com/n-e"
92
- },
93
- {
94
- "name": "Nikita Galkin",
95
- "githubUsername": "galkin",
96
- "url": "https://github.com/galkin"
97
- },
98
- {
99
- "name": "Parambir Singh",
100
- "githubUsername": "parambirs",
101
- "url": "https://github.com/parambirs"
102
- },
103
- {
104
- "name": "Sebastian Silbermann",
105
- "githubUsername": "eps1lon",
106
- "url": "https://github.com/eps1lon"
107
- },
108
- {
109
- "name": "Thomas den Hollander",
110
- "githubUsername": "ThomasdenH",
111
- "url": "https://github.com/ThomasdenH"
112
- },
113
- {
114
- "name": "Wilco Bakker",
115
- "githubUsername": "WilcoBakker",
116
- "url": "https://github.com/WilcoBakker"
117
- },
118
- {
119
- "name": "wwwy3y3",
120
- "githubUsername": "wwwy3y3",
121
- "url": "https://github.com/wwwy3y3"
122
- },
123
- {
124
- "name": "Samuel Ainsworth",
125
- "githubUsername": "samuela",
126
- "url": "https://github.com/samuela"
127
- },
128
- {
129
- "name": "Kyle Uehlein",
130
- "githubUsername": "kuehlein",
131
- "url": "https://github.com/kuehlein"
132
- },
133
- {
134
- "name": "Thanik Bhongbhibhat",
135
- "githubUsername": "bhongy",
136
- "url": "https://github.com/bhongy"
137
- },
138
- {
139
- "name": "Marcin Kopacz",
140
- "githubUsername": "chyzwar",
141
- "url": "https://github.com/chyzwar"
142
- },
143
- {
144
- "name": "Trivikram Kamat",
145
- "githubUsername": "trivikr",
146
- "url": "https://github.com/trivikr"
147
- },
148
- {
149
- "name": "Junxiao Shi",
150
- "githubUsername": "yoursunny",
151
- "url": "https://github.com/yoursunny"
152
- },
153
- {
154
- "name": "Ilia Baryshnikov",
155
- "githubUsername": "qwelias",
156
- "url": "https://github.com/qwelias"
157
- },
158
- {
159
- "name": "ExE Boss",
160
- "githubUsername": "ExE-Boss",
161
- "url": "https://github.com/ExE-Boss"
162
- },
163
- {
164
- "name": "Piotr Błażejewicz",
165
- "githubUsername": "peterblazejewicz",
166
- "url": "https://github.com/peterblazejewicz"
167
- },
168
- {
169
- "name": "Anna Henningsen",
170
- "githubUsername": "addaleax",
171
- "url": "https://github.com/addaleax"
172
- },
173
- {
174
- "name": "Victor Perin",
175
- "githubUsername": "victorperin",
176
- "url": "https://github.com/victorperin"
177
- },
178
- {
179
- "name": "Yongsheng Zhang",
180
- "githubUsername": "ZYSzys",
181
- "url": "https://github.com/ZYSzys"
182
- },
183
- {
184
- "name": "NodeJS Contributors",
185
- "githubUsername": "NodeJS",
186
- "url": "https://github.com/NodeJS"
187
- },
188
- {
189
- "name": "Linus Unnebäck",
190
- "githubUsername": "LinusU",
191
- "url": "https://github.com/LinusU"
192
- },
193
- {
194
- "name": "wafuwafu13",
195
- "githubUsername": "wafuwafu13",
196
- "url": "https://github.com/wafuwafu13"
197
- },
198
- {
199
- "name": "Matteo Collina",
200
- "githubUsername": "mcollina",
201
- "url": "https://github.com/mcollina"
202
- },
203
- {
204
- "name": "Dmitry Semigradsky",
205
- "githubUsername": "Semigradsky",
206
- "url": "https://github.com/Semigradsky"
207
- }
208
- ],
209
- "main": "",
210
- "types": "index.d.ts",
211
- "typesVersions": {
212
- "<=4.8": {
213
- "*": [
214
- "ts4.8/*"
215
- ]
216
- }
217
- },
218
- "repository": {
219
- "type": "git",
220
- "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
221
- "directory": "types/node"
222
- },
223
- "scripts": {},
224
- "dependencies": {
225
- "undici-types": "~5.26.4"
226
- },
227
- "typesPublisherContentHash": "b2819dbf39a2441dc5ca106500073050f96406fa5b9b6227de273d56d6084b97",
228
- "typeScriptVersion": "4.6"
229
- }
@@ -1,191 +0,0 @@
1
- declare module "path/posix" {
2
- import path = require("path");
3
- export = path;
4
- }
5
- declare module "path/win32" {
6
- import path = require("path");
7
- export = path;
8
- }
9
- /**
10
- * The `node:path` module provides utilities for working with file and directory
11
- * paths. It can be accessed using:
12
- *
13
- * ```js
14
- * const path = require('node:path');
15
- * ```
16
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/path.js)
17
- */
18
- declare module "path" {
19
- namespace path {
20
- /**
21
- * A parsed path object generated by path.parse() or consumed by path.format().
22
- */
23
- interface ParsedPath {
24
- /**
25
- * The root of the path such as '/' or 'c:\'
26
- */
27
- root: string;
28
- /**
29
- * The full directory path such as '/home/user/dir' or 'c:\path\dir'
30
- */
31
- dir: string;
32
- /**
33
- * The file name including extension (if any) such as 'index.html'
34
- */
35
- base: string;
36
- /**
37
- * The file extension (if any) such as '.html'
38
- */
39
- ext: string;
40
- /**
41
- * The file name without extension (if any) such as 'index'
42
- */
43
- name: string;
44
- }
45
- interface FormatInputPathObject {
46
- /**
47
- * The root of the path such as '/' or 'c:\'
48
- */
49
- root?: string | undefined;
50
- /**
51
- * The full directory path such as '/home/user/dir' or 'c:\path\dir'
52
- */
53
- dir?: string | undefined;
54
- /**
55
- * The file name including extension (if any) such as 'index.html'
56
- */
57
- base?: string | undefined;
58
- /**
59
- * The file extension (if any) such as '.html'
60
- */
61
- ext?: string | undefined;
62
- /**
63
- * The file name without extension (if any) such as 'index'
64
- */
65
- name?: string | undefined;
66
- }
67
- interface PlatformPath {
68
- /**
69
- * Normalize a string path, reducing '..' and '.' parts.
70
- * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.
71
- *
72
- * @param path string path to normalize.
73
- * @throws {TypeError} if `path` is not a string.
74
- */
75
- normalize(path: string): string;
76
- /**
77
- * Join all arguments together and normalize the resulting path.
78
- *
79
- * @param paths paths to join.
80
- * @throws {TypeError} if any of the path segments is not a string.
81
- */
82
- join(...paths: string[]): string;
83
- /**
84
- * The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
85
- *
86
- * Starting from leftmost {from} parameter, resolves {to} to an absolute path.
87
- *
88
- * If {to} isn't already absolute, {from} arguments are prepended in right to left order,
89
- * until an absolute path is found. If after using all {from} paths still no absolute path is found,
90
- * the current working directory is used as well. The resulting path is normalized,
91
- * and trailing slashes are removed unless the path gets resolved to the root directory.
92
- *
93
- * @param paths A sequence of paths or path segments.
94
- * @throws {TypeError} if any of the arguments is not a string.
95
- */
96
- resolve(...paths: string[]): string;
97
- /**
98
- * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.
99
- *
100
- * If the given {path} is a zero-length string, `false` will be returned.
101
- *
102
- * @param path path to test.
103
- * @throws {TypeError} if `path` is not a string.
104
- */
105
- isAbsolute(path: string): boolean;
106
- /**
107
- * Solve the relative path from {from} to {to} based on the current working directory.
108
- * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.
109
- *
110
- * @throws {TypeError} if either `from` or `to` is not a string.
111
- */
112
- relative(from: string, to: string): string;
113
- /**
114
- * Return the directory name of a path. Similar to the Unix dirname command.
115
- *
116
- * @param path the path to evaluate.
117
- * @throws {TypeError} if `path` is not a string.
118
- */
119
- dirname(path: string): string;
120
- /**
121
- * Return the last portion of a path. Similar to the Unix basename command.
122
- * Often used to extract the file name from a fully qualified path.
123
- *
124
- * @param path the path to evaluate.
125
- * @param suffix optionally, an extension to remove from the result.
126
- * @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string.
127
- */
128
- basename(path: string, suffix?: string): string;
129
- /**
130
- * Return the extension of the path, from the last '.' to end of string in the last portion of the path.
131
- * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string.
132
- *
133
- * @param path the path to evaluate.
134
- * @throws {TypeError} if `path` is not a string.
135
- */
136
- extname(path: string): string;
137
- /**
138
- * The platform-specific file separator. '\\' or '/'.
139
- */
140
- readonly sep: "\\" | "/";
141
- /**
142
- * The platform-specific file delimiter. ';' or ':'.
143
- */
144
- readonly delimiter: ";" | ":";
145
- /**
146
- * Returns an object from a path string - the opposite of format().
147
- *
148
- * @param path path to evaluate.
149
- * @throws {TypeError} if `path` is not a string.
150
- */
151
- parse(path: string): ParsedPath;
152
- /**
153
- * Returns a path string from an object - the opposite of parse().
154
- *
155
- * @param pathObject path to evaluate.
156
- */
157
- format(pathObject: FormatInputPathObject): string;
158
- /**
159
- * On Windows systems only, returns an equivalent namespace-prefixed path for the given path.
160
- * If path is not a string, path will be returned without modifications.
161
- * This method is meaningful only on Windows system.
162
- * On POSIX systems, the method is non-operational and always returns path without modifications.
163
- */
164
- toNamespacedPath(path: string): string;
165
- /**
166
- * Posix specific pathing.
167
- * Same as parent object on posix.
168
- */
169
- readonly posix: PlatformPath;
170
- /**
171
- * Windows specific pathing.
172
- * Same as parent object on windows
173
- */
174
- readonly win32: PlatformPath;
175
- }
176
- }
177
- const path: path.PlatformPath;
178
- export = path;
179
- }
180
- declare module "node:path" {
181
- import path = require("path");
182
- export = path;
183
- }
184
- declare module "node:path/posix" {
185
- import path = require("path/posix");
186
- export = path;
187
- }
188
- declare module "node:path/win32" {
189
- import path = require("path/win32");
190
- export = path;
191
- }