@scalar/openapi-parser 0.10.15 → 0.10.17

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 (332) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +0 -22
  3. package/dist/configuration/index.js +19 -22
  4. package/dist/configuration/index.js.map +7 -0
  5. package/dist/declarations.d.js +1 -0
  6. package/dist/declarations.d.js.map +7 -0
  7. package/dist/index.d.ts +4 -4
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +5 -29
  10. package/dist/index.js.map +7 -0
  11. package/dist/lib/Validator/Validator.d.ts +2 -2
  12. package/dist/lib/Validator/Validator.d.ts.map +1 -1
  13. package/dist/lib/Validator/Validator.js +99 -119
  14. package/dist/lib/Validator/Validator.js.map +7 -0
  15. package/dist/lib/Validator/Validator.test.js +8 -0
  16. package/dist/lib/Validator/Validator.test.js.map +7 -0
  17. package/dist/lib/Validator/index.d.ts +2 -2
  18. package/dist/lib/Validator/index.d.ts.map +1 -1
  19. package/dist/lib/Validator/index.js +3 -0
  20. package/dist/lib/Validator/index.js.map +7 -0
  21. package/dist/plugins/fetch-urls/fetchUrls.d.ts +1 -2
  22. package/dist/plugins/fetch-urls/fetchUrls.d.ts.map +1 -1
  23. package/dist/plugins/fetch-urls/fetchUrls.js +36 -111
  24. package/dist/plugins/fetch-urls/fetchUrls.js.map +7 -0
  25. package/dist/plugins/fetch-urls/fetchUrls.test.js +50 -0
  26. package/dist/plugins/fetch-urls/fetchUrls.test.js.map +7 -0
  27. package/dist/plugins/fetch-urls/index.d.ts +1 -1
  28. package/dist/plugins/fetch-urls/index.d.ts.map +1 -1
  29. package/dist/plugins/fetch-urls/index.js +2 -1
  30. package/dist/plugins/fetch-urls/index.js.map +7 -0
  31. package/dist/plugins/read-files/index.d.ts +1 -1
  32. package/dist/plugins/read-files/index.d.ts.map +1 -1
  33. package/dist/plugins/read-files/index.js +2 -1
  34. package/dist/plugins/read-files/index.js.map +7 -0
  35. package/dist/plugins/read-files/readFiles.d.ts +1 -1
  36. package/dist/plugins/read-files/readFiles.d.ts.map +1 -1
  37. package/dist/plugins/read-files/readFiles.js +50 -70
  38. package/dist/plugins/read-files/readFiles.js.map +7 -0
  39. package/dist/plugins/read-files/readFiles.test.js +20 -0
  40. package/dist/plugins/read-files/readFiles.test.js.map +7 -0
  41. package/dist/polyfills/index.d.ts +1 -1
  42. package/dist/polyfills/index.d.ts.map +1 -1
  43. package/dist/polyfills/index.js +5 -0
  44. package/dist/polyfills/index.js.map +7 -0
  45. package/dist/polyfills/path.js +155 -98
  46. package/dist/polyfills/path.js.map +7 -0
  47. package/dist/schemas/v2.0/schema.d.ts +1405 -0
  48. package/dist/schemas/v2.0/schema.d.ts.map +1 -0
  49. package/dist/schemas/v2.0/schema.js +1463 -0
  50. package/dist/schemas/v2.0/schema.js.map +7 -0
  51. package/dist/schemas/v3.0/schema.d.ts +1264 -0
  52. package/dist/schemas/v3.0/schema.d.ts.map +1 -0
  53. package/dist/schemas/v3.0/schema.js +1493 -0
  54. package/dist/schemas/v3.0/schema.js.map +7 -0
  55. package/dist/schemas/v3.1/schema.d.ts +1225 -0
  56. package/dist/schemas/v3.1/schema.d.ts.map +1 -0
  57. package/dist/schemas/v3.1/schema.js +1296 -0
  58. package/dist/schemas/v3.1/schema.js.map +7 -0
  59. package/dist/types/index.d.ts +5 -24
  60. package/dist/types/index.d.ts.map +1 -1
  61. package/dist/types/index.js +1 -0
  62. package/dist/types/index.js.map +7 -0
  63. package/dist/utils/betterAjvErrors/helpers.js +88 -93
  64. package/dist/utils/betterAjvErrors/helpers.js.map +7 -0
  65. package/dist/utils/betterAjvErrors/index.js +14 -13
  66. package/dist/utils/betterAjvErrors/index.js.map +7 -0
  67. package/dist/utils/betterAjvErrors/json/get-meta-from-path.d.ts +2 -0
  68. package/dist/utils/betterAjvErrors/json/get-meta-from-path.d.ts.map +1 -0
  69. package/dist/utils/betterAjvErrors/json/get-meta-from-path.js +27 -0
  70. package/dist/utils/betterAjvErrors/json/get-meta-from-path.js.map +7 -0
  71. package/dist/utils/betterAjvErrors/json/index.d.ts +2 -0
  72. package/dist/utils/betterAjvErrors/json/index.d.ts.map +1 -0
  73. package/dist/utils/betterAjvErrors/json/index.js +5 -0
  74. package/dist/utils/betterAjvErrors/json/index.js.map +7 -0
  75. package/dist/utils/betterAjvErrors/json/utils.d.ts +2 -0
  76. package/dist/utils/betterAjvErrors/json/utils.d.ts.map +1 -0
  77. package/dist/utils/betterAjvErrors/json/utils.js +11 -0
  78. package/dist/utils/betterAjvErrors/json/utils.js.map +7 -0
  79. package/dist/utils/betterAjvErrors/utils.js +21 -14
  80. package/dist/utils/betterAjvErrors/utils.js.map +7 -0
  81. package/dist/utils/betterAjvErrors/validation-errors/additional-prop.d.ts +10 -0
  82. package/dist/utils/betterAjvErrors/validation-errors/additional-prop.d.ts.map +1 -0
  83. package/dist/utils/betterAjvErrors/validation-errors/additional-prop.js +8 -9
  84. package/dist/utils/betterAjvErrors/validation-errors/additional-prop.js.map +7 -0
  85. package/dist/utils/betterAjvErrors/validation-errors/base.d.ts +23 -0
  86. package/dist/utils/betterAjvErrors/validation-errors/base.d.ts.map +1 -0
  87. package/dist/utils/betterAjvErrors/validation-errors/base.js +6 -10
  88. package/dist/utils/betterAjvErrors/validation-errors/base.js.map +7 -0
  89. package/dist/utils/betterAjvErrors/validation-errors/default.d.ts +10 -0
  90. package/dist/utils/betterAjvErrors/validation-errors/default.d.ts.map +1 -0
  91. package/dist/utils/betterAjvErrors/validation-errors/default.js +8 -9
  92. package/dist/utils/betterAjvErrors/validation-errors/default.js.map +7 -0
  93. package/dist/utils/betterAjvErrors/validation-errors/enum.d.ts +11 -0
  94. package/dist/utils/betterAjvErrors/validation-errors/enum.d.ts.map +1 -0
  95. package/dist/utils/betterAjvErrors/validation-errors/enum.js +19 -29
  96. package/dist/utils/betterAjvErrors/validation-errors/enum.js.map +7 -0
  97. package/dist/utils/betterAjvErrors/validation-errors/index.d.ts +7 -0
  98. package/dist/utils/betterAjvErrors/validation-errors/index.d.ts.map +1 -0
  99. package/dist/utils/betterAjvErrors/validation-errors/index.js +15 -0
  100. package/dist/utils/betterAjvErrors/validation-errors/index.js.map +7 -0
  101. package/dist/utils/betterAjvErrors/validation-errors/pattern.d.ts +10 -0
  102. package/dist/utils/betterAjvErrors/validation-errors/pattern.d.ts.map +1 -0
  103. package/dist/utils/betterAjvErrors/validation-errors/pattern.js +8 -9
  104. package/dist/utils/betterAjvErrors/validation-errors/pattern.js.map +7 -0
  105. package/dist/utils/betterAjvErrors/validation-errors/required.d.ts +10 -0
  106. package/dist/utils/betterAjvErrors/validation-errors/required.d.ts.map +1 -0
  107. package/dist/utils/betterAjvErrors/validation-errors/required.js +8 -9
  108. package/dist/utils/betterAjvErrors/validation-errors/required.js.map +7 -0
  109. package/dist/utils/betterAjvErrors/validation-errors/unevaluated-prop.d.ts +10 -0
  110. package/dist/utils/betterAjvErrors/validation-errors/unevaluated-prop.d.ts.map +1 -0
  111. package/dist/utils/betterAjvErrors/validation-errors/unevaluated-prop.js +8 -9
  112. package/dist/utils/betterAjvErrors/validation-errors/unevaluated-prop.js.map +7 -0
  113. package/dist/utils/dereference.d.ts +2 -2
  114. package/dist/utils/dereference.d.ts.map +1 -1
  115. package/dist/utils/dereference.js +17 -19
  116. package/dist/utils/dereference.js.map +7 -0
  117. package/dist/utils/dereference.test.js +300 -0
  118. package/dist/utils/dereference.test.js.map +7 -0
  119. package/dist/utils/details.d.ts +1 -1
  120. package/dist/utils/details.d.ts.map +1 -1
  121. package/dist/utils/details.js +26 -28
  122. package/dist/utils/details.js.map +7 -0
  123. package/dist/utils/errors.test.js +48 -0
  124. package/dist/utils/errors.test.js.map +7 -0
  125. package/dist/utils/escapeJsonPointer.js +5 -8
  126. package/dist/utils/escapeJsonPointer.js.map +7 -0
  127. package/dist/utils/escapeJsonPointer.test.js +11 -0
  128. package/dist/utils/escapeJsonPointer.test.js.map +7 -0
  129. package/dist/utils/filter.d.ts +1 -1
  130. package/dist/utils/filter.d.ts.map +1 -1
  131. package/dist/utils/filter.js +13 -15
  132. package/dist/utils/filter.js.map +7 -0
  133. package/dist/utils/getEntrypoint.d.ts +1 -1
  134. package/dist/utils/getEntrypoint.d.ts.map +1 -1
  135. package/dist/utils/getEntrypoint.js +5 -6
  136. package/dist/utils/getEntrypoint.js.map +7 -0
  137. package/dist/utils/getEntrypoint.test.js +18 -0
  138. package/dist/utils/getEntrypoint.test.js.map +7 -0
  139. package/dist/utils/getListOfReferences.d.ts +1 -1
  140. package/dist/utils/getListOfReferences.d.ts.map +1 -1
  141. package/dist/utils/getListOfReferences.js +15 -22
  142. package/dist/utils/getListOfReferences.js.map +7 -0
  143. package/dist/utils/getSegmentsFromPath.js +8 -15
  144. package/dist/utils/getSegmentsFromPath.js.map +7 -0
  145. package/dist/utils/getSegmentsFromPath.test.js +13 -0
  146. package/dist/utils/getSegmentsFromPath.test.js.map +7 -0
  147. package/dist/utils/index.d.ts +26 -26
  148. package/dist/utils/index.d.ts.map +1 -1
  149. package/dist/utils/index.js +27 -0
  150. package/dist/utils/index.js.map +7 -0
  151. package/dist/utils/isFilesystem.d.ts +1 -2
  152. package/dist/utils/isFilesystem.d.ts.map +1 -1
  153. package/dist/utils/isFilesystem.js +5 -9
  154. package/dist/utils/isFilesystem.js.map +7 -0
  155. package/dist/utils/isJson.js +10 -9
  156. package/dist/utils/isJson.js.map +7 -0
  157. package/dist/utils/isObject.js +5 -6
  158. package/dist/utils/isObject.js.map +7 -0
  159. package/dist/utils/isObject.test.js +23 -0
  160. package/dist/utils/isObject.test.js.map +7 -0
  161. package/dist/utils/isYaml.js +16 -17
  162. package/dist/utils/isYaml.js.map +7 -0
  163. package/dist/utils/load/index.d.ts +1 -1
  164. package/dist/utils/load/index.d.ts.map +1 -1
  165. package/dist/utils/load/index.js +2 -0
  166. package/dist/utils/load/index.js.map +7 -0
  167. package/dist/utils/load/load.d.ts +3 -12
  168. package/dist/utils/load/load.d.ts.map +1 -1
  169. package/dist/utils/load/load.js +89 -149
  170. package/dist/utils/load/load.js.map +7 -0
  171. package/dist/utils/load/load.test.js +361 -0
  172. package/dist/utils/load/load.test.js.map +7 -0
  173. package/dist/utils/makeFilesystem.d.ts +2 -19
  174. package/dist/utils/makeFilesystem.d.ts.map +1 -1
  175. package/dist/utils/makeFilesystem.js +20 -68
  176. package/dist/utils/makeFilesystem.js.map +7 -0
  177. package/dist/utils/makeFilesystem.test.js +15 -0
  178. package/dist/utils/makeFilesystem.test.js.map +7 -0
  179. package/dist/utils/normalize.d.ts +1 -1
  180. package/dist/utils/normalize.d.ts.map +1 -1
  181. package/dist/utils/normalize.js +22 -27
  182. package/dist/utils/normalize.js.map +7 -0
  183. package/dist/utils/normalize.test.js +88 -0
  184. package/dist/utils/normalize.test.js.map +7 -0
  185. package/dist/utils/openapi/actions/details.d.ts +2 -2
  186. package/dist/utils/openapi/actions/details.d.ts.map +1 -1
  187. package/dist/utils/openapi/actions/details.js +9 -11
  188. package/dist/utils/openapi/actions/details.js.map +7 -0
  189. package/dist/utils/openapi/actions/files.d.ts +1 -1
  190. package/dist/utils/openapi/actions/files.d.ts.map +1 -1
  191. package/dist/utils/openapi/actions/files.js +7 -9
  192. package/dist/utils/openapi/actions/files.js.map +7 -0
  193. package/dist/utils/openapi/actions/get.d.ts +1 -1
  194. package/dist/utils/openapi/actions/get.d.ts.map +1 -1
  195. package/dist/utils/openapi/actions/get.js +9 -11
  196. package/dist/utils/openapi/actions/get.js.map +7 -0
  197. package/dist/utils/openapi/actions/toJson.d.ts +1 -1
  198. package/dist/utils/openapi/actions/toJson.d.ts.map +1 -1
  199. package/dist/utils/openapi/actions/toJson.js +9 -11
  200. package/dist/utils/openapi/actions/toJson.js.map +7 -0
  201. package/dist/utils/openapi/actions/toYaml.d.ts +1 -1
  202. package/dist/utils/openapi/actions/toYaml.d.ts.map +1 -1
  203. package/dist/utils/openapi/actions/toYaml.js +9 -11
  204. package/dist/utils/openapi/actions/toYaml.js.map +7 -0
  205. package/dist/utils/openapi/commands/dereferenceCommand.d.ts +5 -5
  206. package/dist/utils/openapi/commands/dereferenceCommand.d.ts.map +1 -1
  207. package/dist/utils/openapi/commands/dereferenceCommand.js +25 -27
  208. package/dist/utils/openapi/commands/dereferenceCommand.js.map +7 -0
  209. package/dist/utils/openapi/commands/filterCommand.d.ts +9 -9
  210. package/dist/utils/openapi/commands/filterCommand.d.ts.map +1 -1
  211. package/dist/utils/openapi/commands/filterCommand.js +24 -26
  212. package/dist/utils/openapi/commands/filterCommand.js.map +7 -0
  213. package/dist/utils/openapi/commands/loadCommand.d.ts +1174 -1174
  214. package/dist/utils/openapi/commands/loadCommand.d.ts.map +1 -1
  215. package/dist/utils/openapi/commands/loadCommand.js +40 -42
  216. package/dist/utils/openapi/commands/loadCommand.js.map +7 -0
  217. package/dist/utils/openapi/commands/upgradeCommand.d.ts +311 -311
  218. package/dist/utils/openapi/commands/upgradeCommand.d.ts.map +1 -1
  219. package/dist/utils/openapi/commands/upgradeCommand.js +27 -29
  220. package/dist/utils/openapi/commands/upgradeCommand.js.map +7 -0
  221. package/dist/utils/openapi/commands/validateCommand.d.ts +311 -311
  222. package/dist/utils/openapi/commands/validateCommand.d.ts.map +1 -1
  223. package/dist/utils/openapi/commands/validateCommand.js +31 -33
  224. package/dist/utils/openapi/commands/validateCommand.js.map +7 -0
  225. package/dist/utils/openapi/index.d.ts +1 -1
  226. package/dist/utils/openapi/index.d.ts.map +1 -1
  227. package/dist/utils/openapi/index.js +2 -0
  228. package/dist/utils/openapi/index.js.map +7 -0
  229. package/dist/utils/openapi/openapi.d.ts +700 -700
  230. package/dist/utils/openapi/openapi.d.ts.map +1 -1
  231. package/dist/utils/openapi/openapi.js +13 -16
  232. package/dist/utils/openapi/openapi.js.map +7 -0
  233. package/dist/utils/openapi/openapi.test-d.js +14 -0
  234. package/dist/utils/openapi/openapi.test-d.js.map +7 -0
  235. package/dist/utils/openapi/openapi.test.js +309 -0
  236. package/dist/utils/openapi/openapi.test.js.map +7 -0
  237. package/dist/utils/openapi/utils/queueTask.d.ts +1 -1
  238. package/dist/utils/openapi/utils/queueTask.d.ts.map +1 -1
  239. package/dist/utils/openapi/utils/queueTask.js +8 -9
  240. package/dist/utils/openapi/utils/queueTask.js.map +7 -0
  241. package/dist/utils/openapi/utils/workThroughQueue.d.ts +1 -1
  242. package/dist/utils/openapi/utils/workThroughQueue.d.ts.map +1 -1
  243. package/dist/utils/openapi/utils/workThroughQueue.js +49 -64
  244. package/dist/utils/openapi/utils/workThroughQueue.js.map +7 -0
  245. package/dist/utils/openapi/utils/workThroughQueue.test.js +244 -0
  246. package/dist/utils/openapi/utils/workThroughQueue.test.js.map +7 -0
  247. package/dist/utils/resolveReferences.d.ts +1 -7
  248. package/dist/utils/resolveReferences.d.ts.map +1 -1
  249. package/dist/utils/resolveReferences.js +91 -149
  250. package/dist/utils/resolveReferences.js.map +7 -0
  251. package/dist/utils/resolveReferences.test.js +567 -0
  252. package/dist/utils/resolveReferences.test.js.map +7 -0
  253. package/dist/utils/toJson.d.ts +1 -1
  254. package/dist/utils/toJson.d.ts.map +1 -1
  255. package/dist/utils/toJson.js +4 -2
  256. package/dist/utils/toJson.js.map +7 -0
  257. package/dist/utils/toYaml.d.ts +1 -1
  258. package/dist/utils/toYaml.d.ts.map +1 -1
  259. package/dist/utils/toYaml.js +5 -4
  260. package/dist/utils/toYaml.js.map +7 -0
  261. package/dist/utils/transform/index.d.ts +1 -1
  262. package/dist/utils/transform/index.d.ts.map +1 -1
  263. package/dist/utils/transform/index.js +2 -0
  264. package/dist/utils/transform/index.js.map +7 -0
  265. package/dist/utils/transform/sanitize.d.ts +3 -3
  266. package/dist/utils/transform/sanitize.d.ts.map +1 -1
  267. package/dist/utils/transform/sanitize.js +22 -21
  268. package/dist/utils/transform/sanitize.js.map +7 -0
  269. package/dist/utils/transform/sanitize.test.js +148 -0
  270. package/dist/utils/transform/sanitize.test.js.map +7 -0
  271. package/dist/utils/transform/utils/addInfoObject.d.ts +1 -1
  272. package/dist/utils/transform/utils/addInfoObject.d.ts.map +1 -1
  273. package/dist/utils/transform/utils/addInfoObject.js +14 -10
  274. package/dist/utils/transform/utils/addInfoObject.js.map +7 -0
  275. package/dist/utils/transform/utils/addLatestOpenApiVersion.d.ts +1 -1
  276. package/dist/utils/transform/utils/addLatestOpenApiVersion.d.ts.map +1 -1
  277. package/dist/utils/transform/utils/addLatestOpenApiVersion.js +8 -5
  278. package/dist/utils/transform/utils/addLatestOpenApiVersion.js.map +7 -0
  279. package/dist/utils/transform/utils/addMissingTags.d.ts +1 -1
  280. package/dist/utils/transform/utils/addMissingTags.d.ts.map +1 -1
  281. package/dist/utils/transform/utils/addMissingTags.js +26 -27
  282. package/dist/utils/transform/utils/addMissingTags.js.map +7 -0
  283. package/dist/utils/transform/utils/normalizeSecuritySchemes.d.ts +1 -1
  284. package/dist/utils/transform/utils/normalizeSecuritySchemes.d.ts.map +1 -1
  285. package/dist/utils/transform/utils/normalizeSecuritySchemes.js +36 -40
  286. package/dist/utils/transform/utils/normalizeSecuritySchemes.js.map +7 -0
  287. package/dist/utils/transform/utils/rejectSwaggerDocuments.d.ts +1 -1
  288. package/dist/utils/transform/utils/rejectSwaggerDocuments.d.ts.map +1 -1
  289. package/dist/utils/transform/utils/rejectSwaggerDocuments.js +8 -6
  290. package/dist/utils/transform/utils/rejectSwaggerDocuments.js.map +7 -0
  291. package/dist/utils/transformErrors.d.ts +1 -1
  292. package/dist/utils/transformErrors.d.ts.map +1 -1
  293. package/dist/utils/transformErrors.js +18 -21
  294. package/dist/utils/transformErrors.js.map +7 -0
  295. package/dist/utils/transformErrors.test.js +17 -0
  296. package/dist/utils/transformErrors.test.js.map +7 -0
  297. package/dist/utils/traverse.d.ts +1 -1
  298. package/dist/utils/traverse.d.ts.map +1 -1
  299. package/dist/utils/traverse.js +19 -22
  300. package/dist/utils/traverse.js.map +7 -0
  301. package/dist/utils/traverse.test.js +68 -0
  302. package/dist/utils/traverse.test.js.map +7 -0
  303. package/dist/utils/unescapeJsonPointer.js +5 -9
  304. package/dist/utils/unescapeJsonPointer.js.map +7 -0
  305. package/dist/utils/unescapeJsonPointer.test.js +19 -0
  306. package/dist/utils/unescapeJsonPointer.test.js.map +7 -0
  307. package/dist/utils/upgrade.d.ts +1 -1
  308. package/dist/utils/upgrade.d.ts.map +1 -1
  309. package/dist/utils/upgrade.js +22 -22
  310. package/dist/utils/upgrade.js.map +7 -0
  311. package/dist/utils/upgrade.test-d.js +16 -0
  312. package/dist/utils/upgrade.test-d.js.map +7 -0
  313. package/dist/utils/upgrade.test.js +57 -0
  314. package/dist/utils/upgrade.test.js.map +7 -0
  315. package/dist/utils/upgradeFromThreeToThreeOne.js +114 -140
  316. package/dist/utils/upgradeFromThreeToThreeOne.js.map +7 -0
  317. package/dist/utils/upgradeFromThreeToThreeOne.test.js +462 -0
  318. package/dist/utils/upgradeFromThreeToThreeOne.test.js.map +7 -0
  319. package/dist/utils/upgradeFromTwoToThree.js +212 -219
  320. package/dist/utils/upgradeFromTwoToThree.js.map +7 -0
  321. package/dist/utils/upgradeFromTwoToThree.test.js +589 -0
  322. package/dist/utils/upgradeFromTwoToThree.test.js.map +7 -0
  323. package/dist/utils/validate.d.ts +1 -1
  324. package/dist/utils/validate.d.ts.map +1 -1
  325. package/dist/utils/validate.js +14 -16
  326. package/dist/utils/validate.js.map +7 -0
  327. package/dist/utils/validate.test.js +64 -0
  328. package/dist/utils/validate.test.js.map +7 -0
  329. package/package.json +6 -8
  330. package/dist/schemas/v2.0/schema.json.js +0 -1623
  331. package/dist/schemas/v3.0/schema.json.js +0 -1673
  332. package/dist/schemas/v3.1/schema.json.js +0 -1451
@@ -1,115 +1,40 @@
1
1
  const fetchUrlsDefaultConfiguration = {
2
- limit: 100,
2
+ limit: 20
3
3
  };
4
4
  const fetchUrls = (customConfiguration) => {
5
- // State
6
- let numberOfRequests = 0;
7
- // Configuration
8
- const configuration = {
9
- ...fetchUrlsDefaultConfiguration,
10
- ...customConfiguration,
11
- };
12
- return {
13
- // Make it run after readFiles
14
- priority: 0,
15
- check(value) {
16
- // Not a string
17
- if (typeof value !== 'string') {
18
- return false;
19
- }
20
- // Seems to be JSON
21
- if (value.startsWith('{') || value.startsWith('[')) {
22
- return false;
23
- }
24
- // Seems to be YAML
25
- if (value.includes('\n')) {
26
- return false;
27
- }
28
- return true;
29
- },
30
- async get(url) {
31
- // Limit ht enumber of requests
32
- if (configuration?.limit !== false && numberOfRequests >= configuration?.limit) {
33
- console.warn(`[fetchUrls] Maximum number of requests reeached (${configuration?.limit}), skipping request`);
34
- return undefined;
35
- }
36
- try {
37
- numberOfRequests++;
38
- const response = await (configuration?.fetch ? configuration.fetch(url) : fetch(url));
39
- return await response.text();
40
- }
41
- catch (error) {
42
- console.error('[fetchUrls]', error.message, `(${url})`);
43
- return undefined;
44
- }
45
- },
46
- getUri(value, source) {
47
- return getAbsoluteUrl(value, source);
48
- },
49
- };
50
- };
51
- function getAbsoluteUrl(value, source) {
52
- if (typeof source !== 'string') {
53
- return value;
54
- }
55
- // Already an absolute URL
56
- if (value.startsWith('http')) {
57
- return value;
58
- }
59
- // Make it an absolute URL
60
- if (source) {
61
- // Skip if source or value is JSON/YAML content
62
- if (source.startsWith('{') ||
63
- source.startsWith('[') ||
64
- source.includes('\n') ||
65
- value.startsWith('{') ||
66
- value.startsWith('[') ||
67
- value.includes('\n')) {
68
- return value;
69
- }
70
- try {
71
- // If source is an HTTP URL, handle both absolute and relative paths
72
- if (source.startsWith('http')) {
73
- const sourceUrl = new URL(source);
74
- // If value starts with /, treat it as relative to the host root
75
- if (value.startsWith('/')) {
76
- // Simply combine the origin with the absolute path
77
- return `${sourceUrl.origin}${value}`;
78
- }
79
- // Otherwise treat it as relative to the source URL's directory
80
- return new URL(value, sourceUrl.href).toString();
81
- }
82
- // Handle file system paths
83
- if (source.startsWith('/') || !source.startsWith('http')) {
84
- const sourceParts = source.split('/').filter(Boolean).slice(0, -1);
85
- const valueParts = value.split('/').filter(Boolean);
86
- const isAbsolute = source.startsWith('/');
87
- // If value is absolute path, start fresh
88
- if (value.startsWith('/')) {
89
- return value;
90
- }
91
- // Process each part of the path
92
- const resultParts = [...sourceParts];
93
- for (const part of valueParts) {
94
- if (part === '..') {
95
- resultParts.pop();
96
- }
97
- else if (part !== '.') {
98
- resultParts.push(part);
99
- }
100
- }
101
- // Preserve the leading slash for absolute paths, but avoid double slashes
102
- return isAbsolute ? '/' + resultParts.join('/') : resultParts.join('/');
103
- }
104
- return new URL(value, source).toString();
105
- }
106
- catch (error) {
107
- console.warn('[fetchUrls] Failed to resolve URL:', error.message, `(${value})`);
108
- return value;
109
- }
5
+ let numberOfRequests = 0;
6
+ const configuration = {
7
+ ...fetchUrlsDefaultConfiguration,
8
+ ...customConfiguration
9
+ };
10
+ return {
11
+ check(value) {
12
+ if (typeof value !== "string") {
13
+ return false;
14
+ }
15
+ if (!value.startsWith("http://") && !value.startsWith("https://")) {
16
+ return false;
17
+ }
18
+ return true;
19
+ },
20
+ async get(value) {
21
+ if (configuration?.limit !== false && numberOfRequests >= configuration?.limit) {
22
+ console.warn(`[fetchUrls] Maximum number of requests reeached (${configuration?.limit}), skipping request`);
23
+ return void 0;
24
+ }
25
+ try {
26
+ numberOfRequests++;
27
+ const response = await (configuration?.fetch ? configuration.fetch(value) : fetch(value));
28
+ return await response.text();
29
+ } catch (error) {
30
+ console.error("[fetchUrls]", error.message, `(${value})`);
31
+ return void 0;
32
+ }
110
33
  }
111
- // Otherwise, return the value as is
112
- return value;
113
- }
114
-
115
- export { fetchUrls, fetchUrlsDefaultConfiguration, getAbsoluteUrl };
34
+ };
35
+ };
36
+ export {
37
+ fetchUrls,
38
+ fetchUrlsDefaultConfiguration
39
+ };
40
+ //# sourceMappingURL=fetchUrls.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugins/fetch-urls/fetchUrls.ts"],
4
+ "sourcesContent": ["import type { LoadPlugin } from '../../utils/load/load'\n\nexport const fetchUrlsDefaultConfiguration = {\n limit: 20,\n}\n\nexport const fetchUrls: (customConfiguration?: {\n /**\n * Limit the number of requests. Set to `false` to disable the limit.\n */\n limit?: number | false\n /**\n * Fetch function to use instead of the global fetch. Use this to intercept requests.\n */\n fetch?: (url: string) => Promise<Response>\n}) => LoadPlugin = (customConfiguration) => {\n // State\n let numberOfRequests = 0\n\n // Configuration\n const configuration = {\n ...fetchUrlsDefaultConfiguration,\n ...customConfiguration,\n }\n\n return {\n check(value?: any) {\n // Not a string\n if (typeof value !== 'string') {\n return false\n }\n\n // Not http/https\n if (!value.startsWith('http://') && !value.startsWith('https://')) {\n return false\n }\n\n return true\n },\n async get(value?: any) {\n // Limit ht enumber of requests\n if (configuration?.limit !== false && numberOfRequests >= configuration?.limit) {\n console.warn(`[fetchUrls] Maximum number of requests reeached (${configuration?.limit}), skipping request`)\n return undefined\n }\n\n try {\n numberOfRequests++\n\n const response = await (configuration?.fetch ? configuration.fetch(value) : fetch(value))\n\n return await response.text()\n } catch (error) {\n console.error('[fetchUrls]', error.message, `(${value})`)\n return undefined\n }\n },\n }\n}\n"],
5
+ "mappings": "AAEO,MAAM,gCAAgC;AAAA,EAC3C,OAAO;AACT;AAEO,MAAM,YASM,CAAC,wBAAwB;AAE1C,MAAI,mBAAmB;AAGvB,QAAM,gBAAgB;AAAA,IACpB,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAEA,SAAO;AAAA,IACL,MAAM,OAAa;AAEjB,UAAI,OAAO,UAAU,UAAU;AAC7B,eAAO;AAAA,MACT;AAGA,UAAI,CAAC,MAAM,WAAW,SAAS,KAAK,CAAC,MAAM,WAAW,UAAU,GAAG;AACjE,eAAO;AAAA,MACT;AAEA,aAAO;AAAA,IACT;AAAA,IACA,MAAM,IAAI,OAAa;AAErB,UAAI,eAAe,UAAU,SAAS,oBAAoB,eAAe,OAAO;AAC9E,gBAAQ,KAAK,oDAAoD,eAAe,KAAK,qBAAqB;AAC1G,eAAO;AAAA,MACT;AAEA,UAAI;AACF;AAEA,cAAM,WAAW,OAAO,eAAe,QAAQ,cAAc,MAAM,KAAK,IAAI,MAAM,KAAK;AAEvF,eAAO,MAAM,SAAS,KAAK;AAAA,MAC7B,SAAS,OAAO;AACd,gBAAQ,MAAM,eAAe,MAAM,SAAS,IAAI,KAAK,GAAG;AACxD,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,50 @@
1
+ import { beforeEach, describe, expect, it, vi } from "vitest";
2
+ import { fetchUrls } from "./fetchUrls.js";
3
+ global.fetch = vi.fn();
4
+ describe("fetchUrls", async () => {
5
+ beforeEach(() => {
6
+ global.fetch.mockReset();
7
+ });
8
+ it("returns true for an url", async () => {
9
+ expect(fetchUrls().check("http://example.com/specification/openapi.yaml")).toBe(true);
10
+ });
11
+ it("returns false for a filename", async () => {
12
+ expect(fetchUrls().check("openapi.yaml")).toBe(false);
13
+ });
14
+ it("returns false for a path", async () => {
15
+ expect(fetchUrls().check("specification/openapi.yaml")).toBe(false);
16
+ });
17
+ it("returns false for an object", async () => {
18
+ expect(fetchUrls().check({})).toBe(false);
19
+ });
20
+ it("returns false for undefinded", async () => {
21
+ expect(fetchUrls().check()).toBe(false);
22
+ });
23
+ it("fetches the URL", async () => {
24
+ fetch.mockImplementation(async (url) => ({
25
+ text: async () => {
26
+ if (url === "http://example.com/specification/openapi.yaml") {
27
+ return "OK";
28
+ }
29
+ throw new Error("Not found");
30
+ }
31
+ }));
32
+ expect(await fetchUrls().get("http://example.com/specification/openapi.yaml")).toBe("OK");
33
+ });
34
+ it("rewrites the URL", async () => {
35
+ fetch.mockImplementation(async (url) => ({
36
+ text: async () => {
37
+ if (url === "http://foobar.com/specification/openapi.yaml") {
38
+ return "OK";
39
+ }
40
+ throw new Error("Not found");
41
+ }
42
+ }));
43
+ expect(
44
+ await fetchUrls({
45
+ fetch: (url) => fetch(url.replace("example", "foobar"))
46
+ }).get("http://foobar.com/specification/openapi.yaml")
47
+ ).toBe("OK");
48
+ });
49
+ });
50
+ //# sourceMappingURL=fetchUrls.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugins/fetch-urls/fetchUrls.test.ts"],
4
+ "sourcesContent": ["import { beforeEach, describe, expect, it, vi } from 'vitest'\n\nimport { fetchUrls } from './fetchUrls'\n\nglobal.fetch = vi.fn()\n\ndescribe('fetchUrls', async () => {\n beforeEach(() => {\n // @ts-expect-error\n global.fetch.mockReset()\n })\n\n it('returns true for an url', async () => {\n expect(fetchUrls().check('http://example.com/specification/openapi.yaml')).toBe(true)\n })\n\n it('returns false for a filename', async () => {\n expect(fetchUrls().check('openapi.yaml')).toBe(false)\n })\n\n it('returns false for a path', async () => {\n expect(fetchUrls().check('specification/openapi.yaml')).toBe(false)\n })\n\n it('returns false for an object', async () => {\n expect(fetchUrls().check({})).toBe(false)\n })\n\n it('returns false for undefinded', async () => {\n expect(fetchUrls().check()).toBe(false)\n })\n\n it('fetches the URL', async () => {\n // @ts-expect-error\n fetch.mockImplementation(async (url: string) => ({\n text: async () => {\n if (url === 'http://example.com/specification/openapi.yaml') {\n return 'OK'\n }\n\n throw new Error('Not found')\n },\n }))\n\n expect(await fetchUrls().get('http://example.com/specification/openapi.yaml')).toBe('OK')\n })\n\n it('rewrites the URL', async () => {\n // @ts-expect-error\n fetch.mockImplementation(async (url: string) => ({\n text: async () => {\n if (url === 'http://foobar.com/specification/openapi.yaml') {\n return 'OK'\n }\n throw new Error('Not found')\n },\n }))\n\n expect(\n await fetchUrls({\n fetch: (url) => fetch(url.replace('example', 'foobar')),\n }).get('http://foobar.com/specification/openapi.yaml'),\n ).toBe('OK')\n })\n})\n"],
5
+ "mappings": "AAAA,SAAS,YAAY,UAAU,QAAQ,IAAI,UAAU;AAErD,SAAS,iBAAiB;AAE1B,OAAO,QAAQ,GAAG,GAAG;AAErB,SAAS,aAAa,YAAY;AAChC,aAAW,MAAM;AAEf,WAAO,MAAM,UAAU;AAAA,EACzB,CAAC;AAED,KAAG,2BAA2B,YAAY;AACxC,WAAO,UAAU,EAAE,MAAM,+CAA+C,CAAC,EAAE,KAAK,IAAI;AAAA,EACtF,CAAC;AAED,KAAG,gCAAgC,YAAY;AAC7C,WAAO,UAAU,EAAE,MAAM,cAAc,CAAC,EAAE,KAAK,KAAK;AAAA,EACtD,CAAC;AAED,KAAG,4BAA4B,YAAY;AACzC,WAAO,UAAU,EAAE,MAAM,4BAA4B,CAAC,EAAE,KAAK,KAAK;AAAA,EACpE,CAAC;AAED,KAAG,+BAA+B,YAAY;AAC5C,WAAO,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK;AAAA,EAC1C,CAAC;AAED,KAAG,gCAAgC,YAAY;AAC7C,WAAO,UAAU,EAAE,MAAM,CAAC,EAAE,KAAK,KAAK;AAAA,EACxC,CAAC;AAED,KAAG,mBAAmB,YAAY;AAEhC,UAAM,mBAAmB,OAAO,SAAiB;AAAA,MAC/C,MAAM,YAAY;AAChB,YAAI,QAAQ,iDAAiD;AAC3D,iBAAO;AAAA,QACT;AAEA,cAAM,IAAI,MAAM,WAAW;AAAA,MAC7B;AAAA,IACF,EAAE;AAEF,WAAO,MAAM,UAAU,EAAE,IAAI,+CAA+C,CAAC,EAAE,KAAK,IAAI;AAAA,EAC1F,CAAC;AAED,KAAG,oBAAoB,YAAY;AAEjC,UAAM,mBAAmB,OAAO,SAAiB;AAAA,MAC/C,MAAM,YAAY;AAChB,YAAI,QAAQ,gDAAgD;AAC1D,iBAAO;AAAA,QACT;AACA,cAAM,IAAI,MAAM,WAAW;AAAA,MAC7B;AAAA,IACF,EAAE;AAEF;AAAA,MACE,MAAM,UAAU;AAAA,QACd,OAAO,CAAC,QAAQ,MAAM,IAAI,QAAQ,WAAW,QAAQ,CAAC;AAAA,MACxD,CAAC,EAAE,IAAI,8CAA8C;AAAA,IACvD,EAAE,KAAK,IAAI;AAAA,EACb,CAAC;AACH,CAAC;",
6
+ "names": []
7
+ }
@@ -1,2 +1,2 @@
1
- export { fetchUrlsDefaultConfiguration, fetchUrls, getAbsoluteUrl, } from './fetchUrls.ts';
1
+ export * from './fetchUrls.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch-urls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,SAAS,EACT,cAAc,GACf,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch-urls/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
@@ -1 +1,2 @@
1
- export { fetchUrls, fetchUrlsDefaultConfiguration, getAbsoluteUrl } from './fetchUrls.js';
1
+ export * from "./fetchUrls.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugins/fetch-urls/index.ts"],
4
+ "sourcesContent": ["export * from './fetchUrls'\n"],
5
+ "mappings": "AAAA,cAAc;",
6
+ "names": []
7
+ }
@@ -1,2 +1,2 @@
1
- export { readFiles } from './readFiles.ts';
1
+ export * from './readFiles.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/read-files/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/read-files/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
@@ -1 +1,2 @@
1
- export { readFiles } from './readFiles.js';
1
+ export * from "./readFiles.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugins/read-files/index.ts"],
4
+ "sourcesContent": ["export * from './readFiles'\n"],
5
+ "mappings": "AAAA,cAAc;",
6
+ "names": []
7
+ }
@@ -1,3 +1,3 @@
1
- import type { LoadPlugin } from '../../utils/load/load.ts';
1
+ import type { LoadPlugin } from '../../utils/load/load.js';
2
2
  export declare const readFiles: () => LoadPlugin;
3
3
  //# sourceMappingURL=readFiles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"readFiles.d.ts","sourceRoot":"","sources":["../../../src/plugins/read-files/readFiles.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,eAAO,MAAM,SAAS,EAAE,MAAM,UAyE7B,CAAA"}
1
+ {"version":3,"file":"readFiles.d.ts","sourceRoot":"","sources":["../../../src/plugins/read-files/readFiles.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,eAAO,MAAM,SAAS,EAAE,MAAM,UAqD7B,CAAA"}
@@ -1,72 +1,52 @@
1
- import fs from 'node:fs';
2
- import { ERRORS } from '../../configuration/index.js';
3
- import { dirname, join } from '../../polyfills/path.js';
4
- import { isJson } from '../../utils/isJson.js';
5
- import { isYaml } from '../../utils/isYaml.js';
6
-
1
+ import fs from "node:fs";
2
+ import { ERRORS } from "../../configuration/index.js";
3
+ import { dirname, join } from "../../polyfills/path.js";
4
+ import { isJson } from "../../utils/isJson.js";
5
+ import { isYaml } from "../../utils/isYaml.js";
7
6
  const readFiles = () => {
8
- return {
9
- // Make it run before fetchUrls
10
- priority: 100,
11
- check(value) {
12
- // Not a string
13
- if (typeof value !== 'string') {
14
- return false;
15
- }
16
- // URL
17
- if (value.startsWith('http://') || value.startsWith('https://')) {
18
- return false;
19
- }
20
- // Line breaks
21
- if (value.includes('\n')) {
22
- return false;
23
- }
24
- // JSON
25
- if (isJson(value)) {
26
- return false;
27
- }
28
- // YAML (run through YAML.parse)
29
- if (isYaml(value)) {
30
- return false;
31
- }
32
- return true;
33
- },
34
- async get(value) {
35
- if (typeof value !== 'string') {
36
- return false;
37
- }
38
- if (!fs.existsSync(value)) {
39
- throw new Error(ERRORS.FILE_DOES_NOT_EXIST.replace('%s', value));
40
- }
41
- try {
42
- return fs.readFileSync(value, 'utf-8');
43
- }
44
- catch (error) {
45
- console.error('[readFiles]', error);
46
- return false;
47
- }
48
- },
49
- getUri(value, source) {
50
- if (typeof value !== 'string') {
51
- return undefined;
52
- }
53
- if (typeof source !== 'string') {
54
- return value;
55
- }
56
- // Already absolute
57
- if (value.startsWith('/')) {
58
- return value;
59
- }
60
- const dir = dirname(source);
61
- return join(dir, value);
62
- },
63
- getDir(value) {
64
- return dirname(value);
65
- },
66
- getFilename(value) {
67
- return value.split('/').pop();
68
- },
69
- };
7
+ return {
8
+ check(value) {
9
+ if (typeof value !== "string") {
10
+ return false;
11
+ }
12
+ if (value.startsWith("http://") || value.startsWith("https://")) {
13
+ return false;
14
+ }
15
+ if (value.includes("\n")) {
16
+ return false;
17
+ }
18
+ if (isJson(value)) {
19
+ return false;
20
+ }
21
+ if (isYaml(value)) {
22
+ return false;
23
+ }
24
+ return true;
25
+ },
26
+ async get(value) {
27
+ if (!fs.existsSync(value)) {
28
+ throw new Error(ERRORS.FILE_DOES_NOT_EXIST.replace("%s", value));
29
+ }
30
+ try {
31
+ return fs.readFileSync(value, "utf-8");
32
+ } catch (error) {
33
+ console.error("[readFiles]", error);
34
+ return false;
35
+ }
36
+ },
37
+ resolvePath(value, reference) {
38
+ const dir = dirname(value);
39
+ return join(dir, reference);
40
+ },
41
+ getDir(value) {
42
+ return dirname(value);
43
+ },
44
+ getFilename(value) {
45
+ return value.split("/").pop();
46
+ }
47
+ };
70
48
  };
71
-
72
- export { readFiles };
49
+ export {
50
+ readFiles
51
+ };
52
+ //# sourceMappingURL=readFiles.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugins/read-files/readFiles.ts"],
4
+ "sourcesContent": ["import fs from 'node:fs'\n\nimport { ERRORS } from '../../configuration/index'\nimport { dirname, join } from '../../polyfills/path'\nimport { isJson } from '../../utils/isJson'\nimport { isYaml } from '../../utils/isYaml'\nimport type { LoadPlugin } from '../../utils/load/load'\n\nexport const readFiles: () => LoadPlugin = () => {\n return {\n check(value?: any) {\n // Not a string\n if (typeof value !== 'string') {\n return false\n }\n\n // URL\n if (value.startsWith('http://') || value.startsWith('https://')) {\n return false\n }\n\n // Line breaks\n if (value.includes('\\n')) {\n return false\n }\n\n // JSON\n if (isJson(value)) {\n return false\n }\n\n // YAML (run through YAML.parse)\n if (isYaml(value)) {\n return false\n }\n\n return true\n },\n async get(value?: any) {\n if (!fs.existsSync(value)) {\n throw new Error(ERRORS.FILE_DOES_NOT_EXIST.replace('%s', value))\n }\n\n try {\n return fs.readFileSync(value, 'utf-8')\n } catch (error) {\n console.error('[readFiles]', error)\n return false\n }\n },\n resolvePath(value: any, reference: string) {\n const dir = dirname(value)\n return join(dir, reference)\n },\n getDir(value: any) {\n return dirname(value)\n },\n getFilename(value: any) {\n return value.split('/').pop()\n },\n }\n}\n"],
5
+ "mappings": "AAAA,OAAO,QAAQ;AAEf,SAAS,cAAc;AACvB,SAAS,SAAS,YAAY;AAC9B,SAAS,cAAc;AACvB,SAAS,cAAc;AAGhB,MAAM,YAA8B,MAAM;AAC/C,SAAO;AAAA,IACL,MAAM,OAAa;AAEjB,UAAI,OAAO,UAAU,UAAU;AAC7B,eAAO;AAAA,MACT;AAGA,UAAI,MAAM,WAAW,SAAS,KAAK,MAAM,WAAW,UAAU,GAAG;AAC/D,eAAO;AAAA,MACT;AAGA,UAAI,MAAM,SAAS,IAAI,GAAG;AACxB,eAAO;AAAA,MACT;AAGA,UAAI,OAAO,KAAK,GAAG;AACjB,eAAO;AAAA,MACT;AAGA,UAAI,OAAO,KAAK,GAAG;AACjB,eAAO;AAAA,MACT;AAEA,aAAO;AAAA,IACT;AAAA,IACA,MAAM,IAAI,OAAa;AACrB,UAAI,CAAC,GAAG,WAAW,KAAK,GAAG;AACzB,cAAM,IAAI,MAAM,OAAO,oBAAoB,QAAQ,MAAM,KAAK,CAAC;AAAA,MACjE;AAEA,UAAI;AACF,eAAO,GAAG,aAAa,OAAO,OAAO;AAAA,MACvC,SAAS,OAAO;AACd,gBAAQ,MAAM,eAAe,KAAK;AAClC,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,YAAY,OAAY,WAAmB;AACzC,YAAM,MAAM,QAAQ,KAAK;AACzB,aAAO,KAAK,KAAK,SAAS;AAAA,IAC5B;AAAA,IACA,OAAO,OAAY;AACjB,aAAO,QAAQ,KAAK;AAAA,IACtB;AAAA,IACA,YAAY,OAAY;AACtB,aAAO,MAAM,MAAM,GAAG,EAAE,IAAI;AAAA,IAC9B;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,20 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { readFiles } from "./readFiles.js";
3
+ describe("readFiles", async () => {
4
+ it("returns true for a filename", async () => {
5
+ expect(readFiles().check("openapi.yaml")).toBe(true);
6
+ });
7
+ it("returns true for a path", async () => {
8
+ expect(readFiles().check("../specification/openapi.yaml")).toBe(true);
9
+ });
10
+ it("returns false for an object", async () => {
11
+ expect(readFiles().check({})).toBe(false);
12
+ });
13
+ it("returns false for undefinded", async () => {
14
+ expect(readFiles().check()).toBe(false);
15
+ });
16
+ it("returns false for an url", async () => {
17
+ expect(readFiles().check("http://example.com/specification/openapi.yaml")).toBe(false);
18
+ });
19
+ });
20
+ //# sourceMappingURL=readFiles.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugins/read-files/readFiles.test.ts"],
4
+ "sourcesContent": ["import { describe, expect, it } from 'vitest'\n\nimport { readFiles } from './readFiles'\n\ndescribe('readFiles', async () => {\n it('returns true for a filename', async () => {\n expect(readFiles().check('openapi.yaml')).toBe(true)\n })\n\n it('returns true for a path', async () => {\n expect(readFiles().check('../specification/openapi.yaml')).toBe(true)\n })\n\n it('returns false for an object', async () => {\n expect(readFiles().check({})).toBe(false)\n })\n\n it('returns false for undefinded', async () => {\n expect(readFiles().check()).toBe(false)\n })\n\n it('returns false for an url', async () => {\n expect(readFiles().check('http://example.com/specification/openapi.yaml')).toBe(false)\n })\n})\n"],
5
+ "mappings": "AAAA,SAAS,UAAU,QAAQ,UAAU;AAErC,SAAS,iBAAiB;AAE1B,SAAS,aAAa,YAAY;AAChC,KAAG,+BAA+B,YAAY;AAC5C,WAAO,UAAU,EAAE,MAAM,cAAc,CAAC,EAAE,KAAK,IAAI;AAAA,EACrD,CAAC;AAED,KAAG,2BAA2B,YAAY;AACxC,WAAO,UAAU,EAAE,MAAM,+BAA+B,CAAC,EAAE,KAAK,IAAI;AAAA,EACtE,CAAC;AAED,KAAG,+BAA+B,YAAY;AAC5C,WAAO,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK;AAAA,EAC1C,CAAC;AAED,KAAG,gCAAgC,YAAY;AAC7C,WAAO,UAAU,EAAE,MAAM,CAAC,EAAE,KAAK,KAAK;AAAA,EACxC,CAAC;AAED,KAAG,4BAA4B,YAAY;AACzC,WAAO,UAAU,EAAE,MAAM,+CAA+C,CAAC,EAAE,KAAK,KAAK;AAAA,EACvF,CAAC;AACH,CAAC;",
6
+ "names": []
7
+ }
@@ -1,2 +1,2 @@
1
- export * as path from './path.ts';
1
+ export * as path from './path.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/polyfills/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/polyfills/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAA"}
@@ -0,0 +1,5 @@
1
+ import * as path from "./path.js";
2
+ export {
3
+ path
4
+ };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/polyfills/index.ts"],
4
+ "sourcesContent": ["export * as path from './path'\n"],
5
+ "mappings": "AAAA,YAAY,UAAU;",
6
+ "names": []
7
+ }