radiant-docs 0.1.64 → 0.1.65
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/package.json +4 -3
- package/template/package-lock.json +1991 -4096
- package/template/package.json +7 -19
- package/template/src/components/OpenApiPage.astro +107 -18
- package/template/src/components/Sidebar.astro +1 -0
- package/template/src/components/endpoint/PlaygroundBar.astro +1 -1
- package/template/src/components/endpoint/PlaygroundField.astro +433 -71
- package/template/src/components/endpoint/PlaygroundForm.astro +470 -87
- package/template/src/components/endpoint/RequestSnippets.astro +6 -1
- package/template/src/components/endpoint/ResponseDisplay.astro +109 -2
- package/template/src/components/endpoint/ResponseFieldTree.astro +1 -1
- package/template/src/components/endpoint/ResponseFields.astro +97 -28
- package/template/src/components/endpoint/ResponseSnippets.astro +19 -7
- package/template/src/layouts/Layout.astro +94 -0
- package/template/src/lib/openapi/operation-doc.ts +308 -70
- package/template/src/lib/openapi/response-content.ts +133 -0
- package/template/src/lib/openapi/schema-variant-labels.ts +213 -0
- package/template/.vscode/extensions.json +0 -4
- package/template/.vscode/launch.json +0 -11
- package/template/scripts/generate-og-images.mjs +0 -667
- package/template/scripts/generate-og-metadata.mjs +0 -206
- package/template/scripts/generate-proxy-allowed-origins.mjs +0 -48
- package/template/scripts/generate-robots-txt.mjs +0 -47
- package/template/scripts/publish-shiki-platform-assets.mjs +0 -1177
- package/template/scripts/remove-assistant-for-non-pro.mjs +0 -28
- package/template/scripts/stamp-image-versions.mjs +0 -355
- package/template/scripts/stamp-og-image-versions.mjs +0 -199
- package/template/scripts/stamp-pagefind-runtime-version.mjs +0 -140
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import crypto from "node:crypto";
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
|
|
5
|
-
const CWD = process.cwd();
|
|
6
|
-
const DIST_DIR = path.join(CWD, "dist");
|
|
7
|
-
const PAGEFIND_DIR = path.join(DIST_DIR, "pagefind");
|
|
8
|
-
const PAGEFIND_RUNTIME_PATH = path.join(PAGEFIND_DIR, "pagefind.js");
|
|
9
|
-
const VERSION_LENGTH = 12;
|
|
10
|
-
|
|
11
|
-
function findFilesRecursively(dir, files = []) {
|
|
12
|
-
if (!fs.existsSync(dir)) return files;
|
|
13
|
-
|
|
14
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
15
|
-
for (const entry of entries) {
|
|
16
|
-
const fullPath = path.join(dir, entry.name);
|
|
17
|
-
|
|
18
|
-
if (entry.isDirectory()) {
|
|
19
|
-
findFilesRecursively(fullPath, files);
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (entry.isFile()) {
|
|
24
|
-
files.push(fullPath);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return files;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function normalizeRuntimeSourceForHash(source) {
|
|
32
|
-
return source
|
|
33
|
-
.replaceAll(
|
|
34
|
-
/pagefind-entry\.json\?(?:ts=\$\{Date\.now\(\)\}|v=[^"'`)]*)/g,
|
|
35
|
-
"pagefind-entry.json?__VERSION__",
|
|
36
|
-
)
|
|
37
|
-
.replaceAll(
|
|
38
|
-
/wasm\.\$\{language\}\.pagefind(?:\?v=[^"'`)]*)?/g,
|
|
39
|
-
"wasm.${language}.pagefind?__VERSION__",
|
|
40
|
-
)
|
|
41
|
-
.replaceAll(
|
|
42
|
-
/wasm\.unknown\.pagefind(?:\?v=[^"'`)]*)?/g,
|
|
43
|
-
"wasm.unknown.pagefind?__VERSION__",
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function deriveContentVersion(runtimeSource) {
|
|
48
|
-
const hash = crypto.createHash("sha256");
|
|
49
|
-
const normalizedRuntimeSource = normalizeRuntimeSourceForHash(runtimeSource);
|
|
50
|
-
|
|
51
|
-
const pagefindFiles = findFilesRecursively(PAGEFIND_DIR).sort();
|
|
52
|
-
for (const filePath of pagefindFiles) {
|
|
53
|
-
const relativePath = path.relative(PAGEFIND_DIR, filePath).replace(/\\/g, "/");
|
|
54
|
-
hash.update(relativePath);
|
|
55
|
-
hash.update("\0");
|
|
56
|
-
|
|
57
|
-
if (filePath === PAGEFIND_RUNTIME_PATH) {
|
|
58
|
-
hash.update(normalizedRuntimeSource);
|
|
59
|
-
} else {
|
|
60
|
-
hash.update(fs.readFileSync(filePath));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
hash.update("\0");
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return hash.digest("hex").slice(0, VERSION_LENGTH);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function deriveVersion(runtimeSource) {
|
|
70
|
-
const commitSha = process.env.COMMIT_SHA?.trim().toLowerCase();
|
|
71
|
-
if (commitSha && /^[a-f0-9]{7,40}$/.test(commitSha)) {
|
|
72
|
-
return {
|
|
73
|
-
version: commitSha.slice(0, VERSION_LENGTH),
|
|
74
|
-
source: "commit-sha",
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return {
|
|
79
|
-
version: deriveContentVersion(runtimeSource),
|
|
80
|
-
source: "content-hash",
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function stampRuntimeScript(runtimeSource, encodedVersion) {
|
|
85
|
-
let replacements = 0;
|
|
86
|
-
|
|
87
|
-
let next = runtimeSource.replaceAll(
|
|
88
|
-
/pagefind-entry\.json\?(?:ts=\$\{Date\.now\(\)\}|v=[^"'`)]*)/g,
|
|
89
|
-
() => {
|
|
90
|
-
replacements += 1;
|
|
91
|
-
return `pagefind-entry.json?v=${encodedVersion}`;
|
|
92
|
-
},
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
next = next.replaceAll(
|
|
96
|
-
/wasm\.\$\{language\}\.pagefind(?:\?v=[^"'`)]*)?/g,
|
|
97
|
-
() => {
|
|
98
|
-
replacements += 1;
|
|
99
|
-
return `wasm.\${language}.pagefind?v=${encodedVersion}`;
|
|
100
|
-
},
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
next = next.replaceAll(
|
|
104
|
-
/wasm\.unknown\.pagefind(?:\?v=[^"'`)]*)?/g,
|
|
105
|
-
() => {
|
|
106
|
-
replacements += 1;
|
|
107
|
-
return `wasm.unknown.pagefind?v=${encodedVersion}`;
|
|
108
|
-
},
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
return { next, replacements };
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function main() {
|
|
115
|
-
if (!fs.existsSync(PAGEFIND_RUNTIME_PATH)) {
|
|
116
|
-
console.warn(
|
|
117
|
-
"Skipping Pagefind runtime version stamping: dist/pagefind/pagefind.js not found.",
|
|
118
|
-
);
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const runtimeSource = fs.readFileSync(PAGEFIND_RUNTIME_PATH, "utf8");
|
|
123
|
-
const { version, source } = deriveVersion(runtimeSource);
|
|
124
|
-
const encodedVersion = encodeURIComponent(version);
|
|
125
|
-
|
|
126
|
-
const runtimeResult = stampRuntimeScript(runtimeSource, encodedVersion);
|
|
127
|
-
if (runtimeResult.next !== runtimeSource) {
|
|
128
|
-
fs.writeFileSync(PAGEFIND_RUNTIME_PATH, runtimeResult.next, "utf8");
|
|
129
|
-
} else if (runtimeResult.replacements === 0) {
|
|
130
|
-
console.warn(
|
|
131
|
-
"Pagefind runtime version stamping made no runtime changes. Runtime format may have changed.",
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
console.log(
|
|
136
|
-
`✅ Pagefind runtime version stamping complete (version=${version}, source=${source}, runtimeReplacements=${runtimeResult.replacements}).`,
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
main();
|