@redocly/cli 2.35.1 → 2.37.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/THIRD_PARTY_NOTICES +4 -4
- package/lib/chunks/{YQONFFT5.js → 4UQ4YHWW.js} +4 -2
- package/lib/chunks/{RA3UJ5AH.js → CPNIO4J3.js} +742 -348
- package/lib/chunks/{DZ756KUK.js → FRVYIHIR.js} +1 -1
- package/lib/chunks/{FLHMB3O6.js → IVW4MILQ.js} +6 -4
- package/lib/chunks/{XEVW3SW6.js → LJUXYC4S.js} +1 -1
- package/lib/chunks/{BAMV5MGA.js → M7TYKZDD.js} +5 -4
- package/lib/chunks/{Z5JKGONR.js → QFYLVVG2.js} +615 -357
- package/lib/chunks/{G7TNNDDM.js → U3LS66ZD.js} +3 -3
- package/lib/chunks/{HQSFIOKV.js → YCTAWG2U.js} +1 -1
- package/lib/chunks/Z2I5YXYN.js +20272 -0
- package/lib/chunks/{53LXWEMG.js → ZHITMP73.js} +3 -2
- package/lib/chunks/ZK3QRKL5.js +129 -0
- package/lib/index.js +12 -11
- package/package.json +1 -1
|
@@ -8,9 +8,10 @@ import {
|
|
|
8
8
|
maskSecrets,
|
|
9
9
|
parseRuntimeExpression,
|
|
10
10
|
run
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./FRVYIHIR.js";
|
|
12
12
|
import "./VXIQEZPR.js";
|
|
13
|
-
import "./
|
|
13
|
+
import "./CPNIO4J3.js";
|
|
14
|
+
import "./Z2I5YXYN.js";
|
|
14
15
|
import "./5ILQMFXK.js";
|
|
15
16
|
export {
|
|
16
17
|
RESET_ESCAPE_CODE,
|
|
@@ -0,0 +1,129 @@
|
|
|
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
|
+
};
|
package/lib/index.js
CHANGED
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
saveBundle,
|
|
31
31
|
sortTopLevelKeys,
|
|
32
32
|
writeToFileByExtension
|
|
33
|
-
} from "./chunks/
|
|
33
|
+
} from "./chunks/4UQ4YHWW.js";
|
|
34
34
|
import {
|
|
35
35
|
RedoclyOAuthClient,
|
|
36
36
|
ReuniteApi,
|
|
@@ -41,23 +41,23 @@ import {
|
|
|
41
41
|
getReuniteUrl,
|
|
42
42
|
require_undici,
|
|
43
43
|
shouldBypassProxy
|
|
44
|
-
} from "./chunks/
|
|
44
|
+
} from "./chunks/U3LS66ZD.js";
|
|
45
45
|
import {
|
|
46
46
|
ANONYMOUS_ID_CACHE_FILE,
|
|
47
47
|
DEFAULT_FETCH_TIMEOUT,
|
|
48
48
|
OTEL_URL
|
|
49
49
|
} from "./chunks/Y6DTFCLS.js";
|
|
50
|
-
import "./chunks/
|
|
50
|
+
import "./chunks/YCTAWG2U.js";
|
|
51
51
|
import {
|
|
52
52
|
engines,
|
|
53
53
|
name,
|
|
54
54
|
version
|
|
55
|
-
} from "./chunks/
|
|
55
|
+
} from "./chunks/IVW4MILQ.js";
|
|
56
56
|
import {
|
|
57
57
|
RESET_ESCAPE_CODE,
|
|
58
58
|
calculateTotals,
|
|
59
59
|
conditionallyMaskSecrets
|
|
60
|
-
} from "./chunks/
|
|
60
|
+
} from "./chunks/FRVYIHIR.js";
|
|
61
61
|
import "./chunks/VXIQEZPR.js";
|
|
62
62
|
import {
|
|
63
63
|
BaseResolver,
|
|
@@ -109,7 +109,8 @@ import {
|
|
|
109
109
|
white,
|
|
110
110
|
xmlEscape,
|
|
111
111
|
yellow
|
|
112
|
-
} from "./chunks/
|
|
112
|
+
} from "./chunks/CPNIO4J3.js";
|
|
113
|
+
import "./chunks/Z2I5YXYN.js";
|
|
113
114
|
import {
|
|
114
115
|
__commonJS,
|
|
115
116
|
__require,
|
|
@@ -7703,7 +7704,7 @@ async function handleGenerateArazzo({
|
|
|
7703
7704
|
config: config3
|
|
7704
7705
|
};
|
|
7705
7706
|
try {
|
|
7706
|
-
const { generate } = await import("./chunks/
|
|
7707
|
+
const { generate } = await import("./chunks/ZHITMP73.js");
|
|
7707
7708
|
logger.info(gray("\n Generating Arazzo description... \n"));
|
|
7708
7709
|
const generatedArazzo = await generate(options);
|
|
7709
7710
|
writeFileSync2(outputFile, stringifyYaml(generatedArazzo));
|
|
@@ -9179,7 +9180,7 @@ async function handleRespect({
|
|
|
9179
9180
|
let mtlsCerts;
|
|
9180
9181
|
let harLogs;
|
|
9181
9182
|
try {
|
|
9182
|
-
const { run, conditionallyMaskSecrets: conditionallyMaskSecrets2 } = await import("./chunks/
|
|
9183
|
+
const { run, conditionallyMaskSecrets: conditionallyMaskSecrets2 } = await import("./chunks/ZHITMP73.js");
|
|
9183
9184
|
const workingDir = config3.configPath ? dirname4(config3.configPath) : process.cwd();
|
|
9184
9185
|
if (argv.mtls) {
|
|
9185
9186
|
mtlsCerts = resolveMtlsCertificates(argv.mtls, workingDir);
|
|
@@ -12699,7 +12700,7 @@ async function sendTelemetry({
|
|
|
12699
12700
|
$0: _,
|
|
12700
12701
|
...args
|
|
12701
12702
|
} = argv;
|
|
12702
|
-
const { RedoclyOAuthClient: RedoclyOAuthClient2 } = await import("./chunks/
|
|
12703
|
+
const { RedoclyOAuthClient: RedoclyOAuthClient2 } = await import("./chunks/M7TYKZDD.js");
|
|
12703
12704
|
const oauthClient = new RedoclyOAuthClient2();
|
|
12704
12705
|
const reuniteUrl = getReuniteUrl(config3, args.residency);
|
|
12705
12706
|
const logged_in = await oauthClient.isAuthorized(reuniteUrl);
|
|
@@ -12747,7 +12748,7 @@ async function sendTelemetry({
|
|
|
12747
12748
|
category: "product",
|
|
12748
12749
|
data: eventData
|
|
12749
12750
|
});
|
|
12750
|
-
const { otelTelemetry } = await import("./chunks/
|
|
12751
|
+
const { otelTelemetry } = await import("./chunks/LJUXYC4S.js");
|
|
12751
12752
|
otelTelemetry.send(cloudEvent);
|
|
12752
12753
|
} catch (err) {
|
|
12753
12754
|
}
|
|
@@ -13577,7 +13578,7 @@ yargs_default(hideBin(process.argv)).version("version", "Show version number.",
|
|
|
13577
13578
|
return true;
|
|
13578
13579
|
}),
|
|
13579
13580
|
async (argv) => {
|
|
13580
|
-
const { handlerBuildCommand } = await import("./chunks/
|
|
13581
|
+
const { handlerBuildCommand } = await import("./chunks/QFYLVVG2.js");
|
|
13581
13582
|
commandWrapper(handlerBuildCommand)(argv);
|
|
13582
13583
|
}
|
|
13583
13584
|
).command(
|