@lukoweb/apitogo 0.1.131 → 0.1.133
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.133",
|
|
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) {
|
|
@@ -22069,6 +22123,9 @@ async function apply(argv) {
|
|
|
22069
22123
|
}
|
|
22070
22124
|
const platformPlan = argv.platformPlan?.trim();
|
|
22071
22125
|
const progress = createConsoleProgressReporter();
|
|
22126
|
+
await progress.onStep(
|
|
22127
|
+
`Starting deploy from ${sourceDirectory}... this may take a few minutes.`
|
|
22128
|
+
);
|
|
22072
22129
|
let effectiveProjectId = argv.projectId?.trim();
|
|
22073
22130
|
let effectiveProjectName = argv.projectName?.trim();
|
|
22074
22131
|
let createNewProject = false;
|
|
@@ -22262,7 +22319,7 @@ function isInside2(parent, child) {
|
|
|
22262
22319
|
const relative = path64.relative(parent, child);
|
|
22263
22320
|
return relative === "" || !relative.startsWith("..") && !path64.isAbsolute(relative);
|
|
22264
22321
|
}
|
|
22265
|
-
async function collectMarkdownFiles(dir) {
|
|
22322
|
+
async function collectMarkdownFiles(dir, excludeDir) {
|
|
22266
22323
|
const files = [];
|
|
22267
22324
|
let entries;
|
|
22268
22325
|
try {
|
|
@@ -22276,10 +22333,10 @@ async function collectMarkdownFiles(dir) {
|
|
|
22276
22333
|
}
|
|
22277
22334
|
const full = path64.join(dir, entry.name);
|
|
22278
22335
|
if (entry.isDirectory()) {
|
|
22279
|
-
if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink()) {
|
|
22336
|
+
if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink() || excludeDir && path64.resolve(full) === excludeDir) {
|
|
22280
22337
|
continue;
|
|
22281
22338
|
}
|
|
22282
|
-
files.push(...await collectMarkdownFiles(full));
|
|
22339
|
+
files.push(...await collectMarkdownFiles(full, excludeDir));
|
|
22283
22340
|
continue;
|
|
22284
22341
|
}
|
|
22285
22342
|
if ((entry.isFile() || entry.isSymbolicLink()) && /\.mdx?$/i.test(entry.name)) {
|
|
@@ -22328,7 +22385,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
22328
22385
|
if (!await isDirectory(resolved)) {
|
|
22329
22386
|
return;
|
|
22330
22387
|
}
|
|
22331
|
-
const files = (await collectMarkdownFiles(resolved)).sort(
|
|
22388
|
+
const files = (await collectMarkdownFiles(resolved, site)).sort(
|
|
22332
22389
|
(a, b) => a.localeCompare(b)
|
|
22333
22390
|
);
|
|
22334
22391
|
if (files.length === 0) {
|
|
@@ -22355,7 +22412,15 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
22355
22412
|
} catch {
|
|
22356
22413
|
}
|
|
22357
22414
|
}
|
|
22358
|
-
|
|
22415
|
+
const coveredBy = (outer, inner) => outer !== inner && isInside2(outer, inner) && (!isInside2(site, inner) || isInside2(site, outer));
|
|
22416
|
+
return {
|
|
22417
|
+
directories: directories.filter(
|
|
22418
|
+
(inner) => !directories.some(
|
|
22419
|
+
(outer) => coveredBy(outer.sourceDirectory, inner.sourceDirectory)
|
|
22420
|
+
)
|
|
22421
|
+
),
|
|
22422
|
+
searchedDirectories
|
|
22423
|
+
};
|
|
22359
22424
|
}
|
|
22360
22425
|
function slugifyDirName(name) {
|
|
22361
22426
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "docs";
|
|
@@ -22478,6 +22543,15 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
22478
22543
|
path64.relative(directory.sourceDirectory, sourcePath)
|
|
22479
22544
|
);
|
|
22480
22545
|
const linkPath = path64.join(linkDirectory, relativeSource);
|
|
22546
|
+
const relativeLink = toPosix2(path64.relative(site, linkPath));
|
|
22547
|
+
const route = toRoutePath(relativeLink, PAGES_DIR);
|
|
22548
|
+
if (routes.includes(route)) {
|
|
22549
|
+
skipped.push({
|
|
22550
|
+
sourcePath,
|
|
22551
|
+
reason: `route ${route} is already used by another file`
|
|
22552
|
+
});
|
|
22553
|
+
continue;
|
|
22554
|
+
}
|
|
22481
22555
|
const result = await linkMarkdownFile(sourcePath, linkPath);
|
|
22482
22556
|
if (result === "skipped") {
|
|
22483
22557
|
skipped.push({
|
|
@@ -22486,8 +22560,6 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
22486
22560
|
});
|
|
22487
22561
|
continue;
|
|
22488
22562
|
}
|
|
22489
|
-
const relativeLink = toPosix2(path64.relative(site, linkPath));
|
|
22490
|
-
const route = toRoutePath(relativeLink, PAGES_DIR);
|
|
22491
22563
|
linked.push({ sourcePath, linkPath, route, relativeSource });
|
|
22492
22564
|
routes.push(route);
|
|
22493
22565
|
}
|
|
@@ -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[];
|