@fern-api/fern-api-dev 4.104.0 → 4.105.0-4-g36fd47b6743

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 +627 -30
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -346934,7 +346934,14 @@ var require_pushSignedCommit = __commonJS({
346934
346934
  return typeof err === "object" && err != null && "status" in err && typeof err.status === "number";
346935
346935
  }
346936
346936
  function isNotFoundError(err) {
346937
- return hasNumericStatus(err) && err.status === 404;
346937
+ if (hasNumericStatus(err) && err.status === 404) {
346938
+ return true;
346939
+ }
346940
+ if (hasNumericStatus(err) && err.status === 422) {
346941
+ const message = (0, core_utils_1.extractErrorMessage)(err).toLowerCase();
346942
+ return message.includes("reference does not exist");
346943
+ }
346944
+ return false;
346938
346945
  }
346939
346946
  function isNonFastForwardError(err) {
346940
346947
  if (!hasNumericStatus(err) || err.status !== 422) {
@@ -541997,7 +542004,13 @@ async function parseDocsConfiguration({ rawDocsConfiguration, absolutePathToFern
541997
542004
  absolutePathToFernFolder,
541998
542005
  context: context3
541999
542006
  }));
542000
- 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([
542001
542014
  convertedNavigationPromise,
542002
542015
  pagesPromise,
542003
542016
  typographyPromise,
@@ -542007,7 +542020,8 @@ async function parseDocsConfiguration({ rawDocsConfiguration, absolutePathToFern
542007
542020
  context7FilePromise,
542008
542021
  llmsTxtFilePromise,
542009
542022
  llmsFullTxtFilePromise,
542010
- translationPagesPromise
542023
+ translationPagesPromise,
542024
+ translationNavigationOverlaysPromise
542011
542025
  ]);
542012
542026
  const resolvedTheme = convertThemeConfig(rawDocsConfiguration.theme);
542013
542027
  const tabsObj = resolvedTheme?.tabs != null && typeof resolvedTheme.tabs === "object" ? resolvedTheme.tabs : void 0;
@@ -542027,6 +542041,8 @@ async function parseDocsConfiguration({ rawDocsConfiguration, absolutePathToFern
542027
542041
  pages,
542028
542042
  /* per-locale translated page content */
542029
542043
  translationPages,
542044
+ /* per-locale translated navigation overlays */
542045
+ translationNavigationOverlays,
542030
542046
  /* navigation */
542031
542047
  landingPage,
542032
542048
  navigation: navigation2,
@@ -543290,6 +543306,203 @@ These pages will fall back to the default language content.`);
543290
543306
  }));
543291
543307
  return result;
543292
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
+ }
543293
543506
 
543294
543507
  // ../configuration-loader/lib/fern-config-json/loadProjectConfig.js
543295
543508
  init_lib6();
@@ -620978,7 +621191,7 @@ var AccessTokenPosthogManager = class {
620978
621191
  properties: {
620979
621192
  ...event,
620980
621193
  ...event.properties,
620981
- version: "4.104.0",
621194
+ version: "4.105.0-4-g36fd47b6743",
620982
621195
  usingAccessToken: true
620983
621196
  }
620984
621197
  });
@@ -621032,7 +621245,7 @@ var UserPosthogManager = class {
621032
621245
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
621033
621246
  event: "CLI",
621034
621247
  properties: {
621035
- version: "4.104.0",
621248
+ version: "4.105.0-4-g36fd47b6743",
621036
621249
  ...event,
621037
621250
  ...event.properties,
621038
621251
  usingAccessToken: false,
@@ -790443,6 +790656,343 @@ function walkNode(node4, overrides) {
790443
790656
  return updated;
790444
790657
  }
790445
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
+
790446
790996
  // ../docs-resolver/lib/DocsDefinitionResolver.js
790447
790997
  init_lib4();
790448
790998
  init_js();
@@ -798533,6 +799083,14 @@ var DocsDefinitionResolver = class {
798533
799083
  getTranslationPages() {
798534
799084
  return this._parsedDocsConfig?.translationPages;
798535
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
+ }
798536
799094
  /**
798537
799095
  * Returns the map of absolute file paths to uploaded file IDs.
798538
799096
  * Used by translation processing to rewrite image paths in translated pages.
@@ -832328,7 +832886,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
832328
832886
  var LOGS_FOLDER_NAME = "logs";
832329
832887
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
832330
832888
  function getCliSource() {
832331
- const version7 = "4.104.0";
832889
+ const version7 = "4.105.0-4-g36fd47b6743";
832332
832890
  return `cli@${version7}`;
832333
832891
  }
832334
832892
  var DebugLogger = class {
@@ -832687,7 +833245,7 @@ var STANDALONE_FOLDER_NAME = "standalone";
832687
833245
  var LOCAL_STORAGE_FOLDER5 = ".fern-dev";
832688
833246
  var INSTRUMENTATION_PATH = "packages/fern-docs/bundle/.next/server/instrumentation.js";
832689
833247
  var COREPACK_MISSING_KEYID_ERROR_MESSAGE = 'Cannot find matching keyid: {"signatures":';
832690
- function warnIfLongPathsDisabled(logger4) {
833248
+ function assertLongPathsEnabled(logger4) {
832691
833249
  try {
832692
833250
  const output2 = (0, import_child_process6.execSync)('reg query "HKLM\\SYSTEM\\CurrentControlSet\\Control\\FileSystem" /v LongPathsEnabled', { encoding: "utf-8", timeout: 5e3 });
832693
833251
  const match3 = output2.match(/LongPathsEnabled\s+REG_DWORD\s+0x(\d+)/i);
@@ -832697,7 +833255,11 @@ function warnIfLongPathsDisabled(logger4) {
832697
833255
  } catch (error50) {
832698
833256
  logger4.debug(`Registry query for LongPathsEnabled failed: ${error50}`);
832699
833257
  }
832700
- logger4.warn(source_default.yellow.bold("\n\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n\u2551 WARNING: Windows long path support is NOT enabled. \u2551\n\u2551 \u2551\n\u2551 The docs bundle contains deeply nested .pnpm paths that may exceed \u2551\n\u2551 the 260-character MAX_PATH limit. Extraction may silently truncate \u2551\n\u2551 paths and produce a broken bundle. \u2551\n\u2551 \u2551\n\u2551 To fix, run this in an elevated PowerShell: \u2551\n\u2551 \u2551\n\u2551 New-ItemProperty -Path \u2551\n\u2551 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\FileSystem' \u2551\n\u2551 -Name 'LongPathsEnabled' -Value 1 -PropertyType DWORD -Force \u2551\n\u2551 \u2551\n\u2551 Then restart your terminal. \u2551\n\u2551 \u2551\n\u2551 For more details, see: \u2551\n\u2551 https://learn.microsoft.com/en-us/windows/win32/fileio/ \u2551\n\u2551 maximum-file-path-limitation \u2551\n\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n"));
833258
+ throw new CliError({
833259
+ message: "Windows long path support is not enabled. The docs bundle contains deeply nested .pnpm paths that exceed the 260-character MAX_PATH limit.\n\nTo fix, run this in an elevated PowerShell:\n\n New-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\FileSystem' -Name 'LongPathsEnabled' -Value 1 -PropertyType DWORD -Force\n\nThen restart your terminal.",
833260
+ code: CliError.Code.EnvironmentError,
833261
+ docsLink: "https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation"
833262
+ });
832701
833263
  }
832702
833264
  function isWithinOutputDir(resolvedPath, outputDir) {
832703
833265
  const rel2 = import_path57.default.relative(outputDir, resolvedPath);
@@ -832926,7 +833488,7 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
832926
833488
  }, 50);
832927
833489
  }
832928
833490
  if (PLATFORM_IS_WINDOWS) {
832929
- warnIfLongPathsDisabled(logger4);
833491
+ assertLongPathsEnabled(logger4);
832930
833492
  }
832931
833493
  const collectedSymlinks = [];
832932
833494
  try {
@@ -833390,6 +833952,7 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
833390
833952
  return {
833391
833953
  docsDefinition: previousDocsDefinition,
833392
833954
  translationPages: previousPreviewResult.translationPages,
833955
+ translationNavigationOverlays: previousPreviewResult.translationNavigationOverlays,
833393
833956
  collectedFileIds: previousPreviewResult.collectedFileIds,
833394
833957
  docsWorkspacePath: previousPreviewResult.docsWorkspacePath
833395
833958
  };
@@ -833461,10 +834024,12 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
833461
834024
  docsDefinition = { ...substitutedDocs, jsFiles };
833462
834025
  }
833463
834026
  const translationPages = resolver2.getTranslationPages();
834027
+ const translationNavigationOverlays = resolver2.getTranslationNavigationOverlays();
833464
834028
  const collectedFileIds = resolver2.getCollectedFileIds();
833465
834029
  return {
833466
834030
  docsDefinition,
833467
834031
  translationPages,
834032
+ translationNavigationOverlays,
833468
834033
  collectedFileIds,
833469
834034
  docsWorkspacePath: docsWorkspace.absoluteFilePath
833470
834035
  };
@@ -834053,7 +834618,7 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
834053
834618
  const RELOAD_DEBOUNCE_MS = 1e3;
834054
834619
  function computeTranslatedDefinitions(result) {
834055
834620
  const translations = /* @__PURE__ */ new Map();
834056
- const { docsDefinition, translationPages, collectedFileIds, docsWorkspacePath } = result;
834621
+ const { docsDefinition, translationPages, translationNavigationOverlays, collectedFileIds, docsWorkspacePath } = result;
834057
834622
  if (translationPages == null || Object.keys(translationPages).length === 0) {
834058
834623
  return translations;
834059
834624
  }
@@ -834091,13 +834656,20 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
834091
834656
  editThisPageLaunch: basePage?.editThisPageLaunch
834092
834657
  };
834093
834658
  }
834094
- 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
+ }
834095
834666
  const translatedDefinition = {
834096
834667
  ...docsDefinition,
834097
834668
  pages: translatedPages,
834098
834669
  config: {
834099
834670
  ...docsDefinition.config,
834100
- root: updatedRoot
834671
+ root: updatedRoot,
834672
+ announcement: translatedAnnouncement
834101
834673
  }
834102
834674
  };
834103
834675
  translations.set(locale, translatedDefinition);
@@ -834545,7 +835117,7 @@ async function runPreviewServer({ initialProject, reloadProject, validateProject
834545
835117
  const RELOAD_DEBOUNCE_MS = 1e3;
834546
835118
  function computeTranslatedDefinitions(result) {
834547
835119
  const translations = /* @__PURE__ */ new Map();
834548
- const { docsDefinition, translationPages, collectedFileIds, docsWorkspacePath } = result;
835120
+ const { docsDefinition, translationPages, translationNavigationOverlays, collectedFileIds, docsWorkspacePath } = result;
834549
835121
  if (translationPages == null || Object.keys(translationPages).length === 0) {
834550
835122
  return translations;
834551
835123
  }
@@ -834583,13 +835155,20 @@ async function runPreviewServer({ initialProject, reloadProject, validateProject
834583
835155
  editThisPageLaunch: basePage?.editThisPageLaunch
834584
835156
  };
834585
835157
  }
834586
- 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
+ }
834587
835165
  const translatedDefinition = {
834588
835166
  ...docsDefinition,
834589
835167
  pages: translatedPages,
834590
835168
  config: {
834591
835169
  ...docsDefinition.config,
834592
- root: updatedRoot
835170
+ root: updatedRoot,
835171
+ announcement: translatedAnnouncement
834593
835172
  }
834594
835173
  };
834595
835174
  translations.set(locale, translatedDefinition);
@@ -843931,6 +844510,7 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
843931
844510
  const publishTime = performance.now() - publishStart;
843932
844511
  context3.logger.debug(`Docs published to FDR in ${publishTime.toFixed(0)}ms`);
843933
844512
  const translationPages = resolver2.getTranslationPages();
844513
+ const translationNavigationOverlays = resolver2.getTranslationNavigationOverlays();
843934
844514
  const translationDomain = preview ? urlToOutput : domain3;
843935
844515
  if (translationPages != null && Object.keys(translationPages).length > 0) {
843936
844516
  context3.logger.info(`Registering translations for ${Object.keys(translationPages).length} locale(s)...`);
@@ -843972,18 +844552,25 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
843972
844552
  ];
843973
844553
  }))
843974
844554
  };
843975
- const updatedRoot = applyTranslatedFrontmatterToNavTree(
844555
+ let updatedRoot = applyTranslatedFrontmatterToNavTree(
843976
844556
  docsDefinition.config.root,
843977
844557
  // localePages is Record<RelativeFilePath, string> (path -> raw markdown)
843978
844558
  localePages,
843979
844559
  context3
843980
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
+ }
843981
844567
  const translatedDefinition = {
843982
844568
  ...docsDefinition,
843983
844569
  pages: translatedPages,
843984
844570
  config: {
843985
844571
  ...docsDefinition.config,
843986
- root: updatedRoot
844572
+ root: updatedRoot,
844573
+ announcement: translatedAnnouncement
843987
844574
  }
843988
844575
  };
843989
844576
  const pageCount2 = Object.keys(localePages).length;
@@ -844695,7 +845282,7 @@ var LegacyDocsPublisher = class {
844695
845282
  previewId,
844696
845283
  disableTemplates: void 0,
844697
845284
  skipUpload,
844698
- cliVersion: "4.104.0",
845285
+ cliVersion: "4.105.0-4-g36fd47b6743",
844699
845286
  loginCommand: "fern auth login"
844700
845287
  });
844701
845288
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -892828,14 +893415,24 @@ var EndpointSnippetGenerator9 = class {
892828
893415
  const filePropertyInfo = this.getFilePropertyInfo({ request: request7, snippet: snippet2 });
892829
893416
  this.context.errors.unscope();
892830
893417
  if (request7.body != null) {
892831
- args.push(swift_exports.functionArgument({
892832
- label: "request",
892833
- value: this.getInlinedRequestArg({
892834
- request: request7,
892835
- snippet: snippet2,
892836
- filePropertyInfo
892837
- })
892838
- }));
893418
+ if (request7.body.type === "referenced") {
893419
+ args.push(swift_exports.functionArgument({
893420
+ label: "request",
893421
+ value: this.getReferencedRequestBodyPropertyTypeLiteral({
893422
+ body: request7.body.bodyType,
893423
+ value: snippet2.requestBody
893424
+ })
893425
+ }));
893426
+ } else {
893427
+ args.push(swift_exports.functionArgument({
893428
+ label: "request",
893429
+ value: this.getInlinedRequestArg({
893430
+ request: request7,
893431
+ snippet: snippet2,
893432
+ filePropertyInfo
893433
+ })
893434
+ }));
893435
+ }
892839
893436
  }
892840
893437
  return args;
892841
893438
  }
@@ -895204,8 +895801,8 @@ var EndpointSnippetGenerator10 = class {
895204
895801
  getMethodArgsForInlinedRequest({ request: request7, snippet: snippet2 }) {
895205
895802
  const args = [];
895206
895803
  const { inlinePathParameters, inlineFileProperties } = {
895207
- inlinePathParameters: this.context.customConfig?.inlinePathParameters ?? false,
895208
- inlineFileProperties: this.context.customConfig?.inlineFileProperties ?? false
895804
+ inlinePathParameters: this.context.customConfig?.inlinePathParameters ?? true,
895805
+ inlineFileProperties: this.context.customConfig?.inlineFileProperties ?? true
895209
895806
  };
895210
895807
  this.context.errors.scope(Scope4.PathParameters);
895211
895808
  const pathParameterFields = [];
@@ -895302,7 +895899,7 @@ var EndpointSnippetGenerator10 = class {
895302
895899
  }
895303
895900
  }
895304
895901
  getFileUploadRequestBodyObjectFields({ filePropertyInfo }) {
895305
- if (this.context.customConfig?.inlineFileProperties) {
895902
+ if (this.context.customConfig?.inlineFileProperties ?? true) {
895306
895903
  return [...filePropertyInfo.fileFields, ...filePropertyInfo.bodyPropertyFields];
895307
895904
  }
895308
895905
  return filePropertyInfo.bodyPropertyFields;
@@ -918786,7 +919383,7 @@ var CliContext = class _CliContext {
918786
919383
  if (false) {
918787
919384
  this.logger.error("CLI_VERSION is not defined");
918788
919385
  }
918789
- return "4.104.0";
919386
+ return "4.105.0-4-g36fd47b6743";
918790
919387
  }
918791
919388
  getCliName() {
918792
919389
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.104.0",
2
+ "version": "4.105.0-4-g36fd47b6743",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",