@redocly/cli 1.34.3 → 2.0.0-next.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 (321) hide show
  1. package/README.md +34 -3
  2. package/bin/cli.js +1 -1
  3. package/lib/auth/device-flow.d.ts +1 -0
  4. package/lib/auth/device-flow.d.ts.map +1 -0
  5. package/lib/auth/device-flow.js +15 -17
  6. package/lib/auth/device-flow.js.map +1 -0
  7. package/lib/auth/oauth-client.d.ts +1 -0
  8. package/lib/auth/oauth-client.d.ts.map +1 -0
  9. package/lib/auth/oauth-client.js +21 -23
  10. package/lib/auth/oauth-client.js.map +1 -0
  11. package/lib/commands/auth.d.ts +3 -5
  12. package/lib/commands/auth.d.ts.map +1 -0
  13. package/lib/commands/auth.js +19 -44
  14. package/lib/commands/auth.js.map +1 -0
  15. package/lib/commands/build-docs/index.d.ts +4 -3
  16. package/lib/commands/build-docs/index.d.ts.map +1 -0
  17. package/lib/commands/build-docs/index.js +23 -24
  18. package/lib/commands/build-docs/index.js.map +1 -0
  19. package/lib/commands/build-docs/types.d.ts +2 -1
  20. package/lib/commands/build-docs/types.d.ts.map +1 -0
  21. package/lib/commands/build-docs/types.js +2 -2
  22. package/lib/commands/build-docs/types.js.map +1 -0
  23. package/lib/commands/build-docs/utils.d.ts +3 -2
  24. package/lib/commands/build-docs/utils.d.ts.map +1 -0
  25. package/lib/commands/build-docs/utils.js +35 -37
  26. package/lib/commands/build-docs/utils.js.map +1 -0
  27. package/lib/commands/bundle.d.ts +6 -3
  28. package/lib/commands/bundle.d.ts.map +1 -0
  29. package/lib/commands/bundle.js +34 -38
  30. package/lib/commands/bundle.js.map +1 -0
  31. package/lib/commands/eject.d.ts +3 -2
  32. package/lib/commands/eject.d.ts.map +1 -0
  33. package/lib/commands/eject.js +11 -13
  34. package/lib/commands/eject.js.map +1 -0
  35. package/lib/commands/join.d.ts +4 -3
  36. package/lib/commands/join.d.ts.map +1 -0
  37. package/lib/commands/join.js +79 -81
  38. package/lib/commands/join.js.map +1 -0
  39. package/lib/commands/lint.d.ts +8 -6
  40. package/lib/commands/lint.d.ts.map +1 -0
  41. package/lib/commands/lint.js +53 -62
  42. package/lib/commands/lint.js.map +1 -0
  43. package/lib/commands/preview-project/constants.d.ts +2 -1
  44. package/lib/commands/preview-project/constants.d.ts.map +1 -0
  45. package/lib/commands/preview-project/constants.js +4 -6
  46. package/lib/commands/preview-project/constants.js.map +1 -0
  47. package/lib/commands/preview-project/index.d.ts +3 -2
  48. package/lib/commands/preview-project/index.d.ts.map +1 -0
  49. package/lib/commands/preview-project/index.js +21 -23
  50. package/lib/commands/preview-project/index.js.map +1 -0
  51. package/lib/commands/preview-project/types.d.ts +3 -2
  52. package/lib/commands/preview-project/types.d.ts.map +1 -0
  53. package/lib/commands/preview-project/types.js +2 -2
  54. package/lib/commands/preview-project/types.js.map +1 -0
  55. package/lib/commands/split/index.d.ts +4 -3
  56. package/lib/commands/split/index.d.ts.map +1 -0
  57. package/lib/commands/split/index.js +53 -57
  58. package/lib/commands/split/index.js.map +1 -0
  59. package/lib/commands/split/types.d.ts +2 -2
  60. package/lib/commands/split/types.d.ts.map +1 -0
  61. package/lib/commands/split/types.js +11 -13
  62. package/lib/commands/split/types.js.map +1 -0
  63. package/lib/commands/stats.d.ts +3 -2
  64. package/lib/commands/stats.d.ts.map +1 -0
  65. package/lib/commands/stats.js +21 -24
  66. package/lib/commands/stats.js.map +1 -0
  67. package/lib/commands/translations.d.ts +3 -2
  68. package/lib/commands/translations.d.ts.map +1 -0
  69. package/lib/commands/translations.js +11 -13
  70. package/lib/commands/translations.js.map +1 -0
  71. package/lib/index.d.ts +2 -1
  72. package/lib/index.d.ts.map +1 -0
  73. package/lib/index.js +109 -239
  74. package/lib/index.js.map +1 -0
  75. package/lib/otel.d.ts +2 -1
  76. package/lib/otel.d.ts.map +1 -0
  77. package/lib/otel.js +22 -23
  78. package/lib/otel.js.map +1 -0
  79. package/lib/reunite/api/api-client.d.ts +4 -3
  80. package/lib/reunite/api/api-client.d.ts.map +1 -0
  81. package/lib/reunite/api/api-client.js +14 -20
  82. package/lib/reunite/api/api-client.js.map +1 -0
  83. package/lib/reunite/api/api-keys.d.ts +2 -1
  84. package/lib/reunite/api/api-keys.d.ts.map +1 -0
  85. package/lib/reunite/api/api-keys.js +4 -20
  86. package/lib/reunite/api/api-keys.js.map +1 -0
  87. package/lib/reunite/api/domains.d.ts +5 -2
  88. package/lib/reunite/api/domains.d.ts.map +1 -0
  89. package/lib/reunite/api/domains.js +6 -15
  90. package/lib/reunite/api/domains.js.map +1 -0
  91. package/lib/reunite/api/index.d.ts +4 -3
  92. package/lib/reunite/api/index.d.ts.map +1 -0
  93. package/lib/reunite/api/index.js +4 -19
  94. package/lib/reunite/api/index.js.map +1 -0
  95. package/lib/reunite/api/types.d.ts +1 -0
  96. package/lib/reunite/api/types.d.ts.map +1 -0
  97. package/lib/reunite/api/types.js +2 -2
  98. package/lib/reunite/api/types.js.map +1 -0
  99. package/lib/reunite/commands/push-status.d.ts +6 -5
  100. package/lib/reunite/commands/push-status.d.ts.map +1 -0
  101. package/lib/reunite/commands/push-status.js +31 -37
  102. package/lib/reunite/commands/push-status.js.map +1 -0
  103. package/lib/reunite/commands/push.d.ts +6 -6
  104. package/lib/reunite/commands/push.d.ts.map +1 -0
  105. package/lib/reunite/commands/push.js +31 -40
  106. package/lib/reunite/commands/push.js.map +1 -0
  107. package/lib/reunite/commands/utils.d.ts +4 -3
  108. package/lib/reunite/commands/utils.d.ts.map +1 -0
  109. package/lib/reunite/commands/utils.js +9 -12
  110. package/lib/reunite/commands/utils.js.map +1 -0
  111. package/lib/reunite/utils.d.ts +1 -0
  112. package/lib/reunite/utils.d.ts.map +1 -0
  113. package/lib/reunite/utils.js +2 -5
  114. package/lib/reunite/utils.js.map +1 -0
  115. package/lib/types.d.ts +15 -27
  116. package/lib/types.d.ts.map +1 -0
  117. package/lib/types.js +2 -5
  118. package/lib/types.js.map +1 -0
  119. package/lib/utils/assert-node-version.d.ts +1 -0
  120. package/lib/utils/assert-node-version.d.ts.map +1 -0
  121. package/lib/utils/assert-node-version.js +8 -10
  122. package/lib/utils/assert-node-version.js.map +1 -0
  123. package/lib/utils/error.d.ts +4 -0
  124. package/lib/utils/error.d.ts.map +1 -0
  125. package/lib/utils/error.js +8 -0
  126. package/lib/utils/error.js.map +1 -0
  127. package/lib/utils/fetch-with-timeout.d.ts +1 -0
  128. package/lib/utils/fetch-with-timeout.d.ts.map +1 -0
  129. package/lib/utils/fetch-with-timeout.js +6 -8
  130. package/lib/utils/fetch-with-timeout.js.map +1 -0
  131. package/lib/utils/{getCommandNameFromArgs.d.ts → get-command-name-from-args.d.ts} +1 -0
  132. package/lib/utils/get-command-name-from-args.d.ts.map +1 -0
  133. package/lib/utils/get-command-name-from-args.js +4 -0
  134. package/lib/utils/get-command-name-from-args.js.map +1 -0
  135. package/lib/utils/js-utils.d.ts +1 -0
  136. package/lib/utils/js-utils.d.ts.map +1 -0
  137. package/lib/utils/js-utils.js +8 -12
  138. package/lib/utils/js-utils.js.map +1 -0
  139. package/lib/utils/miscellaneous.d.ts +9 -48
  140. package/lib/utils/miscellaneous.d.ts.map +1 -0
  141. package/lib/utils/miscellaneous.js +131 -269
  142. package/lib/utils/miscellaneous.js.map +1 -0
  143. package/lib/utils/package.d.ts +2 -0
  144. package/lib/utils/package.d.ts.map +1 -0
  145. package/lib/utils/package.js +4 -0
  146. package/lib/utils/package.js.map +1 -0
  147. package/lib/utils/platform.d.ts +1 -0
  148. package/lib/utils/platform.d.ts.map +1 -0
  149. package/lib/utils/platform.js +5 -9
  150. package/lib/utils/platform.js.map +1 -0
  151. package/lib/utils/proxy-agent.d.ts +3 -0
  152. package/lib/utils/proxy-agent.d.ts.map +1 -0
  153. package/lib/utils/proxy-agent.js +6 -0
  154. package/lib/utils/proxy-agent.js.map +1 -0
  155. package/lib/utils/spinner.d.ts +1 -0
  156. package/lib/utils/spinner.d.ts.map +1 -0
  157. package/lib/utils/spinner.js +8 -10
  158. package/lib/utils/spinner.js.map +1 -0
  159. package/lib/utils/telemetry.d.ts +40 -0
  160. package/lib/utils/telemetry.d.ts.map +1 -0
  161. package/lib/utils/telemetry.js +138 -0
  162. package/lib/utils/telemetry.js.map +1 -0
  163. package/lib/utils/update-version-notifier.d.ts +1 -1
  164. package/lib/utils/update-version-notifier.d.ts.map +1 -0
  165. package/lib/utils/update-version-notifier.js +35 -38
  166. package/lib/utils/update-version-notifier.js.map +1 -0
  167. package/lib/utils/validate-positive-number.d.ts +2 -0
  168. package/lib/utils/validate-positive-number.d.ts.map +1 -0
  169. package/lib/utils/validate-positive-number.js +13 -0
  170. package/lib/utils/validate-positive-number.js.map +1 -0
  171. package/lib/wrapper.d.ts +3 -3
  172. package/lib/wrapper.d.ts.map +1 -0
  173. package/lib/wrapper.js +39 -26
  174. package/lib/wrapper.js.map +1 -0
  175. package/package.json +15 -16
  176. package/CHANGELOG.md +0 -770
  177. package/lib/__mocks__/@redocly/openapi-core.d.ts +0 -99
  178. package/lib/__mocks__/@redocly/openapi-core.js +0 -84
  179. package/lib/__mocks__/documents.d.ts +0 -150
  180. package/lib/__mocks__/documents.js +0 -123
  181. package/lib/__mocks__/fs.d.ts +0 -8
  182. package/lib/__mocks__/fs.js +0 -9
  183. package/lib/__mocks__/perf_hooks.d.ts +0 -3
  184. package/lib/__mocks__/perf_hooks.js +0 -6
  185. package/lib/__mocks__/redoc.d.ts +0 -6
  186. package/lib/__mocks__/redoc.js +0 -5
  187. package/lib/__tests__/commands/build-docs.test.d.ts +0 -1
  188. package/lib/__tests__/commands/build-docs.test.js +0 -54
  189. package/lib/__tests__/commands/bundle.test.d.ts +0 -1
  190. package/lib/__tests__/commands/bundle.test.js +0 -235
  191. package/lib/__tests__/commands/join.test.d.ts +0 -1
  192. package/lib/__tests__/commands/join.test.js +0 -274
  193. package/lib/__tests__/commands/lint.test.d.ts +0 -1
  194. package/lib/__tests__/commands/lint.test.js +0 -149
  195. package/lib/__tests__/commands/push-region.test.d.ts +0 -1
  196. package/lib/__tests__/commands/push-region.test.js +0 -90
  197. package/lib/__tests__/commands/push.test.d.ts +0 -1
  198. package/lib/__tests__/commands/push.test.js +0 -496
  199. package/lib/__tests__/fetch-with-timeout.test.d.ts +0 -1
  200. package/lib/__tests__/fetch-with-timeout.test.js +0 -64
  201. package/lib/__tests__/fixtures/config.d.ts +0 -21
  202. package/lib/__tests__/fixtures/config.js +0 -24
  203. package/lib/__tests__/spinner.test.d.ts +0 -1
  204. package/lib/__tests__/spinner.test.js +0 -43
  205. package/lib/__tests__/utils.test.d.ts +0 -1
  206. package/lib/__tests__/utils.test.js +0 -651
  207. package/lib/__tests__/wrapper.test.d.ts +0 -1
  208. package/lib/__tests__/wrapper.test.js +0 -76
  209. package/lib/auth/__tests__/device-flow.test.d.ts +0 -1
  210. package/lib/auth/__tests__/device-flow.test.js +0 -62
  211. package/lib/auth/__tests__/oauth-client.test.d.ts +0 -1
  212. package/lib/auth/__tests__/oauth-client.test.js +0 -93
  213. package/lib/commands/preview-docs/index.d.ts +0 -12
  214. package/lib/commands/preview-docs/index.js +0 -127
  215. package/lib/commands/preview-docs/preview-server/default.hbs +0 -24
  216. package/lib/commands/preview-docs/preview-server/hot.js +0 -59
  217. package/lib/commands/preview-docs/preview-server/oauth2-redirect.html +0 -21
  218. package/lib/commands/preview-docs/preview-server/preview-server.d.ts +0 -5
  219. package/lib/commands/preview-docs/preview-server/preview-server.js +0 -113
  220. package/lib/commands/preview-docs/preview-server/server.d.ts +0 -22
  221. package/lib/commands/preview-docs/preview-server/server.js +0 -85
  222. package/lib/commands/push.d.ts +0 -44
  223. package/lib/commands/push.js +0 -301
  224. package/lib/commands/split/__tests__/index.test.d.ts +0 -1
  225. package/lib/commands/split/__tests__/index.test.js +0 -91
  226. package/lib/reunite/api/__tests__/api-keys.test.d.ts +0 -1
  227. package/lib/reunite/api/__tests__/api-keys.test.js +0 -26
  228. package/lib/reunite/api/__tests__/api.client.test.d.ts +0 -1
  229. package/lib/reunite/api/__tests__/api.client.test.js +0 -337
  230. package/lib/reunite/api/__tests__/domains.test.d.ts +0 -1
  231. package/lib/reunite/api/__tests__/domains.test.js +0 -32
  232. package/lib/reunite/commands/__tests__/push-status.test.d.ts +0 -1
  233. package/lib/reunite/commands/__tests__/push-status.test.js +0 -563
  234. package/lib/reunite/commands/__tests__/push.test.d.ts +0 -1
  235. package/lib/reunite/commands/__tests__/push.test.js +0 -315
  236. package/lib/reunite/commands/__tests__/utils.test.d.ts +0 -1
  237. package/lib/reunite/commands/__tests__/utils.test.js +0 -51
  238. package/lib/utils/__mocks__/miscellaneous.d.ts +0 -43
  239. package/lib/utils/__mocks__/miscellaneous.js +0 -24
  240. package/lib/utils/getCommandNameFromArgs.js +0 -6
  241. package/src/__mocks__/@redocly/openapi-core.ts +0 -88
  242. package/src/__mocks__/documents.ts +0 -124
  243. package/src/__mocks__/fs.ts +0 -6
  244. package/src/__mocks__/perf_hooks.ts +0 -3
  245. package/src/__mocks__/redoc.ts +0 -2
  246. package/src/__tests__/commands/build-docs.test.ts +0 -59
  247. package/src/__tests__/commands/bundle.test.ts +0 -285
  248. package/src/__tests__/commands/join.test.ts +0 -334
  249. package/src/__tests__/commands/lint.test.ts +0 -190
  250. package/src/__tests__/commands/push-region.test.ts +0 -104
  251. package/src/__tests__/commands/push.test.ts +0 -553
  252. package/src/__tests__/fetch-with-timeout.test.ts +0 -81
  253. package/src/__tests__/fixtures/config.ts +0 -21
  254. package/src/__tests__/fixtures/openapi.json +0 -0
  255. package/src/__tests__/fixtures/openapi.yaml +0 -0
  256. package/src/__tests__/fixtures/redocly.yaml +0 -0
  257. package/src/__tests__/spinner.test.ts +0 -51
  258. package/src/__tests__/utils.test.ts +0 -781
  259. package/src/__tests__/wrapper.test.ts +0 -91
  260. package/src/auth/__tests__/device-flow.test.ts +0 -73
  261. package/src/auth/__tests__/oauth-client.test.ts +0 -117
  262. package/src/auth/device-flow.ts +0 -175
  263. package/src/auth/oauth-client.ts +0 -111
  264. package/src/commands/auth.ts +0 -66
  265. package/src/commands/build-docs/index.ts +0 -55
  266. package/src/commands/build-docs/template.hbs +0 -23
  267. package/src/commands/build-docs/types.ts +0 -25
  268. package/src/commands/build-docs/utils.ts +0 -110
  269. package/src/commands/bundle.ts +0 -154
  270. package/src/commands/eject.ts +0 -42
  271. package/src/commands/join.ts +0 -794
  272. package/src/commands/lint.ts +0 -169
  273. package/src/commands/preview-docs/index.ts +0 -183
  274. package/src/commands/preview-docs/preview-server/default.hbs +0 -24
  275. package/src/commands/preview-docs/preview-server/hot.js +0 -59
  276. package/src/commands/preview-docs/preview-server/oauth2-redirect.html +0 -21
  277. package/src/commands/preview-docs/preview-server/preview-server.ts +0 -159
  278. package/src/commands/preview-docs/preview-server/server.ts +0 -92
  279. package/src/commands/preview-project/constants.ts +0 -23
  280. package/src/commands/preview-project/index.ts +0 -71
  281. package/src/commands/preview-project/types.ts +0 -12
  282. package/src/commands/push.ts +0 -470
  283. package/src/commands/split/__tests__/fixtures/samples.json +0 -61
  284. package/src/commands/split/__tests__/fixtures/spec.json +0 -70
  285. package/src/commands/split/__tests__/fixtures/webhooks.json +0 -85
  286. package/src/commands/split/__tests__/index.test.ts +0 -156
  287. package/src/commands/split/index.ts +0 -397
  288. package/src/commands/split/types.ts +0 -60
  289. package/src/commands/stats.ts +0 -140
  290. package/src/commands/translations.ts +0 -32
  291. package/src/custom.d.ts +0 -1
  292. package/src/index.ts +0 -970
  293. package/src/otel.ts +0 -59
  294. package/src/reunite/api/__tests__/api-keys.test.ts +0 -37
  295. package/src/reunite/api/__tests__/api.client.test.ts +0 -452
  296. package/src/reunite/api/__tests__/domains.test.ts +0 -41
  297. package/src/reunite/api/api-client.ts +0 -381
  298. package/src/reunite/api/api-keys.ts +0 -26
  299. package/src/reunite/api/domains.ts +0 -23
  300. package/src/reunite/api/index.ts +0 -3
  301. package/src/reunite/api/types.ts +0 -108
  302. package/src/reunite/commands/__tests__/push-status.test.ts +0 -653
  303. package/src/reunite/commands/__tests__/push.test.ts +0 -385
  304. package/src/reunite/commands/__tests__/utils.test.ts +0 -62
  305. package/src/reunite/commands/push-status.ts +0 -325
  306. package/src/reunite/commands/push.ts +0 -235
  307. package/src/reunite/commands/utils.ts +0 -66
  308. package/src/reunite/utils.ts +0 -1
  309. package/src/types.ts +0 -64
  310. package/src/utils/__mocks__/miscellaneous.ts +0 -24
  311. package/src/utils/assert-node-version.ts +0 -19
  312. package/src/utils/fetch-with-timeout.ts +0 -30
  313. package/src/utils/getCommandNameFromArgs.ts +0 -5
  314. package/src/utils/js-utils.ts +0 -24
  315. package/src/utils/miscellaneous.ts +0 -729
  316. package/src/utils/platform.ts +0 -31
  317. package/src/utils/spinner.ts +0 -50
  318. package/src/utils/update-version-notifier.ts +0 -115
  319. package/src/wrapper.ts +0 -77
  320. package/tsconfig.json +0 -9
  321. package/tsconfig.tsbuildinfo +0 -1
@@ -1,29 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleSplit = handleSplit;
4
- exports.startsWithComponents = startsWithComponents;
5
- exports.crawl = crawl;
6
- exports.iteratePathItems = iteratePathItems;
7
- const colorette_1 = require("colorette");
8
- const fs = require("fs");
9
- const openapi_core_1 = require("@redocly/openapi-core");
10
- const utils_1 = require("@redocly/openapi-core/lib/utils");
11
- const path = require("path");
12
- const perf_hooks_1 = require("perf_hooks");
13
- const miscellaneous_1 = require("../../utils/miscellaneous");
14
- const js_utils_1 = require("../../utils/js-utils");
15
- const types_1 = require("./types");
16
- async function handleSplit({ argv, collectSpecData }) {
17
- const startedAt = perf_hooks_1.performance.now();
1
+ import { red, blue, green } from 'colorette';
2
+ import * as fs from 'node:fs';
3
+ import { parseYaml, slash, isRef, isTruthy, dequal, logger } from '@redocly/openapi-core';
4
+ import * as path from 'node:path';
5
+ import { performance } from 'perf_hooks';
6
+ import { printExecutionTime, pathToFilename, readYaml, escapeLanguageName, langToExt, writeToFileByExtension, getAndValidateFileExtension, } from '../../utils/miscellaneous.js';
7
+ import { isObject, isEmptyObject } from '../../utils/js-utils.js';
8
+ import { exitWithError } from '../../utils/error.js';
9
+ import { OPENAPI3_COMPONENT, COMPONENTS, OPENAPI3_METHOD_NAMES, OPENAPI3_COMPONENT_NAMES, } from './types.js';
10
+ export async function handleSplit({ argv, collectSpecData }) {
11
+ const startedAt = performance.now();
18
12
  const { api, outDir, separator } = argv;
19
13
  validateDefinitionFileName(api);
20
- const ext = (0, miscellaneous_1.getAndValidateFileExtension)(api);
21
- const openapi = (0, miscellaneous_1.readYaml)(api);
14
+ const ext = getAndValidateFileExtension(api);
15
+ const openapi = readYaml(api);
22
16
  collectSpecData?.(openapi);
23
17
  splitDefinition(openapi, outDir, separator, ext);
24
- process.stderr.write(`🪓 Document: ${(0, colorette_1.blue)(api)} ${(0, colorette_1.green)('is successfully split')}
25
- and all related files are saved to the directory: ${(0, colorette_1.blue)(outDir)} \n`);
26
- (0, miscellaneous_1.printExecutionTime)('split', startedAt, api);
18
+ logger.info(`🪓 Document: ${blue(api)} ${green('is successfully split')}
19
+ and all related files are saved to the directory: ${blue(outDir)} \n`);
20
+ printExecutionTime('split', startedAt, api);
27
21
  }
28
22
  function splitDefinition(openapi, openapiDir, pathSeparator, ext) {
29
23
  fs.mkdirSync(openapiDir, { recursive: true });
@@ -34,30 +28,30 @@ function splitDefinition(openapi, openapiDir, pathSeparator, ext) {
34
28
  // use webhook_ prefix for code samples to prevent potential name-clashes with paths samples
35
29
  iteratePathItems(webhooks, openapiDir, path.join(openapiDir, 'webhooks'), componentsFiles, pathSeparator, 'webhook_', ext);
36
30
  replace$Refs(openapi, openapiDir, componentsFiles);
37
- (0, miscellaneous_1.writeToFileByExtension)(openapi, path.join(openapiDir, `openapi.${ext}`));
31
+ writeToFileByExtension(openapi, path.join(openapiDir, `openapi.${ext}`));
38
32
  }
39
- function startsWithComponents(node) {
40
- return node.startsWith(`#/${types_1.COMPONENTS}/`);
33
+ export function startsWithComponents(node) {
34
+ return node.startsWith(`#/${COMPONENTS}/`);
41
35
  }
42
36
  function isSupportedExtension(filename) {
43
37
  return filename.endsWith('.yaml') || filename.endsWith('.yml') || filename.endsWith('.json');
44
38
  }
45
39
  function loadFile(fileName) {
46
40
  try {
47
- return (0, openapi_core_1.parseYaml)(fs.readFileSync(fileName, 'utf8'));
41
+ return parseYaml(fs.readFileSync(fileName, 'utf8'));
48
42
  }
49
43
  catch (e) {
50
- return (0, miscellaneous_1.exitWithError)(e.message);
44
+ return exitWithError(e.message);
51
45
  }
52
46
  }
53
47
  function validateDefinitionFileName(fileName) {
54
48
  if (!fs.existsSync(fileName))
55
- (0, miscellaneous_1.exitWithError)(`File ${(0, colorette_1.blue)(fileName)} does not exist.`);
49
+ exitWithError(`File ${blue(fileName)} does not exist.`);
56
50
  const file = loadFile(fileName);
57
51
  if (file.swagger)
58
- (0, miscellaneous_1.exitWithError)('OpenAPI 2 is not supported by this command.');
52
+ exitWithError('OpenAPI 2 is not supported by this command.');
59
53
  if (!file.openapi)
60
- (0, miscellaneous_1.exitWithError)('File does not conform to the OpenAPI Specification. OpenAPI version is not specified.');
54
+ exitWithError('File does not conform to the OpenAPI Specification. OpenAPI version is not specified.');
61
55
  return true;
62
56
  }
63
57
  function traverseDirectoryDeep(directory, callback, componentsFiles) {
@@ -77,12 +71,12 @@ function traverseDirectoryDeep(directory, callback, componentsFiles) {
77
71
  function traverseDirectoryDeepCallback(filename, directory, componentsFiles) {
78
72
  if (!isSupportedExtension(filename))
79
73
  return;
80
- const pathData = (0, miscellaneous_1.readYaml)(filename);
74
+ const pathData = readYaml(filename);
81
75
  replace$Refs(pathData, directory, componentsFiles);
82
- (0, miscellaneous_1.writeToFileByExtension)(pathData, filename);
76
+ writeToFileByExtension(pathData, filename);
83
77
  }
84
- function crawl(object, visitor) {
85
- if (!(0, js_utils_1.isObject)(object))
78
+ export function crawl(object, visitor) {
79
+ if (!isObject(object))
86
80
  return;
87
81
  visitor(object);
88
82
  for (const key of Object.keys(object)) {
@@ -94,7 +88,7 @@ function replace$Refs(obj, relativeFrom, componentFiles = {}) {
94
88
  if (node.$ref && typeof node.$ref === 'string' && startsWithComponents(node.$ref)) {
95
89
  replace(node, '$ref');
96
90
  }
97
- else if ((0, js_utils_1.isObject)(node.discriminator) && (0, js_utils_1.isObject)(node.discriminator.mapping)) {
91
+ else if (isObject(node.discriminator) && isObject(node.discriminator.mapping)) {
98
92
  const { mapping } = node.discriminator;
99
93
  for (const name of Object.keys(mapping)) {
100
94
  const mappingPointer = mapping[name];
@@ -111,7 +105,7 @@ function replace$Refs(obj, relativeFrom, componentFiles = {}) {
111
105
  const filesGroupName = componentFiles[groupName];
112
106
  if (!filesGroupName || !filesGroupName[name])
113
107
  return;
114
- let filename = (0, openapi_core_1.slash)(path.relative(relativeFrom, filesGroupName[name].filename));
108
+ let filename = slash(path.relative(relativeFrom, filesGroupName[name].filename));
115
109
  if (!filename.startsWith('.')) {
116
110
  filename = './' + filename;
117
111
  }
@@ -121,15 +115,15 @@ function replace$Refs(obj, relativeFrom, componentFiles = {}) {
121
115
  function implicitlyReferenceDiscriminator(obj, defName, filename, schemaFiles) {
122
116
  if (!obj.discriminator)
123
117
  return;
124
- const defPtr = `#/${types_1.COMPONENTS}/${types_1.OPENAPI3_COMPONENT.Schemas}/${defName}`;
118
+ const defPtr = `#/${COMPONENTS}/${OPENAPI3_COMPONENT.Schemas}/${defName}`;
125
119
  const implicitMapping = {};
126
120
  for (const [name, { inherits, filename: parentFilename }] of Object.entries(schemaFiles)) {
127
121
  if (inherits.indexOf(defPtr) > -1) {
128
- const res = (0, openapi_core_1.slash)(path.relative(path.dirname(filename), parentFilename));
122
+ const res = slash(path.relative(path.dirname(filename), parentFilename));
129
123
  implicitMapping[name] = res.startsWith('.') ? res : './' + res;
130
124
  }
131
125
  }
132
- if ((0, js_utils_1.isEmptyObject)(implicitMapping))
126
+ if (isEmptyObject(implicitMapping))
133
127
  return;
134
128
  const discriminatorPropSchema = obj.properties[obj.discriminator.propertyName];
135
129
  const discriminatorEnum = discriminatorPropSchema && discriminatorPropSchema.enum;
@@ -139,25 +133,25 @@ function implicitlyReferenceDiscriminator(obj, defName, filename, schemaFiles) {
139
133
  continue;
140
134
  }
141
135
  if (mapping[name] && mapping[name] !== implicitMapping[name]) {
142
- process.stderr.write((0, colorette_1.yellow)(`warning: explicit mapping overlaps with local mapping entry ${(0, colorette_1.red)(name)} at ${(0, colorette_1.blue)(filename)}. Please check it.`));
136
+ logger.warn(`warning: explicit mapping overlaps with local mapping entry ${red(name)} at ${blue(filename)}. Please check it.`);
143
137
  }
144
138
  mapping[name] = implicitMapping[name];
145
139
  }
146
140
  }
147
141
  function isNotSecurityComponentType(componentType) {
148
- return componentType !== types_1.OPENAPI3_COMPONENT.SecuritySchemes;
142
+ return componentType !== OPENAPI3_COMPONENT.SecuritySchemes;
149
143
  }
150
144
  function findComponentTypes(components) {
151
- return types_1.OPENAPI3_COMPONENT_NAMES.filter((item) => isNotSecurityComponentType(item) && Object.keys(components).includes(item));
145
+ return OPENAPI3_COMPONENT_NAMES.filter((item) => isNotSecurityComponentType(item) && Object.keys(components).includes(item));
152
146
  }
153
147
  function doesFileDiffer(filename, componentData) {
154
- return fs.existsSync(filename) && !(0, utils_1.dequal)((0, miscellaneous_1.readYaml)(filename), componentData);
148
+ return fs.existsSync(filename) && !dequal(readYaml(filename), componentData);
155
149
  }
156
150
  function removeEmptyComponents(openapi, componentType) {
157
- if (openapi.components && (0, js_utils_1.isEmptyObject)(openapi.components[componentType])) {
151
+ if (openapi.components && isEmptyObject(openapi.components[componentType])) {
158
152
  delete openapi.components[componentType];
159
153
  }
160
- if ((0, js_utils_1.isEmptyObject)(openapi.components)) {
154
+ if (isEmptyObject(openapi.components)) {
161
155
  delete openapi.components;
162
156
  }
163
157
  }
@@ -174,10 +168,10 @@ function getFileNamePath(componentDirPath, componentName, ext) {
174
168
  }
175
169
  function gatherComponentsFiles(components, componentsFiles, componentType, componentName, filename) {
176
170
  let inherits = [];
177
- if (componentType === types_1.OPENAPI3_COMPONENT.Schemas) {
171
+ if (componentType === OPENAPI3_COMPONENT.Schemas) {
178
172
  inherits = (components?.[componentType]?.[componentName]?.allOf || [])
179
173
  .map(({ $ref }) => $ref)
180
- .filter(openapi_core_1.isTruthy);
174
+ .filter(isTruthy);
181
175
  }
182
176
  componentsFiles[componentType] = componentsFiles[componentType] || {};
183
177
  componentsFiles[componentType][componentName] = { inherits, filename };
@@ -187,11 +181,11 @@ function iteratePathItems(pathItems, openapiDir, outDir, componentsFiles, pathSe
187
181
  return;
188
182
  fs.mkdirSync(outDir, { recursive: true });
189
183
  for (const pathName of Object.keys(pathItems)) {
190
- const pathFile = `${path.join(outDir, (0, miscellaneous_1.pathToFilename)(pathName, pathSeparator))}.${ext}`;
184
+ const pathFile = `${path.join(outDir, pathToFilename(pathName, pathSeparator))}.${ext}`;
191
185
  const pathData = pathItems[pathName];
192
- if ((0, openapi_core_1.isRef)(pathData))
186
+ if (isRef(pathData))
193
187
  continue;
194
- for (const method of types_1.OPENAPI3_METHOD_NAMES) {
188
+ for (const method of OPENAPI3_METHOD_NAMES) {
195
189
  const methodData = pathData[method];
196
190
  const methodDataXCode = methodData?.['x-code-samples'] || methodData?.['x-codeSamples'];
197
191
  if (!methodDataXCode || !Array.isArray(methodDataXCode)) {
@@ -200,19 +194,19 @@ function iteratePathItems(pathItems, openapiDir, outDir, componentsFiles, pathSe
200
194
  for (const sample of methodDataXCode) {
201
195
  if (sample.source && sample.source.$ref)
202
196
  continue;
203
- const sampleFileName = path.join(openapiDir, 'code_samples', (0, miscellaneous_1.escapeLanguageName)(sample.lang), codeSamplesPathPrefix + (0, miscellaneous_1.pathToFilename)(pathName, pathSeparator), method + (0, miscellaneous_1.langToExt)(sample.lang));
197
+ const sampleFileName = path.join(openapiDir, 'code_samples', escapeLanguageName(sample.lang), codeSamplesPathPrefix + pathToFilename(pathName, pathSeparator), method + langToExt(sample.lang));
204
198
  fs.mkdirSync(path.dirname(sampleFileName), { recursive: true });
205
199
  fs.writeFileSync(sampleFileName, sample.source);
206
200
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
207
201
  // @ts-ignore
208
202
  sample.source = {
209
- $ref: (0, openapi_core_1.slash)(path.relative(outDir, sampleFileName)),
203
+ $ref: slash(path.relative(outDir, sampleFileName)),
210
204
  };
211
205
  }
212
206
  }
213
- (0, miscellaneous_1.writeToFileByExtension)(pathData, pathFile);
207
+ writeToFileByExtension(pathData, pathFile);
214
208
  pathItems[pathName] = {
215
- $ref: (0, openapi_core_1.slash)(path.relative(openapiDir, pathFile)),
209
+ $ref: slash(path.relative(openapiDir, pathFile)),
216
210
  };
217
211
  traverseDirectoryDeep(outDir, traverseDirectoryDeepCallback, componentsFiles);
218
212
  }
@@ -220,7 +214,7 @@ function iteratePathItems(pathItems, openapiDir, outDir, componentsFiles, pathSe
220
214
  function iterateComponents(openapi, openapiDir, componentsFiles, ext) {
221
215
  const { components } = openapi;
222
216
  if (components) {
223
- const componentsDir = path.join(openapiDir, types_1.COMPONENTS);
217
+ const componentsDir = path.join(openapiDir, COMPONENTS);
224
218
  fs.mkdirSync(componentsDir, { recursive: true });
225
219
  const componentTypes = findComponentTypes(components);
226
220
  componentTypes.forEach(iterateAndGatherComponentsFiles);
@@ -243,10 +237,10 @@ function iterateComponents(openapi, openapiDir, componentsFiles, ext) {
243
237
  replace$Refs(componentData, path.dirname(filename), componentsFiles);
244
238
  implicitlyReferenceDiscriminator(componentData, extractFileNameFromPath(filename), filename, componentsFiles.schemas || {});
245
239
  if (doesFileDiffer(filename, componentData)) {
246
- process.stderr.write((0, colorette_1.yellow)(`warning: conflict for ${componentName} - file already exists with different content: ${(0, colorette_1.blue)(filename)} ... Skip.\n`));
240
+ logger.warn(`warning: conflict for ${componentName} - file already exists with different content: ${blue(filename)} ... Skip.\n`);
247
241
  }
248
242
  else {
249
- (0, miscellaneous_1.writeToFileByExtension)(componentData, filename);
243
+ writeToFileByExtension(componentData, filename);
250
244
  }
251
245
  if (isNotSecurityComponentType(componentType)) {
252
246
  // security schemas must referenced from components
@@ -257,3 +251,5 @@ function iterateComponents(openapi, openapiDir, componentsFiles, ext) {
257
251
  }
258
252
  }
259
253
  }
254
+ export { iteratePathItems };
255
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/split/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,SAAS,EACT,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAyBpB,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAAE,IAAI,EAAE,eAAe,EAA6B;IACpF,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IACpC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACxC,0BAA0B,CAAC,GAAG,CAAC,CAAC;IAChC,MAAM,GAAG,GAAG,2BAA2B,CAAC,GAAG,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,QAAQ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OAAO,CAAC,UAAU,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;gBAC9D,CAAC;YACH,CAAC;YACD,qBAAqB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;AACH,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -1,5 +1,4 @@
1
- import type { Oas2Definition } from '@redocly/openapi-core';
2
- import type { Oas3_1Definition, Oas3Definition } from '@redocly/openapi-core/lib/typings/openapi';
1
+ import type { Oas2Definition, Oas3_1Definition, Oas3Definition } from '@redocly/openapi-core';
3
2
  export type Definition = Oas3_1Definition | Oas3Definition | Oas2Definition;
4
3
  export interface ComponentsFiles {
5
4
  [schemas: string]: any;
@@ -34,3 +33,4 @@ export declare enum OPENAPI3_COMPONENT {
34
33
  SecuritySchemes = "securitySchemes"
35
34
  }
36
35
  export declare const OPENAPI3_COMPONENT_NAMES: OPENAPI3_COMPONENT[];
36
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/commands/split/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE9F,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG,cAAc,GAAG,cAAc,CAAC;AAC5E,MAAM,WAAW,eAAe;IAC9B,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC;CACxB;AACD,MAAM,WAAW,SAAS;IACxB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,KAAK,UAAU,CAAC;AAC7B,eAAO,MAAM,QAAQ,aAAa,CAAC;AACnC,eAAO,MAAM,SAAS,eAAe,CAAC;AACtC,oBAAY,eAAe;IACzB,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED,eAAO,MAAM,qBAAqB,EAAE,eAAe,EASlD,CAAC;AAEF,oBAAY,kBAAkB;IAC5B,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,UAAU,eAAe;IACzB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,aAAa,kBAAkB;IAC/B,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,eAAe,oBAAoB;CACpC;AAED,eAAO,MAAM,wBAAwB,EAAE,kBAAkB,EAUxD,CAAC"}
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OPENAPI3_COMPONENT_NAMES = exports.OPENAPI3_COMPONENT = exports.OPENAPI3_METHOD_NAMES = exports.OPENAPI3_METHOD = exports.xWEBHOOKS = exports.WEBHOOKS = exports.PATHS = exports.COMPONENTS = void 0;
4
- exports.COMPONENTS = 'components';
5
- exports.PATHS = 'paths';
6
- exports.WEBHOOKS = 'webhooks';
7
- exports.xWEBHOOKS = 'x-webhooks';
8
- var OPENAPI3_METHOD;
1
+ export const COMPONENTS = 'components';
2
+ export const PATHS = 'paths';
3
+ export const WEBHOOKS = 'webhooks';
4
+ export const xWEBHOOKS = 'x-webhooks';
5
+ export var OPENAPI3_METHOD;
9
6
  (function (OPENAPI3_METHOD) {
10
7
  OPENAPI3_METHOD["get"] = "get";
11
8
  OPENAPI3_METHOD["put"] = "put";
@@ -15,8 +12,8 @@ var OPENAPI3_METHOD;
15
12
  OPENAPI3_METHOD["head"] = "head";
16
13
  OPENAPI3_METHOD["patch"] = "patch";
17
14
  OPENAPI3_METHOD["trace"] = "trace";
18
- })(OPENAPI3_METHOD || (exports.OPENAPI3_METHOD = OPENAPI3_METHOD = {}));
19
- exports.OPENAPI3_METHOD_NAMES = [
15
+ })(OPENAPI3_METHOD || (OPENAPI3_METHOD = {}));
16
+ export const OPENAPI3_METHOD_NAMES = [
20
17
  OPENAPI3_METHOD.get,
21
18
  OPENAPI3_METHOD.put,
22
19
  OPENAPI3_METHOD.post,
@@ -26,7 +23,7 @@ exports.OPENAPI3_METHOD_NAMES = [
26
23
  OPENAPI3_METHOD.patch,
27
24
  OPENAPI3_METHOD.trace,
28
25
  ];
29
- var OPENAPI3_COMPONENT;
26
+ export var OPENAPI3_COMPONENT;
30
27
  (function (OPENAPI3_COMPONENT) {
31
28
  OPENAPI3_COMPONENT["Schemas"] = "schemas";
32
29
  OPENAPI3_COMPONENT["Responses"] = "responses";
@@ -37,8 +34,8 @@ var OPENAPI3_COMPONENT;
37
34
  OPENAPI3_COMPONENT["Links"] = "links";
38
35
  OPENAPI3_COMPONENT["Callbacks"] = "callbacks";
39
36
  OPENAPI3_COMPONENT["SecuritySchemes"] = "securitySchemes";
40
- })(OPENAPI3_COMPONENT || (exports.OPENAPI3_COMPONENT = OPENAPI3_COMPONENT = {}));
41
- exports.OPENAPI3_COMPONENT_NAMES = [
37
+ })(OPENAPI3_COMPONENT || (OPENAPI3_COMPONENT = {}));
38
+ export const OPENAPI3_COMPONENT_NAMES = [
42
39
  OPENAPI3_COMPONENT.RequestBodies,
43
40
  OPENAPI3_COMPONENT.Schemas,
44
41
  OPENAPI3_COMPONENT.Responses,
@@ -49,3 +46,4 @@ exports.OPENAPI3_COMPONENT_NAMES = [
49
46
  OPENAPI3_COMPONENT.Callbacks,
50
47
  OPENAPI3_COMPONENT.SecuritySchemes,
51
48
  ];
49
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/commands/split/types.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC;AACvC,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC;AAC7B,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;AACnC,MAAM,CAAC,MAAM,SAAS,GAAG,YAAY,CAAC;AACtC,MAAM,CAAN,IAAY,eASX;AATD,WAAY,eAAe;IACzB,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,gCAAa,CAAA;IACb,oCAAiB,CAAA;IACjB,sCAAmB,CAAA;IACnB,gCAAa,CAAA;IACb,kCAAe,CAAA;IACf,kCAAe,CAAA;AACjB,CAAC,EATW,eAAe,KAAf,eAAe,QAS1B;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAsB;IACtD,eAAe,CAAC,GAAG;IACnB,eAAe,CAAC,GAAG;IACnB,eAAe,CAAC,IAAI;IACpB,eAAe,CAAC,MAAM;IACtB,eAAe,CAAC,OAAO;IACvB,eAAe,CAAC,IAAI;IACpB,eAAe,CAAC,KAAK;IACrB,eAAe,CAAC,KAAK;CACtB,CAAC;AAEF,MAAM,CAAN,IAAY,kBAUX;AAVD,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,6CAAuB,CAAA;IACvB,+CAAyB,CAAA;IACzB,2CAAqB,CAAA;IACrB,yCAAmB,CAAA;IACnB,qDAA+B,CAAA;IAC/B,qCAAe,CAAA;IACf,6CAAuB,CAAA;IACvB,yDAAmC,CAAA;AACrC,CAAC,EAVW,kBAAkB,KAAlB,kBAAkB,QAU7B;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAyB;IAC5D,kBAAkB,CAAC,aAAa;IAChC,kBAAkB,CAAC,OAAO;IAC1B,kBAAkB,CAAC,SAAS;IAC5B,kBAAkB,CAAC,UAAU;IAC7B,kBAAkB,CAAC,QAAQ;IAC3B,kBAAkB,CAAC,OAAO;IAC1B,kBAAkB,CAAC,KAAK;IACxB,kBAAkB,CAAC,SAAS;IAC5B,kBAAkB,CAAC,eAAe;CACnC,CAAC"}
@@ -1,8 +1,9 @@
1
1
  import type { OutputFormat } from '@redocly/openapi-core';
2
- import type { CommandArgs } from '../wrapper';
3
- import type { VerifyConfigOptions } from '../types';
2
+ import type { CommandArgs } from '../wrapper.js';
3
+ import type { VerifyConfigOptions } from '../types.js';
4
4
  export type StatsOptions = {
5
5
  api?: string;
6
6
  format: OutputFormat;
7
7
  } & VerifyConfigOptions;
8
8
  export declare function handleStats({ argv, config, collectSpecData }: CommandArgs<StatsOptions>): Promise<void>;
9
+ //# sourceMappingURL=stats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/commands/stats.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAA4C,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACpG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAuEvD,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,YAAY,CAAC;CACtB,GAAG,mBAAmB,CAAC;AAExB,wBAAsB,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,EAAE,WAAW,CAAC,YAAY,CAAC,iBAyC7F"}
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleStats = handleStats;
4
- const perf_hooks_1 = require("perf_hooks");
5
- const colors = require("colorette");
6
- const openapi_core_1 = require("@redocly/openapi-core");
7
- const miscellaneous_1 = require("../utils/miscellaneous");
1
+ import { performance } from 'perf_hooks';
2
+ import * as colors from 'colorette';
3
+ import { normalizeTypes, BaseResolver, resolveDocument, detectSpec, getTypes, normalizeVisitors, walkDocument, Stats, bundle, logger, } from '@redocly/openapi-core';
4
+ import { getFallbackApisOrExit, printExecutionTime } from '../utils/miscellaneous.js';
8
5
  const statsAccumulator = {
9
6
  refs: { metric: '🚗 References', total: 0, color: 'red', items: new Set() },
10
7
  externalDocs: { metric: '📦 External Documents', total: 0, color: 'magenta' },
@@ -19,7 +16,7 @@ const statsAccumulator = {
19
16
  function printStatsStylish(statsAccumulator) {
20
17
  for (const node in statsAccumulator) {
21
18
  const { metric, total, color } = statsAccumulator[node];
22
- process.stderr.write(colors[color](`${metric}: ${total} \n`));
19
+ logger.output(colors[color](`${metric}: ${total} \n`));
23
20
  }
24
21
  }
25
22
  function printStatsJson(statsAccumulator) {
@@ -30,7 +27,7 @@ function printStatsJson(statsAccumulator) {
30
27
  total: statsAccumulator[key].total,
31
28
  };
32
29
  }
33
- process.stdout.write(JSON.stringify(json, null, 2));
30
+ logger.output(JSON.stringify(json, null, 2));
34
31
  }
35
32
  function printStatsMarkdown(statsAccumulator) {
36
33
  let output = '| Feature | Count |\n| --- | --- |\n';
@@ -42,14 +39,13 @@ function printStatsMarkdown(statsAccumulator) {
42
39
  statsAccumulator[key].total +
43
40
  ' |\n';
44
41
  }
45
- process.stdout.write(output);
42
+ logger.output(output);
46
43
  }
47
44
  function printStats(statsAccumulator, api, startedAt, format) {
45
+ logger.info(`Document: ${colors.magenta(api)} stats:\n\n`);
48
46
  switch (format) {
49
47
  case 'stylish':
50
- process.stderr.write(`Document: ${colors.magenta(api)} stats:\n\n`);
51
48
  printStatsStylish(statsAccumulator);
52
- (0, miscellaneous_1.printExecutionTime)('stats', startedAt, api);
53
49
  break;
54
50
  case 'json':
55
51
  printStatsJson(statsAccumulator);
@@ -58,34 +54,34 @@ function printStats(statsAccumulator, api, startedAt, format) {
58
54
  printStatsMarkdown(statsAccumulator);
59
55
  break;
60
56
  }
57
+ printExecutionTime('stats', startedAt, api);
61
58
  }
62
- async function handleStats({ argv, config, collectSpecData }) {
63
- const [{ path }] = await (0, miscellaneous_1.getFallbackApisOrExit)(argv.api ? [argv.api] : [], config);
64
- const externalRefResolver = new openapi_core_1.BaseResolver(config.resolve);
65
- const { bundle: document } = await (0, openapi_core_1.bundle)({ config, ref: path });
59
+ export async function handleStats({ argv, config, collectSpecData }) {
60
+ const [{ path }] = await getFallbackApisOrExit(argv.api ? [argv.api] : [], config);
61
+ const externalRefResolver = new BaseResolver(config.resolve);
62
+ const { bundle: document } = await bundle({ config, ref: path });
66
63
  collectSpecData?.(document.parsed);
67
- const lintConfig = config.styleguide;
68
- const specVersion = (0, openapi_core_1.detectSpec)(document.parsed);
69
- const types = (0, openapi_core_1.normalizeTypes)(lintConfig.extendTypes((0, openapi_core_1.getTypes)(specVersion), specVersion), lintConfig);
70
- const startedAt = perf_hooks_1.performance.now();
64
+ const specVersion = detectSpec(document.parsed);
65
+ const types = normalizeTypes(config.extendTypes(getTypes(specVersion), specVersion), config);
66
+ const startedAt = performance.now();
71
67
  const ctx = {
72
68
  problems: [],
73
69
  oasVersion: specVersion,
74
70
  visitorsData: {},
75
71
  };
76
- const resolvedRefMap = await (0, openapi_core_1.resolveDocument)({
72
+ const resolvedRefMap = await resolveDocument({
77
73
  rootDocument: document,
78
74
  rootType: types.Root,
79
75
  externalRefResolver,
80
76
  });
81
- const statsVisitor = (0, openapi_core_1.normalizeVisitors)([
77
+ const statsVisitor = normalizeVisitors([
82
78
  {
83
79
  severity: 'warn',
84
80
  ruleId: 'stats',
85
- visitor: (0, openapi_core_1.Stats)(statsAccumulator),
81
+ visitor: Stats(statsAccumulator),
86
82
  },
87
83
  ], types);
88
- (0, openapi_core_1.walkDocument)({
84
+ walkDocument({
89
85
  document,
90
86
  rootType: types.Root,
91
87
  normalizedVisitors: statsVisitor,
@@ -94,3 +90,4 @@ async function handleStats({ argv, config, collectSpecData }) {
94
90
  });
95
91
  printStats(statsAccumulator, path, startedAt, argv.format);
96
92
  }
93
+ //# sourceMappingURL=stats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/commands/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,cAAc,EACd,YAAY,EACZ,eAAe,EACf,UAAU,EACV,QAAQ,EACR,iBAAi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MAAM,cAAc,GAAG,MAAM,eAAe,CAAC;QAC3C,YAAY,EAAE,QAAQ;QACtB,QAAQ,EAAE,KAAK,CAAC,IAAI;QACpB,mBAAmB;KACpB,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,iBAAiB,CACpC;QACE;YACE,QAAQ,EAAE,MAAM;YAChB,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAC;SACjC;KACF,EACD,KAAK,CACN,CAAC;IAEF,YAAY,CAAC;QACX,QAAQ;QACR,QAAQ,EAAE,KAAK,CAAC,IAAI;QACpB,kBAAkB,EAAE,YAAY;QAChC,cAAc;QACd,GAAG;KACJ,CAAC,CAAC;IAEH,UAAU,CAAC,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;AAC7D,CAAC"}
@@ -1,7 +1,8 @@
1
- import type { CommandArgs } from '../wrapper';
2
- import type { VerifyConfigOptions } from '../types';
1
+ import type { CommandArgs } from '../wrapper.js';
2
+ import type { VerifyConfigOptions } from '../types.js';
3
3
  export type TranslationsOptions = {
4
4
  locale: string;
5
5
  'project-dir'?: string;
6
6
  } & VerifyConfigOptions;
7
7
  export declare const handleTranslations: ({ argv }: CommandArgs<TranslationsOptions>) => Promise<void>;
8
+ //# sourceMappingURL=translations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../src/commands/translations.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,mBAAmB,CAAC;AAExB,eAAO,MAAM,kBAAkB,aAAoB,WAAW,CAAC,mBAAmB,CAAC,kBAoBlF,CAAC"}
@@ -1,20 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleTranslations = void 0;
4
- const child_process_1 = require("child_process");
5
- const platform_1 = require("../utils/platform");
6
- const handleTranslations = async ({ argv }) => {
7
- process.stdout.write(`\nLaunching translate using NPX.\n\n`);
8
- const { npxExecutableName, sanitize, shell } = (0, platform_1.getPlatformSpawnArgs)();
9
- const projectDir = sanitize(argv['project-dir'], platform_1.sanitizePath);
10
- const locale = sanitize(argv.locale, platform_1.sanitizeLocale);
11
- const child = (0, child_process_1.spawn)(npxExecutableName, ['-y', '@redocly/realm', 'translate', locale, `-d=${projectDir}`], {
1
+ import { spawn } from 'node:child_process';
2
+ import { logger } from '@redocly/openapi-core';
3
+ import { getPlatformSpawnArgs, sanitizeLocale, sanitizePath } from '../utils/platform.js';
4
+ export const handleTranslations = async ({ argv }) => {
5
+ logger.info(`\nLaunching translate using NPX.\n\n`);
6
+ const { npxExecutableName, sanitize, shell } = getPlatformSpawnArgs();
7
+ const projectDir = sanitize(argv['project-dir'], sanitizePath);
8
+ const locale = sanitize(argv.locale, sanitizeLocale);
9
+ const child = spawn(npxExecutableName, ['-y', '@redocly/realm', 'translate', locale, `-d=${projectDir}`], {
12
10
  stdio: 'inherit',
13
11
  shell,
14
12
  });
15
13
  child.on('error', (error) => {
16
- process.stderr.write(`Translate launch failed: ${error.message}`);
14
+ logger.info(`Translate launch failed: ${error.message}`);
17
15
  throw new Error(`Translate launch failed.`);
18
16
  });
19
17
  };
20
- exports.handleTranslations = handleTranslations;
18
+ //# sourceMappingURL=translations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translations.js","sourceRoot":"","sources":["../../src/commands/translations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAU1F,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,EAAE,IAAI,EAAoC,EAAE,EAAE;IACrF,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;IACpD,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAEtE,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,YAAY,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAErD,MAAM,KAAK,GAAG,KAAK,CACjB,iBAAiB,EACjB,CAAC,IAAI,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,UAAU,EAAE,CAAC,EACjE;QACE,KAAK,EAAE,SAAS;QAChB,KAAK;KACN,CACF,CAAC;IAEF,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;QAC1B,MAAM,CAAC,IAAI,CAAC,4BAA4B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import './utils/assert-node-version';
2
+ import './utils/assert-node-version.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,gCAAgC,CAAC"}