@fern-api/fern-api-dev 4.105.0 → 4.106.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 +594 -18
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -542004,7 +542004,13 @@ async function parseDocsConfiguration({ rawDocsConfiguration, absolutePathToFern
542004
542004
  absolutePathToFernFolder,
542005
542005
  context: context3
542006
542006
  }));
542007
- const [navigation2, pages, typography, css, js7, metadata, context7File, llmsTxtFile, llmsFullTxtFile, translationPages] = await Promise.all([
542007
+ const translationNavigationOverlaysPromise = loadTranslationNavigationOverlays({
542008
+ translations: rawDocsConfiguration.translations,
542009
+ defaultLocale,
542010
+ absolutePathToFernFolder,
542011
+ context: context3
542012
+ });
542013
+ const [navigation2, pages, typography, css, js7, metadata, context7File, llmsTxtFile, llmsFullTxtFile, translationPages, translationNavigationOverlays] = await Promise.all([
542008
542014
  convertedNavigationPromise,
542009
542015
  pagesPromise,
542010
542016
  typographyPromise,
@@ -542014,7 +542020,8 @@ async function parseDocsConfiguration({ rawDocsConfiguration, absolutePathToFern
542014
542020
  context7FilePromise,
542015
542021
  llmsTxtFilePromise,
542016
542022
  llmsFullTxtFilePromise,
542017
- translationPagesPromise
542023
+ translationPagesPromise,
542024
+ translationNavigationOverlaysPromise
542018
542025
  ]);
542019
542026
  const resolvedTheme = convertThemeConfig(rawDocsConfiguration.theme);
542020
542027
  const tabsObj = resolvedTheme?.tabs != null && typeof resolvedTheme.tabs === "object" ? resolvedTheme.tabs : void 0;
@@ -542034,6 +542041,8 @@ async function parseDocsConfiguration({ rawDocsConfiguration, absolutePathToFern
542034
542041
  pages,
542035
542042
  /* per-locale translated page content */
542036
542043
  translationPages,
542044
+ /* per-locale translated navigation overlays */
542045
+ translationNavigationOverlays,
542037
542046
  /* navigation */
542038
542047
  landingPage,
542039
542048
  navigation: navigation2,
@@ -543297,6 +543306,203 @@ These pages will fall back to the default language content.`);
543297
543306
  }));
543298
543307
  return result;
543299
543308
  }
543309
+ async function loadTranslationNavigationOverlays({ translations, defaultLocale, absolutePathToFernFolder, context: context3 }) {
543310
+ if (translations == null || translations.length === 0) {
543311
+ return void 0;
543312
+ }
543313
+ const translationsRootDir = import_path22.default.join(absolutePathToFernFolder, "translations");
543314
+ const result = {};
543315
+ const normalizedTranslations = translations.map((t3) => docs_yml_exports.DocsYmlSchemas.normalizeTranslationConfig(t3));
543316
+ await Promise.all(normalizedTranslations.map(async ({ lang }) => {
543317
+ if (lang === defaultLocale) {
543318
+ return;
543319
+ }
543320
+ const langFernDir = import_path22.default.join(translationsRootDir, lang, "fern");
543321
+ const overlayDocsYmlPath = import_path22.default.join(langFernDir, "docs.yml");
543322
+ if (!await doesPathExist(overlayDocsYmlPath)) {
543323
+ return;
543324
+ }
543325
+ try {
543326
+ const overlayContent = jsYaml.load(await (0, import_promises14.readFile)(overlayDocsYmlPath, "utf-8"));
543327
+ if (!isPlainObject4(overlayContent)) {
543328
+ context3.logger.warn(`Translation overlay at "${overlayDocsYmlPath}" is not a valid YAML object. Skipping.`);
543329
+ return;
543330
+ }
543331
+ const overlay = await parseNavigationOverlayFromDocsYml({
543332
+ docsYmlContent: overlayContent,
543333
+ langFernDir,
543334
+ context: context3
543335
+ });
543336
+ result[lang] = overlay;
543337
+ } catch (error50) {
543338
+ context3.logger.warn(`Failed to load translation overlay for locale "${lang}": ${String(error50)}. Navigation labels will not be translated for this locale.`);
543339
+ }
543340
+ }));
543341
+ if (Object.keys(result).length === 0) {
543342
+ return void 0;
543343
+ }
543344
+ return result;
543345
+ }
543346
+ function extractString(obj, key2) {
543347
+ if (isPlainObject4(obj)) {
543348
+ const value2 = obj[key2];
543349
+ if (typeof value2 === "string") {
543350
+ return value2;
543351
+ }
543352
+ }
543353
+ return void 0;
543354
+ }
543355
+ async function parseNavigationOverlayFromDocsYml({ docsYmlContent, langFernDir, context: context3 }) {
543356
+ const overlay = {
543357
+ tabs: void 0,
543358
+ products: void 0,
543359
+ versions: void 0,
543360
+ announcement: void 0,
543361
+ navigation: void 0
543362
+ };
543363
+ if (isPlainObject4(docsYmlContent.announcement)) {
543364
+ const message = extractString(docsYmlContent.announcement, "message");
543365
+ if (message != null) {
543366
+ overlay.announcement = { message };
543367
+ }
543368
+ }
543369
+ if (isPlainObject4(docsYmlContent.tabs)) {
543370
+ overlay.tabs = parseTabOverlays(docsYmlContent.tabs);
543371
+ }
543372
+ if (Array.isArray(docsYmlContent.products)) {
543373
+ overlay.products = [];
543374
+ for (const product of docsYmlContent.products) {
543375
+ if (!isPlainObject4(product)) {
543376
+ continue;
543377
+ }
543378
+ const productObj = product;
543379
+ const productOverlay = {
543380
+ slug: typeof productObj.slug === "string" ? productObj.slug : void 0,
543381
+ displayName: typeof productObj["display-name"] === "string" ? productObj["display-name"] : void 0,
543382
+ subtitle: typeof productObj.subtitle === "string" ? productObj.subtitle : void 0,
543383
+ announcement: void 0,
543384
+ tabs: void 0,
543385
+ navigation: void 0
543386
+ };
543387
+ if (isPlainObject4(productObj.announcement)) {
543388
+ const message = extractString(productObj.announcement, "message");
543389
+ if (message != null) {
543390
+ productOverlay.announcement = { message };
543391
+ }
543392
+ }
543393
+ if (typeof productObj.path === "string") {
543394
+ const resolvedNavFilePath = import_path22.default.resolve(langFernDir, productObj.path);
543395
+ if (!resolvedNavFilePath.startsWith(langFernDir)) {
543396
+ context3.logger.warn(`Invalid path in product overlay: "${productObj.path}" escapes the translations directory. Skipping.`);
543397
+ overlay.products.push(productOverlay);
543398
+ continue;
543399
+ }
543400
+ const navFilePath = resolvedNavFilePath;
543401
+ if (await doesPathExist(navFilePath)) {
543402
+ try {
543403
+ const navContent = jsYaml.load(await (0, import_promises14.readFile)(navFilePath, "utf-8"));
543404
+ if (isPlainObject4(navContent)) {
543405
+ const navObj = navContent;
543406
+ if (isPlainObject4(navObj.tabs)) {
543407
+ productOverlay.tabs = parseTabOverlays(navObj.tabs);
543408
+ }
543409
+ if (Array.isArray(navObj.navigation)) {
543410
+ productOverlay.navigation = parseNavigationItemOverlays(navObj.navigation);
543411
+ }
543412
+ }
543413
+ } catch (error50) {
543414
+ context3.logger.warn(`Failed to load translation nav file "${navFilePath}": ${String(error50)}`);
543415
+ }
543416
+ }
543417
+ }
543418
+ overlay.products.push(productOverlay);
543419
+ }
543420
+ }
543421
+ if (Array.isArray(docsYmlContent.versions)) {
543422
+ overlay.versions = [];
543423
+ for (const version7 of docsYmlContent.versions) {
543424
+ if (!isPlainObject4(version7)) {
543425
+ continue;
543426
+ }
543427
+ const versionObj = version7;
543428
+ overlay.versions.push({
543429
+ slug: typeof versionObj.slug === "string" ? versionObj.slug : void 0,
543430
+ displayName: typeof versionObj["display-name"] === "string" ? versionObj["display-name"] : void 0
543431
+ });
543432
+ }
543433
+ }
543434
+ if (Array.isArray(docsYmlContent.navigation)) {
543435
+ overlay.navigation = [...overlay.navigation ?? [], ...parseNavigationItemOverlays(docsYmlContent.navigation)];
543436
+ }
543437
+ return overlay;
543438
+ }
543439
+ function parseTabOverlays(tabsObj) {
543440
+ const result = {};
543441
+ for (const [tabId, tabConfig] of Object.entries(tabsObj)) {
543442
+ if (isPlainObject4(tabConfig)) {
543443
+ const tabConfigObj = tabConfig;
543444
+ result[tabId] = {
543445
+ displayName: typeof tabConfigObj["display-name"] === "string" ? tabConfigObj["display-name"] : void 0,
543446
+ slug: typeof tabConfigObj.slug === "string" ? tabConfigObj.slug : void 0
543447
+ };
543448
+ }
543449
+ }
543450
+ return result;
543451
+ }
543452
+ function parseNavigationItemOverlays(items) {
543453
+ const result = [];
543454
+ for (const item of items) {
543455
+ if (!isPlainObject4(item)) {
543456
+ continue;
543457
+ }
543458
+ const obj = item;
543459
+ if (typeof obj.tab === "string") {
543460
+ const tabOverlay = {
543461
+ type: "tab",
543462
+ tabId: obj.tab,
543463
+ layout: Array.isArray(obj.layout) ? parseNavigationItemOverlays(obj.layout) : void 0,
543464
+ variants: Array.isArray(obj.variants) ? parseVariantOverlays(obj.variants) : void 0
543465
+ };
543466
+ result.push(tabOverlay);
543467
+ continue;
543468
+ }
543469
+ if (typeof obj.section === "string") {
543470
+ const sectionOverlay = {
543471
+ type: "section",
543472
+ title: obj.section,
543473
+ slug: typeof obj.slug === "string" ? obj.slug : void 0,
543474
+ contents: Array.isArray(obj.contents) ? parseNavigationItemOverlays(obj.contents) : void 0
543475
+ };
543476
+ result.push(sectionOverlay);
543477
+ continue;
543478
+ }
543479
+ if (typeof obj.page === "string") {
543480
+ const pageOverlay = {
543481
+ type: "page",
543482
+ title: obj.page,
543483
+ slug: typeof obj.slug === "string" ? obj.slug : void 0
543484
+ };
543485
+ result.push(pageOverlay);
543486
+ continue;
543487
+ }
543488
+ }
543489
+ return result;
543490
+ }
543491
+ function parseVariantOverlays(variants) {
543492
+ const result = [];
543493
+ for (const variant of variants) {
543494
+ if (!isPlainObject4(variant)) {
543495
+ continue;
543496
+ }
543497
+ const obj = variant;
543498
+ result.push({
543499
+ title: typeof obj.title === "string" ? obj.title : void 0,
543500
+ subtitle: typeof obj.subtitle === "string" ? obj.subtitle : void 0,
543501
+ slug: typeof obj.slug === "string" ? obj.slug : void 0
543502
+ });
543503
+ }
543504
+ return result;
543505
+ }
543300
543506
 
543301
543507
  // ../configuration-loader/lib/fern-config-json/loadProjectConfig.js
543302
543508
  init_lib6();
@@ -620985,7 +621191,7 @@ var AccessTokenPosthogManager = class {
620985
621191
  properties: {
620986
621192
  ...event,
620987
621193
  ...event.properties,
620988
- version: "4.105.0",
621194
+ version: "4.106.0",
620989
621195
  usingAccessToken: true
620990
621196
  }
620991
621197
  });
@@ -621039,7 +621245,7 @@ var UserPosthogManager = class {
621039
621245
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
621040
621246
  event: "CLI",
621041
621247
  properties: {
621042
- version: "4.105.0",
621248
+ version: "4.106.0",
621043
621249
  ...event,
621044
621250
  ...event.properties,
621045
621251
  usingAccessToken: false,
@@ -790450,6 +790656,343 @@ function walkNode(node4, overrides) {
790450
790656
  return updated;
790451
790657
  }
790452
790658
 
790659
+ // ../docs-resolver/lib/applyTranslatedNavigationOverlays.js
790660
+ function applyTranslatedNavigationOverlays(root6, overlay) {
790661
+ if (root6 == null) {
790662
+ return void 0;
790663
+ }
790664
+ const result = walkAndApply(root6, overlay);
790665
+ return result;
790666
+ }
790667
+ function getTranslatedAnnouncement(overlay) {
790668
+ if (overlay.announcement?.message != null) {
790669
+ return { text: overlay.announcement.message };
790670
+ }
790671
+ return void 0;
790672
+ }
790673
+ function walkAndApply(node4, overlay) {
790674
+ if (node4 == null || typeof node4 !== "object") {
790675
+ return node4;
790676
+ }
790677
+ if (Array.isArray(node4)) {
790678
+ return node4.map((item) => walkAndApply(item, overlay));
790679
+ }
790680
+ const obj = node4;
790681
+ const updated = {};
790682
+ for (const [k5, v9] of Object.entries(obj)) {
790683
+ if (k5 === "children" && Array.isArray(v9)) {
790684
+ updated[k5] = applyChildOverlays(v9, obj, overlay);
790685
+ } else {
790686
+ updated[k5] = walkAndApply(v9, overlay);
790687
+ }
790688
+ }
790689
+ return updated;
790690
+ }
790691
+ function applyChildOverlays(children2, parent, overlay) {
790692
+ const parentType = parent["type"];
790693
+ if (parentType === "productgroup" && overlay.products != null) {
790694
+ return children2.map((child, index3) => {
790695
+ const childObj = child;
790696
+ if (childObj == null || typeof childObj !== "object") {
790697
+ return walkAndApply(child, overlay);
790698
+ }
790699
+ const productOverlay = findProductOverlay(childObj, overlay.products ?? [], index3);
790700
+ if (productOverlay != null) {
790701
+ const scopedOverlay = {
790702
+ tabs: productOverlay.tabs ?? overlay.tabs,
790703
+ products: void 0,
790704
+ versions: overlay.versions,
790705
+ announcement: productOverlay.announcement ?? overlay.announcement,
790706
+ navigation: productOverlay.navigation ?? overlay.navigation
790707
+ };
790708
+ const walked = walkAndApply(child, scopedOverlay);
790709
+ return applyProductOverlayToNode(walked, productOverlay);
790710
+ }
790711
+ return walkAndApply(child, overlay);
790712
+ });
790713
+ }
790714
+ if (parentType === "versioned" && overlay.versions != null) {
790715
+ return children2.map((child, index3) => {
790716
+ const childObj = child;
790717
+ if (childObj == null || typeof childObj !== "object") {
790718
+ return walkAndApply(child, overlay);
790719
+ }
790720
+ const versionOverlay = findVersionOverlay(childObj, overlay.versions ?? [], index3);
790721
+ const walked = walkAndApply(child, overlay);
790722
+ if (versionOverlay != null) {
790723
+ return applyVersionOverlayToNode(walked, versionOverlay);
790724
+ }
790725
+ return walked;
790726
+ });
790727
+ }
790728
+ if (parentType === "tabbed") {
790729
+ return children2.map((child) => {
790730
+ const childObj = child;
790731
+ if (childObj == null || typeof childObj !== "object") {
790732
+ return walkAndApply(child, overlay);
790733
+ }
790734
+ if (childObj["type"] === "tab") {
790735
+ const walked = walkAndApply(child, overlay);
790736
+ return applyTabOverlayToNode(walked, overlay);
790737
+ }
790738
+ return walkAndApply(child, overlay);
790739
+ });
790740
+ }
790741
+ if (parentType === "sidebarRoot") {
790742
+ const navOverlays = collectFlatNavigationOverlays(overlay);
790743
+ if (navOverlays.length > 0) {
790744
+ return applySidebarChildOverlays(children2, navOverlays, overlay);
790745
+ }
790746
+ }
790747
+ if (parentType === "sidebarGroup") {
790748
+ const navOverlays = collectFlatNavigationOverlays(overlay);
790749
+ if (navOverlays.length > 0) {
790750
+ return applySidebarChildOverlays(children2, navOverlays, overlay);
790751
+ }
790752
+ }
790753
+ if (parentType === "section") {
790754
+ return children2.map((child) => walkAndApply(child, overlay));
790755
+ }
790756
+ return children2.map((child) => walkAndApply(child, overlay));
790757
+ }
790758
+ function findProductOverlay(node4, products, index3) {
790759
+ const nodeSlug = extractLastSlugSegment(node4["slug"]);
790760
+ if (nodeSlug != null) {
790761
+ for (const p14 of products) {
790762
+ if (p14.slug != null && p14.slug === nodeSlug) {
790763
+ return p14;
790764
+ }
790765
+ }
790766
+ }
790767
+ const nodeTitle = node4["title"];
790768
+ const nodeProductId = node4["productId"];
790769
+ for (const p14 of products) {
790770
+ if (p14.displayName != null) {
790771
+ if (nodeTitle === p14.displayName || nodeProductId === p14.displayName) {
790772
+ return p14;
790773
+ }
790774
+ }
790775
+ }
790776
+ if (index3 < products.length) {
790777
+ return products[index3];
790778
+ }
790779
+ return void 0;
790780
+ }
790781
+ function findVersionOverlay(node4, versions, index3) {
790782
+ const nodeSlug = extractLastSlugSegment(node4["slug"]);
790783
+ if (nodeSlug != null) {
790784
+ for (const v9 of versions) {
790785
+ if (v9.slug != null && v9.slug === nodeSlug) {
790786
+ return v9;
790787
+ }
790788
+ }
790789
+ }
790790
+ const nodeTitle = node4["title"];
790791
+ const nodeVersionId = node4["versionId"];
790792
+ for (const v9 of versions) {
790793
+ if (v9.displayName != null) {
790794
+ if (nodeTitle === v9.displayName || nodeVersionId === v9.displayName) {
790795
+ return v9;
790796
+ }
790797
+ }
790798
+ }
790799
+ if (index3 < versions.length) {
790800
+ return versions[index3];
790801
+ }
790802
+ return void 0;
790803
+ }
790804
+ function applyProductOverlayToNode(node4, productOverlay) {
790805
+ if (productOverlay.displayName != null) {
790806
+ node4["title"] = productOverlay.displayName;
790807
+ }
790808
+ if (productOverlay.subtitle != null) {
790809
+ node4["subtitle"] = productOverlay.subtitle;
790810
+ }
790811
+ if (productOverlay.announcement?.message != null) {
790812
+ node4["announcement"] = { text: productOverlay.announcement.message };
790813
+ }
790814
+ return node4;
790815
+ }
790816
+ function applyVersionOverlayToNode(node4, versionOverlay) {
790817
+ if (versionOverlay.displayName != null) {
790818
+ node4["title"] = versionOverlay.displayName;
790819
+ }
790820
+ return node4;
790821
+ }
790822
+ function applyTabOverlayToNode(node4, overlay) {
790823
+ const tabSlug = extractLastSlugSegment(node4["slug"]);
790824
+ if (overlay.tabs != null && tabSlug != null) {
790825
+ for (const [tabId, tabOverlay] of Object.entries(overlay.tabs)) {
790826
+ const isMatch = tabId === tabSlug || tabOverlay.slug != null && tabOverlay.slug === tabSlug;
790827
+ if (isMatch && tabOverlay.displayName != null) {
790828
+ node4["title"] = tabOverlay.displayName;
790829
+ break;
790830
+ }
790831
+ }
790832
+ }
790833
+ const tabNavOverlay = findTabNavOverlay(tabSlug, overlay);
790834
+ if (tabNavOverlay != null) {
790835
+ if (overlay.tabs != null) {
790836
+ const tabOverlayEntry = overlay.tabs[tabNavOverlay.tabId];
790837
+ if (tabOverlayEntry?.displayName != null) {
790838
+ node4["title"] = tabOverlayEntry.displayName;
790839
+ }
790840
+ }
790841
+ if (tabNavOverlay.variants != null && tabNavOverlay.variants.length > 0) {
790842
+ const tabChild = node4["child"];
790843
+ if (tabChild != null && tabChild["type"] === "variants") {
790844
+ const variantsChildren = tabChild["children"];
790845
+ if (variantsChildren != null) {
790846
+ tabChild["children"] = applyVariantOverlays(variantsChildren, tabNavOverlay.variants);
790847
+ }
790848
+ }
790849
+ }
790850
+ if (tabNavOverlay.layout != null) {
790851
+ const scopedOverlay = {
790852
+ tabs: void 0,
790853
+ products: void 0,
790854
+ versions: void 0,
790855
+ announcement: void 0,
790856
+ navigation: tabNavOverlay.layout
790857
+ };
790858
+ return walkAndApply(node4, scopedOverlay);
790859
+ }
790860
+ }
790861
+ return walkAndApply(node4, overlay);
790862
+ }
790863
+ function findTabNavOverlay(tabSlug, overlay) {
790864
+ if (overlay.navigation == null) {
790865
+ return void 0;
790866
+ }
790867
+ for (const navItem of overlay.navigation) {
790868
+ if (navItem.type !== "tab") {
790869
+ continue;
790870
+ }
790871
+ if (tabSlug != null && navItem.tabId === tabSlug) {
790872
+ return navItem;
790873
+ }
790874
+ if (tabSlug != null && overlay.tabs != null) {
790875
+ const tabConfig = overlay.tabs[navItem.tabId];
790876
+ if (tabConfig?.slug != null && tabConfig.slug === tabSlug) {
790877
+ return navItem;
790878
+ }
790879
+ }
790880
+ }
790881
+ return void 0;
790882
+ }
790883
+ function collectFlatNavigationOverlays(overlay) {
790884
+ if (overlay.navigation == null) {
790885
+ return [];
790886
+ }
790887
+ const nonTabItems = overlay.navigation.filter((item) => item.type !== "tab");
790888
+ return nonTabItems;
790889
+ }
790890
+ function applySidebarChildOverlays(children2, navOverlays, overlay) {
790891
+ let sectionIdx = 0;
790892
+ let pageIdx = 0;
790893
+ return children2.map((child) => {
790894
+ const childObj = child;
790895
+ if (childObj == null || typeof childObj !== "object") {
790896
+ return walkAndApply(child, overlay);
790897
+ }
790898
+ const childType = childObj["type"];
790899
+ if (childType === "section") {
790900
+ const sectionOverlays = navOverlays.filter((item) => item.type === "section");
790901
+ const matched = matchSectionOverlay(childObj, sectionOverlays, sectionIdx);
790902
+ sectionIdx++;
790903
+ if (matched != null) {
790904
+ const walked = walkAndApply(child, overlay);
790905
+ if (matched.title != null) {
790906
+ walked["title"] = matched.title;
790907
+ }
790908
+ if (matched.contents != null) {
790909
+ const childArray = walked["children"];
790910
+ if (childArray != null) {
790911
+ walked["children"] = applySidebarChildOverlays(childArray, matched.contents, overlay);
790912
+ }
790913
+ }
790914
+ return walked;
790915
+ }
790916
+ return walkAndApply(child, overlay);
790917
+ }
790918
+ if (childType === "page" || childType === "landingPage") {
790919
+ const pageOverlays = navOverlays.filter((item) => item.type === "page");
790920
+ const matched = matchPageOverlay(childObj, pageOverlays, pageIdx);
790921
+ pageIdx++;
790922
+ if (matched?.title != null) {
790923
+ const walked = walkAndApply(child, overlay);
790924
+ walked["title"] = matched.title;
790925
+ return walked;
790926
+ }
790927
+ return walkAndApply(child, overlay);
790928
+ }
790929
+ return walkAndApply(child, overlay);
790930
+ });
790931
+ }
790932
+ function matchSectionOverlay(section, overlays, positionIndex) {
790933
+ const sectionSlug = extractLastSlugSegment(section["slug"]);
790934
+ for (const o3 of overlays) {
790935
+ if (o3.slug != null && o3.slug === sectionSlug) {
790936
+ return o3;
790937
+ }
790938
+ }
790939
+ const noSlugOverlays = overlays.filter((o3) => o3.slug == null);
790940
+ if (positionIndex < noSlugOverlays.length) {
790941
+ return noSlugOverlays[positionIndex];
790942
+ }
790943
+ return void 0;
790944
+ }
790945
+ function matchPageOverlay(page, overlays, positionIndex) {
790946
+ const pageSlug = extractLastSlugSegment(page["slug"]);
790947
+ for (const o3 of overlays) {
790948
+ if (o3.slug != null && o3.slug === pageSlug) {
790949
+ return o3;
790950
+ }
790951
+ }
790952
+ const noSlugOverlays = overlays.filter((o3) => o3.slug == null);
790953
+ if (positionIndex < noSlugOverlays.length) {
790954
+ return noSlugOverlays[positionIndex];
790955
+ }
790956
+ return void 0;
790957
+ }
790958
+ function extractLastSlugSegment(slug) {
790959
+ if (slug == null) {
790960
+ return void 0;
790961
+ }
790962
+ const parts = slug.split("/");
790963
+ return parts[parts.length - 1];
790964
+ }
790965
+ function applyVariantOverlays(variants, overlays) {
790966
+ return variants.map((variant, index3) => {
790967
+ const variantObj = variant;
790968
+ if (variantObj == null || typeof variantObj !== "object") {
790969
+ return variant;
790970
+ }
790971
+ const variantSlug = extractLastSlugSegment(variantObj["slug"]);
790972
+ let matchedOverlay;
790973
+ if (variantSlug != null) {
790974
+ matchedOverlay = overlays.find((o3) => o3.slug != null && o3.slug === variantSlug);
790975
+ }
790976
+ if (matchedOverlay == null) {
790977
+ const noSlugOverlays = overlays.filter((o3) => o3.slug == null);
790978
+ if (index3 < noSlugOverlays.length) {
790979
+ matchedOverlay = noSlugOverlays[index3];
790980
+ }
790981
+ }
790982
+ if (matchedOverlay != null) {
790983
+ const result = { ...variantObj };
790984
+ if (matchedOverlay.title != null) {
790985
+ result["title"] = matchedOverlay.title;
790986
+ }
790987
+ if (matchedOverlay.subtitle != null) {
790988
+ result["subtitle"] = matchedOverlay.subtitle;
790989
+ }
790990
+ return result;
790991
+ }
790992
+ return variant;
790993
+ });
790994
+ }
790995
+
790453
790996
  // ../docs-resolver/lib/DocsDefinitionResolver.js
790454
790997
  init_lib4();
790455
790998
  init_js();
@@ -798540,6 +799083,14 @@ var DocsDefinitionResolver = class {
798540
799083
  getTranslationPages() {
798541
799084
  return this._parsedDocsConfig?.translationPages;
798542
799085
  }
799086
+ /**
799087
+ * Returns per-locale translated navigation overlays loaded from
799088
+ * `translations/<lang>/fern/docs.yml` and referenced nav YAML files.
799089
+ * Must be called after `resolve()`.
799090
+ */
799091
+ getTranslationNavigationOverlays() {
799092
+ return this._parsedDocsConfig?.translationNavigationOverlays;
799093
+ }
798543
799094
  /**
798544
799095
  * Returns the map of absolute file paths to uploaded file IDs.
798545
799096
  * Used by translation processing to rewrite image paths in translated pages.
@@ -832335,7 +832886,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
832335
832886
  var LOGS_FOLDER_NAME = "logs";
832336
832887
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
832337
832888
  function getCliSource() {
832338
- const version7 = "4.105.0";
832889
+ const version7 = "4.106.0";
832339
832890
  return `cli@${version7}`;
832340
832891
  }
832341
832892
  var DebugLogger = class {
@@ -833401,6 +833952,7 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
833401
833952
  return {
833402
833953
  docsDefinition: previousDocsDefinition,
833403
833954
  translationPages: previousPreviewResult.translationPages,
833955
+ translationNavigationOverlays: previousPreviewResult.translationNavigationOverlays,
833404
833956
  collectedFileIds: previousPreviewResult.collectedFileIds,
833405
833957
  docsWorkspacePath: previousPreviewResult.docsWorkspacePath
833406
833958
  };
@@ -833472,10 +834024,12 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
833472
834024
  docsDefinition = { ...substitutedDocs, jsFiles };
833473
834025
  }
833474
834026
  const translationPages = resolver2.getTranslationPages();
834027
+ const translationNavigationOverlays = resolver2.getTranslationNavigationOverlays();
833475
834028
  const collectedFileIds = resolver2.getCollectedFileIds();
833476
834029
  return {
833477
834030
  docsDefinition,
833478
834031
  translationPages,
834032
+ translationNavigationOverlays,
833479
834033
  collectedFileIds,
833480
834034
  docsWorkspacePath: docsWorkspace.absoluteFilePath
833481
834035
  };
@@ -834064,7 +834618,7 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
834064
834618
  const RELOAD_DEBOUNCE_MS = 1e3;
834065
834619
  function computeTranslatedDefinitions(result) {
834066
834620
  const translations = /* @__PURE__ */ new Map();
834067
- const { docsDefinition, translationPages, collectedFileIds, docsWorkspacePath } = result;
834621
+ const { docsDefinition, translationPages, translationNavigationOverlays, collectedFileIds, docsWorkspacePath } = result;
834068
834622
  if (translationPages == null || Object.keys(translationPages).length === 0) {
834069
834623
  return translations;
834070
834624
  }
@@ -834102,13 +834656,20 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
834102
834656
  editThisPageLaunch: basePage?.editThisPageLaunch
834103
834657
  };
834104
834658
  }
834105
- const updatedRoot = applyTranslatedFrontmatterToNavTree(docsDefinition.config.root, localePages, context3);
834659
+ let updatedRoot = applyTranslatedFrontmatterToNavTree(docsDefinition.config.root, localePages, context3);
834660
+ const localeNavOverlay = translationNavigationOverlays?.[locale];
834661
+ let translatedAnnouncement = docsDefinition.config.announcement;
834662
+ if (localeNavOverlay != null) {
834663
+ updatedRoot = applyTranslatedNavigationOverlays(updatedRoot, localeNavOverlay);
834664
+ translatedAnnouncement = getTranslatedAnnouncement(localeNavOverlay) ?? translatedAnnouncement;
834665
+ }
834106
834666
  const translatedDefinition = {
834107
834667
  ...docsDefinition,
834108
834668
  pages: translatedPages,
834109
834669
  config: {
834110
834670
  ...docsDefinition.config,
834111
- root: updatedRoot
834671
+ root: updatedRoot,
834672
+ announcement: translatedAnnouncement
834112
834673
  }
834113
834674
  };
834114
834675
  translations.set(locale, translatedDefinition);
@@ -834556,7 +835117,7 @@ async function runPreviewServer({ initialProject, reloadProject, validateProject
834556
835117
  const RELOAD_DEBOUNCE_MS = 1e3;
834557
835118
  function computeTranslatedDefinitions(result) {
834558
835119
  const translations = /* @__PURE__ */ new Map();
834559
- const { docsDefinition, translationPages, collectedFileIds, docsWorkspacePath } = result;
835120
+ const { docsDefinition, translationPages, translationNavigationOverlays, collectedFileIds, docsWorkspacePath } = result;
834560
835121
  if (translationPages == null || Object.keys(translationPages).length === 0) {
834561
835122
  return translations;
834562
835123
  }
@@ -834594,13 +835155,20 @@ async function runPreviewServer({ initialProject, reloadProject, validateProject
834594
835155
  editThisPageLaunch: basePage?.editThisPageLaunch
834595
835156
  };
834596
835157
  }
834597
- const updatedRoot = applyTranslatedFrontmatterToNavTree(docsDefinition.config.root, localePages, context3);
835158
+ let updatedRoot = applyTranslatedFrontmatterToNavTree(docsDefinition.config.root, localePages, context3);
835159
+ const localeNavOverlay = translationNavigationOverlays?.[locale];
835160
+ let translatedAnnouncement = docsDefinition.config.announcement;
835161
+ if (localeNavOverlay != null) {
835162
+ updatedRoot = applyTranslatedNavigationOverlays(updatedRoot, localeNavOverlay);
835163
+ translatedAnnouncement = getTranslatedAnnouncement(localeNavOverlay) ?? translatedAnnouncement;
835164
+ }
834598
835165
  const translatedDefinition = {
834599
835166
  ...docsDefinition,
834600
835167
  pages: translatedPages,
834601
835168
  config: {
834602
835169
  ...docsDefinition.config,
834603
- root: updatedRoot
835170
+ root: updatedRoot,
835171
+ announcement: translatedAnnouncement
834604
835172
  }
834605
835173
  };
834606
835174
  translations.set(locale, translatedDefinition);
@@ -843942,6 +844510,7 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
843942
844510
  const publishTime = performance.now() - publishStart;
843943
844511
  context3.logger.debug(`Docs published to FDR in ${publishTime.toFixed(0)}ms`);
843944
844512
  const translationPages = resolver2.getTranslationPages();
844513
+ const translationNavigationOverlays = resolver2.getTranslationNavigationOverlays();
843945
844514
  const translationDomain = preview ? urlToOutput : domain3;
843946
844515
  if (translationPages != null && Object.keys(translationPages).length > 0) {
843947
844516
  context3.logger.info(`Registering translations for ${Object.keys(translationPages).length} locale(s)...`);
@@ -843983,18 +844552,25 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
843983
844552
  ];
843984
844553
  }))
843985
844554
  };
843986
- const updatedRoot = applyTranslatedFrontmatterToNavTree(
844555
+ let updatedRoot = applyTranslatedFrontmatterToNavTree(
843987
844556
  docsDefinition.config.root,
843988
844557
  // localePages is Record<RelativeFilePath, string> (path -> raw markdown)
843989
844558
  localePages,
843990
844559
  context3
843991
844560
  );
844561
+ const localeNavOverlay = translationNavigationOverlays?.[locale];
844562
+ let translatedAnnouncement = docsDefinition.config.announcement;
844563
+ if (localeNavOverlay != null) {
844564
+ updatedRoot = applyTranslatedNavigationOverlays(updatedRoot, localeNavOverlay);
844565
+ translatedAnnouncement = getTranslatedAnnouncement(localeNavOverlay) ?? translatedAnnouncement;
844566
+ }
843992
844567
  const translatedDefinition = {
843993
844568
  ...docsDefinition,
843994
844569
  pages: translatedPages,
843995
844570
  config: {
843996
844571
  ...docsDefinition.config,
843997
- root: updatedRoot
844572
+ root: updatedRoot,
844573
+ announcement: translatedAnnouncement
843998
844574
  }
843999
844575
  };
844000
844576
  const pageCount2 = Object.keys(localePages).length;
@@ -844706,7 +845282,7 @@ var LegacyDocsPublisher = class {
844706
845282
  previewId,
844707
845283
  disableTemplates: void 0,
844708
845284
  skipUpload,
844709
- cliVersion: "4.105.0",
845285
+ cliVersion: "4.106.0",
844710
845286
  loginCommand: "fern auth login"
844711
845287
  });
844712
845288
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -895225,8 +895801,8 @@ var EndpointSnippetGenerator10 = class {
895225
895801
  getMethodArgsForInlinedRequest({ request: request7, snippet: snippet2 }) {
895226
895802
  const args = [];
895227
895803
  const { inlinePathParameters, inlineFileProperties } = {
895228
- inlinePathParameters: this.context.customConfig?.inlinePathParameters ?? false,
895229
- inlineFileProperties: this.context.customConfig?.inlineFileProperties ?? false
895804
+ inlinePathParameters: this.context.customConfig?.inlinePathParameters ?? true,
895805
+ inlineFileProperties: this.context.customConfig?.inlineFileProperties ?? true
895230
895806
  };
895231
895807
  this.context.errors.scope(Scope4.PathParameters);
895232
895808
  const pathParameterFields = [];
@@ -895323,7 +895899,7 @@ var EndpointSnippetGenerator10 = class {
895323
895899
  }
895324
895900
  }
895325
895901
  getFileUploadRequestBodyObjectFields({ filePropertyInfo }) {
895326
- if (this.context.customConfig?.inlineFileProperties) {
895902
+ if (this.context.customConfig?.inlineFileProperties ?? true) {
895327
895903
  return [...filePropertyInfo.fileFields, ...filePropertyInfo.bodyPropertyFields];
895328
895904
  }
895329
895905
  return filePropertyInfo.bodyPropertyFields;
@@ -918807,7 +919383,7 @@ var CliContext = class _CliContext {
918807
919383
  if (false) {
918808
919384
  this.logger.error("CLI_VERSION is not defined");
918809
919385
  }
918810
- return "4.105.0";
919386
+ return "4.106.0";
918811
919387
  }
918812
919388
  getCliName() {
918813
919389
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.105.0",
2
+ "version": "4.106.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",