@fern-api/fern-api-dev 4.40.0 → 4.41.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/cli.cjs +36 -38
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -513506,52 +513506,47 @@ function nameToSlug({ name: name2 }) {
|
|
|
513506
513506
|
function nameToTitle({ name: name2 }) {
|
|
513507
513507
|
return name2.replace(/\.(md|mdx)$/i, "").replace(/[-_]/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
|
|
513508
513508
|
}
|
|
513509
|
-
async function
|
|
513509
|
+
async function getFrontmatterMetadata({ absolutePath, readFileFn = (path90, encoding) => (0, import_promises13.readFile)(path90, encoding) }) {
|
|
513510
513510
|
try {
|
|
513511
513511
|
const content5 = await readFileFn(absolutePath, "utf-8");
|
|
513512
513512
|
const { data: data2 } = (0, import_gray_matter.default)(content5);
|
|
513513
|
-
|
|
513514
|
-
|
|
513515
|
-
|
|
513516
|
-
|
|
513517
|
-
|
|
513518
|
-
|
|
513513
|
+
let position4;
|
|
513514
|
+
if (data2.position != null) {
|
|
513515
|
+
const parsed = typeof data2.position === "string" ? parseFloat(data2.position) : data2.position;
|
|
513516
|
+
if (typeof parsed === "number" && Number.isFinite(parsed)) {
|
|
513517
|
+
position4 = parsed;
|
|
513518
|
+
}
|
|
513519
513519
|
}
|
|
513520
|
-
|
|
513520
|
+
const title3 = typeof data2.title === "string" && data2.title.trim().length > 0 ? data2.title.trim() : void 0;
|
|
513521
|
+
const hidden2 = data2.hidden === true ? true : void 0;
|
|
513522
|
+
const noindex = data2.noindex === true ? true : void 0;
|
|
513523
|
+
return { position: position4, title: title3, hidden: hidden2, noindex };
|
|
513521
513524
|
} catch {
|
|
513522
|
-
return void 0;
|
|
513525
|
+
return { position: void 0, title: void 0, hidden: void 0, noindex: void 0 };
|
|
513523
513526
|
}
|
|
513524
513527
|
}
|
|
513525
|
-
|
|
513526
|
-
|
|
513527
|
-
|
|
513528
|
-
const { data: data2 } = (0, import_gray_matter.default)(content5);
|
|
513529
|
-
if (typeof data2.title === "string" && data2.title.trim().length > 0) {
|
|
513530
|
-
return data2.title.trim();
|
|
513531
|
-
}
|
|
513532
|
-
return void 0;
|
|
513533
|
-
} catch {
|
|
513534
|
-
return void 0;
|
|
513528
|
+
function resolveTitle({ frontmatterTitle, useFrontmatterTitles, fallbackName }) {
|
|
513529
|
+
if (useFrontmatterTitles && frontmatterTitle != null) {
|
|
513530
|
+
return frontmatterTitle;
|
|
513535
513531
|
}
|
|
513532
|
+
return nameToTitle({ name: fallbackName });
|
|
513536
513533
|
}
|
|
513537
513534
|
async function buildNavigationForDirectory({ directoryPath, titleSource, getDir = getDirectoryContents, readFileFn = (path90, encoding) => (0, import_promises13.readFile)(path90, encoding) }) {
|
|
513538
513535
|
const contents = await getDir(directoryPath);
|
|
513539
513536
|
const useFrontmatterTitles = titleSource === "frontmatter";
|
|
513540
513537
|
const markdownFiles = contents.filter((item) => item.type === "file" && !item.name.startsWith("_") && (item.name.toLowerCase().endsWith(".md") || item.name.toLowerCase().endsWith(".mdx")));
|
|
513541
513538
|
const subdirectories = contents.filter((item) => item.type === "directory" && !item.name.startsWith("_"));
|
|
513542
|
-
const
|
|
513543
|
-
Promise.all(markdownFiles.map((file4) => getFrontmatterPosition({ absolutePath: file4.absolutePath, readFileFn }))),
|
|
513544
|
-
useFrontmatterTitles ? Promise.all(markdownFiles.map((file4) => getFrontmatterTitle({ absolutePath: file4.absolutePath, readFileFn }))) : Promise.resolve(markdownFiles.map(() => void 0))
|
|
513545
|
-
]);
|
|
513539
|
+
const pageMetadata = await Promise.all(markdownFiles.map((file4) => getFrontmatterMetadata({ absolutePath: file4.absolutePath, readFileFn })));
|
|
513546
513540
|
const pages = markdownFiles.map((file4, index3) => {
|
|
513541
|
+
const metadata = pageMetadata[index3];
|
|
513547
513542
|
return {
|
|
513548
513543
|
type: "page",
|
|
513549
|
-
title:
|
|
513544
|
+
title: resolveTitle({ frontmatterTitle: metadata?.title, useFrontmatterTitles, fallbackName: file4.name }),
|
|
513550
513545
|
absolutePath: file4.absolutePath,
|
|
513551
513546
|
slug: nameToSlug({ name: file4.name }),
|
|
513552
513547
|
icon: void 0,
|
|
513553
|
-
hidden:
|
|
513554
|
-
noindex:
|
|
513548
|
+
hidden: metadata?.hidden,
|
|
513549
|
+
noindex: metadata?.noindex,
|
|
513555
513550
|
viewers: void 0,
|
|
513556
513551
|
orphaned: void 0,
|
|
513557
513552
|
featureFlags: void 0,
|
|
@@ -513567,9 +513562,12 @@ async function buildNavigationForDirectory({ directoryPath, titleSource, getDir
|
|
|
513567
513562
|
});
|
|
513568
513563
|
const indexPage = subContents.find((item) => item.type === "page" && (item.slug === "index" || item.absolutePath.toLowerCase().endsWith("/index.mdx") || item.absolutePath.toLowerCase().endsWith("/index.md")));
|
|
513569
513564
|
const filteredContents = indexPage ? subContents.filter((item) => item !== indexPage) : subContents;
|
|
513570
|
-
const
|
|
513571
|
-
const sectionTitle =
|
|
513572
|
-
|
|
513565
|
+
const indexMetadata = indexPage?.type === "page" ? await getFrontmatterMetadata({ absolutePath: indexPage.absolutePath, readFileFn }) : void 0;
|
|
513566
|
+
const sectionTitle = resolveTitle({
|
|
513567
|
+
frontmatterTitle: indexMetadata?.title,
|
|
513568
|
+
useFrontmatterTitles,
|
|
513569
|
+
fallbackName: dir.name
|
|
513570
|
+
});
|
|
513573
513571
|
return {
|
|
513574
513572
|
section: {
|
|
513575
513573
|
type: "section",
|
|
@@ -513580,7 +513578,7 @@ async function buildNavigationForDirectory({ directoryPath, titleSource, getDir
|
|
|
513580
513578
|
collapsed: void 0,
|
|
513581
513579
|
collapsible: void 0,
|
|
513582
513580
|
collapsedByDefault: void 0,
|
|
513583
|
-
hidden:
|
|
513581
|
+
hidden: indexMetadata?.hidden,
|
|
513584
513582
|
skipUrlSlug: false,
|
|
513585
513583
|
overviewAbsolutePath: indexPage?.type === "page" ? indexPage.absolutePath : void 0,
|
|
513586
513584
|
viewers: void 0,
|
|
@@ -513588,14 +513586,14 @@ async function buildNavigationForDirectory({ directoryPath, titleSource, getDir
|
|
|
513588
513586
|
featureFlags: void 0,
|
|
513589
513587
|
availability: void 0
|
|
513590
513588
|
},
|
|
513591
|
-
position:
|
|
513589
|
+
position: indexMetadata?.position
|
|
513592
513590
|
};
|
|
513593
513591
|
}));
|
|
513594
513592
|
const itemsWithMeta = [
|
|
513595
513593
|
...pages.map((page, index3) => ({
|
|
513596
513594
|
item: page,
|
|
513597
513595
|
title: page.type === "page" ? page.title : "",
|
|
513598
|
-
position:
|
|
513596
|
+
position: pageMetadata[index3]?.position
|
|
513599
513597
|
})),
|
|
513600
513598
|
...sectionsWithPositions.map((s11) => ({
|
|
513601
513599
|
item: s11.section,
|
|
@@ -514332,7 +514330,7 @@ async function expandFolderConfiguration({ rawConfig, absolutePathToFernFolder,
|
|
|
514332
514330
|
const indexPage = contents.find((item) => item.type === "page" && (item.slug === "index" || item.absolutePath.toLowerCase().endsWith("/index.mdx") || item.absolutePath.toLowerCase().endsWith("/index.md")));
|
|
514333
514331
|
const filteredContents = indexPage ? contents.filter((item) => item !== indexPage) : contents;
|
|
514334
514332
|
const folderName = import_path19.default.basename(folderPath);
|
|
514335
|
-
const indexFrontmatterTitle = effectiveTitleSource === "frontmatter" && indexPage?.type === "page" ? await
|
|
514333
|
+
const indexFrontmatterTitle = effectiveTitleSource === "frontmatter" && indexPage?.type === "page" ? (await getFrontmatterMetadata({ absolutePath: indexPage.absolutePath })).title : void 0;
|
|
514336
514334
|
const title3 = rawConfig.title ?? indexFrontmatterTitle ?? nameToTitle({ name: folderName });
|
|
514337
514335
|
const slug = rawConfig.slug ?? nameToSlug({ name: folderName });
|
|
514338
514336
|
return {
|
|
@@ -581651,7 +581649,7 @@ var AccessTokenPosthogManager = class {
|
|
|
581651
581649
|
properties: {
|
|
581652
581650
|
...event,
|
|
581653
581651
|
...event.properties,
|
|
581654
|
-
version: "4.
|
|
581652
|
+
version: "4.41.0",
|
|
581655
581653
|
usingAccessToken: true
|
|
581656
581654
|
}
|
|
581657
581655
|
});
|
|
@@ -581702,7 +581700,7 @@ var UserPosthogManager = class {
|
|
|
581702
581700
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
581703
581701
|
event: "CLI",
|
|
581704
581702
|
properties: {
|
|
581705
|
-
version: "4.
|
|
581703
|
+
version: "4.41.0",
|
|
581706
581704
|
...event,
|
|
581707
581705
|
...event.properties,
|
|
581708
581706
|
usingAccessToken: false,
|
|
@@ -787805,7 +787803,7 @@ var import_path51 = __toESM(require("path"), 1);
|
|
|
787805
787803
|
var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
787806
787804
|
var LOGS_FOLDER_NAME = "logs";
|
|
787807
787805
|
function getCliSource() {
|
|
787808
|
-
const version8 = "4.
|
|
787806
|
+
const version8 = "4.41.0";
|
|
787809
787807
|
return `cli@${version8}`;
|
|
787810
787808
|
}
|
|
787811
787809
|
var DebugLogger = class {
|
|
@@ -798616,7 +798614,7 @@ var LegacyDocsPublisher = class {
|
|
|
798616
798614
|
previewId: void 0,
|
|
798617
798615
|
disableTemplates: void 0,
|
|
798618
798616
|
skipUpload,
|
|
798619
|
-
cliVersion: "4.
|
|
798617
|
+
cliVersion: "4.41.0"
|
|
798620
798618
|
});
|
|
798621
798619
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
798622
798620
|
return { success: false };
|
|
@@ -871223,7 +871221,7 @@ var CliContext = class {
|
|
|
871223
871221
|
if (false) {
|
|
871224
871222
|
this.logger.error("CLI_VERSION is not defined");
|
|
871225
871223
|
}
|
|
871226
|
-
return "4.
|
|
871224
|
+
return "4.41.0";
|
|
871227
871225
|
}
|
|
871228
871226
|
getCliName() {
|
|
871229
871227
|
if (false) {
|
package/package.json
CHANGED