@fern-api/fern-api-dev 4.107.1 → 4.107.2

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 +62 -22
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -477450,7 +477450,8 @@ var USER_ENVIRONMENT_ERRNOS = /* @__PURE__ */ new Set([
477450
477450
  "EROFS",
477451
477451
  "EMFILE",
477452
477452
  "ENFILE",
477453
- "EBUSY"
477453
+ "EBUSY",
477454
+ "EADDRINUSE"
477454
477455
  ]);
477455
477456
  var NETWORK_ERRNOS = /* @__PURE__ */ new Set([
477456
477457
  "ENOTFOUND",
@@ -543610,6 +543611,7 @@ function parseVariantOverlays(variants) {
543610
543611
  }
543611
543612
 
543612
543613
  // ../configuration-loader/lib/fern-config-json/loadProjectConfig.js
543614
+ init_lib4();
543613
543615
  init_lib6();
543614
543616
  var import_promises15 = require("fs/promises");
543615
543617
 
@@ -543624,7 +543626,15 @@ var ProjectConfigSchema = external_exports2.strictObject({
543624
543626
  async function loadProjectConfig({ directory, context: context3 }) {
543625
543627
  const pathToConfig = join8(directory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME));
543626
543628
  const projectConfigStr = await (0, import_promises15.readFile)(pathToConfig);
543627
- const projectConfigParsed = JSON.parse(projectConfigStr.toString());
543629
+ let projectConfigParsed;
543630
+ try {
543631
+ projectConfigParsed = JSON.parse(projectConfigStr.toString());
543632
+ } catch (error50) {
543633
+ throw new CliError({
543634
+ message: `Failed to parse ${PROJECT_CONFIG_FILENAME}: ${extractErrorMessage(error50)}`,
543635
+ code: CliError.Code.ParseError
543636
+ });
543637
+ }
543628
543638
  const rawProjectConfig = await validateSchema({
543629
543639
  schema: ProjectConfigSchema,
543630
543640
  value: projectConfigParsed,
@@ -612723,6 +612733,16 @@ function collapseSpecBooleanSetting(specs, getter) {
612723
612733
  }
612724
612734
  return values2.every((v9) => v9 == null || v9 === true);
612725
612735
  }
612736
+ function toRelativePath(raw, field5) {
612737
+ try {
612738
+ return RelativeFilePath2.of(raw);
612739
+ } catch {
612740
+ throw new CliError({
612741
+ message: `"${field5}: ${raw}" must be a relative path, not an absolute one.`,
612742
+ code: CliError.Code.ConfigError
612743
+ });
612744
+ }
612745
+ }
612726
612746
  function convertRemoveDiscriminantsFromSchemas(specs) {
612727
612747
  if (specs.every((spec) => spec.settings?.removeDiscriminantsFromSchemas === generators_yml_exports.RemoveDiscriminantsFromSchemas.Never)) {
612728
612748
  return generators_yml_exports.RemoveDiscriminantsFromSchemas.Never;
@@ -613118,20 +613138,20 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
613118
613138
  const specs = [];
613119
613139
  for (const spec of specsOverride) {
613120
613140
  if (generators_yml_exports.isOpenApiSpecSchema(spec)) {
613121
- const absoluteFilepath = join8(this.absoluteFilePath, RelativeFilePath2.of(spec.openapi));
613141
+ const absoluteFilepath = join8(this.absoluteFilePath, toRelativePath(spec.openapi, "openapi"));
613122
613142
  let absoluteFilepathToOverrides;
613123
613143
  const specOverridePaths = [];
613124
613144
  if (spec.overrides != null) {
613125
613145
  if (Array.isArray(spec.overrides)) {
613126
- specOverridePaths.push(...spec.overrides.map((override) => join8(this.absoluteFilePath, RelativeFilePath2.of(override))));
613146
+ specOverridePaths.push(...spec.overrides.map((override) => join8(this.absoluteFilePath, toRelativePath(override, "overrides"))));
613127
613147
  } else {
613128
- specOverridePaths.push(join8(this.absoluteFilePath, RelativeFilePath2.of(spec.overrides)));
613148
+ specOverridePaths.push(join8(this.absoluteFilePath, toRelativePath(spec.overrides, "overrides")));
613129
613149
  }
613130
613150
  }
613131
613151
  if (specOverridePaths.length > 0) {
613132
613152
  absoluteFilepathToOverrides = specOverridePaths.length === 1 ? specOverridePaths[0] : specOverridePaths;
613133
613153
  }
613134
- const absoluteFilepathToOverlays = spec.overlays ? join8(this.absoluteFilePath, RelativeFilePath2.of(spec.overlays)) : void 0;
613154
+ const absoluteFilepathToOverlays = spec.overlays ? join8(this.absoluteFilePath, toRelativePath(spec.overlays, "overlays")) : void 0;
613135
613155
  const openApiSpec = {
613136
613156
  type: "openapi",
613137
613157
  absoluteFilepath,
@@ -621305,7 +621325,7 @@ var AccessTokenPosthogManager = class {
621305
621325
  properties: {
621306
621326
  ...event,
621307
621327
  ...event.properties,
621308
- version: "4.107.1",
621328
+ version: "4.107.2",
621309
621329
  usingAccessToken: true
621310
621330
  }
621311
621331
  });
@@ -621359,7 +621379,7 @@ var UserPosthogManager = class {
621359
621379
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
621360
621380
  event: "CLI",
621361
621381
  properties: {
621362
- version: "4.107.1",
621382
+ version: "4.107.2",
621363
621383
  ...event,
621364
621384
  ...event.properties,
621365
621385
  usingAccessToken: false,
@@ -799353,7 +799373,10 @@ var DocsDefinitionResolver = class {
799353
799373
  }
799354
799374
  } catch (error50) {
799355
799375
  this.taskContext.logger.error(`Failed to parse ${relativePath}: ${extractErrorMessage(error50)}`);
799356
- throw error50;
799376
+ throw new CliError({
799377
+ message: `Failed to parse markdown file ${relativePath}: ${extractErrorMessage(error50)}`,
799378
+ code: CliError.Code.ParseError
799379
+ });
799357
799380
  }
799358
799381
  }
799359
799382
  const imageParseTime = performance.now() - imageParseStart;
@@ -833002,7 +833025,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
833002
833025
  var LOGS_FOLDER_NAME = "logs";
833003
833026
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
833004
833027
  function getCliSource() {
833005
- const version7 = "4.107.1";
833028
+ const version7 = "4.107.2";
833006
833029
  return `cli@${version7}`;
833007
833030
  }
833008
833031
  var DebugLogger = class {
@@ -834025,10 +834048,19 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
834025
834048
  absolutePathToFernFolder: docsWorkspace.absoluteFilePath,
834026
834049
  absolutePathToMarkdownFile: absoluteFilePath
834027
834050
  });
834028
- const { markdown: markdownWithAbsPaths, filepaths } = parseImagePaths(markdownReplacedMdAndCode, {
834029
- absolutePathToFernFolder: docsWorkspace.absoluteFilePath,
834030
- absolutePathToMarkdownFile: absoluteFilePath
834031
- });
834051
+ let markdownWithAbsPaths;
834052
+ let filepaths;
834053
+ try {
834054
+ ({ markdown: markdownWithAbsPaths, filepaths } = parseImagePaths(markdownReplacedMdAndCode, {
834055
+ absolutePathToFernFolder: docsWorkspace.absoluteFilePath,
834056
+ absolutePathToMarkdownFile: absoluteFilePath
834057
+ }));
834058
+ } catch (error50) {
834059
+ throw new CliError({
834060
+ message: `Failed to parse markdown in ${absoluteFilePath}: ${extractErrorMessage(error50)}`,
834061
+ code: CliError.Code.ParseError
834062
+ });
834063
+ }
834032
834064
  if (previousDocsDefinition.filesV2 == null) {
834033
834065
  previousDocsDefinition.filesV2 = {};
834034
834066
  }
@@ -845411,7 +845443,7 @@ var LegacyDocsPublisher = class {
845411
845443
  previewId,
845412
845444
  disableTemplates: void 0,
845413
845445
  skipUpload,
845414
- cliVersion: "4.107.1",
845446
+ cliVersion: "4.107.2",
845415
845447
  loginCommand: "fern auth login"
845416
845448
  });
845417
845449
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -881496,7 +881528,8 @@ var Comment6 = class extends AstNode6 {
881496
881528
  this.docs.split("\n").forEach((line) => {
881497
881529
  const wrappedLines = this.wrapLine(line, writer2);
881498
881530
  wrappedLines.forEach((wrappedLine) => {
881499
- writer2.writeLine(`# ${wrappedLine}`);
881531
+ const trimmed2 = wrappedLine.trimEnd();
881532
+ writer2.writeLine(trimmed2 === "" ? "#" : `# ${trimmed2}`);
881500
881533
  });
881501
881534
  });
881502
881535
  }
@@ -919528,10 +919561,15 @@ function processGeneratorGroups(groups2, maybeApiName, logger4) {
919528
919561
  for (const [groupName, group] of Object.entries(groups2)) {
919529
919562
  for (const [generatorName, generatorVersions] of Object.entries(group)) {
919530
919563
  logger4.debug(`Checking if ${generatorName} in group ${groupName} has an upgrade available...`);
919531
- const isUpgradeAvailable = isVersionAhead(
919532
- generatorVersions.latestVersion,
919533
- generatorVersions.previousVersion
919534
- );
919564
+ let isUpgradeAvailable;
919565
+ try {
919566
+ isUpgradeAvailable = isVersionAhead(generatorVersions.latestVersion, generatorVersions.previousVersion);
919567
+ } catch {
919568
+ throw new CliError({
919569
+ message: `Generator "${generatorName}" has an invalid version "${generatorVersions.previousVersion}" in generators.yml. Use an exact version like 1.2.3.`,
919570
+ code: CliError.Code.ConfigError
919571
+ });
919572
+ }
919535
919573
  logger4.debug(
919536
919574
  `Latest version: ${generatorVersions.latestVersion}. ` + (isUpgradeAvailable ? "Upgrade available." : "No upgrade available.")
919537
919575
  );
@@ -919640,7 +919678,7 @@ var CliContext = class _CliContext {
919640
919678
  if (false) {
919641
919679
  this.logger.error("CLI_VERSION is not defined");
919642
919680
  }
919643
- return "4.107.1";
919681
+ return "4.107.2";
919644
919682
  }
919645
919683
  getCliName() {
919646
919684
  if (false) {
@@ -928173,7 +928211,9 @@ async function resolvePreviewUrlFromId({
928173
928211
  const fernDirectory = await getFernDirectory();
928174
928212
  if (fernDirectory == null) {
928175
928213
  return cliContext.failAndThrow(
928176
- "No fern directory found. The --id flag requires a Fern project to resolve the organization.\nRun this command from within a Fern project directory, or use the URL argument instead."
928214
+ "No fern directory found. The --id flag requires a Fern project to resolve the organization.\nRun this command from within a Fern project directory, or use the URL argument instead.",
928215
+ void 0,
928216
+ { code: CliError.Code.ValidationError }
928177
928217
  );
928178
928218
  }
928179
928219
  const projectConfig = await cliContext.runTask(
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.107.1",
2
+ "version": "4.107.2",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",