@fern-api/fern-api-dev 5.23.3-1507-g3fdf51652f8 → 5.23.3-1514-g653125ed301

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 +113 -24
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -691149,7 +691149,7 @@ var AccessTokenPosthogManager = class {
691149
691149
  properties: {
691150
691150
  ...event,
691151
691151
  ...event.properties,
691152
- version: "5.23.3-1507-g3fdf51652f8",
691152
+ version: "5.23.3-1514-g653125ed301",
691153
691153
  usingAccessToken: true,
691154
691154
  ...getRunIdProperties()
691155
691155
  }
@@ -691215,7 +691215,7 @@ var UserPosthogManager = class {
691215
691215
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
691216
691216
  event: "CLI",
691217
691217
  properties: {
691218
- version: "5.23.3-1507-g3fdf51652f8",
691218
+ version: "5.23.3-1514-g653125ed301",
691219
691219
  ...event,
691220
691220
  ...event.properties,
691221
691221
  usingAccessToken: false,
@@ -872320,7 +872320,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
872320
872320
  var LOGS_FOLDER_NAME = "logs";
872321
872321
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
872322
872322
  function getCliSource() {
872323
- const version7 = "5.23.3-1507-g3fdf51652f8";
872323
+ const version7 = "5.23.3-1514-g653125ed301";
872324
872324
  return `cli@${version7}`;
872325
872325
  }
872326
872326
  var DebugLogger = class {
@@ -875598,6 +875598,8 @@ var SnippetDependencyTracker = class {
875598
875598
  snippetToPages = /* @__PURE__ */ new Map();
875599
875599
  // Map: page file path -> Set of snippet files it references
875600
875600
  pageToSnippets = /* @__PURE__ */ new Map();
875601
+ // Whether a full scan has populated the maps at least once.
875602
+ hasBuiltInitialMap = false;
875601
875603
  constructor(context3) {
875602
875604
  this.context = context3;
875603
875605
  }
@@ -875643,21 +875645,77 @@ var SnippetDependencyTracker = class {
875643
875645
  const content5 = await (0, import_promises101.readFile)(markdownFile, "utf-8");
875644
875646
  const referencedFiles = this.extractReferences(content5, markdownFile, docsWorkspace.absoluteFilePath);
875645
875647
  this.pageToSnippets.set(markdownFile, referencedFiles);
875646
- for (const referencedFile of referencedFiles) {
875647
- if (!this.snippetToPages.has(referencedFile)) {
875648
- this.snippetToPages.set(referencedFile, /* @__PURE__ */ new Set());
875649
- }
875650
- this.snippetToPages.get(referencedFile)?.add(markdownFile);
875651
- }
875652
875648
  } catch (error50) {
875653
875649
  this.context.logger.debug(`Failed to read markdown file ${markdownFile}: ${error50}`);
875654
875650
  }
875655
875651
  }
875652
+ this.rebuildReverseMap();
875653
+ this.hasBuiltInitialMap = true;
875656
875654
  this.context.logger.debug(`Built dependency map: ${this.snippetToPages.size} snippets, ${this.pageToSnippets.size} pages`);
875657
875655
  } catch (error50) {
875658
875656
  this.context.logger.debug(`Failed to build dependency map: ${error50}`);
875659
875657
  }
875660
875658
  }
875659
+ /**
875660
+ * Incrementally updates the dependency maps for a set of changed markdown files,
875661
+ * avoiding a full re-scan of every page in the workspace.
875662
+ *
875663
+ * Only content-only (`.md`/`.mdx`) reloads take this path. For each changed file we
875664
+ * re-read it and recompute its outgoing references (the page -> snippets forward
875665
+ * edge); deleted files are dropped. We then rebuild the snippet -> pages reverse
875666
+ * map from the forward map in memory (no disk I/O), so the reverse map is always
875667
+ * fully consistent with the forward map and can never accumulate stale edges.
875668
+ *
875669
+ * Reloads never overlap (the watcher handler serializes them behind `isReloading`),
875670
+ * so these mutations are not subject to concurrent access. Falls back to a full
875671
+ * scan if an initial map has not been built yet.
875672
+ */
875673
+ async updateDependencyMapForFiles(changedFiles, project) {
875674
+ const docsWorkspace = project.docsWorkspaces;
875675
+ if (!docsWorkspace) {
875676
+ return;
875677
+ }
875678
+ if (!this.hasBuiltInitialMap) {
875679
+ await this.buildDependencyMap(project);
875680
+ return;
875681
+ }
875682
+ for (const changedFile of changedFiles) {
875683
+ const lower = changedFile.toLowerCase();
875684
+ if (!lower.endsWith(".md") && !lower.endsWith(".mdx")) {
875685
+ continue;
875686
+ }
875687
+ if (!await doesPathExist(changedFile)) {
875688
+ this.pageToSnippets.delete(changedFile);
875689
+ continue;
875690
+ }
875691
+ try {
875692
+ const content5 = await (0, import_promises101.readFile)(changedFile, "utf-8");
875693
+ const referencedFiles = this.extractReferences(content5, changedFile, docsWorkspace.absoluteFilePath);
875694
+ this.pageToSnippets.set(changedFile, referencedFiles);
875695
+ } catch (error50) {
875696
+ this.context.logger.debug(`Failed to read markdown file ${changedFile}: ${error50}`);
875697
+ this.pageToSnippets.delete(changedFile);
875698
+ }
875699
+ }
875700
+ this.rebuildReverseMap();
875701
+ }
875702
+ /**
875703
+ * Rebuilds the snippet -> pages (reverse) map from the page -> snippets (forward)
875704
+ * map. A pure in-memory transformation, so it can never leave stale reverse edges.
875705
+ */
875706
+ rebuildReverseMap() {
875707
+ this.snippetToPages.clear();
875708
+ for (const [page, references] of this.pageToSnippets) {
875709
+ for (const reference4 of references) {
875710
+ let pages = this.snippetToPages.get(reference4);
875711
+ if (pages == null) {
875712
+ pages = /* @__PURE__ */ new Set();
875713
+ this.snippetToPages.set(reference4, pages);
875714
+ }
875715
+ pages.add(page);
875716
+ }
875717
+ }
875718
+ }
875661
875719
  /**
875662
875720
  * Find all markdown files in the docs workspace directory
875663
875721
  */
@@ -876078,10 +876136,16 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
876078
876136
  context3.logger.info("Reloading docs...");
876079
876137
  const startTime = Date.now();
876080
876138
  void debugLogger.logCliReloadStart();
876139
+ const contentOnlyEdit = isContentOnlyEdit(editedAbsoluteFilepaths2);
876081
876140
  try {
876082
- project = await reloadProject();
876083
- await snippetTracker.buildDependencyMap(project);
876084
- if (!isContentOnlyEdit(editedAbsoluteFilepaths2)) {
876141
+ if (contentOnlyEdit) {
876142
+ context3.logger.debug("Content-only edit; reusing loaded project (skipping full reload).");
876143
+ await snippetTracker.updateDependencyMapForFiles(editedAbsoluteFilepaths2 ?? [], project);
876144
+ } else {
876145
+ project = await reloadProject();
876146
+ await snippetTracker.buildDependencyMap(project);
876147
+ }
876148
+ if (!contentOnlyEdit) {
876085
876149
  const validationStartTime = Date.now();
876086
876150
  void validateProject(project).then(() => {
876087
876151
  const validationTime = Date.now() - validationStartTime;
@@ -904909,7 +904973,7 @@ var LegacyDocsPublisher = class {
904909
904973
  previewId,
904910
904974
  disableTemplates: void 0,
904911
904975
  skipUpload,
904912
- cliVersion: "5.23.3-1507-g3fdf51652f8",
904976
+ cliVersion: "5.23.3-1514-g653125ed301",
904913
904977
  loginCommand: "fern auth login"
904914
904978
  });
904915
904979
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -952132,13 +952196,15 @@ var ComputedProperty = class extends AstNode8 {
952132
952196
  var DocComment2 = class _DocComment extends AstNode8 {
952133
952197
  summary;
952134
952198
  description;
952199
+ codeExample;
952135
952200
  parameters;
952136
952201
  returns;
952137
952202
  throws;
952138
- constructor({ summary, description, parameters: parameters2, returns, throws }) {
952203
+ constructor({ summary, description, codeExample, parameters: parameters2, returns, throws }) {
952139
952204
  super();
952140
- this.summary = _DocComment.sanitizeText(summary);
952205
+ this.summary = summary != null ? _DocComment.sanitizeText(summary) : void 0;
952141
952206
  this.description = description != null ? _DocComment.sanitizeText(description) : void 0;
952207
+ this.codeExample = codeExample != null ? _DocComment.sanitizeText(codeExample) : void 0;
952142
952208
  this.parameters = (parameters2 ?? []).map((param) => ({
952143
952209
  name: param.name,
952144
952210
  description: _DocComment.sanitizeText(param.description)
@@ -952147,15 +952213,34 @@ var DocComment2 = class _DocComment extends AstNode8 {
952147
952213
  this.throws = (throws ?? []).map((t3) => _DocComment.sanitizeText(t3));
952148
952214
  }
952149
952215
  write(writer2) {
952150
- this.writeMultilineText(writer2, this.summary);
952216
+ let hasPrecedingSection = false;
952217
+ if (this.summary != null) {
952218
+ this.writeMultilineText(writer2, this.summary);
952219
+ hasPrecedingSection = true;
952220
+ }
952151
952221
  if (this.description != null) {
952152
- writer2.write("///");
952153
- writer2.newLine();
952222
+ if (hasPrecedingSection) {
952223
+ writer2.write("///");
952224
+ writer2.newLine();
952225
+ }
952154
952226
  this.writeMultilineText(writer2, this.description);
952227
+ hasPrecedingSection = true;
952228
+ }
952229
+ if (this.codeExample != null) {
952230
+ if (hasPrecedingSection) {
952231
+ writer2.write("///");
952232
+ writer2.newLine();
952233
+ }
952234
+ this.writeMultilineText(writer2, `\`\`\`swift
952235
+ ${this.codeExample}
952236
+ \`\`\``);
952237
+ hasPrecedingSection = true;
952155
952238
  }
952156
952239
  if (this.parameters.length > 0) {
952157
- writer2.write("///");
952158
- writer2.newLine();
952240
+ if (hasPrecedingSection) {
952241
+ writer2.write("///");
952242
+ writer2.newLine();
952243
+ }
952159
952244
  for (const param of this.parameters) {
952160
952245
  const paramLines = param.description.split("\n");
952161
952246
  paramLines.forEach((line, lineIdx) => {
@@ -952204,8 +952289,12 @@ var DocComment2 = class _DocComment extends AstNode8 {
952204
952289
  writeMultilineText(writer2, sanitizedText) {
952205
952290
  const lines = sanitizedText.split("\n");
952206
952291
  for (const line of lines) {
952207
- writer2.write("/// ");
952208
- writer2.write(line);
952292
+ if (line === "") {
952293
+ writer2.write("///");
952294
+ } else {
952295
+ writer2.write("/// ");
952296
+ writer2.write(line);
952297
+ }
952209
952298
  writer2.newLine();
952210
952299
  }
952211
952300
  }
@@ -971797,7 +971886,7 @@ function getAutomationContextFromEnv() {
971797
971886
  config_branch: process.env.FERN_CONFIG_BRANCH,
971798
971887
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
971799
971888
  trigger: process.env.GITHUB_EVENT_NAME,
971800
- cli_version: "5.23.3-1507-g3fdf51652f8"
971889
+ cli_version: "5.23.3-1514-g653125ed301"
971801
971890
  };
971802
971891
  }
971803
971892
  function isAutomationMode() {
@@ -972629,7 +972718,7 @@ var CliContext = class _CliContext {
972629
972718
  if (false) {
972630
972719
  this.logger.error("CLI_VERSION is not defined");
972631
972720
  }
972632
- return "5.23.3-1507-g3fdf51652f8";
972721
+ return "5.23.3-1514-g653125ed301";
972633
972722
  }
972634
972723
  getCliName() {
972635
972724
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.23.3-1507-g3fdf51652f8",
2
+ "version": "5.23.3-1514-g653125ed301",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",