@lukoweb/apitogo 0.1.131 → 0.1.132
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/dist/cli/cli.js
CHANGED
|
@@ -5809,7 +5809,7 @@ import {
|
|
|
5809
5809
|
// package.json
|
|
5810
5810
|
var package_default = {
|
|
5811
5811
|
name: "@lukoweb/apitogo",
|
|
5812
|
-
version: "0.1.
|
|
5812
|
+
version: "0.1.132",
|
|
5813
5813
|
type: "module",
|
|
5814
5814
|
sideEffects: [
|
|
5815
5815
|
"**/*.css",
|
|
@@ -11877,7 +11877,9 @@ var treeToNavigationItems = (node) => {
|
|
|
11877
11877
|
return [...docs, ...categories];
|
|
11878
11878
|
};
|
|
11879
11879
|
function buildDocumentationItems(routePaths) {
|
|
11880
|
-
return treeToNavigationItems(
|
|
11880
|
+
return treeToNavigationItems(
|
|
11881
|
+
buildTree(sortDocPaths([...new Set(routePaths)]))
|
|
11882
|
+
);
|
|
11881
11883
|
}
|
|
11882
11884
|
function navItemKey(item) {
|
|
11883
11885
|
if (typeof item === "string") {
|
|
@@ -11894,19 +11896,67 @@ function navItemKey(item) {
|
|
|
11894
11896
|
}
|
|
11895
11897
|
return JSON.stringify(item);
|
|
11896
11898
|
}
|
|
11899
|
+
function normalizeDocRoute(value) {
|
|
11900
|
+
const trimmed = value.trim().replace(/^\.?\/+/, "").replace(/\.mdx?$/i, "").replace(/(^|\/)index$/, "");
|
|
11901
|
+
return `/${trimmed}`;
|
|
11902
|
+
}
|
|
11903
|
+
function docRoutesOf(item) {
|
|
11904
|
+
if (typeof item === "string") return [normalizeDocRoute(item)];
|
|
11905
|
+
if (!isRecord(item)) return [];
|
|
11906
|
+
if (item.type === "doc") {
|
|
11907
|
+
return [item.file, item.path].filter((value) => typeof value === "string").map(normalizeDocRoute);
|
|
11908
|
+
}
|
|
11909
|
+
if (item.type === "link" && typeof item.to === "string") {
|
|
11910
|
+
return item.to.startsWith("/") ? [normalizeDocRoute(item.to)] : [];
|
|
11911
|
+
}
|
|
11912
|
+
if (item.type === "category") {
|
|
11913
|
+
return [
|
|
11914
|
+
...docRoutesOf(item.link),
|
|
11915
|
+
...Array.isArray(item.items) ? item.items.flatMap(docRoutesOf) : []
|
|
11916
|
+
];
|
|
11917
|
+
}
|
|
11918
|
+
return [];
|
|
11919
|
+
}
|
|
11920
|
+
function collectNavigationDocRoutes(navigation) {
|
|
11921
|
+
return new Set(
|
|
11922
|
+
Array.isArray(navigation) ? navigation.flatMap(docRoutesOf) : []
|
|
11923
|
+
);
|
|
11924
|
+
}
|
|
11925
|
+
function pruneKnownDocs(items, known) {
|
|
11926
|
+
return items.flatMap((item) => {
|
|
11927
|
+
if (typeof item === "string") {
|
|
11928
|
+
return known.has(normalizeDocRoute(item)) ? [] : [item];
|
|
11929
|
+
}
|
|
11930
|
+
if (item.type !== "category" || !Array.isArray(item.items)) return [item];
|
|
11931
|
+
const children = pruneKnownDocs(item.items, known);
|
|
11932
|
+
return children.length > 0 ? [{ ...item, items: children }] : [];
|
|
11933
|
+
});
|
|
11934
|
+
}
|
|
11897
11935
|
function mergeNavItems(existing, incoming) {
|
|
11898
|
-
const seen = new Set(existing.map(navItemKey));
|
|
11899
11936
|
const merged = [...existing];
|
|
11900
11937
|
for (const item of incoming) {
|
|
11901
11938
|
const key = navItemKey(item);
|
|
11902
|
-
|
|
11939
|
+
const index = merged.findIndex((current2) => navItemKey(current2) === key);
|
|
11940
|
+
if (index === -1) {
|
|
11941
|
+
merged.push(item);
|
|
11903
11942
|
continue;
|
|
11904
11943
|
}
|
|
11905
|
-
|
|
11906
|
-
|
|
11944
|
+
const current = merged[index];
|
|
11945
|
+
if (isRecord(current) && isRecord(item) && current.type === "category" && item.type === "category") {
|
|
11946
|
+
merged[index] = {
|
|
11947
|
+
...current,
|
|
11948
|
+
items: mergeNavItems(
|
|
11949
|
+
Array.isArray(current.items) ? current.items : [],
|
|
11950
|
+
Array.isArray(item.items) ? item.items : []
|
|
11951
|
+
)
|
|
11952
|
+
};
|
|
11953
|
+
}
|
|
11907
11954
|
}
|
|
11908
11955
|
return merged;
|
|
11909
11956
|
}
|
|
11957
|
+
function isRecord(value) {
|
|
11958
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
11959
|
+
}
|
|
11910
11960
|
function isDocumentationCategory(item) {
|
|
11911
11961
|
return typeof item === "object" && item.type === "category" && item.label === DOCUMENTATION_NAV_LABEL;
|
|
11912
11962
|
}
|
|
@@ -11919,13 +11969,17 @@ function mergeDocumentationNavigation(navigation, docRoutePaths, options) {
|
|
|
11919
11969
|
const rest = existing.filter((item) => !isDocumentationCategory(item));
|
|
11920
11970
|
const currentDocs = existing.find(isDocumentationCategory);
|
|
11921
11971
|
const currentItems = Array.isArray(currentDocs?.items) ? currentDocs.items : [];
|
|
11922
|
-
const items = options.force ? generated : mergeNavItems(
|
|
11972
|
+
const items = options.force ? generated : mergeNavItems(
|
|
11973
|
+
currentItems,
|
|
11974
|
+
pruneKnownDocs(generated, collectNavigationDocRoutes(existing))
|
|
11975
|
+
);
|
|
11923
11976
|
const documentation = {
|
|
11977
|
+
...currentDocs,
|
|
11924
11978
|
type: "category",
|
|
11925
11979
|
label: DOCUMENTATION_NAV_LABEL,
|
|
11926
11980
|
items
|
|
11927
11981
|
};
|
|
11928
|
-
if (generated.length === 0) {
|
|
11982
|
+
if (generated.length === 0 || !currentDocs && items.length === 0) {
|
|
11929
11983
|
return existing;
|
|
11930
11984
|
}
|
|
11931
11985
|
if (currentDocs) {
|
|
@@ -22262,7 +22316,7 @@ function isInside2(parent, child) {
|
|
|
22262
22316
|
const relative = path64.relative(parent, child);
|
|
22263
22317
|
return relative === "" || !relative.startsWith("..") && !path64.isAbsolute(relative);
|
|
22264
22318
|
}
|
|
22265
|
-
async function collectMarkdownFiles(dir) {
|
|
22319
|
+
async function collectMarkdownFiles(dir, excludeDir) {
|
|
22266
22320
|
const files = [];
|
|
22267
22321
|
let entries;
|
|
22268
22322
|
try {
|
|
@@ -22276,10 +22330,10 @@ async function collectMarkdownFiles(dir) {
|
|
|
22276
22330
|
}
|
|
22277
22331
|
const full = path64.join(dir, entry.name);
|
|
22278
22332
|
if (entry.isDirectory()) {
|
|
22279
|
-
if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink()) {
|
|
22333
|
+
if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink() || excludeDir && path64.resolve(full) === excludeDir) {
|
|
22280
22334
|
continue;
|
|
22281
22335
|
}
|
|
22282
|
-
files.push(...await collectMarkdownFiles(full));
|
|
22336
|
+
files.push(...await collectMarkdownFiles(full, excludeDir));
|
|
22283
22337
|
continue;
|
|
22284
22338
|
}
|
|
22285
22339
|
if ((entry.isFile() || entry.isSymbolicLink()) && /\.mdx?$/i.test(entry.name)) {
|
|
@@ -22328,7 +22382,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
22328
22382
|
if (!await isDirectory(resolved)) {
|
|
22329
22383
|
return;
|
|
22330
22384
|
}
|
|
22331
|
-
const files = (await collectMarkdownFiles(resolved)).sort(
|
|
22385
|
+
const files = (await collectMarkdownFiles(resolved, site)).sort(
|
|
22332
22386
|
(a, b) => a.localeCompare(b)
|
|
22333
22387
|
);
|
|
22334
22388
|
if (files.length === 0) {
|
|
@@ -22355,7 +22409,15 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
22355
22409
|
} catch {
|
|
22356
22410
|
}
|
|
22357
22411
|
}
|
|
22358
|
-
|
|
22412
|
+
const coveredBy = (outer, inner) => outer !== inner && isInside2(outer, inner) && (!isInside2(site, inner) || isInside2(site, outer));
|
|
22413
|
+
return {
|
|
22414
|
+
directories: directories.filter(
|
|
22415
|
+
(inner) => !directories.some(
|
|
22416
|
+
(outer) => coveredBy(outer.sourceDirectory, inner.sourceDirectory)
|
|
22417
|
+
)
|
|
22418
|
+
),
|
|
22419
|
+
searchedDirectories
|
|
22420
|
+
};
|
|
22359
22421
|
}
|
|
22360
22422
|
function slugifyDirName(name) {
|
|
22361
22423
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "docs";
|
|
@@ -22478,6 +22540,15 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
22478
22540
|
path64.relative(directory.sourceDirectory, sourcePath)
|
|
22479
22541
|
);
|
|
22480
22542
|
const linkPath = path64.join(linkDirectory, relativeSource);
|
|
22543
|
+
const relativeLink = toPosix2(path64.relative(site, linkPath));
|
|
22544
|
+
const route = toRoutePath(relativeLink, PAGES_DIR);
|
|
22545
|
+
if (routes.includes(route)) {
|
|
22546
|
+
skipped.push({
|
|
22547
|
+
sourcePath,
|
|
22548
|
+
reason: `route ${route} is already used by another file`
|
|
22549
|
+
});
|
|
22550
|
+
continue;
|
|
22551
|
+
}
|
|
22481
22552
|
const result = await linkMarkdownFile(sourcePath, linkPath);
|
|
22482
22553
|
if (result === "skipped") {
|
|
22483
22554
|
skipped.push({
|
|
@@ -22486,8 +22557,6 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
22486
22557
|
});
|
|
22487
22558
|
continue;
|
|
22488
22559
|
}
|
|
22489
|
-
const relativeLink = toPosix2(path64.relative(site, linkPath));
|
|
22490
|
-
const route = toRoutePath(relativeLink, PAGES_DIR);
|
|
22491
22560
|
linked.push({ sourcePath, linkPath, route, relativeSource });
|
|
22492
22561
|
routes.push(route);
|
|
22493
22562
|
}
|
|
@@ -20,6 +20,7 @@ export declare function applyConfigPatches(config: JsonRecord, patches: {
|
|
|
20
20
|
}): JsonRecord;
|
|
21
21
|
export declare const sortDocPaths: (docPaths: string[]) => string[];
|
|
22
22
|
export declare function buildDocumentationItems(routePaths: string[]): NavItem[];
|
|
23
|
+
export declare function collectNavigationDocRoutes(navigation: unknown): Set<string>;
|
|
23
24
|
export declare function mergeDocumentationNavigation(navigation: unknown, docRoutePaths: string[], options: {
|
|
24
25
|
force: boolean;
|
|
25
26
|
}): NavItem[];
|