@fern-api/fern-api-dev 5.16.0-2-g8c4df38ae6a → 5.16.0-3-g504bbfdb500

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 +67 -27
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -660824,7 +660824,7 @@ var AccessTokenPosthogManager = class {
660824
660824
  properties: {
660825
660825
  ...event,
660826
660826
  ...event.properties,
660827
- version: "5.16.0-2-g8c4df38ae6a",
660827
+ version: "5.16.0-3-g504bbfdb500",
660828
660828
  usingAccessToken: true
660829
660829
  }
660830
660830
  });
@@ -660878,7 +660878,7 @@ var UserPosthogManager = class {
660878
660878
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
660879
660879
  event: "CLI",
660880
660880
  properties: {
660881
- version: "5.16.0-2-g8c4df38ae6a",
660881
+ version: "5.16.0-3-g504bbfdb500",
660882
660882
  ...event,
660883
660883
  ...event.properties,
660884
660884
  usingAccessToken: false,
@@ -824006,15 +824006,31 @@ var CHANGELOG_FEED_ALLOWED_SLUGS = [
824006
824006
  "whatsnew"
824007
824007
  ];
824008
824008
  var DEFAULT_CHANGELOG_TITLE3 = "Changelog";
824009
- function getEffectiveChangelogSlugLastSegment(config5) {
824009
+ function getEffectiveChangelogSlugSegments(config5) {
824010
824010
  const raw = config5.slug ?? kebabCase_default(config5.title ?? DEFAULT_CHANGELOG_TITLE3);
824011
- const segments = raw.split("/").filter((s9) => s9.length > 0);
824011
+ return splitSegments(raw);
824012
+ }
824013
+ function getEffectiveChangelogSlugLastSegment(config5) {
824014
+ const segments = getEffectiveChangelogSlugSegments(config5);
824012
824015
  return segments[segments.length - 1] ?? "";
824013
824016
  }
824014
- function isAllowedChangelogSlug(lastSegment) {
824015
- return CHANGELOG_FEED_ALLOWED_SLUGS.includes(lastSegment);
824017
+ function isAllowedChangelogSlug(segment) {
824018
+ return CHANGELOG_FEED_ALLOWED_SLUGS.includes(segment);
824019
+ }
824020
+ function hasAllowedChangelogSegment(segments) {
824021
+ return segments.some((segment) => isAllowedChangelogSlug(segment));
824022
+ }
824023
+ function ancestorSlugSegments(opts) {
824024
+ if (opts.skipSlug) {
824025
+ return [];
824026
+ }
824027
+ const raw = opts.slug ?? kebabCase_default(opts.displayName ?? "");
824028
+ return splitSegments(raw);
824016
824029
  }
824017
- function collectChangelogLocations(items, breadcrumb) {
824030
+ function splitSegments(raw) {
824031
+ return raw.split("/").filter((segment) => segment.length > 0);
824032
+ }
824033
+ function collectChangelogLocations(items, breadcrumb, ancestorSegments) {
824018
824034
  if (items == null) {
824019
824035
  return [];
824020
824036
  }
@@ -824024,18 +824040,24 @@ function collectChangelogLocations(items, breadcrumb) {
824024
824040
  out.push({
824025
824041
  where: `${breadcrumb} > changelog (${item.changelog})`,
824026
824042
  slug: item.slug,
824027
- title: item.title
824043
+ title: item.title,
824044
+ ancestorSegments
824028
824045
  });
824029
824046
  continue;
824030
824047
  }
824031
824048
  if (isSection3(item)) {
824032
824049
  const next2 = `${breadcrumb} > section "${item.section}"`;
824033
- out.push(...collectChangelogLocations(item.contents, next2));
824050
+ const sectionSegments = ancestorSlugSegments({
824051
+ slug: item.slug,
824052
+ displayName: item.section,
824053
+ skipSlug: item.skipSlug
824054
+ });
824055
+ out.push(...collectChangelogLocations(item.contents, next2, [...ancestorSegments, ...sectionSegments]));
824034
824056
  }
824035
824057
  }
824036
824058
  return out;
824037
824059
  }
824038
- function collectFromTabs(tabs, breadcrumb) {
824060
+ function collectFromTabs(tabs, breadcrumb, ancestorSegments) {
824039
824061
  if (tabs == null) {
824040
824062
  return [];
824041
824063
  }
@@ -824045,13 +824067,14 @@ function collectFromTabs(tabs, breadcrumb) {
824045
824067
  out.push({
824046
824068
  where: `${breadcrumb} > tab "${tabId}" (changelog: ${tab2.changelog})`,
824047
824069
  slug: tab2.slug,
824048
- title: tab2.displayName
824070
+ title: tab2.displayName,
824071
+ ancestorSegments
824049
824072
  });
824050
824073
  }
824051
824074
  }
824052
824075
  return out;
824053
824076
  }
824054
- function collectFromNavigation(navigation2, breadcrumb) {
824077
+ function collectFromNavigation(navigation2, tabs, breadcrumb, ancestorSegments) {
824055
824078
  if (navigation2 == null || !Array.isArray(navigation2) || navigation2.length === 0) {
824056
824079
  return [];
824057
824080
  }
@@ -824059,32 +824082,49 @@ function collectFromNavigation(navigation2, breadcrumb) {
824059
824082
  const out = [];
824060
824083
  for (const item of navigation2) {
824061
824084
  const next2 = `${breadcrumb} > tab "${item.tab}"`;
824085
+ const tabConfig = tabs?.[item.tab];
824086
+ const tabSegments = ancestorSlugSegments({
824087
+ slug: tabConfig?.slug,
824088
+ displayName: tabConfig?.displayName ?? item.tab,
824089
+ skipSlug: tabConfig?.skipSlug
824090
+ });
824091
+ const tabAncestors = [...ancestorSegments, ...tabSegments];
824062
824092
  if ("layout" in item && Array.isArray(item.layout)) {
824063
- out.push(...collectChangelogLocations(item.layout, next2));
824093
+ out.push(...collectChangelogLocations(item.layout, next2, tabAncestors));
824064
824094
  }
824065
824095
  if ("variants" in item && Array.isArray(item.variants)) {
824066
824096
  for (const variant of item.variants) {
824067
824097
  const variantBreadcrumb = `${next2} > variant "${variant.title}"`;
824068
- out.push(...collectChangelogLocations(variant.layout, variantBreadcrumb));
824098
+ const variantSegments = ancestorSlugSegments({
824099
+ slug: variant.slug,
824100
+ displayName: variant.title,
824101
+ skipSlug: variant.skipSlug
824102
+ });
824103
+ out.push(...collectChangelogLocations(variant.layout, variantBreadcrumb, [
824104
+ ...tabAncestors,
824105
+ ...variantSegments
824106
+ ]));
824069
824107
  }
824070
824108
  }
824071
824109
  }
824072
824110
  return out;
824073
824111
  }
824074
- return collectChangelogLocations(navigation2, breadcrumb);
824112
+ return collectChangelogLocations(navigation2, breadcrumb, ancestorSegments);
824075
824113
  }
824076
824114
  function violationsForLocations(locations) {
824077
824115
  const violations = [];
824078
824116
  for (const loc of locations) {
824079
- const lastSegment = getEffectiveChangelogSlugLastSegment(loc);
824080
- if (lastSegment === "" || isAllowedChangelogSlug(lastSegment)) {
824117
+ const ownSegments = getEffectiveChangelogSlugSegments(loc);
824118
+ const allSegments = [...loc.ancestorSegments, ...ownSegments];
824119
+ if (allSegments.length === 0 || hasAllowedChangelogSegment(allSegments)) {
824081
824120
  continue;
824082
824121
  }
824083
824122
  const allowed = CHANGELOG_FEED_ALLOWED_SLUGS.join(", ");
824084
824123
  const sourceField = loc.slug != null ? `slug: "${loc.slug}"` : `title: "${loc.title ?? DEFAULT_CHANGELOG_TITLE3}"`;
824124
+ const fullPath = "/" + allSegments.join("/");
824085
824125
  violations.push({
824086
824126
  severity: "error",
824087
- message: `Changelog at ${loc.where} resolves to URL segment "${lastSegment}" (from ${sourceField}). The docs server only serves changelog feeds (.rss, .atom, .json) when the final URL segment is one of: ${allowed}. Rename the changelog's title or set an explicit slug to one of these values, otherwise subscribers will get a 404 when they request the feed.`
824127
+ message: `Changelog at ${loc.where} resolves to URL path "${fullPath}" (from ${sourceField}). The docs server only serves changelog feeds (.rss, .atom, .json) when at least one segment of the URL is one of: ${allowed}. Rename the changelog (or one of its parent tabs/sections), or set an explicit slug to one of these values, otherwise subscribers will get a 404 when they request the feed.`
824088
824128
  });
824089
824129
  }
824090
824130
  return violations;
@@ -824095,8 +824135,8 @@ var ValidChangelogSlugRule = {
824095
824135
  return {
824096
824136
  file: async ({ config: config5 }) => {
824097
824137
  const locations = [
824098
- ...collectFromNavigation(config5.navigation, "navigation"),
824099
- ...collectFromTabs(config5.tabs, "tabs")
824138
+ ...collectFromNavigation(config5.navigation, config5.tabs, "navigation", []),
824139
+ ...collectFromTabs(config5.tabs, "tabs", [])
824100
824140
  ];
824101
824141
  return violationsForLocations(locations);
824102
824142
  },
@@ -824107,8 +824147,8 @@ var ValidChangelogSlugRule = {
824107
824147
  }
824108
824148
  const versionConfig = parseResult.contents;
824109
824149
  const locations = [
824110
- ...collectFromNavigation(versionConfig.navigation, `version "${path106}" navigation`),
824111
- ...collectFromTabs(versionConfig.tabs, `version "${path106}" tabs`)
824150
+ ...collectFromNavigation(versionConfig.navigation, versionConfig.tabs, `version "${path106}" navigation`, []),
824151
+ ...collectFromTabs(versionConfig.tabs, `version "${path106}" tabs`, [])
824112
824152
  ];
824113
824153
  return violationsForLocations(locations);
824114
824154
  },
@@ -824119,8 +824159,8 @@ var ValidChangelogSlugRule = {
824119
824159
  }
824120
824160
  const productConfig = parseResult.contents;
824121
824161
  const locations = [
824122
- ...collectFromNavigation(productConfig.navigation, `product "${path106}" navigation`),
824123
- ...collectFromTabs(productConfig.tabs, `product "${path106}" tabs`)
824162
+ ...collectFromNavigation(productConfig.navigation, productConfig.tabs, `product "${path106}" navigation`, []),
824163
+ ...collectFromTabs(productConfig.tabs, `product "${path106}" tabs`, [])
824124
824164
  ];
824125
824165
  return violationsForLocations(locations);
824126
824166
  }
@@ -851819,7 +851859,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
851819
851859
  var LOGS_FOLDER_NAME = "logs";
851820
851860
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
851821
851861
  function getCliSource() {
851822
- const version7 = "5.16.0-2-g8c4df38ae6a";
851862
+ const version7 = "5.16.0-3-g504bbfdb500";
851823
851863
  return `cli@${version7}`;
851824
851864
  }
851825
851865
  var DebugLogger = class {
@@ -864628,7 +864668,7 @@ var LegacyDocsPublisher = class {
864628
864668
  previewId,
864629
864669
  disableTemplates: void 0,
864630
864670
  skipUpload,
864631
- cliVersion: "5.16.0-2-g8c4df38ae6a",
864671
+ cliVersion: "5.16.0-3-g504bbfdb500",
864632
864672
  loginCommand: "fern auth login"
864633
864673
  });
864634
864674
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -939206,7 +939246,7 @@ var CliContext = class _CliContext {
939206
939246
  if (false) {
939207
939247
  this.logger.error("CLI_VERSION is not defined");
939208
939248
  }
939209
- return "5.16.0-2-g8c4df38ae6a";
939249
+ return "5.16.0-3-g504bbfdb500";
939210
939250
  }
939211
939251
  getCliName() {
939212
939252
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.16.0-2-g8c4df38ae6a",
2
+ "version": "5.16.0-3-g504bbfdb500",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",