@redocly/cli 2.41.2 → 2.43.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.
- package/README.md +15 -0
- package/THIRD_PARTY_NOTICES +3 -2
- package/lib/chunks/32XCOMOR.js +7 -0
- package/lib/chunks/3BCHPW6T.js +22 -0
- package/lib/chunks/3VZLNQK3.js +47 -0
- package/lib/chunks/4VF6MPJJ.js +11 -0
- package/lib/chunks/55GMSQDD.js +7 -0
- package/lib/chunks/5E3VKU5T.js +7 -0
- package/lib/chunks/AE6JGTY4.js +7 -0
- package/lib/chunks/C35TOMVY.js +8 -0
- package/lib/chunks/D5T6ETPZ.js +8 -0
- package/lib/chunks/DNOXLF53.js +8 -0
- package/lib/chunks/E36IFTLX.js +59 -0
- package/lib/chunks/ECZUPR2N.js +7 -0
- package/lib/chunks/EU6GURJZ.js +7 -0
- package/lib/chunks/HXYO6QS2.js +3132 -0
- package/lib/chunks/IW4HG6VD.js +19 -0
- package/lib/chunks/KIVPQZDC.js +31 -0
- package/lib/chunks/KLY5RV3W.js +7 -0
- package/lib/chunks/KM7RL6C4.js +2317 -0
- package/lib/chunks/L3YH7RCT.js +8 -0
- package/lib/chunks/NEWT5A6S.js +159 -0
- package/lib/chunks/NGPG6D6W.js +7 -0
- package/lib/chunks/O6MCQRCP.js +59 -0
- package/lib/chunks/O6PRCLSV.js +13 -0
- package/lib/chunks/OFAMJNQ6.js +7 -0
- package/lib/chunks/P26PQ2RU.js +7 -0
- package/lib/chunks/PFD7KGH7.js +93 -0
- package/lib/chunks/QFG7TTKG.js +22 -0
- package/lib/chunks/RFWIIJFG.js +7 -0
- package/lib/chunks/RS5PUOTT.js +18 -0
- package/lib/chunks/TMQJQANP.js +7 -0
- package/lib/chunks/UPPWQBGX.js +7 -0
- package/lib/chunks/UXH3ZSSV.js +9 -0
- package/lib/chunks/UYZXI3NO.js +7 -0
- package/lib/chunks/WNTLDT6L.js +184 -0
- package/lib/chunks/WZXA5XPB.js +7 -0
- package/lib/chunks/X6IKW6K4.js +7 -0
- package/lib/index.js +226 -13885
- package/package.json +1 -1
- package/lib/chunks/3CX2Z7JI.js +0 -496
- package/lib/chunks/3UUTQVCJ.js +0 -3614
- package/lib/chunks/4FB5ZIPP.js +0 -1133
- package/lib/chunks/5ILQMFXK.js +0 -59
- package/lib/chunks/7F5O43EU.js +0 -1756
- package/lib/chunks/7IX44JLO.js +0 -16
- package/lib/chunks/7MOL2QVN.js +0 -92635
- package/lib/chunks/A3VFVVHD.js +0 -25
- package/lib/chunks/A6JSOHCP.js +0 -41
- package/lib/chunks/AIT3U3JT.js +0 -22
- package/lib/chunks/ASYQPOQY.js +0 -681
- package/lib/chunks/BVP23YP7.js +0 -13374
- package/lib/chunks/FO6BDVGE.js +0 -25
- package/lib/chunks/GFU5KGSW.js +0 -92
- package/lib/chunks/ICPYP2LP.js +0 -401
- package/lib/chunks/KPMZLKQG.js +0 -79
- package/lib/chunks/KRMBH6JF.js +0 -17902
- package/lib/chunks/NLIKC7UP.js +0 -528
- package/lib/chunks/NW3XJZXQ.js +0 -175
- package/lib/chunks/P6UGG7F6.js +0 -414
- package/lib/chunks/RRC5IDC3.js +0 -2416
- package/lib/chunks/T6UZU3XM.js +0 -17
- package/lib/chunks/TS33ZDKX.js +0 -35
- package/lib/chunks/UUU33DK3.js +0 -125
- package/lib/chunks/VUDTNFRL.js +0 -42
- package/lib/chunks/VXIQEZPR.js +0 -2564
- package/lib/chunks/W7G5WVPB.js +0 -44
- package/lib/chunks/XB6C62FW.js +0 -18497
- package/lib/chunks/XHPY6UJF.js +0 -1638
- package/lib/chunks/Y6DTFCLS.js +0 -15
- package/lib/chunks/Z2664VV5.js +0 -39331
- package/lib/chunks/Z2I5YXYN.js +0 -20272
- package/lib/chunks/ZK3QRKL5.js +0 -129
package/lib/chunks/ZK3QRKL5.js
DELETED
|
@@ -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
|
-
};
|