@fern-api/fern-api-dev 4.39.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.
Files changed (2) hide show
  1. package/cli.cjs +39 -42
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -482356,7 +482356,6 @@ var ApiDefinitionSettingsSchema = schemas_exports8.object({
482356
482356
  "wrap-references-to-nullable-in-optional": schemas_exports8.boolean().optional(),
482357
482357
  "coerce-optional-schemas-to-nullable": schemas_exports8.boolean().optional(),
482358
482358
  "group-environments-by-host": schemas_exports8.boolean().optional(),
482359
- "infer-default-environment": schemas_exports8.boolean().optional(),
482360
482359
  "remove-discriminants-from-schemas": RemoveDiscriminantsFromSchemas2.optional(),
482361
482360
  "path-parameter-order": PathParameterOrder2.optional()
482362
482361
  });
@@ -482422,11 +482421,11 @@ var BaseApiSettingsSchema = schemas_exports8.object({
482422
482421
  "wrap-references-to-nullable-in-optional": schemas_exports8.boolean().optional(),
482423
482422
  "coerce-optional-schemas-to-nullable": schemas_exports8.boolean().optional(),
482424
482423
  "group-environments-by-host": schemas_exports8.boolean().optional(),
482425
- "infer-default-environment": schemas_exports8.boolean().optional(),
482426
482424
  "remove-discriminants-from-schemas": RemoveDiscriminantsFromSchemas2.optional(),
482427
482425
  "path-parameter-order": PathParameterOrder2.optional(),
482428
482426
  "resolve-schema-collisions": schemas_exports8.boolean().optional(),
482429
482427
  "infer-forward-compatible": schemas_exports8.boolean().optional(),
482428
+ "infer-default-environment": schemas_exports8.boolean().optional(),
482430
482429
  "coerce-consts-to": CoerceConstsTo2.optional()
482431
482430
  });
482432
482431
 
@@ -513507,52 +513506,47 @@ function nameToSlug({ name: name2 }) {
513507
513506
  function nameToTitle({ name: name2 }) {
513508
513507
  return name2.replace(/\.(md|mdx)$/i, "").replace(/[-_]/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
513509
513508
  }
513510
- async function getFrontmatterPosition({ absolutePath, readFileFn = (path90, encoding) => (0, import_promises13.readFile)(path90, encoding) }) {
513509
+ async function getFrontmatterMetadata({ absolutePath, readFileFn = (path90, encoding) => (0, import_promises13.readFile)(path90, encoding) }) {
513511
513510
  try {
513512
513511
  const content5 = await readFileFn(absolutePath, "utf-8");
513513
513512
  const { data: data2 } = (0, import_gray_matter.default)(content5);
513514
- if (data2.position == null) {
513515
- return void 0;
513516
- }
513517
- const position4 = typeof data2.position === "string" ? parseFloat(data2.position) : data2.position;
513518
- if (typeof position4 === "number" && Number.isFinite(position4)) {
513519
- return position4;
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
+ }
513520
513519
  }
513521
- return void 0;
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 };
513522
513524
  } catch {
513523
- return void 0;
513525
+ return { position: void 0, title: void 0, hidden: void 0, noindex: void 0 };
513524
513526
  }
513525
513527
  }
513526
- async function getFrontmatterTitle({ absolutePath, readFileFn = (path90, encoding) => (0, import_promises13.readFile)(path90, encoding) }) {
513527
- try {
513528
- const content5 = await readFileFn(absolutePath, "utf-8");
513529
- const { data: data2 } = (0, import_gray_matter.default)(content5);
513530
- if (typeof data2.title === "string" && data2.title.trim().length > 0) {
513531
- return data2.title.trim();
513532
- }
513533
- return void 0;
513534
- } catch {
513535
- return void 0;
513528
+ function resolveTitle({ frontmatterTitle, useFrontmatterTitles, fallbackName }) {
513529
+ if (useFrontmatterTitles && frontmatterTitle != null) {
513530
+ return frontmatterTitle;
513536
513531
  }
513532
+ return nameToTitle({ name: fallbackName });
513537
513533
  }
513538
513534
  async function buildNavigationForDirectory({ directoryPath, titleSource, getDir = getDirectoryContents, readFileFn = (path90, encoding) => (0, import_promises13.readFile)(path90, encoding) }) {
513539
513535
  const contents = await getDir(directoryPath);
513540
513536
  const useFrontmatterTitles = titleSource === "frontmatter";
513541
- const markdownFiles = contents.filter((item) => item.type === "file" && (item.name.toLowerCase().endsWith(".md") || item.name.toLowerCase().endsWith(".mdx")));
513542
- const subdirectories = contents.filter((item) => item.type === "directory");
513543
- const [pagePositions, pageTitles] = await Promise.all([
513544
- Promise.all(markdownFiles.map((file4) => getFrontmatterPosition({ absolutePath: file4.absolutePath, readFileFn }))),
513545
- useFrontmatterTitles ? Promise.all(markdownFiles.map((file4) => getFrontmatterTitle({ absolutePath: file4.absolutePath, readFileFn }))) : Promise.resolve(markdownFiles.map(() => void 0))
513546
- ]);
513537
+ const markdownFiles = contents.filter((item) => item.type === "file" && !item.name.startsWith("_") && (item.name.toLowerCase().endsWith(".md") || item.name.toLowerCase().endsWith(".mdx")));
513538
+ const subdirectories = contents.filter((item) => item.type === "directory" && !item.name.startsWith("_"));
513539
+ const pageMetadata = await Promise.all(markdownFiles.map((file4) => getFrontmatterMetadata({ absolutePath: file4.absolutePath, readFileFn })));
513547
513540
  const pages = markdownFiles.map((file4, index3) => {
513541
+ const metadata = pageMetadata[index3];
513548
513542
  return {
513549
513543
  type: "page",
513550
- title: pageTitles[index3] ?? nameToTitle({ name: file4.name }),
513544
+ title: resolveTitle({ frontmatterTitle: metadata?.title, useFrontmatterTitles, fallbackName: file4.name }),
513551
513545
  absolutePath: file4.absolutePath,
513552
513546
  slug: nameToSlug({ name: file4.name }),
513553
513547
  icon: void 0,
513554
- hidden: void 0,
513555
- noindex: void 0,
513548
+ hidden: metadata?.hidden,
513549
+ noindex: metadata?.noindex,
513556
513550
  viewers: void 0,
513557
513551
  orphaned: void 0,
513558
513552
  featureFlags: void 0,
@@ -513568,9 +513562,12 @@ async function buildNavigationForDirectory({ directoryPath, titleSource, getDir
513568
513562
  });
513569
513563
  const indexPage = subContents.find((item) => item.type === "page" && (item.slug === "index" || item.absolutePath.toLowerCase().endsWith("/index.mdx") || item.absolutePath.toLowerCase().endsWith("/index.md")));
513570
513564
  const filteredContents = indexPage ? subContents.filter((item) => item !== indexPage) : subContents;
513571
- const indexFileFrontmatterTitle = useFrontmatterTitles ? indexPage?.type === "page" ? await getFrontmatterTitle({ absolutePath: indexPage.absolutePath, readFileFn }) : void 0 : void 0;
513572
- const sectionTitle = indexFileFrontmatterTitle ?? nameToTitle({ name: dir.name });
513573
- const sectionPosition = indexPage?.type === "page" ? await getFrontmatterPosition({ absolutePath: indexPage.absolutePath, readFileFn }) : void 0;
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
+ });
513574
513571
  return {
513575
513572
  section: {
513576
513573
  type: "section",
@@ -513581,7 +513578,7 @@ async function buildNavigationForDirectory({ directoryPath, titleSource, getDir
513581
513578
  collapsed: void 0,
513582
513579
  collapsible: void 0,
513583
513580
  collapsedByDefault: void 0,
513584
- hidden: void 0,
513581
+ hidden: indexMetadata?.hidden,
513585
513582
  skipUrlSlug: false,
513586
513583
  overviewAbsolutePath: indexPage?.type === "page" ? indexPage.absolutePath : void 0,
513587
513584
  viewers: void 0,
@@ -513589,14 +513586,14 @@ async function buildNavigationForDirectory({ directoryPath, titleSource, getDir
513589
513586
  featureFlags: void 0,
513590
513587
  availability: void 0
513591
513588
  },
513592
- position: sectionPosition
513589
+ position: indexMetadata?.position
513593
513590
  };
513594
513591
  }));
513595
513592
  const itemsWithMeta = [
513596
513593
  ...pages.map((page, index3) => ({
513597
513594
  item: page,
513598
513595
  title: page.type === "page" ? page.title : "",
513599
- position: pagePositions[index3]
513596
+ position: pageMetadata[index3]?.position
513600
513597
  })),
513601
513598
  ...sectionsWithPositions.map((s11) => ({
513602
513599
  item: s11.section,
@@ -514333,7 +514330,7 @@ async function expandFolderConfiguration({ rawConfig, absolutePathToFernFolder,
514333
514330
  const indexPage = contents.find((item) => item.type === "page" && (item.slug === "index" || item.absolutePath.toLowerCase().endsWith("/index.mdx") || item.absolutePath.toLowerCase().endsWith("/index.md")));
514334
514331
  const filteredContents = indexPage ? contents.filter((item) => item !== indexPage) : contents;
514335
514332
  const folderName = import_path19.default.basename(folderPath);
514336
- const indexFrontmatterTitle = effectiveTitleSource === "frontmatter" && indexPage?.type === "page" ? await getFrontmatterTitle({ absolutePath: indexPage.absolutePath }) : void 0;
514333
+ const indexFrontmatterTitle = effectiveTitleSource === "frontmatter" && indexPage?.type === "page" ? (await getFrontmatterMetadata({ absolutePath: indexPage.absolutePath })).title : void 0;
514337
514334
  const title3 = rawConfig.title ?? indexFrontmatterTitle ?? nameToTitle({ name: folderName });
514338
514335
  const slug = rawConfig.slug ?? nameToSlug({ name: folderName });
514339
514336
  return {
@@ -581652,7 +581649,7 @@ var AccessTokenPosthogManager = class {
581652
581649
  properties: {
581653
581650
  ...event,
581654
581651
  ...event.properties,
581655
- version: "4.39.0",
581652
+ version: "4.41.0",
581656
581653
  usingAccessToken: true
581657
581654
  }
581658
581655
  });
@@ -581703,7 +581700,7 @@ var UserPosthogManager = class {
581703
581700
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
581704
581701
  event: "CLI",
581705
581702
  properties: {
581706
- version: "4.39.0",
581703
+ version: "4.41.0",
581707
581704
  ...event,
581708
581705
  ...event.properties,
581709
581706
  usingAccessToken: false,
@@ -787806,7 +787803,7 @@ var import_path51 = __toESM(require("path"), 1);
787806
787803
  var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
787807
787804
  var LOGS_FOLDER_NAME = "logs";
787808
787805
  function getCliSource() {
787809
- const version8 = "4.39.0";
787806
+ const version8 = "4.41.0";
787810
787807
  return `cli@${version8}`;
787811
787808
  }
787812
787809
  var DebugLogger = class {
@@ -798617,7 +798614,7 @@ var LegacyDocsPublisher = class {
798617
798614
  previewId: void 0,
798618
798615
  disableTemplates: void 0,
798619
798616
  skipUpload,
798620
- cliVersion: "4.39.0"
798617
+ cliVersion: "4.41.0"
798621
798618
  });
798622
798619
  if (taskContext.getResult() === TaskResult.Failure) {
798623
798620
  return { success: false };
@@ -871224,7 +871221,7 @@ var CliContext = class {
871224
871221
  if (false) {
871225
871222
  this.logger.error("CLI_VERSION is not defined");
871226
871223
  }
871227
- return "4.39.0";
871224
+ return "4.41.0";
871228
871225
  }
871229
871226
  getCliName() {
871230
871227
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.39.0",
2
+ "version": "4.41.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",