@fern-api/fern-api-dev 5.75.4 → 5.75.6

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 +187 -41
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -84194,6 +84194,10 @@ function getPackageNameFromGeneratorConfig(generatorInvocation) {
84194
84194
  if (modulePath != null) {
84195
84195
  return modulePath;
84196
84196
  }
84197
+ const camelCasePackageName = generatorInvocation.raw.config.packageName;
84198
+ if (typeof camelCasePackageName === "string") {
84199
+ return camelCasePackageName;
84200
+ }
84197
84201
  }
84198
84202
  return void 0;
84199
84203
  }
@@ -691149,7 +691153,7 @@ var AccessTokenPosthogManager = class {
691149
691153
  properties: {
691150
691154
  ...event,
691151
691155
  ...event.properties,
691152
- version: "5.75.4",
691156
+ version: "5.75.6",
691153
691157
  usingAccessToken: true,
691154
691158
  ...getRunIdProperties()
691155
691159
  }
@@ -691215,7 +691219,7 @@ var UserPosthogManager = class {
691215
691219
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
691216
691220
  event: "CLI",
691217
691221
  properties: {
691218
- version: "5.75.4",
691222
+ version: "5.75.6",
691219
691223
  ...event,
691220
691224
  ...event.properties,
691221
691225
  usingAccessToken: false,
@@ -872320,7 +872324,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
872320
872324
  var LOGS_FOLDER_NAME = "logs";
872321
872325
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
872322
872326
  function getCliSource() {
872323
- const version7 = "5.75.4";
872327
+ const version7 = "5.75.6";
872324
872328
  return `cli@${version7}`;
872325
872329
  }
872326
872330
  var DebugLogger = class {
@@ -875598,6 +875602,8 @@ var SnippetDependencyTracker = class {
875598
875602
  snippetToPages = /* @__PURE__ */ new Map();
875599
875603
  // Map: page file path -> Set of snippet files it references
875600
875604
  pageToSnippets = /* @__PURE__ */ new Map();
875605
+ // Whether a full scan has populated the maps at least once.
875606
+ hasBuiltInitialMap = false;
875601
875607
  constructor(context3) {
875602
875608
  this.context = context3;
875603
875609
  }
@@ -875643,21 +875649,77 @@ var SnippetDependencyTracker = class {
875643
875649
  const content5 = await (0, import_promises101.readFile)(markdownFile, "utf-8");
875644
875650
  const referencedFiles = this.extractReferences(content5, markdownFile, docsWorkspace.absoluteFilePath);
875645
875651
  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
875652
  } catch (error50) {
875653
875653
  this.context.logger.debug(`Failed to read markdown file ${markdownFile}: ${error50}`);
875654
875654
  }
875655
875655
  }
875656
+ this.rebuildReverseMap();
875657
+ this.hasBuiltInitialMap = true;
875656
875658
  this.context.logger.debug(`Built dependency map: ${this.snippetToPages.size} snippets, ${this.pageToSnippets.size} pages`);
875657
875659
  } catch (error50) {
875658
875660
  this.context.logger.debug(`Failed to build dependency map: ${error50}`);
875659
875661
  }
875660
875662
  }
875663
+ /**
875664
+ * Incrementally updates the dependency maps for a set of changed markdown files,
875665
+ * avoiding a full re-scan of every page in the workspace.
875666
+ *
875667
+ * Only content-only (`.md`/`.mdx`) reloads take this path. For each changed file we
875668
+ * re-read it and recompute its outgoing references (the page -> snippets forward
875669
+ * edge); deleted files are dropped. We then rebuild the snippet -> pages reverse
875670
+ * map from the forward map in memory (no disk I/O), so the reverse map is always
875671
+ * fully consistent with the forward map and can never accumulate stale edges.
875672
+ *
875673
+ * Reloads never overlap (the watcher handler serializes them behind `isReloading`),
875674
+ * so these mutations are not subject to concurrent access. Falls back to a full
875675
+ * scan if an initial map has not been built yet.
875676
+ */
875677
+ async updateDependencyMapForFiles(changedFiles, project) {
875678
+ const docsWorkspace = project.docsWorkspaces;
875679
+ if (!docsWorkspace) {
875680
+ return;
875681
+ }
875682
+ if (!this.hasBuiltInitialMap) {
875683
+ await this.buildDependencyMap(project);
875684
+ return;
875685
+ }
875686
+ for (const changedFile of changedFiles) {
875687
+ const lower = changedFile.toLowerCase();
875688
+ if (!lower.endsWith(".md") && !lower.endsWith(".mdx")) {
875689
+ continue;
875690
+ }
875691
+ if (!await doesPathExist(changedFile)) {
875692
+ this.pageToSnippets.delete(changedFile);
875693
+ continue;
875694
+ }
875695
+ try {
875696
+ const content5 = await (0, import_promises101.readFile)(changedFile, "utf-8");
875697
+ const referencedFiles = this.extractReferences(content5, changedFile, docsWorkspace.absoluteFilePath);
875698
+ this.pageToSnippets.set(changedFile, referencedFiles);
875699
+ } catch (error50) {
875700
+ this.context.logger.debug(`Failed to read markdown file ${changedFile}: ${error50}`);
875701
+ this.pageToSnippets.delete(changedFile);
875702
+ }
875703
+ }
875704
+ this.rebuildReverseMap();
875705
+ }
875706
+ /**
875707
+ * Rebuilds the snippet -> pages (reverse) map from the page -> snippets (forward)
875708
+ * map. A pure in-memory transformation, so it can never leave stale reverse edges.
875709
+ */
875710
+ rebuildReverseMap() {
875711
+ this.snippetToPages.clear();
875712
+ for (const [page, references] of this.pageToSnippets) {
875713
+ for (const reference4 of references) {
875714
+ let pages = this.snippetToPages.get(reference4);
875715
+ if (pages == null) {
875716
+ pages = /* @__PURE__ */ new Set();
875717
+ this.snippetToPages.set(reference4, pages);
875718
+ }
875719
+ pages.add(page);
875720
+ }
875721
+ }
875722
+ }
875661
875723
  /**
875662
875724
  * Find all markdown files in the docs workspace directory
875663
875725
  */
@@ -876078,10 +876140,16 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
876078
876140
  context3.logger.info("Reloading docs...");
876079
876141
  const startTime = Date.now();
876080
876142
  void debugLogger.logCliReloadStart();
876143
+ const contentOnlyEdit = isContentOnlyEdit(editedAbsoluteFilepaths2);
876081
876144
  try {
876082
- project = await reloadProject();
876083
- await snippetTracker.buildDependencyMap(project);
876084
- if (!isContentOnlyEdit(editedAbsoluteFilepaths2)) {
876145
+ if (contentOnlyEdit) {
876146
+ context3.logger.debug("Content-only edit; reusing loaded project (skipping full reload).");
876147
+ await snippetTracker.updateDependencyMapForFiles(editedAbsoluteFilepaths2 ?? [], project);
876148
+ } else {
876149
+ project = await reloadProject();
876150
+ await snippetTracker.buildDependencyMap(project);
876151
+ }
876152
+ if (!contentOnlyEdit) {
876085
876153
  const validationStartTime = Date.now();
876086
876154
  void validateProject(project).then(() => {
876087
876155
  const validationTime = Date.now() - validationStartTime;
@@ -904909,7 +904977,7 @@ var LegacyDocsPublisher = class {
904909
904977
  previewId,
904910
904978
  disableTemplates: void 0,
904911
904979
  skipUpload,
904912
- cliVersion: "5.75.4",
904980
+ cliVersion: "5.75.6",
904913
904981
  loginCommand: "fern auth login"
904914
904982
  });
904915
904983
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -935496,10 +935564,12 @@ function convertToPhpVariableName(name2) {
935496
935564
  // ../../../generators/php/codegen/lib/ast/Comment.js
935497
935565
  var Comment4 = class extends AstNode4 {
935498
935566
  docs;
935567
+ codeExample;
935499
935568
  tags = [];
935500
- constructor({ docs: docs2 } = {}) {
935569
+ constructor({ docs: docs2, codeExample } = {}) {
935501
935570
  super();
935502
935571
  this.docs = docs2;
935572
+ this.codeExample = codeExample;
935503
935573
  }
935504
935574
  addTag(tag2) {
935505
935575
  this.tags.push({
@@ -935513,6 +935583,17 @@ var Comment4 = class extends AstNode4 {
935513
935583
  this.docs.split("\n").forEach((line) => {
935514
935584
  writer2.writeLine(` * ${line}`);
935515
935585
  });
935586
+ if (this.codeExample != null || this.tags.length > 0) {
935587
+ writer2.writeLine(" *");
935588
+ }
935589
+ }
935590
+ if (this.codeExample != null) {
935591
+ writer2.writeLine(" * Example:");
935592
+ writer2.writeLine(" * ```php");
935593
+ this.codeExample.split("\n").forEach((line) => {
935594
+ writer2.writeLine(` * ${this.escapeDocs(line)}`.trimEnd());
935595
+ });
935596
+ writer2.writeLine(" * ```");
935516
935597
  if (this.tags.length > 0) {
935517
935598
  writer2.writeLine(" *");
935518
935599
  }
@@ -935522,6 +935603,9 @@ var Comment4 = class extends AstNode4 {
935522
935603
  }
935523
935604
  writer2.writeLine(" */");
935524
935605
  }
935606
+ escapeDocs(line) {
935607
+ return line.replaceAll("*/", "*\\/");
935608
+ }
935525
935609
  writeTag({ writer: writer2, tag: tag2 }) {
935526
935610
  const docsSplit = tag2.docs != null ? tag2.docs.split("\n") : void 0;
935527
935611
  if (docsSplit != null && docsSplit.length > 1) {
@@ -936694,10 +936778,11 @@ var Method4 = class extends AstNode4 {
936694
936778
  return_;
936695
936779
  body;
936696
936780
  docs;
936781
+ codeExample;
936697
936782
  classReference;
936698
936783
  static_;
936699
936784
  noBody;
936700
- constructor({ name: name2, access: access7, parameters: parameters2, throws, return_, body, docs: docs2, classReference: classReference4, static_, noBody }) {
936785
+ constructor({ name: name2, access: access7, parameters: parameters2, throws, return_, body, docs: docs2, codeExample, classReference: classReference4, static_, noBody }) {
936701
936786
  super();
936702
936787
  this.name = name2;
936703
936788
  this.access = access7;
@@ -936706,6 +936791,7 @@ var Method4 = class extends AstNode4 {
936706
936791
  this.return_ = return_;
936707
936792
  this.body = body;
936708
936793
  this.docs = docs2;
936794
+ this.codeExample = codeExample;
936709
936795
  this.classReference = classReference4;
936710
936796
  this.static_ = static_ ?? false;
936711
936797
  this.noBody = noBody ?? false;
@@ -936739,7 +936825,7 @@ var Method4 = class extends AstNode4 {
936739
936825
  }
936740
936826
  }
936741
936827
  writeComment(writer2) {
936742
- const comment6 = new Comment4({ docs: this.docs });
936828
+ const comment6 = new Comment4({ docs: this.docs, codeExample: this.codeExample });
936743
936829
  for (const parameter6 of this.parameters) {
936744
936830
  comment6.addTag({
936745
936831
  tagType: "param",
@@ -942729,7 +942815,8 @@ var Method6 = class extends AstNode6 {
942729
942815
  statements;
942730
942816
  returnType;
942731
942817
  splatOptionDocs;
942732
- constructor({ name: name2, docstring, kind, visibility, parameters: parameters2, returnType, statements, splatOptionDocs }) {
942818
+ codeExample;
942819
+ constructor({ name: name2, docstring, kind, visibility, parameters: parameters2, returnType, statements, splatOptionDocs, codeExample }) {
942733
942820
  super();
942734
942821
  this.name = name2;
942735
942822
  this.docstring = docstring;
@@ -942743,6 +942830,7 @@ var Method6 = class extends AstNode6 {
942743
942830
  this.returnType = returnType ?? Type35.untyped();
942744
942831
  this.statements = statements ?? [];
942745
942832
  this.splatOptionDocs = splatOptionDocs ?? [];
942833
+ this.codeExample = codeExample;
942746
942834
  }
942747
942835
  addStatement(statement) {
942748
942836
  this.statements.push(statement);
@@ -942788,8 +942876,18 @@ var Method6 = class extends AstNode6 {
942788
942876
  for (const optionDoc of this.splatOptionDocs) {
942789
942877
  writer2.writeLine(`# ${optionDoc}`);
942790
942878
  }
942879
+ const codeExample = this.codeExample?.trim();
942880
+ if (codeExample) {
942881
+ if (this.docstring || hasAnyParameters || this.splatOptionDocs.length > 0) {
942882
+ writer2.writeLine("#");
942883
+ }
942884
+ writer2.writeLine("# @example");
942885
+ for (const line of codeExample.split("\n")) {
942886
+ writer2.writeLine(line.trim() === "" ? "#" : `# ${line.trimEnd()}`);
942887
+ }
942888
+ }
942791
942889
  if (this.returnType != null) {
942792
- if (hasAnyParameters || this.docstring) {
942890
+ if (hasAnyParameters || this.docstring || codeExample) {
942793
942891
  writer2.writeLine("#");
942794
942892
  }
942795
942893
  writer2.write(`# @return [`);
@@ -946231,7 +946329,7 @@ var DocComment = class extends AstNode7 {
946231
946329
  examples;
946232
946330
  constructor({ summary, description, parameters: parameters2, returns, errors: errors4, examples }) {
946233
946331
  super();
946234
- this.summary = this.sanitizeText(summary);
946332
+ this.summary = summary ? this.sanitizeText(summary) : void 0;
946235
946333
  this.description = description ? this.sanitizeText(description) : void 0;
946236
946334
  this.parameters = (parameters2 ?? []).map((param) => ({
946237
946335
  name: param.name,
@@ -946241,15 +946339,25 @@ var DocComment = class extends AstNode7 {
946241
946339
  this.examples = (examples ?? []).map((e2) => this.sanitizeText(e2));
946242
946340
  }
946243
946341
  write(writer2) {
946244
- this.writeMultilineText(writer2, this.summary);
946342
+ let hasContent = false;
946343
+ if (this.summary) {
946344
+ this.writeMultilineText(writer2, this.summary);
946345
+ hasContent = true;
946346
+ }
946245
946347
  if (this.description) {
946246
- writer2.write("///");
946247
- writer2.newLine();
946348
+ if (hasContent) {
946349
+ writer2.write("///");
946350
+ writer2.newLine();
946351
+ }
946248
946352
  this.writeMultilineText(writer2, this.description);
946353
+ hasContent = true;
946249
946354
  }
946250
946355
  if (this.parameters.length > 0) {
946251
- writer2.write("///");
946252
- writer2.newLine();
946356
+ if (hasContent) {
946357
+ writer2.write("///");
946358
+ writer2.newLine();
946359
+ }
946360
+ hasContent = true;
946253
946361
  writer2.write("/// # Arguments");
946254
946362
  writer2.newLine();
946255
946363
  writer2.write("///");
@@ -946267,8 +946375,11 @@ var DocComment = class extends AstNode7 {
946267
946375
  });
946268
946376
  }
946269
946377
  if (this.returns) {
946270
- writer2.write("///");
946271
- writer2.newLine();
946378
+ if (hasContent) {
946379
+ writer2.write("///");
946380
+ writer2.newLine();
946381
+ }
946382
+ hasContent = true;
946272
946383
  writer2.write("/// # Returns");
946273
946384
  writer2.newLine();
946274
946385
  writer2.write("///");
@@ -946280,16 +946391,18 @@ var DocComment = class extends AstNode7 {
946280
946391
  });
946281
946392
  }
946282
946393
  if (this.examples.length > 0) {
946283
- writer2.write("///");
946284
- writer2.newLine();
946394
+ if (hasContent) {
946395
+ writer2.write("///");
946396
+ writer2.newLine();
946397
+ }
946285
946398
  writer2.write("/// # Examples");
946286
946399
  writer2.newLine();
946287
946400
  writer2.write("///");
946288
946401
  writer2.newLine();
946289
946402
  this.examples.forEach((example) => {
946290
- writer2.write("/// ```rust");
946403
+ writer2.write("/// ```no_run");
946291
946404
  writer2.newLine();
946292
- this.writeMultilineText(writer2, example);
946405
+ this.writeCodeBlock(writer2, example);
946293
946406
  writer2.write("/// ```");
946294
946407
  writer2.newLine();
946295
946408
  });
@@ -946303,6 +946416,14 @@ var DocComment = class extends AstNode7 {
946303
946416
  writer2.newLine();
946304
946417
  }
946305
946418
  }
946419
+ writeCodeBlock(writer2, code5) {
946420
+ const lines = code5.split("\n");
946421
+ for (const line of lines) {
946422
+ const trimmed2 = line.trimEnd();
946423
+ writer2.write(trimmed2.length > 0 ? `/// ${trimmed2}` : "///");
946424
+ writer2.newLine();
946425
+ }
946426
+ }
946306
946427
  /**
946307
946428
  * Sanitizes text content to ensure it doesn't break Rust doc comment syntax.
946308
946429
  */
@@ -952079,13 +952200,15 @@ var ComputedProperty = class extends AstNode8 {
952079
952200
  var DocComment2 = class _DocComment extends AstNode8 {
952080
952201
  summary;
952081
952202
  description;
952203
+ codeExample;
952082
952204
  parameters;
952083
952205
  returns;
952084
952206
  throws;
952085
- constructor({ summary, description, parameters: parameters2, returns, throws }) {
952207
+ constructor({ summary, description, codeExample, parameters: parameters2, returns, throws }) {
952086
952208
  super();
952087
- this.summary = _DocComment.sanitizeText(summary);
952209
+ this.summary = summary != null ? _DocComment.sanitizeText(summary) : void 0;
952088
952210
  this.description = description != null ? _DocComment.sanitizeText(description) : void 0;
952211
+ this.codeExample = codeExample != null ? _DocComment.sanitizeText(codeExample) : void 0;
952089
952212
  this.parameters = (parameters2 ?? []).map((param) => ({
952090
952213
  name: param.name,
952091
952214
  description: _DocComment.sanitizeText(param.description)
@@ -952094,15 +952217,34 @@ var DocComment2 = class _DocComment extends AstNode8 {
952094
952217
  this.throws = (throws ?? []).map((t3) => _DocComment.sanitizeText(t3));
952095
952218
  }
952096
952219
  write(writer2) {
952097
- this.writeMultilineText(writer2, this.summary);
952220
+ let hasPrecedingSection = false;
952221
+ if (this.summary != null) {
952222
+ this.writeMultilineText(writer2, this.summary);
952223
+ hasPrecedingSection = true;
952224
+ }
952098
952225
  if (this.description != null) {
952099
- writer2.write("///");
952100
- writer2.newLine();
952226
+ if (hasPrecedingSection) {
952227
+ writer2.write("///");
952228
+ writer2.newLine();
952229
+ }
952101
952230
  this.writeMultilineText(writer2, this.description);
952231
+ hasPrecedingSection = true;
952232
+ }
952233
+ if (this.codeExample != null) {
952234
+ if (hasPrecedingSection) {
952235
+ writer2.write("///");
952236
+ writer2.newLine();
952237
+ }
952238
+ this.writeMultilineText(writer2, `\`\`\`swift
952239
+ ${this.codeExample}
952240
+ \`\`\``);
952241
+ hasPrecedingSection = true;
952102
952242
  }
952103
952243
  if (this.parameters.length > 0) {
952104
- writer2.write("///");
952105
- writer2.newLine();
952244
+ if (hasPrecedingSection) {
952245
+ writer2.write("///");
952246
+ writer2.newLine();
952247
+ }
952106
952248
  for (const param of this.parameters) {
952107
952249
  const paramLines = param.description.split("\n");
952108
952250
  paramLines.forEach((line, lineIdx) => {
@@ -952151,8 +952293,12 @@ var DocComment2 = class _DocComment extends AstNode8 {
952151
952293
  writeMultilineText(writer2, sanitizedText) {
952152
952294
  const lines = sanitizedText.split("\n");
952153
952295
  for (const line of lines) {
952154
- writer2.write("/// ");
952155
- writer2.write(line);
952296
+ if (line === "") {
952297
+ writer2.write("///");
952298
+ } else {
952299
+ writer2.write("/// ");
952300
+ writer2.write(line);
952301
+ }
952156
952302
  writer2.newLine();
952157
952303
  }
952158
952304
  }
@@ -971744,7 +971890,7 @@ function getAutomationContextFromEnv() {
971744
971890
  config_branch: process.env.FERN_CONFIG_BRANCH,
971745
971891
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
971746
971892
  trigger: process.env.GITHUB_EVENT_NAME,
971747
- cli_version: "5.75.4"
971893
+ cli_version: "5.75.6"
971748
971894
  };
971749
971895
  }
971750
971896
  function isAutomationMode() {
@@ -972576,7 +972722,7 @@ var CliContext = class _CliContext {
972576
972722
  if (false) {
972577
972723
  this.logger.error("CLI_VERSION is not defined");
972578
972724
  }
972579
- return "5.75.4";
972725
+ return "5.75.6";
972580
972726
  }
972581
972727
  getCliName() {
972582
972728
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.75.4",
2
+ "version": "5.75.6",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",