@redocly/cli 2.41.2 → 2.42.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 (73) hide show
  1. package/README.md +15 -0
  2. package/THIRD_PARTY_NOTICES +3 -2
  3. package/lib/chunks/32XCOMOR.js +7 -0
  4. package/lib/chunks/4S2W4DOH.js +7 -0
  5. package/lib/chunks/55GMSQDD.js +7 -0
  6. package/lib/chunks/62KMHHXM.js +93 -0
  7. package/lib/chunks/7J6QXKSL.js +59 -0
  8. package/lib/chunks/7TEHO26G.js +3132 -0
  9. package/lib/chunks/AE6JGTY4.js +7 -0
  10. package/lib/chunks/B62AKN6U.js +7 -0
  11. package/lib/chunks/BZ7PKRCP.js +2317 -0
  12. package/lib/chunks/D5T6ETPZ.js +8 -0
  13. package/lib/chunks/DNYSY7SK.js +8 -0
  14. package/lib/chunks/E2UJUSIU.js +11 -0
  15. package/lib/chunks/ECZUPR2N.js +7 -0
  16. package/lib/chunks/EU6GURJZ.js +7 -0
  17. package/lib/chunks/F4DGJH6G.js +8 -0
  18. package/lib/chunks/GELB6SHC.js +22 -0
  19. package/lib/chunks/HJ6KJBQG.js +9 -0
  20. package/lib/chunks/HXR6INJN.js +22 -0
  21. package/lib/chunks/IP2FG3VC.js +19 -0
  22. package/lib/chunks/KLY5RV3W.js +7 -0
  23. package/lib/chunks/LSG6IYBM.js +47 -0
  24. package/lib/chunks/NEWT5A6S.js +159 -0
  25. package/lib/chunks/O6MCQRCP.js +59 -0
  26. package/lib/chunks/O6PRCLSV.js +13 -0
  27. package/lib/chunks/OFAMJNQ6.js +7 -0
  28. package/lib/chunks/P26PQ2RU.js +7 -0
  29. package/lib/chunks/QQOKWPJZ.js +184 -0
  30. package/lib/chunks/RFWIIJFG.js +7 -0
  31. package/lib/chunks/RS5PUOTT.js +18 -0
  32. package/lib/chunks/SPVQTYE2.js +7 -0
  33. package/lib/chunks/TXOARWFE.js +7 -0
  34. package/lib/chunks/UPPWQBGX.js +7 -0
  35. package/lib/chunks/UYZXI3NO.js +7 -0
  36. package/lib/chunks/WZXA5XPB.js +7 -0
  37. package/lib/chunks/XYO6U5CE.js +31 -0
  38. package/lib/chunks/ZGSJFP2Z.js +8 -0
  39. package/lib/index.js +226 -13885
  40. package/package.json +1 -1
  41. package/lib/chunks/3CX2Z7JI.js +0 -496
  42. package/lib/chunks/3UUTQVCJ.js +0 -3614
  43. package/lib/chunks/4FB5ZIPP.js +0 -1133
  44. package/lib/chunks/5ILQMFXK.js +0 -59
  45. package/lib/chunks/7F5O43EU.js +0 -1756
  46. package/lib/chunks/7IX44JLO.js +0 -16
  47. package/lib/chunks/7MOL2QVN.js +0 -92635
  48. package/lib/chunks/A3VFVVHD.js +0 -25
  49. package/lib/chunks/A6JSOHCP.js +0 -41
  50. package/lib/chunks/AIT3U3JT.js +0 -22
  51. package/lib/chunks/ASYQPOQY.js +0 -681
  52. package/lib/chunks/BVP23YP7.js +0 -13374
  53. package/lib/chunks/FO6BDVGE.js +0 -25
  54. package/lib/chunks/GFU5KGSW.js +0 -92
  55. package/lib/chunks/ICPYP2LP.js +0 -401
  56. package/lib/chunks/KPMZLKQG.js +0 -79
  57. package/lib/chunks/KRMBH6JF.js +0 -17902
  58. package/lib/chunks/NLIKC7UP.js +0 -528
  59. package/lib/chunks/NW3XJZXQ.js +0 -175
  60. package/lib/chunks/P6UGG7F6.js +0 -414
  61. package/lib/chunks/RRC5IDC3.js +0 -2416
  62. package/lib/chunks/T6UZU3XM.js +0 -17
  63. package/lib/chunks/TS33ZDKX.js +0 -35
  64. package/lib/chunks/UUU33DK3.js +0 -125
  65. package/lib/chunks/VUDTNFRL.js +0 -42
  66. package/lib/chunks/VXIQEZPR.js +0 -2564
  67. package/lib/chunks/W7G5WVPB.js +0 -44
  68. package/lib/chunks/XB6C62FW.js +0 -18497
  69. package/lib/chunks/XHPY6UJF.js +0 -1638
  70. package/lib/chunks/Y6DTFCLS.js +0 -15
  71. package/lib/chunks/Z2664VV5.js +0 -39331
  72. package/lib/chunks/Z2I5YXYN.js +0 -20272
  73. package/lib/chunks/ZK3QRKL5.js +0 -129
@@ -1,129 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- const require = __createRequire(import.meta.url);
3
- import {
4
- initRules,
5
- require_graphql
6
- } from "./Z2I5YXYN.js";
7
- import {
8
- __toESM
9
- } from "./5ILQMFXK.js";
10
-
11
- // ../core/lib/graphql/lint-graphql.js
12
- var import_graphql2 = __toESM(require_graphql(), 1);
13
-
14
- // ../core/lib/graphql/visitor.js
15
- var import_graphql = __toESM(require_graphql(), 1);
16
- function toAstVisitor(visitor, opts) {
17
- const astVisitor = {};
18
- for (const kind of Object.keys(visitor)) {
19
- const handler = visitor[kind];
20
- if (!handler)
21
- continue;
22
- const enter = typeof handler === "function" ? handler : handler.enter;
23
- const leave = typeof handler === "function" ? void 0 : handler.leave;
24
- astVisitor[kind] = {
25
- ...enter ? { enter: wrap(enter, opts) } : {},
26
- ...leave ? { leave: wrap(leave, opts) } : {}
27
- };
28
- }
29
- return astVisitor;
30
- }
31
- function wrap(fn, opts) {
32
- return (node, _key, _parent, _path, ancestors) => {
33
- fn(node, makeContext(node, opts, ancestors));
34
- };
35
- }
36
- function makeContext(currentNode, opts, rawAncestors = []) {
37
- const { ruleId, severity, message, source, config, problems } = opts;
38
- const ancestors = rawAncestors.filter((ancestor) => !Array.isArray(ancestor));
39
- return {
40
- source,
41
- config,
42
- ancestors,
43
- report(problem) {
44
- const node = problem.node ?? currentNode;
45
- const loc = problem.loc ?? nodeToLoc(node);
46
- const location = {
47
- source,
48
- pointer: void 0,
49
- start: loc?.start ?? { line: 1, col: 1 },
50
- end: loc?.end
51
- };
52
- problems.push({
53
- ruleId: problem.ruleId ?? ruleId,
54
- severity: problem.severity ?? severity,
55
- message: message ? message.replace("{{message}}", problem.message) : problem.message,
56
- suggest: problem.suggest ?? [],
57
- location: [location]
58
- });
59
- }
60
- };
61
- }
62
- function nodeToLoc(node) {
63
- if (!node?.loc)
64
- return void 0;
65
- const start = (0, import_graphql.getLocation)(node.loc.source, node.loc.start);
66
- const end = (0, import_graphql.getLocation)(node.loc.source, node.loc.end);
67
- return {
68
- start: { line: start.line, col: start.column },
69
- end: { line: end.line, col: end.column }
70
- };
71
- }
72
-
73
- // ../core/lib/graphql/lint-graphql.js
74
- function lintGraphqlDocument(opts) {
75
- const { document, config } = opts;
76
- const source = document.source;
77
- if (source.body.trim() === "") {
78
- return [
79
- {
80
- ruleId: "struct",
81
- severity: "error",
82
- message: "The GraphQL document is empty. Expected at least one type definition.",
83
- suggest: [],
84
- location: [{ source, pointer: void 0, start: { line: 1, col: 1 } }]
85
- }
86
- ];
87
- }
88
- let ast;
89
- try {
90
- ast = (0, import_graphql2.parse)(new import_graphql2.Source(source.body, source.absoluteRef));
91
- } catch (e) {
92
- if (e instanceof import_graphql2.GraphQLError) {
93
- return [syntaxErrorToProblem(e, source)];
94
- }
95
- throw e;
96
- }
97
- const ruleSets = config.getRulesForSpecVersion("graphql") ?? [];
98
- const rules = initRules(ruleSets, config, "rules", "graphql");
99
- const problems = runGraphqlRules({ ast, source, config, rules });
100
- return problems.map((problem) => config.addProblemToIgnore(problem));
101
- }
102
- function syntaxErrorToProblem(error, source) {
103
- const loc = error.locations?.[0];
104
- return {
105
- ruleId: "struct",
106
- severity: "error",
107
- message: error.message,
108
- suggest: [],
109
- location: [
110
- {
111
- source,
112
- pointer: void 0,
113
- start: loc ? { line: loc.line, col: loc.column } : { line: 1, col: 1 }
114
- }
115
- ]
116
- };
117
- }
118
- function runGraphqlRules(opts) {
119
- const { ast, source, config, rules } = opts;
120
- const problems = [];
121
- const astVisitors = rules.map(({ ruleId, severity, message, visitor }) => toAstVisitor(visitor, { ruleId, severity, message, source, config, problems }));
122
- if (astVisitors.length > 0) {
123
- (0, import_graphql2.visit)(ast, (0, import_graphql2.visitInParallel)(astVisitors));
124
- }
125
- return problems;
126
- }
127
- export {
128
- lintGraphqlDocument
129
- };