@fern-api/fern-api-dev 5.23.3-1434-ge2b8af6d2b9 → 5.23.3-1439-g54567d57062
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.
- package/cli.cjs +99 -13
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -573335,9 +573335,9 @@ var require_diff3 = __commonJS({
|
|
|
573335
573335
|
}
|
|
573336
573336
|
});
|
|
573337
573337
|
|
|
573338
|
-
// ../../../node_modules/.pnpm/@fern-api+replay@0.19.
|
|
573338
|
+
// ../../../node_modules/.pnpm/@fern-api+replay@0.19.1/node_modules/@fern-api/replay/dist/index.cjs
|
|
573339
573339
|
var require_dist24 = __commonJS({
|
|
573340
|
-
"../../../node_modules/.pnpm/@fern-api+replay@0.19.
|
|
573340
|
+
"../../../node_modules/.pnpm/@fern-api+replay@0.19.1/node_modules/@fern-api/replay/dist/index.cjs"(exports2, module4) {
|
|
573341
573341
|
"use strict";
|
|
573342
573342
|
var __defProp5 = Object.defineProperty;
|
|
573343
573343
|
var __getOwnPropDesc4 = Object.getOwnPropertyDescriptor;
|
|
@@ -575379,6 +575379,47 @@ var require_dist24 = __commonJS({
|
|
|
575379
575379
|
}
|
|
575380
575380
|
var import_promises218 = require("fs/promises");
|
|
575381
575381
|
var import_node_path45 = require("path");
|
|
575382
|
+
var AUTOVERSION_PLACEHOLDERS = [
|
|
575383
|
+
"v0.0.0-fern-placeholder",
|
|
575384
|
+
// Go -- a superstring of the default; check first
|
|
575385
|
+
"0.0.0-fern-placeholder",
|
|
575386
|
+
// TS/Java/C#/Ruby/PHP/Rust/default
|
|
575387
|
+
"0.0.0.dev0"
|
|
575388
|
+
// Python (PEP 440 -- Poetry rejects hyphens)
|
|
575389
|
+
];
|
|
575390
|
+
var VERSION_TOKEN = /(?:v)?\d+\.\d+\.\d+[0-9A-Za-z.+-]*/g;
|
|
575391
|
+
var VERSION_MASK = "@@FERN_VERSION@@";
|
|
575392
|
+
function maskVersions(line) {
|
|
575393
|
+
return line.replace(VERSION_TOKEN, VERSION_MASK);
|
|
575394
|
+
}
|
|
575395
|
+
function containsPlaceholder(content5) {
|
|
575396
|
+
if (!content5) return false;
|
|
575397
|
+
return AUTOVERSION_PLACEHOLDERS.some((p6) => content5.includes(p6));
|
|
575398
|
+
}
|
|
575399
|
+
function remapManagedLines(genBase, target, theirs) {
|
|
575400
|
+
if (!containsPlaceholder(genBase)) return theirs;
|
|
575401
|
+
const managedMasks = /* @__PURE__ */ new Set();
|
|
575402
|
+
for (const line of genBase.split("\n")) {
|
|
575403
|
+
if (AUTOVERSION_PLACEHOLDERS.some((p6) => line.includes(p6))) managedMasks.add(maskVersions(line));
|
|
575404
|
+
}
|
|
575405
|
+
if (managedMasks.size === 0) return theirs;
|
|
575406
|
+
const targetByMask = /* @__PURE__ */ new Map();
|
|
575407
|
+
for (const line of target.split("\n")) {
|
|
575408
|
+
const mask2 = maskVersions(line);
|
|
575409
|
+
if (managedMasks.has(mask2) && !targetByMask.has(mask2)) targetByMask.set(mask2, line);
|
|
575410
|
+
}
|
|
575411
|
+
return theirs.split("\n").map((line) => {
|
|
575412
|
+
const mask2 = maskVersions(line);
|
|
575413
|
+
const replacement = managedMasks.has(mask2) ? targetByMask.get(mask2) : void 0;
|
|
575414
|
+
return replacement !== void 0 && replacement !== line ? replacement : line;
|
|
575415
|
+
}).join("\n");
|
|
575416
|
+
}
|
|
575417
|
+
function neutralizeAutoversionTheirs(genBase, theirs) {
|
|
575418
|
+
return remapManagedLines(genBase, genBase, theirs);
|
|
575419
|
+
}
|
|
575420
|
+
function alignAutoversionToOurs(genBase, ours, theirs) {
|
|
575421
|
+
return remapManagedLines(genBase, ours, theirs);
|
|
575422
|
+
}
|
|
575382
575423
|
async function runMergeAndRecord(args) {
|
|
575383
575424
|
const { plan, inputs, patch: patch5, accumulator } = args;
|
|
575384
575425
|
const { resolvedPath, metadata, oursPath, ours } = inputs;
|
|
@@ -575409,11 +575450,13 @@ var require_dist24 = __commonJS({
|
|
|
575409
575450
|
accumulator.recordMerge(resolvedPath, merged2.content, patch5.base_generation);
|
|
575410
575451
|
return { file: resolvedPath, status: "merged", ...unreachableFlag };
|
|
575411
575452
|
}
|
|
575412
|
-
const
|
|
575453
|
+
const mergeBase = inputs.base != null ? alignAutoversionToOurs(inputs.base, ours, plan.mergeBase) : plan.mergeBase;
|
|
575454
|
+
const theirs = inputs.base != null ? alignAutoversionToOurs(inputs.base, ours, plan.theirs) : plan.theirs;
|
|
575455
|
+
const merged = threeWayMerge(mergeBase, ours, theirs);
|
|
575413
575456
|
await (0, import_promises218.mkdir)((0, import_node_path45.dirname)(oursPath), { recursive: true });
|
|
575414
575457
|
await (0, import_promises218.writeFile)(oursPath, merged.content);
|
|
575415
575458
|
if (merged.hasConflicts) {
|
|
575416
|
-
accumulator.recordConflict(resolvedPath,
|
|
575459
|
+
accumulator.recordConflict(resolvedPath, theirs, patch5.base_generation);
|
|
575417
575460
|
return {
|
|
575418
575461
|
file: resolvedPath,
|
|
575419
575462
|
status: "conflict",
|
|
@@ -575422,7 +575465,7 @@ var require_dist24 = __commonJS({
|
|
|
575422
575465
|
conflictMetadata: metadata
|
|
575423
575466
|
};
|
|
575424
575467
|
}
|
|
575425
|
-
accumulator.recordMerge(resolvedPath,
|
|
575468
|
+
accumulator.recordMerge(resolvedPath, theirs, patch5.base_generation);
|
|
575426
575469
|
return {
|
|
575427
575470
|
file: resolvedPath,
|
|
575428
575471
|
status: "merged",
|
|
@@ -577186,7 +577229,9 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
577186
577229
|
if (baseChanged) repointed++;
|
|
577187
577230
|
continue;
|
|
577188
577231
|
}
|
|
577189
|
-
const
|
|
577232
|
+
const rawDiff = await this.git.exec(["diff", currentGenSha, "--", ...patch5.files]).catch(() => null);
|
|
577233
|
+
const neutralizedRebase = rawDiff != null && containsPlaceholder(rawDiff) ? await this.computeAutoversionNeutralizedRebase(patch5.files, currentGenSha) : null;
|
|
577234
|
+
const diff2 = neutralizedRebase ? neutralizedRebase.diff : rawDiff;
|
|
577190
577235
|
if (diff2 === null) continue;
|
|
577191
577236
|
if (!diff2.trim()) {
|
|
577192
577237
|
if (hasProtectedFiles) {
|
|
@@ -577242,7 +577287,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
577242
577287
|
patch5.base_generation = currentGenSha;
|
|
577243
577288
|
patch5.patch_content = diff2;
|
|
577244
577289
|
patch5.content_hash = newContentHash;
|
|
577245
|
-
const snapshot = await this.readSnapshotFromDisk(patch5.files);
|
|
577290
|
+
const snapshot = neutralizedRebase ? neutralizedRebase.snapshot : await this.readSnapshotFromDisk(patch5.files);
|
|
577246
577291
|
const snapshotIsNonEmpty = Object.keys(snapshot).length > 0;
|
|
577247
577292
|
if (snapshotIsNonEmpty) {
|
|
577248
577293
|
patch5.theirs_snapshot = snapshot;
|
|
@@ -577282,6 +577327,47 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
577282
577327
|
}
|
|
577283
577328
|
return snapshot;
|
|
577284
577329
|
}
|
|
577330
|
+
/**
|
|
577331
|
+
* Autoversion-aware replacement for the naive `git diff currentGen -- files`
|
|
577332
|
+
* + on-disk snapshot used when rebasing a cleanly-applied patch.
|
|
577333
|
+
*
|
|
577334
|
+
* The generation tree (BASE) still carries the placeholder on version lines
|
|
577335
|
+
* (autoversion runs after `[fern-generated]`), but the working tree holds
|
|
577336
|
+
* autoversion's resolved semver. A raw diff/snapshot would fold the
|
|
577337
|
+
* placeholder->semver swap into the customer's patch_content/theirs_snapshot,
|
|
577338
|
+
* pinning a stale version. This re-derives both against a version-neutralized
|
|
577339
|
+
* THEIRS so the pipeline-owned version line never enters the patch.
|
|
577340
|
+
*
|
|
577341
|
+
* Returns null when no file is under autoversion (fixed `--version`, i.e. no
|
|
577342
|
+
* placeholder in the generation tree) — callers keep their existing behavior.
|
|
577343
|
+
*/
|
|
577344
|
+
async computeAutoversionNeutralizedRebase(files, currentGenSha) {
|
|
577345
|
+
const genByFile = /* @__PURE__ */ new Map();
|
|
577346
|
+
let anyPlaceholder = false;
|
|
577347
|
+
for (const file4 of files) {
|
|
577348
|
+
const gen = await this.git.showFile(currentGenSha, file4).catch(() => null);
|
|
577349
|
+
genByFile.set(file4, gen);
|
|
577350
|
+
if (containsPlaceholder(gen)) anyPlaceholder = true;
|
|
577351
|
+
}
|
|
577352
|
+
if (!anyPlaceholder) return null;
|
|
577353
|
+
const snapshot = {};
|
|
577354
|
+
const fragments = [];
|
|
577355
|
+
for (const file4 of files) {
|
|
577356
|
+
if (isBinaryFile(file4)) continue;
|
|
577357
|
+
const disk = await (0, import_promises610.readFile)((0, import_node_path92.join)(this.outputDir, file4), "utf-8").catch(() => null);
|
|
577358
|
+
if (disk == null) continue;
|
|
577359
|
+
const gen = genByFile.get(file4) ?? null;
|
|
577360
|
+
const neutralized = gen != null ? neutralizeAutoversionTheirs(gen, disk) : disk;
|
|
577361
|
+
snapshot[file4] = neutralized;
|
|
577362
|
+
if (gen == null) {
|
|
577363
|
+
fragments.push(synthesizeNewFileDiff(file4, neutralized));
|
|
577364
|
+
} else if (gen !== neutralized) {
|
|
577365
|
+
const fileDiff = await unifiedDiff(gen, neutralized, file4);
|
|
577366
|
+
if (fileDiff.trim()) fragments.push(fileDiff);
|
|
577367
|
+
}
|
|
577368
|
+
}
|
|
577369
|
+
return { diff: fragments.join(""), snapshot };
|
|
577370
|
+
}
|
|
577285
577371
|
/**
|
|
577286
577372
|
* Detects autoversion contamination — returns true when a
|
|
577287
577373
|
* `[fern-autoversion]` commit between `fromSha` and `toSha` touched any
|
|
@@ -690812,7 +690898,7 @@ var AccessTokenPosthogManager = class {
|
|
|
690812
690898
|
properties: {
|
|
690813
690899
|
...event,
|
|
690814
690900
|
...event.properties,
|
|
690815
|
-
version: "5.23.3-
|
|
690901
|
+
version: "5.23.3-1439-g54567d57062",
|
|
690816
690902
|
usingAccessToken: true,
|
|
690817
690903
|
...getRunIdProperties()
|
|
690818
690904
|
}
|
|
@@ -690878,7 +690964,7 @@ var UserPosthogManager = class {
|
|
|
690878
690964
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
690879
690965
|
event: "CLI",
|
|
690880
690966
|
properties: {
|
|
690881
|
-
version: "5.23.3-
|
|
690967
|
+
version: "5.23.3-1439-g54567d57062",
|
|
690882
690968
|
...event,
|
|
690883
690969
|
...event.properties,
|
|
690884
690970
|
usingAccessToken: false,
|
|
@@ -871979,7 +872065,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
871979
872065
|
var LOGS_FOLDER_NAME = "logs";
|
|
871980
872066
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
871981
872067
|
function getCliSource() {
|
|
871982
|
-
const version7 = "5.23.3-
|
|
872068
|
+
const version7 = "5.23.3-1439-g54567d57062";
|
|
871983
872069
|
return `cli@${version7}`;
|
|
871984
872070
|
}
|
|
871985
872071
|
var DebugLogger = class {
|
|
@@ -904562,7 +904648,7 @@ var LegacyDocsPublisher = class {
|
|
|
904562
904648
|
previewId,
|
|
904563
904649
|
disableTemplates: void 0,
|
|
904564
904650
|
skipUpload,
|
|
904565
|
-
cliVersion: "5.23.3-
|
|
904651
|
+
cliVersion: "5.23.3-1439-g54567d57062",
|
|
904566
904652
|
loginCommand: "fern auth login"
|
|
904567
904653
|
});
|
|
904568
904654
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -971088,7 +971174,7 @@ function getAutomationContextFromEnv() {
|
|
|
971088
971174
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
971089
971175
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
971090
971176
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
971091
|
-
cli_version: "5.23.3-
|
|
971177
|
+
cli_version: "5.23.3-1439-g54567d57062"
|
|
971092
971178
|
};
|
|
971093
971179
|
}
|
|
971094
971180
|
function isAutomationMode() {
|
|
@@ -971920,7 +972006,7 @@ var CliContext = class _CliContext {
|
|
|
971920
972006
|
if (false) {
|
|
971921
972007
|
this.logger.error("CLI_VERSION is not defined");
|
|
971922
972008
|
}
|
|
971923
|
-
return "5.23.3-
|
|
972009
|
+
return "5.23.3-1439-g54567d57062";
|
|
971924
972010
|
}
|
|
971925
972011
|
getCliName() {
|
|
971926
972012
|
if (false) {
|
package/package.json
CHANGED