@fern-api/fern-api-dev 5.92.3 → 5.93.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 +91 -17
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -32221,6 +32221,15 @@ var init_extractErrorMessage = __esm({
32221
32221
  }
32222
32222
  });
32223
32223
 
32224
+ // ../../commons/core-utils/lib/fernEnvVars.js
32225
+ var FERN_JAVA_SKIP_FORMATTING_ENV_VAR;
32226
+ var init_fernEnvVars = __esm({
32227
+ "../../commons/core-utils/lib/fernEnvVars.js"() {
32228
+ "use strict";
32229
+ FERN_JAVA_SKIP_FORMATTING_ENV_VAR = "FERN_JAVA_SKIP_FORMATTING";
32230
+ }
32231
+ });
32232
+
32224
32233
  // ../../commons/core-utils/lib/getDuplicates.js
32225
32234
  function getDuplicates(items) {
32226
32235
  const seen = /* @__PURE__ */ new Set();
@@ -32271,6 +32280,22 @@ var init_identity2 = __esm({
32271
32280
  }
32272
32281
  });
32273
32282
 
32283
+ // ../../commons/core-utils/lib/isEnvVarTruthy.js
32284
+ function isEnvVarTruthy(value2) {
32285
+ if (value2 == null) {
32286
+ return false;
32287
+ }
32288
+ const normalized = value2.trim().replace(/^["']|["']$/g, "").trim().toLowerCase();
32289
+ return TRUTHY_VALUES.has(normalized);
32290
+ }
32291
+ var TRUTHY_VALUES;
32292
+ var init_isEnvVarTruthy = __esm({
32293
+ "../../commons/core-utils/lib/isEnvVarTruthy.js"() {
32294
+ "use strict";
32295
+ TRUTHY_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
32296
+ }
32297
+ });
32298
+
32274
32299
  // ../../commons/core-utils/lib/isNonNullish.js
32275
32300
  function isNonNullish(x4) {
32276
32301
  return x4 != null;
@@ -44637,6 +44662,7 @@ __export(lib_exports, {
44637
44662
  EMPTY_ARRAY: () => EMPTY_ARRAY,
44638
44663
  EMPTY_OBJECT: () => EMPTY_OBJECT,
44639
44664
  Examples: () => examples_exports,
44665
+ FERN_JAVA_SKIP_FORMATTING_ENV_VAR: () => FERN_JAVA_SKIP_FORMATTING_ENV_VAR,
44640
44666
  MediaType: () => MediaType,
44641
44667
  PLATFORM: () => PLATFORM,
44642
44668
  SKIP_MARKER: () => SKIP_MARKER,
@@ -44658,6 +44684,7 @@ __export(lib_exports, {
44658
44684
  haveSameNullishness: () => haveSameNullishness,
44659
44685
  identity: () => identity2,
44660
44686
  isCommitSha: () => isCommitSha,
44687
+ isEnvVarTruthy: () => isEnvVarTruthy,
44661
44688
  isGitAvailable: () => isGitAvailable,
44662
44689
  isNonNullish: () => isNonNullish,
44663
44690
  isPlainObject: () => isPlainObject4,
@@ -44695,9 +44722,11 @@ var init_lib4 = __esm({
44695
44722
  init_empty();
44696
44723
  init_examples();
44697
44724
  init_extractErrorMessage();
44725
+ init_fernEnvVars();
44698
44726
  init_getDuplicates();
44699
44727
  init_gitUtils();
44700
44728
  init_identity2();
44729
+ init_isEnvVarTruthy();
44701
44730
  init_isNonNullish();
44702
44731
  init_mediaType();
44703
44732
  init_mergeWithOverrides();
@@ -453889,7 +453918,7 @@ function parseMarkdownImage(content5, start2, metadata) {
453889
453918
  }
453890
453919
  const urlEnd = i5 - 1;
453891
453920
  const url3 = content5.slice(urlStart, urlEnd).trim();
453892
- const rawSrc = trimAnchor(splitDestinationAndTitle(url3));
453921
+ const rawSrc = trimAnchor(unwrapDelimitedDestination(splitDestinationAndTitle(url3)).path);
453893
453922
  const src = rawSrc != null ? unescapeMarkdownUrl(rawSrc) : void 0;
453894
453923
  const resolvedPath = resolvePath5(src, metadata);
453895
453924
  if (rawSrc && src && resolvedPath) {
@@ -453926,6 +453955,12 @@ function splitDestinationAndTitle(url3) {
453926
453955
  const isTitle = title2.length >= 2 && (title2.startsWith('"') && title2.endsWith('"') || title2.startsWith("'") && title2.endsWith("'") || title2.startsWith("(") && title2.endsWith(")"));
453927
453956
  return isTitle ? url3.slice(0, i5) : url3;
453928
453957
  }
453958
+ function unwrapDelimitedDestination(destination) {
453959
+ if (destination.length >= 2 && destination.startsWith("<") && destination.endsWith(">")) {
453960
+ return { path: destination.slice(1, -1), wrapped: true };
453961
+ }
453962
+ return { path: destination, wrapped: false };
453963
+ }
453929
453964
  function parseMarkdownLink(content5, start2, metadata) {
453930
453965
  const len = content5.length;
453931
453966
  const labelEnd2 = findLabelEnd(content5, start2);
@@ -454370,18 +454405,20 @@ function replaceImagePathsAndUrls(markdown, fileIdsMap, markdownFilesToPathName,
454370
454405
  const href = content5.slice(urlStart, urlEnd).trim();
454371
454406
  const destination = splitDestinationAndTitle(href);
454372
454407
  const hrefTitle = href.slice(destination.length);
454373
- const trimmedHref = trimAnchor(destination) ?? destination;
454374
- const hrefAnchor = trimmedHref !== destination ? destination.slice(trimmedHref.length) : "";
454408
+ const { path: hrefPath, wrapped } = unwrapDelimitedDestination(destination);
454409
+ const trimmedHref = trimAnchor(hrefPath) ?? hrefPath;
454410
+ const hrefAnchor = trimmedHref !== hrefPath ? hrefPath.slice(trimmedHref.length) : "";
454375
454411
  const replacedHref = getReplacedHref({
454376
454412
  href: trimmedHref,
454377
454413
  markdownFilesToPathName,
454378
454414
  metadata
454379
454415
  });
454380
454416
  if (replacedHref && replacedHref.type === "replace") {
454417
+ const slug = replacedHref.slug + hrefAnchor;
454381
454418
  edits.push({
454382
454419
  start: urlStart,
454383
454420
  end: urlEnd,
454384
- replacement: replacedHref.slug + hrefAnchor + hrefTitle
454421
+ replacement: (wrapped ? `<${slug}>` : slug) + hrefTitle
454385
454422
  });
454386
454423
  }
454387
454424
  i5 = j5;
@@ -575076,6 +575113,23 @@ var require_dist21 = __commonJS({
575076
575113
  }
575077
575114
  });
575078
575115
 
575116
+ // ../generation/local-generation/docker-utils/lib/buildContainerEnvVars.js
575117
+ function buildContainerEnvVars({ envVars, processEnv }) {
575118
+ const forwardedEntries = FORWARDED_ENV_VARS.filter((name2) => envVars[name2] == null).map((name2) => [name2, processEnv[name2]]).filter((entry) => entry[1] != null && entry[1] !== "");
575119
+ return {
575120
+ envVars: { ...Object.fromEntries(forwardedEntries), ...envVars },
575121
+ forwardedFromHost: forwardedEntries.map(([name2]) => name2)
575122
+ };
575123
+ }
575124
+ var FORWARDED_ENV_VARS;
575125
+ var init_buildContainerEnvVars = __esm({
575126
+ "../generation/local-generation/docker-utils/lib/buildContainerEnvVars.js"() {
575127
+ "use strict";
575128
+ init_lib4();
575129
+ FORWARDED_ENV_VARS = ["FERN_STACK_TRACK", FERN_JAVA_SKIP_FORMATTING_ENV_VAR];
575130
+ }
575131
+ });
575132
+
575079
575133
  // ../generation/local-generation/docker-utils/lib/runDocker.js
575080
575134
  async function runContainer({ logger: logger4, imageName, args = [], binds = [], envVars = {}, ports = {}, writeLogsToFile = true, removeAfterCompletion = false, runner, pull = false, platform: platform4, signal }) {
575081
575135
  const tryRun = () => tryRunContainer({
@@ -575104,9 +575158,11 @@ async function runContainer({ logger: logger4, imageName, args = [], binds = [],
575104
575158
  }
575105
575159
  }
575106
575160
  async function tryRunContainer({ logger: logger4, imageName, args, binds, envVars = {}, ports = {}, removeAfterCompletion, writeLogsToFile, runner, pull = false, platform: platform4, signal }) {
575107
- if (process.env["FERN_STACK_TRACK"]) {
575108
- envVars["FERN_STACK_TRACK"] = process.env["FERN_STACK_TRACK"];
575109
- }
575161
+ const { envVars: containerEnvVars, forwardedFromHost } = buildContainerEnvVars({
575162
+ envVars,
575163
+ processEnv: process.env
575164
+ });
575165
+ logForwardedEnvVars({ logger: logger4, containerEnvVars, forwardedFromHost });
575110
575166
  const containerArgs = [
575111
575167
  "run",
575112
575168
  "--user",
@@ -575114,7 +575170,7 @@ async function tryRunContainer({ logger: logger4, imageName, args, binds, envVar
575114
575170
  ...pull ? ["--pull", "always"] : [],
575115
575171
  ...platform4 != null ? ["--platform", platform4] : [],
575116
575172
  ...binds.flatMap((bind5) => ["-v", bind5]),
575117
- ...Object.entries(envVars).flatMap(([key2, value2]) => ["-e", `${key2}="${value2}"`]),
575173
+ ...Object.entries(containerEnvVars).flatMap(([key2, value2]) => ["-e", `${key2}="${value2}"`]),
575118
575174
  ...Object.entries(ports).flatMap(([hostPort, containerPort]) => ["-p", `${hostPort}:${containerPort}`]),
575119
575175
  removeAfterCompletion ? "--rm" : "",
575120
575176
  imageName,
@@ -575144,6 +575200,16 @@ ${stdout}
575144
575200
  ${stderr}`);
575145
575201
  }
575146
575202
  }
575203
+ function logForwardedEnvVars({ logger: logger4, containerEnvVars, forwardedFromHost }) {
575204
+ for (const name2 of forwardedFromHost) {
575205
+ logger4.info(`Forwarding ${name2}=${containerEnvVars[name2]} into the generator container`);
575206
+ }
575207
+ for (const name2 of FORWARDED_ENV_VARS) {
575208
+ if (!forwardedFromHost.includes(name2) && containerEnvVars[name2] == null) {
575209
+ logger4.debug(`${name2} is not set on the host; not forwarding it into the generator container`);
575210
+ }
575211
+ }
575212
+ }
575147
575213
  async function pullImage(imageName, runner, signal) {
575148
575214
  await loggingExeca(void 0, runner ?? "docker", ["pull", imageName], {
575149
575215
  all: true,
@@ -575181,7 +575247,12 @@ ${stderr}`);
575181
575247
  }
575182
575248
  async function execInContainer({ logger: logger4, containerId, command: command3, runner, envVars = {}, writeLogsToFile = true, reject = true }) {
575183
575249
  const containerRunner = runner ?? "docker";
575184
- const envArgs = Object.entries(envVars).flatMap(([key2, value2]) => ["-e", `${key2}=${value2}`]);
575250
+ const { envVars: containerEnvVars, forwardedFromHost } = buildContainerEnvVars({
575251
+ envVars,
575252
+ processEnv: process.env
575253
+ });
575254
+ logForwardedEnvVars({ logger: logger4, containerEnvVars, forwardedFromHost });
575255
+ const envArgs = Object.entries(containerEnvVars).flatMap(([key2, value2]) => ["-e", `${key2}=${value2}`]);
575185
575256
  const { stdout, stderr, exitCode } = await loggingExeca(logger4, containerRunner, ["exec", "--user", "root", ...envArgs, containerId, ...command3], {
575186
575257
  reject: false,
575187
575258
  all: true,
@@ -575239,6 +575310,7 @@ var init_runDocker = __esm({
575239
575310
  init_lib18();
575240
575311
  import_promises112 = require("fs/promises");
575241
575312
  import_tmp_promise13 = __toESM(require_tmp_promise(), 1);
575313
+ init_buildContainerEnvVars();
575242
575314
  runDocker = runContainer;
575243
575315
  }
575244
575316
  });
@@ -702750,7 +702822,7 @@ var AccessTokenPosthogManager = class {
702750
702822
  properties: {
702751
702823
  ...event,
702752
702824
  ...event.properties,
702753
- version: "5.92.3",
702825
+ version: "5.93.0",
702754
702826
  usingAccessToken: true,
702755
702827
  ...getRunIdProperties()
702756
702828
  }
@@ -702816,7 +702888,7 @@ var UserPosthogManager = class {
702816
702888
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
702817
702889
  event: "CLI",
702818
702890
  properties: {
702819
- version: "5.92.3",
702891
+ version: "5.93.0",
702820
702892
  ...event,
702821
702893
  ...event.properties,
702822
702894
  usingAccessToken: false,
@@ -883982,7 +884054,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
883982
884054
  var LOGS_FOLDER_NAME = "logs";
883983
884055
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
883984
884056
  function getCliSource() {
883985
- const version7 = "5.92.3";
884057
+ const version7 = "5.93.0";
883986
884058
  return `cli@${version7}`;
883987
884059
  }
883988
884060
  var DebugLogger = class {
@@ -909298,7 +909370,7 @@ var LegacyDocsPublisher = class {
909298
909370
  previewId,
909299
909371
  disableTemplates: void 0,
909300
909372
  skipUpload,
909301
- cliVersion: "5.92.3",
909373
+ cliVersion: "5.93.0",
909302
909374
  loginCommand: "fern auth login"
909303
909375
  });
909304
909376
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -935699,6 +935771,7 @@ var DynamicSnippetsGoTestGenerator = class {
935699
935771
  };
935700
935772
 
935701
935773
  // ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/java/DynamicSnippetsJavaTestGenerator.js
935774
+ init_lib4();
935702
935775
  init_lib8();
935703
935776
 
935704
935777
  // ../../../generators/java-v2/dynamic-snippets/lib/context/DynamicSnippetsGeneratorContext.js
@@ -939615,10 +939688,11 @@ var DynamicSnippetsJavaTestGenerator = class {
939615
939688
  this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
939616
939689
  }
939617
939690
  }
939618
- this.context.logger.debug("Dynamic snippets test files generated, running spotlessApply...");
939691
+ const skipFormatting = isEnvVarTruthy(process.env[FERN_JAVA_SKIP_FORMATTING_ENV_VAR]);
939692
+ this.context.logger.debug(skipFormatting ? `Dynamic snippets test files generated, skipping spotlessApply because ${FERN_JAVA_SKIP_FORMATTING_ENV_VAR} is set` : "Dynamic snippets test files generated, running spotlessApply...");
939619
939693
  const gradlewPath = join8(outputDir, RelativeFilePath2.of("gradlew"));
939620
939694
  const gradlewExists = await doesPathExist(gradlewPath, "file");
939621
- if (gradlewExists) {
939695
+ if (gradlewExists && !skipFormatting) {
939622
939696
  try {
939623
939697
  const customConfig = this.generatorConfig.customConfig;
939624
939698
  const enableProfiling = customConfig?.["enable-gradle-profiling"] === true;
@@ -976214,7 +976288,7 @@ function getAutomationContextFromEnv() {
976214
976288
  config_branch: process.env.FERN_CONFIG_BRANCH,
976215
976289
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
976216
976290
  trigger: process.env.GITHUB_EVENT_NAME,
976217
- cli_version: "5.92.3"
976291
+ cli_version: "5.93.0"
976218
976292
  };
976219
976293
  }
976220
976294
  function isAutomationMode() {
@@ -977046,7 +977120,7 @@ var CliContext = class _CliContext {
977046
977120
  if (false) {
977047
977121
  this.logger.error("CLI_VERSION is not defined");
977048
977122
  }
977049
- return "5.92.3";
977123
+ return "5.93.0";
977050
977124
  }
977051
977125
  getCliName() {
977052
977126
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.92.3",
2
+ "version": "5.93.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",