@openapi-qraft/plugin 2.15.0-beta.0 → 2.15.0-beta.1

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 (78) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/lib/QraftCommand.d.ts +8 -62
  3. package/dist/lib/QraftCommand.d.ts.map +1 -1
  4. package/dist/lib/QraftCommand.js +30 -193
  5. package/dist/lib/QraftCommand.js.map +1 -1
  6. package/dist/lib/QraftCommandPlugin.d.ts +2 -6
  7. package/dist/lib/QraftCommandPlugin.d.ts.map +1 -1
  8. package/dist/packageVersion.d.ts +1 -1
  9. package/dist/packageVersion.js +1 -1
  10. package/package.json +4 -3
  11. package/src/lib/QraftCommand.ts +58 -381
  12. package/src/lib/QraftCommandPlugin.ts +2 -11
  13. package/src/packageVersion.ts +1 -1
  14. package/dist/lib/GeneratorFile.d.ts +0 -9
  15. package/dist/lib/GeneratorFile.d.ts.map +0 -1
  16. package/dist/lib/GeneratorFile.js +0 -2
  17. package/dist/lib/GeneratorFile.js.map +0 -1
  18. package/dist/lib/OutputOptions.d.ts +0 -6
  19. package/dist/lib/OutputOptions.d.ts.map +0 -1
  20. package/dist/lib/OutputOptions.js +0 -2
  21. package/dist/lib/OutputOptions.js.map +0 -1
  22. package/dist/lib/RedoclyConfigCommand.d.ts +0 -22
  23. package/dist/lib/RedoclyConfigCommand.d.ts.map +0 -1
  24. package/dist/lib/RedoclyConfigCommand.js +0 -133
  25. package/dist/lib/RedoclyConfigCommand.js.map +0 -1
  26. package/dist/lib/fileHeader.d.ts +0 -2
  27. package/dist/lib/fileHeader.d.ts.map +0 -1
  28. package/dist/lib/fileHeader.js +0 -7
  29. package/dist/lib/fileHeader.js.map +0 -1
  30. package/dist/lib/formatFileHeader.d.ts +0 -2
  31. package/dist/lib/formatFileHeader.d.ts.map +0 -1
  32. package/dist/lib/formatFileHeader.js +0 -6
  33. package/dist/lib/formatFileHeader.js.map +0 -1
  34. package/dist/lib/getRedocAPIsToQraft.d.ts +0 -16
  35. package/dist/lib/getRedocAPIsToQraft.d.ts.map +0 -1
  36. package/dist/lib/getRedocAPIsToQraft.js +0 -45
  37. package/dist/lib/getRedocAPIsToQraft.js.map +0 -1
  38. package/dist/lib/handleSchemaInput.d.ts +0 -10
  39. package/dist/lib/handleSchemaInput.d.ts.map +0 -1
  40. package/dist/lib/handleSchemaInput.js +0 -40
  41. package/dist/lib/handleSchemaInput.js.map +0 -1
  42. package/dist/lib/loadRedoclyConfig.d.ts +0 -12
  43. package/dist/lib/loadRedoclyConfig.d.ts.map +0 -1
  44. package/dist/lib/loadRedoclyConfig.js +0 -17
  45. package/dist/lib/loadRedoclyConfig.js.map +0 -1
  46. package/dist/lib/maybeEscapeShellArg.d.ts +0 -2
  47. package/dist/lib/maybeEscapeShellArg.d.ts.map +0 -1
  48. package/dist/lib/maybeEscapeShellArg.js +0 -9
  49. package/dist/lib/maybeEscapeShellArg.js.map +0 -1
  50. package/dist/lib/parseConfigToArgs.d.ts +0 -7
  51. package/dist/lib/parseConfigToArgs.d.ts.map +0 -1
  52. package/dist/lib/parseConfigToArgs.js +0 -130
  53. package/dist/lib/parseConfigToArgs.js.map +0 -1
  54. package/dist/lib/shouldQuoteCommandLineArg.d.ts +0 -11
  55. package/dist/lib/shouldQuoteCommandLineArg.d.ts.map +0 -1
  56. package/dist/lib/shouldQuoteCommandLineArg.js +0 -33
  57. package/dist/lib/shouldQuoteCommandLineArg.js.map +0 -1
  58. package/dist/lib/vitestFsMock.d.ts +0 -2
  59. package/dist/lib/vitestFsMock.d.ts.map +0 -1
  60. package/dist/lib/vitestFsMock.js +0 -16
  61. package/dist/lib/vitestFsMock.js.map +0 -1
  62. package/dist/lib/writeGeneratorFiles.d.ts +0 -7
  63. package/dist/lib/writeGeneratorFiles.d.ts.map +0 -1
  64. package/dist/lib/writeGeneratorFiles.js +0 -51
  65. package/dist/lib/writeGeneratorFiles.js.map +0 -1
  66. package/src/lib/GeneratorFile.ts +0 -5
  67. package/src/lib/OutputOptions.ts +0 -6
  68. package/src/lib/RedoclyConfigCommand.ts +0 -232
  69. package/src/lib/fileHeader.ts +0 -6
  70. package/src/lib/formatFileHeader.ts +0 -4
  71. package/src/lib/getRedocAPIsToQraft.ts +0 -87
  72. package/src/lib/handleSchemaInput.ts +0 -53
  73. package/src/lib/loadRedoclyConfig.ts +0 -47
  74. package/src/lib/maybeEscapeShellArg.ts +0 -10
  75. package/src/lib/parseConfigToArgs.ts +0 -134
  76. package/src/lib/shouldQuoteCommandLineArg.ts +0 -32
  77. package/src/lib/vitestFsMock.ts +0 -23
  78. package/src/lib/writeGeneratorFiles.ts +0 -82
@@ -1,32 +0,0 @@
1
- /**
2
- * Checks if a command-line argument needs to be quoted when used in a command line.
3
- *
4
- * Arguments containing special characters like spaces, quotes, or shell metacharacters
5
- * need to be wrapped in quotes to be properly interpreted by the shell.
6
- *
7
- * @param arg The command-line argument to check
8
- * @returns True if the argument needs quotes, false otherwise
9
- */
10
- export function shouldQuoteCommandLineArg(arg: string): boolean {
11
- if (!arg) return false;
12
-
13
- // Check for spaces
14
- if (arg.includes(' ')) return true;
15
-
16
- // Check for quotes
17
- if (arg.includes('"') || arg.includes("'")) return true;
18
-
19
- // Check for shell metacharacters and special characters
20
- const shellSpecialChars = /[&|<>(){}[\]$;!*?~`\n\r\t#]/;
21
- if (shellSpecialChars.test(arg)) return true;
22
-
23
- // Check for control characters
24
- // eslint-disable-next-line no-control-regex
25
- if (/[\x00-\x1F\x7F]/.test(arg)) return true;
26
-
27
- // Check if argument starts with a dash (to avoid confusion with options)
28
- if (arg.startsWith('-') && !arg.startsWith('--')) return true;
29
-
30
- // Check for wildcards
31
- return arg.includes('*') || arg.includes('?');
32
- }
@@ -1,23 +0,0 @@
1
- import { vi } from 'vitest';
2
-
3
- const createMemFs = vi.hoisted(
4
- () => async (_fsOriginal: typeof import('node:fs')) => {
5
- const { Volume, createFsFromVolume } = await import('memfs');
6
-
7
- return createFsFromVolume(Volume.fromJSON({}));
8
- }
9
- );
10
-
11
- vi.mock('node:fs', async (importOriginal) => {
12
- return {
13
- default: await createMemFs(
14
- await importOriginal<typeof import('node:fs')>()
15
- ),
16
- };
17
- });
18
-
19
- vi.mock('fs', async (importOriginal) => {
20
- return {
21
- default: await createMemFs(await importOriginal<typeof import('fs')>()),
22
- };
23
- });
@@ -1,82 +0,0 @@
1
- import fs from 'node:fs';
2
- import c from 'ansi-colors';
3
- import { Ora } from 'ora';
4
- import { GeneratorFile } from './GeneratorFile.js';
5
-
6
- export const writeGeneratorFiles = async ({
7
- spinner,
8
- fileItems,
9
- }: {
10
- spinner: Ora;
11
- fileItems: GeneratorFile[];
12
- }) => {
13
- await setupDirectories(spinner, fileItems);
14
- await writeFiles(spinner, fileItems);
15
- };
16
-
17
- const setupDirectories = async (spinner: Ora, fileItems: GeneratorFile[]) => {
18
- for (const fileItem of fileItems) {
19
- if (!('directory' in fileItem)) continue;
20
-
21
- if (fileItem.clean) {
22
- spinner.text = `Cleaning ${c.magenta(fileItem.directory.pathname)}`;
23
-
24
- try {
25
- await fs.promises.rm(fileItem.directory, {
26
- recursive: true,
27
- force: true,
28
- });
29
- } catch (error) {
30
- spinner.fail(
31
- c.redBright(
32
- `Error occurred during ${c.magenta(
33
- fileItem.directory.pathname
34
- )} directory cleaning`
35
- )
36
- );
37
-
38
- throw error;
39
- }
40
- }
41
-
42
- try {
43
- spinner.text = `Creating directory ${c.magenta(fileItem.directory.pathname)}`;
44
-
45
- await fs.promises.mkdir(fileItem.directory, { recursive: true });
46
- } catch (error) {
47
- spinner.fail(
48
- c.redBright(
49
- `Error occurred during ${c.magenta(
50
- fileItem.directory.pathname
51
- )} directory creation`
52
- )
53
- );
54
-
55
- throw error;
56
- }
57
- }
58
- };
59
-
60
- const writeFiles = async (spinner: Ora, fileItems: GeneratorFile[]) => {
61
- for (const fileItem of fileItems) {
62
- if ('directory' in fileItem) continue;
63
-
64
- const { file, code } = fileItem;
65
-
66
- spinner.text = `Writing ${c.magenta(file.pathname)}`;
67
-
68
- try {
69
- await fs.promises.writeFile(file, code, {
70
- encoding: 'utf-8',
71
- });
72
- } catch (error) {
73
- spinner.fail(
74
- c.redBright(
75
- `Error occurred during ${c.magenta(file.pathname)} file writing`
76
- )
77
- );
78
-
79
- throw error;
80
- }
81
- }
82
- };