@fern-api/fern-api-dev 5.6.0 → 5.6.1
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 +565 -461
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -67641,8 +67641,8 @@ var require_graceful_fs = __commonJS({
|
|
|
67641
67641
|
fs29.createReadStream = createReadStream5;
|
|
67642
67642
|
fs29.createWriteStream = createWriteStream7;
|
|
67643
67643
|
var fs$readFile = fs29.readFile;
|
|
67644
|
-
fs29.readFile =
|
|
67645
|
-
function
|
|
67644
|
+
fs29.readFile = readFile112;
|
|
67645
|
+
function readFile112(path106, options2, cb) {
|
|
67646
67646
|
if (typeof options2 === "function")
|
|
67647
67647
|
cb = options2, options2 = null;
|
|
67648
67648
|
return go$readFile(path106, options2, cb);
|
|
@@ -294419,8 +294419,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
294419
294419
|
fs29.createReadStream = createReadStream5;
|
|
294420
294420
|
fs29.createWriteStream = createWriteStream7;
|
|
294421
294421
|
var fs$readFile = fs29.readFile;
|
|
294422
|
-
fs29.readFile =
|
|
294423
|
-
function
|
|
294422
|
+
fs29.readFile = readFile112;
|
|
294423
|
+
function readFile112(path106, options2, cb) {
|
|
294424
294424
|
if (typeof options2 === "function")
|
|
294425
294425
|
cb = options2, options2 = null;
|
|
294426
294426
|
return go$readFile(path106, options2, cb);
|
|
@@ -341210,7 +341210,7 @@ var require_dist14 = __commonJS({
|
|
|
341210
341210
|
}
|
|
341211
341211
|
};
|
|
341212
341212
|
var import_node_crypto7 = require("crypto");
|
|
341213
|
-
var
|
|
341213
|
+
var import_promises195 = require("fs/promises");
|
|
341214
341214
|
var import_node_os15 = require("os");
|
|
341215
341215
|
var import_node_path210 = require("path");
|
|
341216
341216
|
var import_minimatch8 = require_commonjs3();
|
|
@@ -341617,9 +341617,9 @@ var require_dist14 = __commonJS({
|
|
|
341617
341617
|
if (laterFiles.has(fileResult.file) || laterFiles.has(originalPath)) {
|
|
341618
341618
|
const filePath = (0, import_node_path210.join)(this.outputDir, fileResult.file);
|
|
341619
341619
|
try {
|
|
341620
|
-
const content5 = await (0,
|
|
341620
|
+
const content5 = await (0, import_promises195.readFile)(filePath, "utf-8");
|
|
341621
341621
|
const stripped = stripConflictMarkers(content5);
|
|
341622
|
-
await (0,
|
|
341622
|
+
await (0, import_promises195.writeFile)(filePath, stripped);
|
|
341623
341623
|
} catch {
|
|
341624
341624
|
}
|
|
341625
341625
|
}
|
|
@@ -341639,7 +341639,7 @@ var require_dist14 = __commonJS({
|
|
|
341639
341639
|
async populateAccumulatorForPatch(patch5, baseGen, currentTreeHash) {
|
|
341640
341640
|
const fileResults = [];
|
|
341641
341641
|
if (!baseGen) return fileResults;
|
|
341642
|
-
const tempDir2 = await (0,
|
|
341642
|
+
const tempDir2 = await (0, import_promises195.mkdtemp)((0, import_node_path210.join)((0, import_node_os15.tmpdir)(), "replay-acc-"));
|
|
341643
341643
|
const { GitClient: GitClient2 } = await Promise.resolve().then(() => (init_GitClient(), GitClient_exports));
|
|
341644
341644
|
const tempGit = new GitClient2(tempDir2);
|
|
341645
341645
|
await tempGit.exec(["init"]);
|
|
@@ -341653,7 +341653,7 @@ var require_dist14 = __commonJS({
|
|
|
341653
341653
|
const snapshotForFile = patch5.theirs_snapshot?.[resolvedPath] ?? patch5.theirs_snapshot?.[filePath];
|
|
341654
341654
|
const fileIsShared = this.sharedFiles.has(resolvedPath) || this.sharedFiles.has(filePath);
|
|
341655
341655
|
const theirs = !fileIsShared && snapshotForFile != null ? snapshotForFile : await this.applyPatchToContent(base4, patch5.patch_content, filePath, tempGit, tempDir2);
|
|
341656
|
-
const finalOnDisk = await (0,
|
|
341656
|
+
const finalOnDisk = await (0, import_promises195.readFile)((0, import_node_path210.join)(this.outputDir, resolvedPath), "utf-8").catch(() => null);
|
|
341657
341657
|
const effectiveTheirs = theirs ?? finalOnDisk;
|
|
341658
341658
|
if (effectiveTheirs != null) {
|
|
341659
341659
|
this.fileTheirsAccumulator.set(resolvedPath, {
|
|
@@ -341673,7 +341673,7 @@ var require_dist14 = __commonJS({
|
|
|
341673
341673
|
}
|
|
341674
341674
|
}
|
|
341675
341675
|
} finally {
|
|
341676
|
-
await (0,
|
|
341676
|
+
await (0, import_promises195.rm)(tempDir2, { recursive: true }).catch(() => {
|
|
341677
341677
|
});
|
|
341678
341678
|
}
|
|
341679
341679
|
return fileResults;
|
|
@@ -341703,7 +341703,7 @@ var require_dist14 = __commonJS({
|
|
|
341703
341703
|
const snapshots = /* @__PURE__ */ new Map();
|
|
341704
341704
|
for (const filePath of patch5.files) {
|
|
341705
341705
|
const fullPath = (0, import_node_path210.join)(this.outputDir, filePath);
|
|
341706
|
-
snapshots.set(filePath, await (0,
|
|
341706
|
+
snapshots.set(filePath, await (0, import_promises195.readFile)(fullPath, "utf-8").catch(() => null));
|
|
341707
341707
|
}
|
|
341708
341708
|
try {
|
|
341709
341709
|
await this.git.execWithInput(["apply", "--3way"], patch5.patch_content);
|
|
@@ -341719,9 +341719,9 @@ var require_dist14 = __commonJS({
|
|
|
341719
341719
|
for (const [filePath, content5] of snapshots) {
|
|
341720
341720
|
const fullPath = (0, import_node_path210.join)(this.outputDir, filePath);
|
|
341721
341721
|
if (content5 != null) {
|
|
341722
|
-
await (0,
|
|
341722
|
+
await (0, import_promises195.writeFile)(fullPath, content5);
|
|
341723
341723
|
} else {
|
|
341724
|
-
await (0,
|
|
341724
|
+
await (0, import_promises195.unlink)(fullPath).catch(() => {
|
|
341725
341725
|
});
|
|
341726
341726
|
}
|
|
341727
341727
|
}
|
|
@@ -341732,7 +341732,7 @@ var require_dist14 = __commonJS({
|
|
|
341732
341732
|
async applyWithThreeWayMerge(patch5) {
|
|
341733
341733
|
const fileResults = [];
|
|
341734
341734
|
const resolvedFiles = {};
|
|
341735
|
-
const tempDir2 = await (0,
|
|
341735
|
+
const tempDir2 = await (0, import_promises195.mkdtemp)((0, import_node_path210.join)((0, import_node_os15.tmpdir)(), "replay-"));
|
|
341736
341736
|
const { GitClient: GitClient2 } = await Promise.resolve().then(() => (init_GitClient(), GitClient_exports));
|
|
341737
341737
|
const tempGit = new GitClient2(tempDir2);
|
|
341738
341738
|
await tempGit.exec(["init"]);
|
|
@@ -341755,7 +341755,7 @@ var require_dist14 = __commonJS({
|
|
|
341755
341755
|
fileResults.push(result);
|
|
341756
341756
|
}
|
|
341757
341757
|
} finally {
|
|
341758
|
-
await (0,
|
|
341758
|
+
await (0, import_promises195.rm)(tempDir2, { recursive: true }).catch(() => {
|
|
341759
341759
|
});
|
|
341760
341760
|
}
|
|
341761
341761
|
const conflictFiles = fileResults.filter((r5) => r5.status === "conflict");
|
|
@@ -341796,7 +341796,7 @@ var require_dist14 = __commonJS({
|
|
|
341796
341796
|
}
|
|
341797
341797
|
}
|
|
341798
341798
|
const oursPath = (0, import_node_path210.join)(this.outputDir, resolvedPath);
|
|
341799
|
-
const ours = await (0,
|
|
341799
|
+
const ours = await (0, import_promises195.readFile)(oursPath, "utf-8").catch(() => null);
|
|
341800
341800
|
let ghostReconstructed = false;
|
|
341801
341801
|
let theirs = null;
|
|
341802
341802
|
if (!base4 && ours && !renameSourcePath) {
|
|
@@ -341909,15 +341909,15 @@ var require_dist14 = __commonJS({
|
|
|
341909
341909
|
baseGeneration: patch5.base_generation
|
|
341910
341910
|
});
|
|
341911
341911
|
const outDir2 = (0, import_node_path210.dirname)(oursPath);
|
|
341912
|
-
await (0,
|
|
341913
|
-
await (0,
|
|
341912
|
+
await (0, import_promises195.mkdir)(outDir2, { recursive: true });
|
|
341913
|
+
await (0, import_promises195.writeFile)(oursPath, effective_theirs);
|
|
341914
341914
|
return { file: resolvedPath, status: "merged", reason: "new-file" };
|
|
341915
341915
|
}
|
|
341916
341916
|
if (base4 == null && ours != null && effective_theirs != null && !useAccumulatorAsMergeBase) {
|
|
341917
341917
|
const merged2 = threeWayMerge("", ours, effective_theirs);
|
|
341918
341918
|
const outDir2 = (0, import_node_path210.dirname)(oursPath);
|
|
341919
|
-
await (0,
|
|
341920
|
-
await (0,
|
|
341919
|
+
await (0, import_promises195.mkdir)(outDir2, { recursive: true });
|
|
341920
|
+
await (0, import_promises195.writeFile)(oursPath, merged2.content);
|
|
341921
341921
|
if (merged2.hasConflicts) {
|
|
341922
341922
|
return {
|
|
341923
341923
|
file: resolvedPath,
|
|
@@ -341957,8 +341957,8 @@ var require_dist14 = __commonJS({
|
|
|
341957
341957
|
}
|
|
341958
341958
|
const merged = threeWayMerge(mergeBase, ours, effective_theirs);
|
|
341959
341959
|
const outDir = (0, import_node_path210.dirname)(oursPath);
|
|
341960
|
-
await (0,
|
|
341961
|
-
await (0,
|
|
341960
|
+
await (0, import_promises195.mkdir)(outDir, { recursive: true });
|
|
341961
|
+
await (0, import_promises195.writeFile)(oursPath, merged.content);
|
|
341962
341962
|
const populateAccumulator = effective_theirs != null && (!merged.hasConflicts || this.currentApplyMode === "resolve");
|
|
341963
341963
|
if (populateAccumulator) {
|
|
341964
341964
|
this.fileTheirsAccumulator.set(resolvedPath, {
|
|
@@ -342038,8 +342038,8 @@ var require_dist14 = __commonJS({
|
|
|
342038
342038
|
try {
|
|
342039
342039
|
if (sourceFilePath) {
|
|
342040
342040
|
const tempSourcePath = (0, import_node_path210.join)(tempDir2, sourceFilePath);
|
|
342041
|
-
await (0,
|
|
342042
|
-
await (0,
|
|
342041
|
+
await (0, import_promises195.mkdir)((0, import_node_path210.dirname)(tempSourcePath), { recursive: true });
|
|
342042
|
+
await (0, import_promises195.writeFile)(tempSourcePath, base4);
|
|
342043
342043
|
await tempGit.exec(["add", sourceFilePath]);
|
|
342044
342044
|
await tempGit.exec([
|
|
342045
342045
|
"commit",
|
|
@@ -342049,15 +342049,15 @@ var require_dist14 = __commonJS({
|
|
|
342049
342049
|
]);
|
|
342050
342050
|
await tempGit.execWithInput(["apply", "--allow-empty"], fileDiff);
|
|
342051
342051
|
const tempTargetPath = (0, import_node_path210.join)(tempDir2, filePath);
|
|
342052
|
-
return await (0,
|
|
342052
|
+
return await (0, import_promises195.readFile)(tempTargetPath, "utf-8");
|
|
342053
342053
|
}
|
|
342054
342054
|
const tempFilePath = (0, import_node_path210.join)(tempDir2, filePath);
|
|
342055
|
-
await (0,
|
|
342056
|
-
await (0,
|
|
342055
|
+
await (0, import_promises195.mkdir)((0, import_node_path210.dirname)(tempFilePath), { recursive: true });
|
|
342056
|
+
await (0, import_promises195.writeFile)(tempFilePath, base4);
|
|
342057
342057
|
await tempGit.exec(["add", filePath]);
|
|
342058
342058
|
await tempGit.exec(["commit", "-m", `base for ${filePath}`, "--allow-empty"]);
|
|
342059
342059
|
await tempGit.execWithInput(["apply", "--allow-empty"], fileDiff);
|
|
342060
|
-
return await (0,
|
|
342060
|
+
return await (0, import_promises195.readFile)(tempFilePath, "utf-8");
|
|
342061
342061
|
} catch {
|
|
342062
342062
|
return null;
|
|
342063
342063
|
}
|
|
@@ -342074,8 +342074,8 @@ var require_dist14 = __commonJS({
|
|
|
342074
342074
|
if (!fileDiff) return false;
|
|
342075
342075
|
try {
|
|
342076
342076
|
const tempFilePath = (0, import_node_path210.join)(tempDir2, filePath);
|
|
342077
|
-
await (0,
|
|
342078
|
-
await (0,
|
|
342077
|
+
await (0, import_promises195.mkdir)((0, import_node_path210.dirname)(tempFilePath), { recursive: true });
|
|
342078
|
+
await (0, import_promises195.writeFile)(tempFilePath, content5);
|
|
342079
342079
|
await tempGit.exec(["add", filePath]);
|
|
342080
342080
|
await tempGit.exec(["commit", "-m", `check already-applied ${filePath}`, "--allow-empty"]);
|
|
342081
342081
|
await tempGit.execWithInput(["apply", "--reverse", "--check", "--allow-empty"], fileDiff);
|
|
@@ -359219,7 +359219,7 @@ async function readFernYmlRaw(start2) {
|
|
|
359219
359219
|
for (let i9 = 0; i9 < 50; i9++) {
|
|
359220
359220
|
const candidate = (0, import_path83.resolve)(dir, "fern.yml");
|
|
359221
359221
|
try {
|
|
359222
|
-
const content5 = await (0,
|
|
359222
|
+
const content5 = await (0, import_promises116.readFile)(candidate, "utf-8");
|
|
359223
359223
|
const parsed = jsYaml.load(content5);
|
|
359224
359224
|
if (isRawFernYml(parsed)) {
|
|
359225
359225
|
return parsed;
|
|
@@ -359267,11 +359267,11 @@ function extractInstances(raw) {
|
|
|
359267
359267
|
}
|
|
359268
359268
|
return raw.docs.instances.flatMap((inst) => typeof inst?.url === "string" ? [inst.url] : []);
|
|
359269
359269
|
}
|
|
359270
|
-
var
|
|
359270
|
+
var import_promises116, import_path83;
|
|
359271
359271
|
var init_completion2 = __esm({
|
|
359272
359272
|
"../cli-v2/lib/completion.js"() {
|
|
359273
359273
|
"use strict";
|
|
359274
|
-
|
|
359274
|
+
import_promises116 = require("fs/promises");
|
|
359275
359275
|
init_js_yaml();
|
|
359276
359276
|
import_path83 = require("path");
|
|
359277
359277
|
}
|
|
@@ -360410,7 +360410,7 @@ var require_jsonfile = __commonJS({
|
|
|
360410
360410
|
}
|
|
360411
360411
|
return obj;
|
|
360412
360412
|
}
|
|
360413
|
-
var
|
|
360413
|
+
var readFile112 = universalify.fromPromise(_readFile);
|
|
360414
360414
|
function readFileSync19(file4, options2 = {}) {
|
|
360415
360415
|
if (typeof options2 === "string") {
|
|
360416
360416
|
options2 = { encoding: options2 };
|
|
@@ -360442,7 +360442,7 @@ var require_jsonfile = __commonJS({
|
|
|
360442
360442
|
return fs28.writeFileSync(file4, str3, options2);
|
|
360443
360443
|
}
|
|
360444
360444
|
module4.exports = {
|
|
360445
|
-
readFile:
|
|
360445
|
+
readFile: readFile112,
|
|
360446
360446
|
readFileSync: readFileSync19,
|
|
360447
360447
|
writeFile: writeFile93,
|
|
360448
360448
|
writeFileSync: writeFileSync9
|
|
@@ -423831,7 +423831,7 @@ async function unpackArchive(archivePath, folderPath) {
|
|
|
423831
423831
|
} else if (archivePath.endsWith(".tar.bz2")) {
|
|
423832
423832
|
await extractTar(archivePath, folderPath, "bzip2");
|
|
423833
423833
|
} else if (archivePath.endsWith(".dmg")) {
|
|
423834
|
-
await (0,
|
|
423834
|
+
await (0, import_promises126.mkdir)(folderPath);
|
|
423835
423835
|
await installDMG(archivePath, folderPath);
|
|
423836
423836
|
} else if (archivePath.endsWith(".exe")) {
|
|
423837
423837
|
const result = (0, import_node_child_process4.spawnSync)(archivePath, [`/ExtractDir=${folderPath}`], {
|
|
@@ -423920,7 +423920,7 @@ async function installDMG(dmgPath, folderPath) {
|
|
|
423920
423920
|
}
|
|
423921
423921
|
const mountPath = volumes[0];
|
|
423922
423922
|
try {
|
|
423923
|
-
const fileNames = await (0,
|
|
423923
|
+
const fileNames = await (0, import_promises126.readdir)(mountPath);
|
|
423924
423924
|
const appName = fileNames.find((item) => {
|
|
423925
423925
|
return typeof item === "string" && item.endsWith(".app");
|
|
423926
423926
|
});
|
|
@@ -423933,13 +423933,13 @@ async function installDMG(dmgPath, folderPath) {
|
|
|
423933
423933
|
(0, import_node_child_process4.spawnSync)("hdiutil", ["detach", mountPath, "-quiet"]);
|
|
423934
423934
|
}
|
|
423935
423935
|
}
|
|
423936
|
-
var import_node_child_process4, import_node_fs24,
|
|
423936
|
+
var import_node_child_process4, import_node_fs24, import_promises126, path85, import_node_stream6, import_debug8, debugFileUtil, internalConstantsForTesting;
|
|
423937
423937
|
var init_fileUtil = __esm({
|
|
423938
423938
|
"../../../node_modules/.pnpm/@puppeteer+browsers@2.13.0/node_modules/@puppeteer/browsers/lib/esm/fileUtil.js"() {
|
|
423939
423939
|
"use strict";
|
|
423940
423940
|
import_node_child_process4 = require("child_process");
|
|
423941
423941
|
import_node_fs24 = require("fs");
|
|
423942
|
-
|
|
423942
|
+
import_promises126 = require("fs/promises");
|
|
423943
423943
|
path85 = __toESM(require("path"), 1);
|
|
423944
423944
|
import_node_stream6 = require("stream");
|
|
423945
423945
|
import_debug8 = __toESM(require_src(), 1);
|
|
@@ -424002,7 +424002,7 @@ async function installWithProviders(options2) {
|
|
|
424002
424002
|
}
|
|
424003
424003
|
debugInstall(`Successfully got URL from ${provider.getName()}: ${url3}`);
|
|
424004
424004
|
if (!(0, import_node_fs25.existsSync)(browserRoot)) {
|
|
424005
|
-
await (0,
|
|
424005
|
+
await (0, import_promises127.mkdir)(browserRoot, { recursive: true });
|
|
424006
424006
|
}
|
|
424007
424007
|
return await installUrl(url3, options2, provider);
|
|
424008
424008
|
} catch (err) {
|
|
@@ -424075,7 +424075,7 @@ async function installUrl(url3, options2, provider) {
|
|
|
424075
424075
|
const browserRoot = cache2.browserRoot(options2.browser);
|
|
424076
424076
|
const archivePath = import_node_path34.default.join(browserRoot, `${options2.buildId}-${fileName}`);
|
|
424077
424077
|
if (!(0, import_node_fs25.existsSync)(browserRoot)) {
|
|
424078
|
-
await (0,
|
|
424078
|
+
await (0, import_promises127.mkdir)(browserRoot, { recursive: true });
|
|
424079
424079
|
}
|
|
424080
424080
|
if (!options2.unpack) {
|
|
424081
424081
|
if ((0, import_node_fs25.existsSync)(archivePath)) {
|
|
@@ -424139,7 +424139,7 @@ async function installUrl(url3, options2, provider) {
|
|
|
424139
424139
|
return installedBrowser;
|
|
424140
424140
|
} finally {
|
|
424141
424141
|
if ((0, import_node_fs25.existsSync)(archivePath)) {
|
|
424142
|
-
await (0,
|
|
424142
|
+
await (0, import_promises127.unlink)(archivePath);
|
|
424143
424143
|
}
|
|
424144
424144
|
}
|
|
424145
424145
|
}
|
|
@@ -424219,14 +424219,14 @@ function toMegabytes(bytes) {
|
|
|
424219
424219
|
const mb = bytes / 1e3 / 1e3;
|
|
424220
424220
|
return `${Math.round(mb * 10) / 10} MB`;
|
|
424221
424221
|
}
|
|
424222
|
-
var import_node_assert3, import_node_child_process5, import_node_fs25,
|
|
424222
|
+
var import_node_assert3, import_node_child_process5, import_node_fs25, import_promises127, import_node_os9, import_node_path34, import_progress, debugInstall, times;
|
|
424223
424223
|
var init_install = __esm({
|
|
424224
424224
|
"../../../node_modules/.pnpm/@puppeteer+browsers@2.13.0/node_modules/@puppeteer/browsers/lib/esm/install.js"() {
|
|
424225
424225
|
"use strict";
|
|
424226
424226
|
import_node_assert3 = __toESM(require("assert"), 1);
|
|
424227
424227
|
import_node_child_process5 = require("child_process");
|
|
424228
424228
|
import_node_fs25 = require("fs");
|
|
424229
|
-
|
|
424229
|
+
import_promises127 = require("fs/promises");
|
|
424230
424230
|
import_node_os9 = __toESM(require("os"), 1);
|
|
424231
424231
|
import_node_path34 = __toESM(require("path"), 1);
|
|
424232
424232
|
import_progress = __toESM(require_progress(), 1);
|
|
@@ -622565,7 +622565,7 @@ var AccessTokenPosthogManager = class {
|
|
|
622565
622565
|
properties: {
|
|
622566
622566
|
...event,
|
|
622567
622567
|
...event.properties,
|
|
622568
|
-
version: "5.6.
|
|
622568
|
+
version: "5.6.1",
|
|
622569
622569
|
usingAccessToken: true
|
|
622570
622570
|
}
|
|
622571
622571
|
});
|
|
@@ -622619,7 +622619,7 @@ var UserPosthogManager = class {
|
|
|
622619
622619
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
622620
622620
|
event: "CLI",
|
|
622621
622621
|
properties: {
|
|
622622
|
-
version: "5.6.
|
|
622622
|
+
version: "5.6.1",
|
|
622623
622623
|
...event,
|
|
622624
622624
|
...event.properties,
|
|
622625
622625
|
usingAccessToken: false,
|
|
@@ -841343,7 +841343,7 @@ var MDX_NODE_TYPES = [
|
|
|
841343
841343
|
"mdxTextExpression",
|
|
841344
841344
|
"mdxjsEsm"
|
|
841345
841345
|
];
|
|
841346
|
-
function collectLinksAndSources({ readFile:
|
|
841346
|
+
function collectLinksAndSources({ readFile: readFile112 = (path106) => (0, import_node_fs14.readFileSync)(path106, "utf-8"), ...opts }) {
|
|
841347
841347
|
const visitedAbsoluteFilepaths = /* @__PURE__ */ new Set();
|
|
841348
841348
|
const contentQueue = [opts];
|
|
841349
841349
|
const links = [];
|
|
@@ -841387,7 +841387,7 @@ function collectLinksAndSources({ readFile: readFile111 = (path106) => (0, impor
|
|
|
841387
841387
|
const resolvedImportPath = resolve6(dirname6(absoluteFilepath), importPath);
|
|
841388
841388
|
if (resolvedImportPath.endsWith(".mdx") || resolvedImportPath.endsWith(".md")) {
|
|
841389
841389
|
contentQueue.push({
|
|
841390
|
-
content:
|
|
841390
|
+
content: readFile112(resolvedImportPath),
|
|
841391
841391
|
absoluteFilepath: resolvedImportPath
|
|
841392
841392
|
});
|
|
841393
841393
|
}
|
|
@@ -841430,7 +841430,7 @@ function collectLinksAndSources({ readFile: readFile111 = (path106) => (0, impor
|
|
|
841430
841430
|
if (absoluteFilepath && typeof src === "string") {
|
|
841431
841431
|
const resolvedImportPath = resolve6(dirname6(absoluteFilepath), src);
|
|
841432
841432
|
contentQueue.push({
|
|
841433
|
-
content:
|
|
841433
|
+
content: readFile112(resolvedImportPath),
|
|
841434
841434
|
absoluteFilepath: resolvedImportPath
|
|
841435
841435
|
});
|
|
841436
841436
|
}
|
|
@@ -846880,7 +846880,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
846880
846880
|
var LOGS_FOLDER_NAME = "logs";
|
|
846881
846881
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
846882
846882
|
function getCliSource() {
|
|
846883
|
-
const version7 = "5.6.
|
|
846883
|
+
const version7 = "5.6.1";
|
|
846884
846884
|
return `cli@${version7}`;
|
|
846885
846885
|
}
|
|
846886
846886
|
var DebugLogger = class {
|
|
@@ -848619,7 +848619,7 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
|
|
|
848619
848619
|
let reloadTimer = null;
|
|
848620
848620
|
let isReloading = false;
|
|
848621
848621
|
const RELOAD_DEBOUNCE_MS = 1e3;
|
|
848622
|
-
function computeTranslatedDefinitions(result) {
|
|
848622
|
+
async function computeTranslatedDefinitions(result) {
|
|
848623
848623
|
const translations = /* @__PURE__ */ new Map();
|
|
848624
848624
|
const { docsDefinition, translationPages, translationNavigationOverlays, collectedFileIds, docsWorkspacePath } = result;
|
|
848625
848625
|
if (translationPages == null || Object.keys(translationPages).length === 0) {
|
|
@@ -848631,6 +848631,21 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
|
|
|
848631
848631
|
continue;
|
|
848632
848632
|
}
|
|
848633
848633
|
try {
|
|
848634
|
+
const resolveLocalePath = async (filepath) => {
|
|
848635
|
+
const relPath = relative4(docsWorkspacePath, filepath);
|
|
848636
|
+
const translatedPath = resolve6(docsWorkspacePath, RelativeFilePath2.of(`translations/${locale}/${relPath}`));
|
|
848637
|
+
return await doesPathExist(translatedPath) ? translatedPath : filepath;
|
|
848638
|
+
};
|
|
848639
|
+
const localeAwareMarkdownLoader = async (filepath) => {
|
|
848640
|
+
const pathToRead = await resolveLocalePath(filepath);
|
|
848641
|
+
const raw = await (0, import_promises85.readFile)(pathToRead, "utf-8");
|
|
848642
|
+
const fmMatch = raw.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);
|
|
848643
|
+
return fmMatch != null ? raw.slice(fmMatch[0].length) : raw;
|
|
848644
|
+
};
|
|
848645
|
+
const localeAwareFileLoader = async (filepath) => {
|
|
848646
|
+
const pathToRead = await resolveLocalePath(filepath);
|
|
848647
|
+
return (0, import_promises85.readFile)(pathToRead, "utf-8");
|
|
848648
|
+
};
|
|
848634
848649
|
const translatedPages = {};
|
|
848635
848650
|
for (const [pageId, page] of Object.entries(docsDefinition.pages)) {
|
|
848636
848651
|
if (page != null) {
|
|
@@ -848640,8 +848655,27 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
|
|
|
848640
848655
|
for (const [pagePath, rawMarkdown] of Object.entries(localePages)) {
|
|
848641
848656
|
try {
|
|
848642
848657
|
const basePage = translatedPages[pagePath];
|
|
848643
|
-
let processedMarkdown = stripMdxComments(rawMarkdown);
|
|
848644
848658
|
const absolutePathToMarkdownFile = resolve6(docsWorkspacePath, RelativeFilePath2.of(pagePath));
|
|
848659
|
+
const { markdown: markdownResolved } = await replaceReferencedMarkdown({
|
|
848660
|
+
markdown: rawMarkdown,
|
|
848661
|
+
absolutePathToFernFolder: docsWorkspacePath,
|
|
848662
|
+
absolutePathToMarkdownFile,
|
|
848663
|
+
context: context3,
|
|
848664
|
+
markdownLoader: localeAwareMarkdownLoader
|
|
848665
|
+
});
|
|
848666
|
+
const codeResolved = await replaceReferencedCode({
|
|
848667
|
+
markdown: markdownResolved,
|
|
848668
|
+
absolutePathToFernFolder: docsWorkspacePath,
|
|
848669
|
+
absolutePathToMarkdownFile,
|
|
848670
|
+
context: context3,
|
|
848671
|
+
fileLoader: localeAwareFileLoader
|
|
848672
|
+
});
|
|
848673
|
+
const importsResolved = transformAtPrefixImports({
|
|
848674
|
+
markdown: codeResolved,
|
|
848675
|
+
absolutePathToFernFolder: docsWorkspacePath,
|
|
848676
|
+
absolutePathToMarkdownFile
|
|
848677
|
+
});
|
|
848678
|
+
let processedMarkdown = stripMdxComments(importsResolved);
|
|
848645
848679
|
processedMarkdown = replaceImagePathsAndUrls(
|
|
848646
848680
|
processedMarkdown,
|
|
848647
848681
|
collectedFileIds,
|
|
@@ -848751,7 +848785,7 @@ ${err.stack}`);
|
|
|
848751
848785
|
};
|
|
848752
848786
|
previewResult = await reloadDocsDefinition();
|
|
848753
848787
|
if (previewResult != null) {
|
|
848754
|
-
translatedDefinitions = computeTranslatedDefinitions(previewResult);
|
|
848788
|
+
translatedDefinitions = await computeTranslatedDefinitions(previewResult);
|
|
848755
848789
|
if (translatedDefinitions.size > 0) {
|
|
848756
848790
|
context3.logger.info(`Computed translations for ${translatedDefinitions.size} locale(s)`);
|
|
848757
848791
|
}
|
|
@@ -848933,7 +848967,7 @@ ${err.stack}`);
|
|
|
848933
848967
|
if (reloadedPreviewResult != null) {
|
|
848934
848968
|
const slugChanges = slugTracker.updateAndDetectChanges(reloadedPreviewResult.docsDefinition);
|
|
848935
848969
|
previewResult = reloadedPreviewResult;
|
|
848936
|
-
translatedDefinitions = computeTranslatedDefinitions(reloadedPreviewResult);
|
|
848970
|
+
translatedDefinitions = await computeTranslatedDefinitions(reloadedPreviewResult);
|
|
848937
848971
|
if (translatedDefinitions.size > 0) {
|
|
848938
848972
|
context3.logger.debug(`Recomputed translations for ${translatedDefinitions.size} locale(s)`);
|
|
848939
848973
|
}
|
|
@@ -849028,6 +849062,7 @@ init_js();
|
|
|
849028
849062
|
init_lib6();
|
|
849029
849063
|
var import_cors2 = __toESM(require_lib14(), 1);
|
|
849030
849064
|
var import_express4 = __toESM(require_express3(), 1);
|
|
849065
|
+
var import_promises86 = require("fs/promises");
|
|
849031
849066
|
var import_http10 = __toESM(require("http"), 1);
|
|
849032
849067
|
var import_path61 = __toESM(require("path"), 1);
|
|
849033
849068
|
init_wrapper();
|
|
@@ -849122,7 +849157,7 @@ async function runPreviewServer({ initialProject, reloadProject, validateProject
|
|
|
849122
849157
|
let reloadTimer = null;
|
|
849123
849158
|
let isReloading = false;
|
|
849124
849159
|
const RELOAD_DEBOUNCE_MS = 1e3;
|
|
849125
|
-
function computeTranslatedDefinitions(result) {
|
|
849160
|
+
async function computeTranslatedDefinitions(result) {
|
|
849126
849161
|
const translations = /* @__PURE__ */ new Map();
|
|
849127
849162
|
const { docsDefinition, translationPages, translationNavigationOverlays, collectedFileIds, docsWorkspacePath } = result;
|
|
849128
849163
|
if (translationPages == null || Object.keys(translationPages).length === 0) {
|
|
@@ -849134,6 +849169,21 @@ async function runPreviewServer({ initialProject, reloadProject, validateProject
|
|
|
849134
849169
|
continue;
|
|
849135
849170
|
}
|
|
849136
849171
|
try {
|
|
849172
|
+
const resolveLocalePath = async (filepath) => {
|
|
849173
|
+
const relPath = relative4(docsWorkspacePath, filepath);
|
|
849174
|
+
const translatedPath = resolve6(docsWorkspacePath, RelativeFilePath2.of(`translations/${locale}/${relPath}`));
|
|
849175
|
+
return await doesPathExist(translatedPath) ? translatedPath : filepath;
|
|
849176
|
+
};
|
|
849177
|
+
const localeAwareMarkdownLoader = async (filepath) => {
|
|
849178
|
+
const pathToRead = await resolveLocalePath(filepath);
|
|
849179
|
+
const raw = await (0, import_promises86.readFile)(pathToRead, "utf-8");
|
|
849180
|
+
const fmMatch = raw.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);
|
|
849181
|
+
return fmMatch != null ? raw.slice(fmMatch[0].length) : raw;
|
|
849182
|
+
};
|
|
849183
|
+
const localeAwareFileLoader = async (filepath) => {
|
|
849184
|
+
const pathToRead = await resolveLocalePath(filepath);
|
|
849185
|
+
return (0, import_promises86.readFile)(pathToRead, "utf-8");
|
|
849186
|
+
};
|
|
849137
849187
|
const translatedPages = {};
|
|
849138
849188
|
for (const [pageId, page] of Object.entries(docsDefinition.pages)) {
|
|
849139
849189
|
if (page != null) {
|
|
@@ -849143,8 +849193,27 @@ async function runPreviewServer({ initialProject, reloadProject, validateProject
|
|
|
849143
849193
|
for (const [pagePath, rawMarkdown] of Object.entries(localePages)) {
|
|
849144
849194
|
try {
|
|
849145
849195
|
const basePage = translatedPages[pagePath];
|
|
849146
|
-
let processedMarkdown = stripMdxComments(rawMarkdown);
|
|
849147
849196
|
const absolutePathToMarkdownFile = resolve6(docsWorkspacePath, RelativeFilePath2.of(pagePath));
|
|
849197
|
+
const { markdown: markdownResolved } = await replaceReferencedMarkdown({
|
|
849198
|
+
markdown: rawMarkdown,
|
|
849199
|
+
absolutePathToFernFolder: docsWorkspacePath,
|
|
849200
|
+
absolutePathToMarkdownFile,
|
|
849201
|
+
context: context3,
|
|
849202
|
+
markdownLoader: localeAwareMarkdownLoader
|
|
849203
|
+
});
|
|
849204
|
+
const codeResolved = await replaceReferencedCode({
|
|
849205
|
+
markdown: markdownResolved,
|
|
849206
|
+
absolutePathToFernFolder: docsWorkspacePath,
|
|
849207
|
+
absolutePathToMarkdownFile,
|
|
849208
|
+
context: context3,
|
|
849209
|
+
fileLoader: localeAwareFileLoader
|
|
849210
|
+
});
|
|
849211
|
+
const importsResolved = transformAtPrefixImports({
|
|
849212
|
+
markdown: codeResolved,
|
|
849213
|
+
absolutePathToFernFolder: docsWorkspacePath,
|
|
849214
|
+
absolutePathToMarkdownFile
|
|
849215
|
+
});
|
|
849216
|
+
let processedMarkdown = stripMdxComments(importsResolved);
|
|
849148
849217
|
processedMarkdown = replaceImagePathsAndUrls(
|
|
849149
849218
|
processedMarkdown,
|
|
849150
849219
|
collectedFileIds,
|
|
@@ -849230,7 +849299,7 @@ ${err.stack}`);
|
|
|
849230
849299
|
};
|
|
849231
849300
|
previewResult = await reloadDocsDefinition();
|
|
849232
849301
|
if (previewResult != null) {
|
|
849233
|
-
translatedDefinitions = computeTranslatedDefinitions(previewResult);
|
|
849302
|
+
translatedDefinitions = await computeTranslatedDefinitions(previewResult);
|
|
849234
849303
|
if (translatedDefinitions.size > 0) {
|
|
849235
849304
|
context3.logger.info(`Computed translations for ${translatedDefinitions.size} locale(s)`);
|
|
849236
849305
|
}
|
|
@@ -849263,7 +849332,7 @@ ${err.stack}`);
|
|
|
849263
849332
|
const reloadedPreviewResult = await reloadDocsDefinition(editedAbsoluteFilepaths);
|
|
849264
849333
|
if (reloadedPreviewResult != null) {
|
|
849265
849334
|
previewResult = reloadedPreviewResult;
|
|
849266
|
-
translatedDefinitions = computeTranslatedDefinitions(reloadedPreviewResult);
|
|
849335
|
+
translatedDefinitions = await computeTranslatedDefinitions(reloadedPreviewResult);
|
|
849267
849336
|
if (translatedDefinitions.size > 0) {
|
|
849268
849337
|
context3.logger.debug(`Recomputed translations for ${translatedDefinitions.size} locale(s)`);
|
|
849269
849338
|
}
|
|
@@ -849478,7 +849547,7 @@ init_lib4();
|
|
|
849478
849547
|
init_lib4();
|
|
849479
849548
|
|
|
849480
849549
|
// ../generation/remote-generation/remote-workspace-runner/lib/automationMetadata.js
|
|
849481
|
-
var
|
|
849550
|
+
var import_promises87 = require("fs/promises");
|
|
849482
849551
|
function getOutputRepoUrl(generatorInvocation) {
|
|
849483
849552
|
return generatorInvocation.outputMode._visit({
|
|
849484
849553
|
downloadFiles: () => void 0,
|
|
@@ -849497,7 +849566,7 @@ function getOutputRepoUrl(generatorInvocation) {
|
|
|
849497
849566
|
async function findGeneratorLineNumber(absolutePathToGeneratorsYml, generatorName, occurrenceIndex) {
|
|
849498
849567
|
let content5;
|
|
849499
849568
|
try {
|
|
849500
|
-
content5 = await (0,
|
|
849569
|
+
content5 = await (0, import_promises87.readFile)(absolutePathToGeneratorsYml, "utf8");
|
|
849501
849570
|
} catch {
|
|
849502
849571
|
return void 0;
|
|
849503
849572
|
}
|
|
@@ -850314,7 +850383,7 @@ init_lib6();
|
|
|
850314
850383
|
|
|
850315
850384
|
// ../workspace/loader/lib/listFernFiles.js
|
|
850316
850385
|
init_lib6();
|
|
850317
|
-
var
|
|
850386
|
+
var import_promises88 = require("fs/promises");
|
|
850318
850387
|
async function listFernFiles2(root6, extensionGlob) {
|
|
850319
850388
|
const files = [];
|
|
850320
850389
|
for (const absoluteFilepath of await listFiles(root6, extensionGlob)) {
|
|
@@ -850329,7 +850398,7 @@ async function createFernFile2({ relativeFilepath, absoluteFilepath }) {
|
|
|
850329
850398
|
return {
|
|
850330
850399
|
relativeFilepath,
|
|
850331
850400
|
absoluteFilepath,
|
|
850332
|
-
fileContents: (await (0,
|
|
850401
|
+
fileContents: (await (0, import_promises88.readFile)(absoluteFilepath)).toString()
|
|
850333
850402
|
};
|
|
850334
850403
|
}
|
|
850335
850404
|
|
|
@@ -850636,7 +850705,7 @@ async function loadAPIWorkspace({ absolutePathToWorkspace, context: context3, cl
|
|
|
850636
850705
|
// ../workspace/loader/lib/loadDocsWorkspace.js
|
|
850637
850706
|
init_lib4();
|
|
850638
850707
|
init_lib6();
|
|
850639
|
-
var
|
|
850708
|
+
var import_promises89 = require("fs/promises");
|
|
850640
850709
|
init_js_yaml();
|
|
850641
850710
|
|
|
850642
850711
|
// ../workspace/loader/lib/docs-yml.schema.json
|
|
@@ -856787,7 +856856,7 @@ async function loadDocsConfiguration({ absolutePathToDocsDefinition, context: co
|
|
|
856787
856856
|
});
|
|
856788
856857
|
}
|
|
856789
856858
|
async function loadRawDocsConfiguration({ absolutePathOfConfiguration, context: context3 }) {
|
|
856790
|
-
const contentsStr = await (0,
|
|
856859
|
+
const contentsStr = await (0, import_promises89.readFile)(absolutePathOfConfiguration);
|
|
856791
856860
|
const contentsJson = jsYaml.load(contentsStr.toString());
|
|
856792
856861
|
const result = validateAgainstJsonSchema(contentsJson, docs_yml_schema_exports, {
|
|
856793
856862
|
filePath: absolutePathOfConfiguration
|
|
@@ -856824,8 +856893,8 @@ ${result.error?.message ?? "Unknown error"}`,
|
|
|
856824
856893
|
// ../generation/remote-generation/remote-workspace-runner/lib/downloadSnippetsForTask.js
|
|
856825
856894
|
init_lib6();
|
|
856826
856895
|
var import_fs30 = require("fs");
|
|
856827
|
-
var
|
|
856828
|
-
var
|
|
856896
|
+
var import_promises90 = require("fs/promises");
|
|
856897
|
+
var import_promises91 = require("stream/promises");
|
|
856829
856898
|
async function downloadSnippetsForTask({ snippetsS3PreSignedReadUrl, absolutePathToLocalSnippetJSON, context: context3 }) {
|
|
856830
856899
|
try {
|
|
856831
856900
|
await downloadFileForTask({
|
|
@@ -856842,10 +856911,10 @@ async function downloadFileForTask({ s3PreSignedReadUrl, absolutePathToLocalOutp
|
|
|
856842
856911
|
responseType: "stream"
|
|
856843
856912
|
});
|
|
856844
856913
|
if (await doesPathExist(absolutePathToLocalOutput)) {
|
|
856845
|
-
await (0,
|
|
856914
|
+
await (0, import_promises90.rm)(absolutePathToLocalOutput, { recursive: true });
|
|
856846
856915
|
}
|
|
856847
|
-
await (0,
|
|
856848
|
-
await (0,
|
|
856916
|
+
await (0, import_promises90.mkdir)(dirname6(absolutePathToLocalOutput), { recursive: true });
|
|
856917
|
+
await (0, import_promises91.pipeline)(request7.data, (0, import_fs30.createWriteStream)(absolutePathToLocalOutput));
|
|
856849
856918
|
}
|
|
856850
856919
|
|
|
856851
856920
|
// ../generation/remote-generation/remote-workspace-runner/lib/resolveAutoDiscoveredFernignorePath.js
|
|
@@ -856869,7 +856938,7 @@ init_js();
|
|
|
856869
856938
|
// ../generation/remote-generation/remote-workspace-runner/lib/createAndStartJob.js
|
|
856870
856939
|
init_lib6();
|
|
856871
856940
|
var import_form_data4 = __toESM(require_form_data(), 1);
|
|
856872
|
-
var
|
|
856941
|
+
var import_promises92 = require("fs/promises");
|
|
856873
856942
|
init_js_yaml();
|
|
856874
856943
|
var import_url_join23 = __toESM(require_url_join(), 1);
|
|
856875
856944
|
var import_util19 = require("util");
|
|
@@ -856926,7 +856995,7 @@ async function createAndStartJob({ projectConfig, workspace, organization, inter
|
|
|
856926
856995
|
fernignoreContents = "";
|
|
856927
856996
|
} else if (fernignorePath != null) {
|
|
856928
856997
|
try {
|
|
856929
|
-
fernignoreContents = await (0,
|
|
856998
|
+
fernignoreContents = await (0, import_promises92.readFile)(fernignorePath, "utf-8");
|
|
856930
856999
|
} catch (error50) {
|
|
856931
857000
|
context3.failAndThrow(`Failed to read fernignore file at ${fernignorePath}: ${error50}`, void 0, {
|
|
856932
857001
|
code: CliError.Code.ConfigError
|
|
@@ -857188,9 +857257,9 @@ init_lib4();
|
|
|
857188
857257
|
init_lib6();
|
|
857189
857258
|
init_lib10();
|
|
857190
857259
|
var import_fs31 = require("fs");
|
|
857191
|
-
var
|
|
857260
|
+
var import_promises93 = require("fs/promises");
|
|
857192
857261
|
var import_path62 = __toESM(require("path"), 1);
|
|
857193
|
-
var
|
|
857262
|
+
var import_promises94 = require("stream/promises");
|
|
857194
857263
|
|
|
857195
857264
|
// ../../../node_modules/.pnpm/terminal-link@3.0.0/node_modules/terminal-link/index.js
|
|
857196
857265
|
var import_supports_hyperlinks = __toESM(require_supports_hyperlinks(), 1);
|
|
@@ -857389,9 +857458,9 @@ async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutpu
|
|
|
857389
857458
|
});
|
|
857390
857459
|
const tmpDir = await import_tmp_promise10.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
857391
857460
|
const outputZipPath = import_path62.default.join(tmpDir.path, "output.zip");
|
|
857392
|
-
await (0,
|
|
857461
|
+
await (0, import_promises94.pipeline)(request7.data, (0, import_fs31.createWriteStream)(outputZipPath));
|
|
857393
857462
|
await forceRemoveDirectory(absolutePathToLocalOutput);
|
|
857394
|
-
await (0,
|
|
857463
|
+
await (0, import_promises93.mkdir)(absolutePathToLocalOutput, { recursive: true });
|
|
857395
857464
|
await extractZipToDirectory(outputZipPath, absolutePathToLocalOutput);
|
|
857396
857465
|
}
|
|
857397
857466
|
async function forceRemoveDirectory(dirPath) {
|
|
@@ -857399,22 +857468,22 @@ async function forceRemoveDirectory(dirPath) {
|
|
|
857399
857468
|
return;
|
|
857400
857469
|
}
|
|
857401
857470
|
await makeWritableRecursive(dirPath);
|
|
857402
|
-
await (0,
|
|
857471
|
+
await (0, import_promises93.rm)(dirPath, { recursive: true, force: true });
|
|
857403
857472
|
}
|
|
857404
857473
|
async function makeWritableRecursive(dirPath) {
|
|
857405
857474
|
try {
|
|
857406
|
-
const entries24 = await (0,
|
|
857475
|
+
const entries24 = await (0, import_promises93.readdir)(dirPath, { withFileTypes: true });
|
|
857407
857476
|
for (const entry of entries24) {
|
|
857408
857477
|
const fullPath = AbsoluteFilePath2.of(import_path62.default.join(dirPath, entry.name));
|
|
857409
857478
|
if (entry.isDirectory()) {
|
|
857410
857479
|
await makeWritableRecursive(fullPath);
|
|
857411
857480
|
}
|
|
857412
857481
|
try {
|
|
857413
|
-
await (0,
|
|
857482
|
+
await (0, import_promises93.chmod)(fullPath, 493);
|
|
857414
857483
|
} catch {
|
|
857415
857484
|
}
|
|
857416
857485
|
}
|
|
857417
|
-
await (0,
|
|
857486
|
+
await (0, import_promises93.chmod)(dirPath, 493);
|
|
857418
857487
|
} catch {
|
|
857419
857488
|
}
|
|
857420
857489
|
}
|
|
@@ -857460,7 +857529,7 @@ async function downloadFilesWithFernIgnoreInTempRepo({ s3PreSignedReadUrl, absol
|
|
|
857460
857529
|
const tmpOutputResolutionDir = AbsoluteFilePath2.of((await import_tmp_promise10.default.dir({})).path);
|
|
857461
857530
|
const absolutePathToFernignore = join8(absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME));
|
|
857462
857531
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
857463
|
-
await (0,
|
|
857532
|
+
await (0, import_promises93.cp)(absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
857464
857533
|
await runGitCommand(["init"], tmpOutputResolutionDir, context3);
|
|
857465
857534
|
await runGitCommand(["add", "."], tmpOutputResolutionDir, context3);
|
|
857466
857535
|
await runGitCommand([
|
|
@@ -857483,7 +857552,7 @@ async function downloadFilesWithFernIgnoreInTempRepo({ s3PreSignedReadUrl, absol
|
|
|
857483
857552
|
await runGitCommand(["restore", "."], tmpOutputResolutionDir, context3);
|
|
857484
857553
|
await forceRemoveDirectory(join8(tmpOutputResolutionDir, RelativeFilePath2.of(".git")));
|
|
857485
857554
|
await forceRemoveDirectory(absolutePathToLocalOutput);
|
|
857486
|
-
await (0,
|
|
857555
|
+
await (0, import_promises93.cp)(tmpOutputResolutionDir, absolutePathToLocalOutput, { recursive: true });
|
|
857487
857556
|
}
|
|
857488
857557
|
async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath }) {
|
|
857489
857558
|
const request7 = await axios_default.get(s3PreSignedReadUrl, {
|
|
@@ -857491,7 +857560,7 @@ async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath
|
|
|
857491
857560
|
});
|
|
857492
857561
|
const tmpDir = await import_tmp_promise10.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
857493
857562
|
const outputZipPath = import_path62.default.join(tmpDir.path, "output.zip");
|
|
857494
|
-
await (0,
|
|
857563
|
+
await (0, import_promises94.pipeline)(request7.data, (0, import_fs31.createWriteStream)(outputZipPath));
|
|
857495
857564
|
await extractZipToDirectory(outputZipPath, outputPath);
|
|
857496
857565
|
}
|
|
857497
857566
|
async function extractZipToDirectory(zipPath, outputDir) {
|
|
@@ -857506,10 +857575,10 @@ async function extractZipToDirectory(zipPath, outputDir) {
|
|
|
857506
857575
|
zipFile.on("entry", (entry) => {
|
|
857507
857576
|
const outputPath = import_path62.default.join(outputDir, entry.fileName);
|
|
857508
857577
|
if (entry.fileName.endsWith("/")) {
|
|
857509
|
-
(0,
|
|
857578
|
+
(0, import_promises93.mkdir)(outputPath, { recursive: true }).then(() => zipFile.readEntry()).catch(reject);
|
|
857510
857579
|
return;
|
|
857511
857580
|
}
|
|
857512
|
-
(0,
|
|
857581
|
+
(0, import_promises93.mkdir)(import_path62.default.dirname(outputPath), { recursive: true }).then(() => {
|
|
857513
857582
|
zipFile.openReadStream(entry, (streamErr, readStream2) => {
|
|
857514
857583
|
if (streamErr || !readStream2) {
|
|
857515
857584
|
reject(streamErr ?? new Error("Failed to open read stream"));
|
|
@@ -857527,7 +857596,7 @@ async function extractZipToDirectory(zipPath, outputDir) {
|
|
|
857527
857596
|
// ../generation/remote-generation/remote-workspace-runner/lib/SourceUploader.js
|
|
857528
857597
|
init_lib6();
|
|
857529
857598
|
init_lib10();
|
|
857530
|
-
var
|
|
857599
|
+
var import_promises95 = require("fs/promises");
|
|
857531
857600
|
var import_tmp_promise11 = __toESM(require_tmp_promise(), 1);
|
|
857532
857601
|
var PROTOBUF_ZIP_FILENAME = "proto.zip";
|
|
857533
857602
|
var SourceUploader = class {
|
|
@@ -857548,7 +857617,7 @@ var SourceUploader = class {
|
|
|
857548
857617
|
}
|
|
857549
857618
|
async uploadSource(source2, uploadURL) {
|
|
857550
857619
|
const uploadCommand = await this.getUploadCommand(source2);
|
|
857551
|
-
const fileData = await (0,
|
|
857620
|
+
const fileData = await (0, import_promises95.readFile)(uploadCommand.absoluteFilePath);
|
|
857552
857621
|
const response = await fetch(uploadURL, {
|
|
857553
857622
|
method: "PUT",
|
|
857554
857623
|
body: fileData,
|
|
@@ -857568,7 +857637,7 @@ var SourceUploader = class {
|
|
|
857568
857637
|
absoluteFilePath,
|
|
857569
857638
|
cleanup: async () => {
|
|
857570
857639
|
this.context.logger.debug(`Removing ${absoluteFilePath}`);
|
|
857571
|
-
await (0,
|
|
857640
|
+
await (0, import_promises95.unlink)(absoluteFilePath);
|
|
857572
857641
|
}
|
|
857573
857642
|
};
|
|
857574
857643
|
}
|
|
@@ -858145,7 +858214,7 @@ init_lib4();
|
|
|
858145
858214
|
init_js();
|
|
858146
858215
|
init_lib6();
|
|
858147
858216
|
var import_crypto8 = require("crypto");
|
|
858148
|
-
var
|
|
858217
|
+
var import_promises96 = require("fs/promises");
|
|
858149
858218
|
init_lodash();
|
|
858150
858219
|
var mime2 = __toESM(require_mime_types(), 1);
|
|
858151
858220
|
|
|
@@ -858224,7 +858293,7 @@ async function unlockDeploy({ fdrOrigin, token, domain: domain3, basepath }) {
|
|
|
858224
858293
|
}
|
|
858225
858294
|
}
|
|
858226
858295
|
async function calculateFileHash(absoluteFilePath) {
|
|
858227
|
-
const fileBuffer = await (0,
|
|
858296
|
+
const fileBuffer = await (0, import_promises96.readFile)(absoluteFilePath);
|
|
858228
858297
|
return (0, import_crypto8.createHash)("sha256").update(new Uint8Array(fileBuffer)).digest("hex");
|
|
858229
858298
|
}
|
|
858230
858299
|
function sanitizeRelativePathForS3(relativeFilePath) {
|
|
@@ -858553,44 +858622,79 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
858553
858622
|
try {
|
|
858554
858623
|
const collectedFileIds = resolver2.getCollectedFileIds();
|
|
858555
858624
|
const docsWorkspacePath = resolver2.getDocsWorkspacePath();
|
|
858625
|
+
const resolveLocalePath = async (filepath) => {
|
|
858626
|
+
const relPath = relative4(docsWorkspacePath, filepath);
|
|
858627
|
+
const translatedPath = resolve6(docsWorkspacePath, RelativeFilePath2.of(`translations/${locale}/${relPath}`));
|
|
858628
|
+
return await doesPathExist(translatedPath) ? translatedPath : filepath;
|
|
858629
|
+
};
|
|
858630
|
+
const localeAwareMarkdownLoader = async (filepath) => {
|
|
858631
|
+
const pathToRead = await resolveLocalePath(filepath);
|
|
858632
|
+
const raw = await (0, import_promises96.readFile)(pathToRead, "utf-8");
|
|
858633
|
+
const fmMatch = raw.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);
|
|
858634
|
+
return fmMatch != null ? raw.slice(fmMatch[0].length) : raw;
|
|
858635
|
+
};
|
|
858636
|
+
const localeAwareFileLoader = async (filepath) => {
|
|
858637
|
+
const pathToRead = await resolveLocalePath(filepath);
|
|
858638
|
+
return (0, import_promises96.readFile)(pathToRead, "utf-8");
|
|
858639
|
+
};
|
|
858640
|
+
const translatedPageEntries = await Promise.all(Object.entries(localePages).map(async ([path106, rawMarkdown]) => {
|
|
858641
|
+
try {
|
|
858642
|
+
const basePage = docsDefinition.pages[path106];
|
|
858643
|
+
const absolutePathToMarkdownFile = resolve6(docsWorkspacePath, RelativeFilePath2.of(path106));
|
|
858644
|
+
const { markdown: markdownResolved } = await replaceReferencedMarkdown({
|
|
858645
|
+
markdown: rawMarkdown,
|
|
858646
|
+
absolutePathToFernFolder: docsWorkspacePath,
|
|
858647
|
+
absolutePathToMarkdownFile,
|
|
858648
|
+
context: context3,
|
|
858649
|
+
markdownLoader: localeAwareMarkdownLoader
|
|
858650
|
+
});
|
|
858651
|
+
const codeResolved = await replaceReferencedCode({
|
|
858652
|
+
markdown: markdownResolved,
|
|
858653
|
+
absolutePathToFernFolder: docsWorkspacePath,
|
|
858654
|
+
absolutePathToMarkdownFile,
|
|
858655
|
+
context: context3,
|
|
858656
|
+
fileLoader: localeAwareFileLoader
|
|
858657
|
+
});
|
|
858658
|
+
const importsResolved = transformAtPrefixImports({
|
|
858659
|
+
markdown: codeResolved,
|
|
858660
|
+
absolutePathToFernFolder: docsWorkspacePath,
|
|
858661
|
+
absolutePathToMarkdownFile
|
|
858662
|
+
});
|
|
858663
|
+
let processedMarkdown = stripMdxComments(importsResolved);
|
|
858664
|
+
processedMarkdown = replaceImagePathsAndUrls(
|
|
858665
|
+
processedMarkdown,
|
|
858666
|
+
collectedFileIds,
|
|
858667
|
+
{},
|
|
858668
|
+
// markdownFilesToPathName not needed for translations
|
|
858669
|
+
{
|
|
858670
|
+
absolutePathToMarkdownFile,
|
|
858671
|
+
absolutePathToFernFolder: docsWorkspacePath
|
|
858672
|
+
},
|
|
858673
|
+
context3
|
|
858674
|
+
);
|
|
858675
|
+
let editThisPageUrl = basePage?.editThisPageUrl;
|
|
858676
|
+
if (editThisPageUrl != null) {
|
|
858677
|
+
const fernPathPattern = `/fern/${path106}`;
|
|
858678
|
+
const translatedPath = `/fern/translations/${locale}/${path106}`;
|
|
858679
|
+
editThisPageUrl = editThisPageUrl.replace(fernPathPattern, translatedPath);
|
|
858680
|
+
}
|
|
858681
|
+
return [
|
|
858682
|
+
path106,
|
|
858683
|
+
{
|
|
858684
|
+
markdown: processedMarkdown,
|
|
858685
|
+
rawMarkdown: processedMarkdown,
|
|
858686
|
+
editThisPageUrl,
|
|
858687
|
+
editThisPageLaunch: basePage?.editThisPageLaunch
|
|
858688
|
+
}
|
|
858689
|
+
];
|
|
858690
|
+
} catch (pageError) {
|
|
858691
|
+
context3.logger.warn(`Failed to process translated page "${path106}" for locale "${locale}": ${String(pageError)}. Falling back to base page.`);
|
|
858692
|
+
return void 0;
|
|
858693
|
+
}
|
|
858694
|
+
}));
|
|
858556
858695
|
const translatedPages = {
|
|
858557
858696
|
...docsDefinition.pages,
|
|
858558
|
-
...Object.fromEntries(
|
|
858559
|
-
try {
|
|
858560
|
-
const basePage = docsDefinition.pages[path106];
|
|
858561
|
-
let processedMarkdown = stripMdxComments(rawMarkdown);
|
|
858562
|
-
const absolutePathToMarkdownFile = resolve6(docsWorkspacePath, RelativeFilePath2.of(path106));
|
|
858563
|
-
processedMarkdown = replaceImagePathsAndUrls(
|
|
858564
|
-
processedMarkdown,
|
|
858565
|
-
collectedFileIds,
|
|
858566
|
-
{},
|
|
858567
|
-
// markdownFilesToPathName not needed for translations
|
|
858568
|
-
{
|
|
858569
|
-
absolutePathToMarkdownFile,
|
|
858570
|
-
absolutePathToFernFolder: docsWorkspacePath
|
|
858571
|
-
},
|
|
858572
|
-
context3
|
|
858573
|
-
);
|
|
858574
|
-
let editThisPageUrl = basePage?.editThisPageUrl;
|
|
858575
|
-
if (editThisPageUrl != null) {
|
|
858576
|
-
const fernPathPattern = `/fern/${path106}`;
|
|
858577
|
-
const translatedPath = `/fern/translations/${locale}/${path106}`;
|
|
858578
|
-
editThisPageUrl = editThisPageUrl.replace(fernPathPattern, translatedPath);
|
|
858579
|
-
}
|
|
858580
|
-
return [
|
|
858581
|
-
path106,
|
|
858582
|
-
{
|
|
858583
|
-
markdown: processedMarkdown,
|
|
858584
|
-
rawMarkdown: processedMarkdown,
|
|
858585
|
-
editThisPageUrl,
|
|
858586
|
-
editThisPageLaunch: basePage?.editThisPageLaunch
|
|
858587
|
-
}
|
|
858588
|
-
];
|
|
858589
|
-
} catch (pageError) {
|
|
858590
|
-
context3.logger.warn(`Failed to process translated page "${path106}" for locale "${locale}": ${String(pageError)}. Falling back to base page.`);
|
|
858591
|
-
return void 0;
|
|
858592
|
-
}
|
|
858593
|
-
}).filter((entry) => entry != null))
|
|
858697
|
+
...Object.fromEntries(translatedPageEntries.filter((entry) => entry != null))
|
|
858594
858698
|
};
|
|
858595
858699
|
let updatedRoot = applyTranslatedFrontmatterToNavTree(
|
|
858596
858700
|
docsDefinition.config.root,
|
|
@@ -858693,7 +858797,7 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context3, batchSize
|
|
|
858693
858797
|
try {
|
|
858694
858798
|
const uploadUrl = extractUploadUrl(urlValue);
|
|
858695
858799
|
const mimeType = mime2.lookup(absoluteFilePath);
|
|
858696
|
-
await axios_default.put(uploadUrl, await (0,
|
|
858800
|
+
await axios_default.put(uploadUrl, await (0, import_promises96.readFile)(absoluteFilePath), {
|
|
858697
858801
|
headers: {
|
|
858698
858802
|
"Content-Type": mimeType === false ? "application/octet-stream" : mimeType,
|
|
858699
858803
|
// Set max cache control for S3 uploads
|
|
@@ -859348,7 +859452,7 @@ var LegacyDocsPublisher = class {
|
|
|
859348
859452
|
previewId,
|
|
859349
859453
|
disableTemplates: void 0,
|
|
859350
859454
|
skipUpload,
|
|
859351
|
-
cliVersion: "5.6.
|
|
859455
|
+
cliVersion: "5.6.1",
|
|
859352
859456
|
loginCommand: "fern auth login"
|
|
859353
859457
|
});
|
|
859354
859458
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -860319,7 +860423,7 @@ function addDocsCommand(cli) {
|
|
|
860319
860423
|
// ../cli-v2/lib/commands/init/command.js
|
|
860320
860424
|
init_lib4();
|
|
860321
860425
|
init_lib6();
|
|
860322
|
-
var
|
|
860426
|
+
var import_promises97 = require("fs/promises");
|
|
860323
860427
|
var import_path64 = __toESM(require("path"), 1);
|
|
860324
860428
|
|
|
860325
860429
|
// ../cli-v2/lib/config/fern-yml/FernYmlBuilder.js
|
|
@@ -861198,7 +861302,7 @@ var InitCommand = class {
|
|
|
861198
861302
|
apiPath,
|
|
861199
861303
|
defaultGroup: result.defaultGroup
|
|
861200
861304
|
});
|
|
861201
|
-
await (0,
|
|
861305
|
+
await (0, import_promises97.writeFile)(fernYmlPath, fernYmlContent, "utf-8");
|
|
861202
861306
|
context3.stderr.info(`
|
|
861203
861307
|
${Icons.success} Created ${FERN_YML_FILENAME}`);
|
|
861204
861308
|
}
|
|
@@ -861220,9 +861324,9 @@ var InitCommand = class {
|
|
|
861220
861324
|
}
|
|
861221
861325
|
async writeSpecFile(cwd2, filename, content5) {
|
|
861222
861326
|
const specsDir = join8(cwd2, RelativeFilePath2.of(SPECS_DIR));
|
|
861223
|
-
await (0,
|
|
861327
|
+
await (0, import_promises97.mkdir)(specsDir, { recursive: true });
|
|
861224
861328
|
const filePath = join8(specsDir, RelativeFilePath2.of(filename));
|
|
861225
|
-
await (0,
|
|
861329
|
+
await (0, import_promises97.writeFile)(filePath, content5, "utf-8");
|
|
861226
861330
|
}
|
|
861227
861331
|
resolveApiPath(apiSource) {
|
|
861228
861332
|
switch (apiSource.type) {
|
|
@@ -862624,12 +862728,12 @@ function addCheckCommand4(cli) {
|
|
|
862624
862728
|
// ../cli-v2/lib/commands/sdk/generate/command.js
|
|
862625
862729
|
init_lib4();
|
|
862626
862730
|
init_lib6();
|
|
862627
|
-
var
|
|
862731
|
+
var import_promises114 = require("fs/promises");
|
|
862628
862732
|
init_js_yaml();
|
|
862629
862733
|
|
|
862630
862734
|
// ../cli-v2/lib/api/resolver/ApiSpecResolver.js
|
|
862631
862735
|
init_lib6();
|
|
862632
|
-
var
|
|
862736
|
+
var import_promises98 = require("fs/promises");
|
|
862633
862737
|
var import_os11 = require("os");
|
|
862634
862738
|
var import_path68 = __toESM(require("path"), 1);
|
|
862635
862739
|
|
|
@@ -862695,9 +862799,9 @@ var ApiSpecResolver = class {
|
|
|
862695
862799
|
async resolveUrl({ reference: reference4 }) {
|
|
862696
862800
|
const { content: content5, contentType } = await this.fetchContent({ url: reference4 });
|
|
862697
862801
|
const extension4 = this.inferExtension({ url: reference4, contentType });
|
|
862698
|
-
const tempDir2 = await (0,
|
|
862802
|
+
const tempDir2 = await (0, import_promises98.mkdtemp)(import_path68.default.join((0, import_os11.tmpdir)(), "fern-"));
|
|
862699
862803
|
const absoluteFilePath = AbsoluteFilePath2.of(import_path68.default.join(tempDir2, `spec${extension4}`));
|
|
862700
|
-
await (0,
|
|
862804
|
+
await (0, import_promises98.writeFile)(absoluteFilePath, content5, "utf-8");
|
|
862701
862805
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
862702
862806
|
return {
|
|
862703
862807
|
absoluteFilePath,
|
|
@@ -862713,7 +862817,7 @@ var ApiSpecResolver = class {
|
|
|
862713
862817
|
code: CliError.Code.ConfigError
|
|
862714
862818
|
});
|
|
862715
862819
|
}
|
|
862716
|
-
const content5 = await (0,
|
|
862820
|
+
const content5 = await (0, import_promises98.readFile)(absoluteFilePath, "utf-8");
|
|
862717
862821
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
862718
862822
|
return {
|
|
862719
862823
|
absoluteFilePath,
|
|
@@ -862784,7 +862888,7 @@ init_lib6();
|
|
|
862784
862888
|
|
|
862785
862889
|
// ../generation/local-generation/docker-utils/lib/runDocker.js
|
|
862786
862890
|
init_lib10();
|
|
862787
|
-
var
|
|
862891
|
+
var import_promises99 = require("fs/promises");
|
|
862788
862892
|
var import_tmp_promise12 = __toESM(require_tmp_promise(), 1);
|
|
862789
862893
|
async function runContainer({ logger: logger4, imageName, args = [], binds = [], envVars = {}, ports = {}, writeLogsToFile = true, removeAfterCompletion = false, runner, signal }) {
|
|
862790
862894
|
const tryRun = () => tryRunContainer({
|
|
@@ -862835,7 +862939,7 @@ async function tryRunContainer({ logger: logger4, imageName, args, binds, envVar
|
|
|
862835
862939
|
const logs4 = stdout + stderr;
|
|
862836
862940
|
if (writeLogsToFile) {
|
|
862837
862941
|
const tmpFile = await import_tmp_promise12.default.file();
|
|
862838
|
-
await (0,
|
|
862942
|
+
await (0, import_promises99.writeFile)(tmpFile.path, logs4);
|
|
862839
862943
|
logger4.info(`Generator logs here: ${tmpFile.path}`);
|
|
862840
862944
|
}
|
|
862841
862945
|
if (exitCode == null) {
|
|
@@ -881435,7 +881539,7 @@ var DynamicSnippetsGenerator = class extends AbstractDynamicSnippetsGenerator {
|
|
|
881435
881539
|
|
|
881436
881540
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/csharp/DynamicSnippetsCsharpTestGenerator.js
|
|
881437
881541
|
init_lib6();
|
|
881438
|
-
var
|
|
881542
|
+
var import_promises100 = require("fs/promises");
|
|
881439
881543
|
var import_path70 = __toESM(require("path"), 1);
|
|
881440
881544
|
|
|
881441
881545
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/utils/convertEndpointSnippetRequest.js
|
|
@@ -881567,8 +881671,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
881567
881671
|
endpointId
|
|
881568
881672
|
});
|
|
881569
881673
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
881570
|
-
await (0,
|
|
881571
|
-
await (0,
|
|
881674
|
+
await (0, import_promises100.mkdir)(import_path70.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
881675
|
+
await (0, import_promises100.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
881572
881676
|
} catch (error50) {
|
|
881573
881677
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
881574
881678
|
}
|
|
@@ -881577,8 +881681,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
881577
881681
|
}
|
|
881578
881682
|
async initializeProject(outputDir) {
|
|
881579
881683
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Snippets"));
|
|
881580
|
-
await (0,
|
|
881581
|
-
await (0,
|
|
881684
|
+
await (0, import_promises100.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
881685
|
+
await (0, import_promises100.writeFile)(join8(absolutePathToOutputDir, RelativeFilePath2.of("Snippets.csproj")), PROJECT_FILE_CONTENT);
|
|
881582
881686
|
return absolutePathToOutputDir;
|
|
881583
881687
|
}
|
|
881584
881688
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -885030,7 +885134,7 @@ var DynamicSnippetsGenerator2 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
885030
885134
|
};
|
|
885031
885135
|
|
|
885032
885136
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/go/DynamicSnippetsGoTestGenerator.js
|
|
885033
|
-
var
|
|
885137
|
+
var import_promises101 = require("fs/promises");
|
|
885034
885138
|
var import_path72 = __toESM(require("path"), 1);
|
|
885035
885139
|
var DynamicSnippetsGoTestGenerator = class {
|
|
885036
885140
|
context;
|
|
@@ -885059,8 +885163,8 @@ var DynamicSnippetsGoTestGenerator = class {
|
|
|
885059
885163
|
endpointId
|
|
885060
885164
|
});
|
|
885061
885165
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
885062
|
-
await (0,
|
|
885063
|
-
await (0,
|
|
885166
|
+
await (0, import_promises101.mkdir)(import_path72.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
885167
|
+
await (0, import_promises101.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
885064
885168
|
} catch (error50) {
|
|
885065
885169
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
885066
885170
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -888455,7 +888559,7 @@ var DynamicSnippetsGenerator3 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
888455
888559
|
|
|
888456
888560
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/java/DynamicSnippetsJavaTestGenerator.js
|
|
888457
888561
|
init_lib10();
|
|
888458
|
-
var
|
|
888562
|
+
var import_promises102 = require("fs/promises");
|
|
888459
888563
|
var import_path73 = __toESM(require("path"), 1);
|
|
888460
888564
|
var DynamicSnippetsJavaTestGenerator = class {
|
|
888461
888565
|
context;
|
|
@@ -888490,8 +888594,8 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
888490
888594
|
endpointId
|
|
888491
888595
|
});
|
|
888492
888596
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
888493
|
-
await (0,
|
|
888494
|
-
await (0,
|
|
888597
|
+
await (0, import_promises102.mkdir)(import_path73.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
888598
|
+
await (0, import_promises102.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
888495
888599
|
} catch (error50) {
|
|
888496
888600
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
888497
888601
|
}
|
|
@@ -888518,7 +888622,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
888518
888622
|
const reportsPath = join8(outputDir, RelativeFilePath2.of("reports"));
|
|
888519
888623
|
const buildReportsExists = await doesPathExist(buildReportsPath, "directory");
|
|
888520
888624
|
if (buildReportsExists) {
|
|
888521
|
-
await (0,
|
|
888625
|
+
await (0, import_promises102.cp)(buildReportsPath, reportsPath, { recursive: true });
|
|
888522
888626
|
this.context.logger.info("Gradle profiling report copied to reports/");
|
|
888523
888627
|
} else {
|
|
888524
888628
|
this.context.logger.info("No profiling report found in build/reports/");
|
|
@@ -888532,7 +888636,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
888532
888636
|
}
|
|
888533
888637
|
async initializeProject(outputDir) {
|
|
888534
888638
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("src/main/java/com/snippets"));
|
|
888535
|
-
await (0,
|
|
888639
|
+
await (0, import_promises102.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
888536
888640
|
return absolutePathToOutputDir;
|
|
888537
888641
|
}
|
|
888538
888642
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -891997,7 +892101,7 @@ var DynamicSnippetsGenerator4 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
891997
892101
|
};
|
|
891998
892102
|
|
|
891999
892103
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/php/DynamicSnippetsPhpTestGenerator.js
|
|
892000
|
-
var
|
|
892104
|
+
var import_promises103 = require("fs/promises");
|
|
892001
892105
|
var import_path74 = __toESM(require("path"), 1);
|
|
892002
892106
|
var DynamicSnippetsPhpTestGenerator = class {
|
|
892003
892107
|
context;
|
|
@@ -892026,8 +892130,8 @@ var DynamicSnippetsPhpTestGenerator = class {
|
|
|
892026
892130
|
endpointId
|
|
892027
892131
|
});
|
|
892028
892132
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
892029
|
-
await (0,
|
|
892030
|
-
await (0,
|
|
892133
|
+
await (0, import_promises103.mkdir)(import_path74.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
892134
|
+
await (0, import_promises103.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
892031
892135
|
} catch (error50) {
|
|
892032
892136
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
892033
892137
|
}
|
|
@@ -895251,7 +895355,7 @@ var DynamicSnippetsGenerator5 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
895251
895355
|
};
|
|
895252
895356
|
|
|
895253
895357
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/python/DynamicSnippetsPythonTestGenerator.js
|
|
895254
|
-
var
|
|
895358
|
+
var import_promises104 = require("fs/promises");
|
|
895255
895359
|
var import_path75 = __toESM(require("path"), 1);
|
|
895256
895360
|
var DynamicSnippetsPythonTestGenerator = class {
|
|
895257
895361
|
context;
|
|
@@ -895280,8 +895384,8 @@ var DynamicSnippetsPythonTestGenerator = class {
|
|
|
895280
895384
|
endpointId
|
|
895281
895385
|
});
|
|
895282
895386
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
895283
|
-
await (0,
|
|
895284
|
-
await (0,
|
|
895387
|
+
await (0, import_promises104.mkdir)(import_path75.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
895388
|
+
await (0, import_promises104.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
895285
895389
|
} catch (error50) {
|
|
895286
895390
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
895287
895391
|
}
|
|
@@ -898153,7 +898257,7 @@ var DynamicSnippetsGenerator6 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
898153
898257
|
};
|
|
898154
898258
|
|
|
898155
898259
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/ruby/DynamicSnippetsRubyTestGenerator.js
|
|
898156
|
-
var
|
|
898260
|
+
var import_promises105 = require("fs/promises");
|
|
898157
898261
|
var import_path76 = __toESM(require("path"), 1);
|
|
898158
898262
|
var DynamicSnippetsRubyTestGenerator = class {
|
|
898159
898263
|
context;
|
|
@@ -898182,8 +898286,8 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
898182
898286
|
endpointId
|
|
898183
898287
|
});
|
|
898184
898288
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
898185
|
-
await (0,
|
|
898186
|
-
await (0,
|
|
898289
|
+
await (0, import_promises105.mkdir)(import_path76.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
898290
|
+
await (0, import_promises105.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
898187
898291
|
} catch (error50) {
|
|
898188
898292
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
898189
898293
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -898199,7 +898303,7 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
898199
898303
|
};
|
|
898200
898304
|
|
|
898201
898305
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/rust/DynamicSnippetsRustTestGenerator.js
|
|
898202
|
-
var
|
|
898306
|
+
var import_promises106 = require("fs/promises");
|
|
898203
898307
|
var import_node_path25 = __toESM(require("path"), 1);
|
|
898204
898308
|
init_lib6();
|
|
898205
898309
|
|
|
@@ -903433,8 +903537,8 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
903433
903537
|
absolutePathToOutputDir,
|
|
903434
903538
|
idx
|
|
903435
903539
|
});
|
|
903436
|
-
await (0,
|
|
903437
|
-
await (0,
|
|
903540
|
+
await (0, import_promises106.mkdir)(import_node_path25.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
903541
|
+
await (0, import_promises106.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
903438
903542
|
} catch (error50) {
|
|
903439
903543
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
903440
903544
|
}
|
|
@@ -903443,7 +903547,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
903443
903547
|
}
|
|
903444
903548
|
async initializeProject(outputDir) {
|
|
903445
903549
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("dynamic-snippets"));
|
|
903446
|
-
await (0,
|
|
903550
|
+
await (0, import_promises106.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
903447
903551
|
return absolutePathToOutputDir;
|
|
903448
903552
|
}
|
|
903449
903553
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -903452,7 +903556,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
903452
903556
|
};
|
|
903453
903557
|
|
|
903454
903558
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/swift/DynamicSnippetsSwiftTestGenerator.js
|
|
903455
|
-
var
|
|
903559
|
+
var import_promises107 = require("fs/promises");
|
|
903456
903560
|
var import_node_path26 = __toESM(require("path"), 1);
|
|
903457
903561
|
init_lib6();
|
|
903458
903562
|
|
|
@@ -908002,8 +908106,8 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
908002
908106
|
absolutePathToOutputDir,
|
|
908003
908107
|
idx
|
|
908004
908108
|
});
|
|
908005
|
-
await (0,
|
|
908006
|
-
await (0,
|
|
908109
|
+
await (0, import_promises107.mkdir)(import_node_path26.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
908110
|
+
await (0, import_promises107.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
908007
908111
|
} catch (error50) {
|
|
908008
908112
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
908009
908113
|
}
|
|
@@ -908012,7 +908116,7 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
908012
908116
|
}
|
|
908013
908117
|
async initializeProject(outputDir) {
|
|
908014
908118
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Snippets"));
|
|
908015
|
-
await (0,
|
|
908119
|
+
await (0, import_promises107.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
908016
908120
|
return absolutePathToOutputDir;
|
|
908017
908121
|
}
|
|
908018
908122
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -910340,7 +910444,7 @@ var DynamicSnippetsGenerator9 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
910340
910444
|
};
|
|
910341
910445
|
|
|
910342
910446
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/typescript/DynamicSnippetsTypeScriptTestGenerator.js
|
|
910343
|
-
var
|
|
910447
|
+
var import_promises108 = require("fs/promises");
|
|
910344
910448
|
var import_path77 = __toESM(require("path"), 1);
|
|
910345
910449
|
var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
910346
910450
|
context;
|
|
@@ -910369,8 +910473,8 @@ var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
|
910369
910473
|
endpointId
|
|
910370
910474
|
});
|
|
910371
910475
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
910372
|
-
await (0,
|
|
910373
|
-
await (0,
|
|
910476
|
+
await (0, import_promises108.mkdir)(import_path77.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
910477
|
+
await (0, import_promises108.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
910374
910478
|
} catch (error50) {
|
|
910375
910479
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
910376
910480
|
}
|
|
@@ -910479,7 +910583,7 @@ async function generateDynamicSnippetTests({ context: context3, ir: ir11, config
|
|
|
910479
910583
|
init_lib6();
|
|
910480
910584
|
var import_autoversion2 = __toESM(require_autoversion(), 1);
|
|
910481
910585
|
var import_serialization = __toESM(require_serialization3(), 1);
|
|
910482
|
-
var
|
|
910586
|
+
var import_promises110 = require("fs/promises");
|
|
910483
910587
|
var path76 = __toESM(require("path"), 1);
|
|
910484
910588
|
var import_path79 = require("path");
|
|
910485
910589
|
var import_tmp_promise14 = __toESM(require_tmp_promise(), 1);
|
|
@@ -910965,7 +911069,7 @@ init_lib6();
|
|
|
910965
911069
|
var import_autoversion = __toESM(require_autoversion(), 1);
|
|
910966
911070
|
init_lib10();
|
|
910967
911071
|
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
910968
|
-
var
|
|
911072
|
+
var import_promises109 = require("fs/promises");
|
|
910969
911073
|
var import_os12 = require("os");
|
|
910970
911074
|
var import_path78 = require("path");
|
|
910971
911075
|
var import_semver12 = __toESM(require_semver2(), 1);
|
|
@@ -911072,7 +911176,7 @@ var LocalTaskHandler = class {
|
|
|
911072
911176
|
try {
|
|
911073
911177
|
this.context.logger.info("Analyzing SDK changes for automatic semantic versioning");
|
|
911074
911178
|
diffFile = await this.generateDiffFile();
|
|
911075
|
-
const diffContent = await (0,
|
|
911179
|
+
const diffContent = await (0, import_promises109.readFile)(diffFile, "utf-8");
|
|
911076
911180
|
if (diffContent.trim().length === 0) {
|
|
911077
911181
|
this.context.logger.info("No changes detected in generated SDK");
|
|
911078
911182
|
return null;
|
|
@@ -911276,7 +911380,7 @@ var LocalTaskHandler = class {
|
|
|
911276
911380
|
} finally {
|
|
911277
911381
|
if (diffFile) {
|
|
911278
911382
|
try {
|
|
911279
|
-
await (0,
|
|
911383
|
+
await (0, import_promises109.rm)(diffFile);
|
|
911280
911384
|
} catch (cleanupError) {
|
|
911281
911385
|
this.context.logger.warn(`Failed to delete temp diff file: ${diffFile}`, String(cleanupError));
|
|
911282
911386
|
}
|
|
@@ -911447,7 +911551,7 @@ var LocalTaskHandler = class {
|
|
|
911447
911551
|
const absolutePathToFernignore = AbsoluteFilePath2.of(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
|
|
911448
911552
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
911449
911553
|
const pathsToPreserve = await this.getPathsToPreserve(fernIgnorePaths);
|
|
911450
|
-
await (0,
|
|
911554
|
+
await (0, import_promises109.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
911451
911555
|
await this.runThrowawayGitCommand(["init"], tmpOutputResolutionDir);
|
|
911452
911556
|
await this.runThrowawayGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
911453
911557
|
await this.runThrowawayGitCommand([
|
|
@@ -911467,17 +911571,17 @@ var LocalTaskHandler = class {
|
|
|
911467
911571
|
await this.runThrowawayGitCommand(["reset", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
911468
911572
|
await this.runThrowawayGitCommand(["clean", "-fd", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
911469
911573
|
await this.runThrowawayGitCommand(["restore", "."], tmpOutputResolutionDir);
|
|
911470
|
-
await (0,
|
|
911471
|
-
await (0,
|
|
911472
|
-
await (0,
|
|
911574
|
+
await (0, import_promises109.rm)(join8(tmpOutputResolutionDir, RelativeFilePath2.of(".git")), { recursive: true });
|
|
911575
|
+
await (0, import_promises109.rm)(this.absolutePathToLocalOutput, { recursive: true });
|
|
911576
|
+
await (0, import_promises109.cp)(tmpOutputResolutionDir, this.absolutePathToLocalOutput, { recursive: true });
|
|
911473
911577
|
}
|
|
911474
911578
|
async copyGeneratedFilesNoFernIgnorePreservingGit() {
|
|
911475
|
-
const contents = await (0,
|
|
911579
|
+
const contents = await (0, import_promises109.readdir)(this.absolutePathToLocalOutput);
|
|
911476
911580
|
const itemsToPreserve = [".git"];
|
|
911477
911581
|
if (await this.generatedOutputMissingReadme()) {
|
|
911478
911582
|
itemsToPreserve.push("README.md");
|
|
911479
911583
|
}
|
|
911480
|
-
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0,
|
|
911584
|
+
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0, import_promises109.rm)(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(item)), {
|
|
911481
911585
|
force: true,
|
|
911482
911586
|
recursive: true
|
|
911483
911587
|
})));
|
|
@@ -911485,11 +911589,11 @@ var LocalTaskHandler = class {
|
|
|
911485
911589
|
}
|
|
911486
911590
|
async copyGeneratedFilesNoFernIgnoreDeleteAll() {
|
|
911487
911591
|
this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
|
|
911488
|
-
await (0,
|
|
911592
|
+
await (0, import_promises109.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
|
|
911489
911593
|
await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
|
|
911490
911594
|
}
|
|
911491
911595
|
async copyGeneratedFilesToDirectory(outputPath) {
|
|
911492
|
-
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0,
|
|
911596
|
+
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises109.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
911493
911597
|
if (firstLocalOutputItem == null) {
|
|
911494
911598
|
return;
|
|
911495
911599
|
}
|
|
@@ -911497,15 +911601,15 @@ var LocalTaskHandler = class {
|
|
|
911497
911601
|
if (firstLocalOutputItem.endsWith(".zip")) {
|
|
911498
911602
|
await (0, import_decompress2.default)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(firstLocalOutputItem)), outputPath);
|
|
911499
911603
|
for (const localOutputItem of remaininglocalOutputItems) {
|
|
911500
|
-
await (0,
|
|
911604
|
+
await (0, import_promises109.cp)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(localOutputItem)), join8(outputPath, RelativeFilePath2.of(localOutputItem)), { recursive: true });
|
|
911501
911605
|
}
|
|
911502
911606
|
} else {
|
|
911503
|
-
await (0,
|
|
911607
|
+
await (0, import_promises109.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true });
|
|
911504
911608
|
}
|
|
911505
911609
|
}
|
|
911506
911610
|
async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
|
|
911507
911611
|
this.context.logger.debug(`Copying generated snippets to ${absolutePathToLocalSnippetJSON}`);
|
|
911508
|
-
await (0,
|
|
911612
|
+
await (0, import_promises109.cp)(absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON);
|
|
911509
911613
|
}
|
|
911510
911614
|
/**
|
|
911511
911615
|
* Checks whether the generated output is missing README.md.
|
|
@@ -911514,7 +911618,7 @@ var LocalTaskHandler = class {
|
|
|
911514
911618
|
*/
|
|
911515
911619
|
async generatedOutputMissingReadme() {
|
|
911516
911620
|
try {
|
|
911517
|
-
const contents = await (0,
|
|
911621
|
+
const contents = await (0, import_promises109.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
911518
911622
|
if (contents.length === 1 && contents[0] != null && contents[0].endsWith(".zip")) {
|
|
911519
911623
|
return false;
|
|
911520
911624
|
}
|
|
@@ -911557,13 +911661,13 @@ var LocalTaskHandler = class {
|
|
|
911557
911661
|
async readPriorChangelog(maxEntries) {
|
|
911558
911662
|
const MAX_CHANGELOG_SIZE = 2048;
|
|
911559
911663
|
try {
|
|
911560
|
-
const files = await (0,
|
|
911664
|
+
const files = await (0, import_promises109.readdir)(this.absolutePathToLocalOutput);
|
|
911561
911665
|
const changelogFile = files.find((f5) => f5.toLowerCase() === "changelog.md");
|
|
911562
911666
|
if (!changelogFile) {
|
|
911563
911667
|
return "";
|
|
911564
911668
|
}
|
|
911565
911669
|
const changelogPath = join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(changelogFile));
|
|
911566
|
-
const content5 = await (0,
|
|
911670
|
+
const content5 = await (0, import_promises109.readFile)(changelogPath, "utf-8");
|
|
911567
911671
|
if (content5.trim().length === 0) {
|
|
911568
911672
|
return "";
|
|
911569
911673
|
}
|
|
@@ -911673,24 +911777,24 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
911673
911777
|
context3.logger.debug("Wrote IR to: " + absolutePathToIr);
|
|
911674
911778
|
const configJsonFile = (0, import_path79.join)(workspaceTempDir.path, GENERATOR_CONFIG_FILENAME);
|
|
911675
911779
|
const absolutePathToWriteConfigJson = AbsoluteFilePath2.of(configJsonFile);
|
|
911676
|
-
await (0,
|
|
911780
|
+
await (0, import_promises110.writeFile)(configJsonFile, "");
|
|
911677
911781
|
context3.logger.debug("Will write config.json to: " + absolutePathToWriteConfigJson);
|
|
911678
911782
|
const tmpOutputDirectory = (0, import_path79.join)(workspaceTempDir.path, CODEGEN_OUTPUT_DIRECTORY_NAME);
|
|
911679
911783
|
const absolutePathToTmpOutputDirectory = AbsoluteFilePath2.of(tmpOutputDirectory);
|
|
911680
|
-
await (0,
|
|
911784
|
+
await (0, import_promises110.mkdir)(tmpOutputDirectory, { recursive: true });
|
|
911681
911785
|
context3.logger.debug("Will write output to: " + absolutePathToTmpOutputDirectory);
|
|
911682
911786
|
let absolutePathToTmpSnippetJSON = void 0;
|
|
911683
911787
|
if (absolutePathToLocalSnippetJSON != null) {
|
|
911684
911788
|
const snippetJsonFile = (0, import_path79.join)(workspaceTempDir.path, "snippet.json");
|
|
911685
911789
|
absolutePathToTmpSnippetJSON = AbsoluteFilePath2.of(snippetJsonFile);
|
|
911686
|
-
await (0,
|
|
911790
|
+
await (0, import_promises110.writeFile)(snippetJsonFile, "");
|
|
911687
911791
|
context3.logger.debug("Will write snippet.json to: " + absolutePathToTmpSnippetJSON);
|
|
911688
911792
|
}
|
|
911689
911793
|
let absolutePathToTmpSnippetTemplatesJSON = void 0;
|
|
911690
911794
|
if (absolutePathToLocalSnippetTemplateJSON != null) {
|
|
911691
911795
|
const snippetTemplatesJsonFile = (0, import_path79.join)(workspaceTempDir.path, SNIPPET_TEMPLATES_JSON_FILENAME);
|
|
911692
911796
|
absolutePathToTmpSnippetTemplatesJSON = AbsoluteFilePath2.of(snippetTemplatesJsonFile);
|
|
911693
|
-
await (0,
|
|
911797
|
+
await (0, import_promises110.writeFile)(snippetTemplatesJsonFile, "");
|
|
911694
911798
|
context3.logger.debug("Will write snippet-templates.json to: " + absolutePathToTmpSnippetTemplatesJSON);
|
|
911695
911799
|
}
|
|
911696
911800
|
const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
|
|
@@ -911730,7 +911834,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
911730
911834
|
publishToRegistry,
|
|
911731
911835
|
paths
|
|
911732
911836
|
});
|
|
911733
|
-
await (0,
|
|
911837
|
+
await (0, import_promises110.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(await import_serialization.GeneratorConfig.jsonOrThrow(config5), void 0, 4));
|
|
911734
911838
|
const absolutePathToLicenseFile = extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig);
|
|
911735
911839
|
const sourceMounts = workspace.getSources().filter((source2) => source2.type === "protobuf").map((source2) => ({
|
|
911736
911840
|
hostPath: source2.absoluteFilePath,
|
|
@@ -912397,13 +912501,13 @@ var GenerationRunner = class {
|
|
|
912397
912501
|
};
|
|
912398
912502
|
|
|
912399
912503
|
// ../cli-v2/lib/sdk/generator/LegacyLocalGenerationRunner.js
|
|
912400
|
-
var
|
|
912504
|
+
var import_promises112 = require("fs/promises");
|
|
912401
912505
|
|
|
912402
912506
|
// ../cli-v2/lib/sdk/adapter/LegacyGeneratorInvocationAdapter.js
|
|
912403
912507
|
init_lib4();
|
|
912404
912508
|
init_lib6();
|
|
912405
912509
|
init_lib7();
|
|
912406
|
-
var
|
|
912510
|
+
var import_promises111 = require("fs/promises");
|
|
912407
912511
|
var LegacyGeneratorInvocationAdapter = class {
|
|
912408
912512
|
context;
|
|
912409
912513
|
constructor(config5) {
|
|
@@ -912646,7 +912750,7 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
912646
912750
|
code: CliError.Code.InternalError
|
|
912647
912751
|
});
|
|
912648
912752
|
}
|
|
912649
|
-
const contents = await (0,
|
|
912753
|
+
const contents = await (0, import_promises111.readFile)(absolutePath, "utf-8");
|
|
912650
912754
|
return api_exports4.GithubLicense.custom({ contents });
|
|
912651
912755
|
}
|
|
912652
912756
|
buildReadme(target) {
|
|
@@ -912872,7 +912976,7 @@ var LegacyLocalGenerationRunner = class {
|
|
|
912872
912976
|
});
|
|
912873
912977
|
if (args.target.output.path != null && generatorInvocation.absolutePathToLocalOutput != null) {
|
|
912874
912978
|
const snippetPath = join8(generatorInvocation.absolutePathToLocalOutput, RelativeFilePath2.of(SNIPPET_JSON_FILENAME));
|
|
912875
|
-
await (0,
|
|
912979
|
+
await (0, import_promises112.rm)(snippetPath, { force: true });
|
|
912876
912980
|
}
|
|
912877
912981
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
912878
912982
|
return {
|
|
@@ -912889,7 +912993,7 @@ var LegacyLocalGenerationRunner = class {
|
|
|
912889
912993
|
// ../cli-v2/lib/sdk/generator/LegacyRemoteGenerationRunner.js
|
|
912890
912994
|
init_lib4();
|
|
912891
912995
|
init_lib6();
|
|
912892
|
-
var
|
|
912996
|
+
var import_promises113 = require("fs/promises");
|
|
912893
912997
|
var import_os14 = require("os");
|
|
912894
912998
|
var LegacyRemoteGenerationRunner = class {
|
|
912895
912999
|
context;
|
|
@@ -912945,13 +913049,13 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
912945
913049
|
const previewOutputDirectory = join8(absolutePathToPreview, RelativeFilePath2.of(generatorName));
|
|
912946
913050
|
const targetOutputDirectory = generatorInvocation.absolutePathToLocalOutput;
|
|
912947
913051
|
if (targetOutputDirectory != null) {
|
|
912948
|
-
await (0,
|
|
912949
|
-
await (0,
|
|
913052
|
+
await (0, import_promises113.cp)(previewOutputDirectory, targetOutputDirectory, { recursive: true });
|
|
913053
|
+
await (0, import_promises113.rm)(join8(targetOutputDirectory, RelativeFilePath2.of(".git")), {
|
|
912950
913054
|
recursive: true,
|
|
912951
913055
|
force: true
|
|
912952
913056
|
});
|
|
912953
913057
|
}
|
|
912954
|
-
await (0,
|
|
913058
|
+
await (0, import_promises113.rm)(absolutePathToPreview, { recursive: true, force: true });
|
|
912955
913059
|
}
|
|
912956
913060
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
912957
913061
|
return {
|
|
@@ -912980,7 +913084,7 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
912980
913084
|
}
|
|
912981
913085
|
async getAbsolutePathToPreview(args) {
|
|
912982
913086
|
if (this.isLocalGitCombo(args)) {
|
|
912983
|
-
const tmpPreviewDirectory = await (0,
|
|
913087
|
+
const tmpPreviewDirectory = await (0, import_promises113.mkdtemp)(join8(AbsoluteFilePath2.of((0, import_os14.tmpdir)()), RelativeFilePath2.of("fern-preview-")));
|
|
912984
913088
|
return AbsoluteFilePath2.of(tmpPreviewDirectory);
|
|
912985
913089
|
}
|
|
912986
913090
|
if (!args.preview) {
|
|
@@ -913711,7 +913815,7 @@ Example:
|
|
|
913711
913815
|
if (!exists2) {
|
|
913712
913816
|
return { shouldProceed: true };
|
|
913713
913817
|
}
|
|
913714
|
-
const files = await (0,
|
|
913818
|
+
const files = await (0, import_promises114.readdir)(outputPath);
|
|
913715
913819
|
if (files.length === 0) {
|
|
913716
913820
|
return { shouldProceed: true };
|
|
913717
913821
|
}
|
|
@@ -913943,7 +914047,7 @@ init_lib4();
|
|
|
913943
914047
|
init_lib4();
|
|
913944
914048
|
init_lib10();
|
|
913945
914049
|
var import_fs32 = require("fs");
|
|
913946
|
-
var
|
|
914050
|
+
var import_promises115 = require("fs/promises");
|
|
913947
914051
|
var import_path82 = require("path");
|
|
913948
914052
|
var import_semver13 = __toESM(require_semver2(), 1);
|
|
913949
914053
|
var import_url8 = require("url");
|
|
@@ -914053,7 +914157,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
914053
914157
|
}
|
|
914054
914158
|
this.migrationsInstallPromise = (async () => {
|
|
914055
914159
|
const cacheDir = this.cachePath;
|
|
914056
|
-
await (0,
|
|
914160
|
+
await (0, import_promises115.mkdir)(cacheDir, { recursive: true });
|
|
914057
914161
|
const npmCacheDir = (0, import_path82.join)(cacheDir, ".npm-cache");
|
|
914058
914162
|
const packageDir = (0, import_path82.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME);
|
|
914059
914163
|
const packageJsonPath = (0, import_path82.join)(packageDir, "package.json");
|
|
@@ -914070,7 +914174,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
914070
914174
|
"--no-audit",
|
|
914071
914175
|
"--no-fund"
|
|
914072
914176
|
], { doNotPipeOutput: true });
|
|
914073
|
-
const packageJsonContent = await (0,
|
|
914177
|
+
const packageJsonContent = await (0, import_promises115.readFile)(packageJsonPath, "utf-8");
|
|
914074
914178
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
914075
914179
|
if (packageJson2.main == null) {
|
|
914076
914180
|
throw new CliError({
|
|
@@ -914115,7 +914219,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
914115
914219
|
const myPid = String(process.pid);
|
|
914116
914220
|
while (true) {
|
|
914117
914221
|
try {
|
|
914118
|
-
const fh = await (0,
|
|
914222
|
+
const fh = await (0, import_promises115.open)(lockPath, "wx");
|
|
914119
914223
|
await fh.writeFile(myPid);
|
|
914120
914224
|
await fh.close();
|
|
914121
914225
|
const exitHandler = () => {
|
|
@@ -914132,9 +914236,9 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
914132
914236
|
return async () => {
|
|
914133
914237
|
process.removeListener("exit", exitHandler);
|
|
914134
914238
|
try {
|
|
914135
|
-
const currentContent = await (0,
|
|
914239
|
+
const currentContent = await (0, import_promises115.readFile)(lockPath, "utf-8");
|
|
914136
914240
|
if (currentContent.trim() === myPid) {
|
|
914137
|
-
await (0,
|
|
914241
|
+
await (0, import_promises115.unlink)(lockPath);
|
|
914138
914242
|
} else {
|
|
914139
914243
|
logger4.debug(`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`);
|
|
914140
914244
|
}
|
|
@@ -914148,14 +914252,14 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
914148
914252
|
throw err;
|
|
914149
914253
|
}
|
|
914150
914254
|
try {
|
|
914151
|
-
const lockContent = await (0,
|
|
914255
|
+
const lockContent = await (0, import_promises115.readFile)(lockPath, "utf-8");
|
|
914152
914256
|
const lockPid = Number(lockContent.trim());
|
|
914153
|
-
const lockStat = await (0,
|
|
914257
|
+
const lockStat = await (0, import_promises115.stat)(lockPath);
|
|
914154
914258
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
914155
914259
|
if (lockAge > _GeneratorMigrator.LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !_GeneratorMigrator.isProcessAlive(lockPid)) {
|
|
914156
914260
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
914157
914261
|
try {
|
|
914158
|
-
await (0,
|
|
914262
|
+
await (0, import_promises115.unlink)(lockPath);
|
|
914159
914263
|
} catch (unlinkErr) {
|
|
914160
914264
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
914161
914265
|
}
|
|
@@ -914685,13 +914789,13 @@ var import_generator_cli5 = __toESM(require_api3(), 1);
|
|
|
914685
914789
|
|
|
914686
914790
|
// ../init/lib/initializeAPI.js
|
|
914687
914791
|
init_lib6();
|
|
914688
|
-
var
|
|
914792
|
+
var import_promises120 = require("fs/promises");
|
|
914689
914793
|
var import_fs_extra = __toESM(require_lib19(), 1);
|
|
914690
914794
|
var import_path85 = __toESM(require("path"), 1);
|
|
914691
914795
|
|
|
914692
914796
|
// ../init/lib/createFernDirectoryAndOrganization.js
|
|
914693
914797
|
init_lib6();
|
|
914694
|
-
var
|
|
914798
|
+
var import_promises117 = require("fs/promises");
|
|
914695
914799
|
init_lodash();
|
|
914696
914800
|
var GITIGNORE_CONTENT = "**/.preview\n**/.definition\n";
|
|
914697
914801
|
async function createFernDirectoryAndWorkspace({ organization, taskContext, versionOfCli }) {
|
|
@@ -914723,7 +914827,7 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
|
|
|
914723
914827
|
}
|
|
914724
914828
|
}
|
|
914725
914829
|
}
|
|
914726
|
-
await (0,
|
|
914830
|
+
await (0, import_promises117.mkdir)(FERN_DIRECTORY);
|
|
914727
914831
|
await writeProjectConfig({
|
|
914728
914832
|
filepath: join8(pathToFernDirectory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)),
|
|
914729
914833
|
organization,
|
|
@@ -914747,11 +914851,11 @@ async function writeProjectConfig({ organization, filepath, versionOfCli }) {
|
|
|
914747
914851
|
organization,
|
|
914748
914852
|
version: versionOfCli
|
|
914749
914853
|
};
|
|
914750
|
-
await (0,
|
|
914854
|
+
await (0, import_promises117.writeFile)(filepath, JSON.stringify(projectConfig, void 0, 4));
|
|
914751
914855
|
}
|
|
914752
914856
|
async function writeGitignore({ absolutePathToFernDirectory }) {
|
|
914753
914857
|
const gitignorePath = join8(absolutePathToFernDirectory, RelativeFilePath2.of(".gitignore"));
|
|
914754
|
-
await (0,
|
|
914858
|
+
await (0, import_promises117.writeFile)(gitignorePath, GITIGNORE_CONTENT);
|
|
914755
914859
|
}
|
|
914756
914860
|
|
|
914757
914861
|
// ../fern-definition/formatter/lib/FernDefinitionFileFormatter.js
|
|
@@ -914940,7 +915044,7 @@ async function formatDefinitionFile({ fileContents }) {
|
|
|
914940
915044
|
|
|
914941
915045
|
// ../fern-definition/formatter/lib/formatWorkspace.js
|
|
914942
915046
|
init_lib4();
|
|
914943
|
-
var
|
|
915047
|
+
var import_promises118 = require("fs/promises");
|
|
914944
915048
|
async function formatFernWorkspace({ workspace, context: context3, shouldFix }) {
|
|
914945
915049
|
for (const [relativeFilepath, file4] of entries(workspace.definition.namedDefinitionFiles)) {
|
|
914946
915050
|
const formatted = await formatDefinitionFile({
|
|
@@ -914948,7 +915052,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
914948
915052
|
});
|
|
914949
915053
|
if (formatted !== file4.rawContents) {
|
|
914950
915054
|
if (shouldFix) {
|
|
914951
|
-
await (0,
|
|
915055
|
+
await (0, import_promises118.writeFile)(file4.absoluteFilePath, formatted);
|
|
914952
915056
|
context3.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
|
|
914953
915057
|
} else {
|
|
914954
915058
|
context3.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
|
|
@@ -914960,7 +915064,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
914960
915064
|
|
|
914961
915065
|
// ../init/lib/createWorkspace.js
|
|
914962
915066
|
init_lib6();
|
|
914963
|
-
var
|
|
915067
|
+
var import_promises119 = require("fs/promises");
|
|
914964
915068
|
init_js_yaml();
|
|
914965
915069
|
|
|
914966
915070
|
// ../init/lib/sampleImdbApi.js
|
|
@@ -915161,7 +915265,7 @@ components:
|
|
|
915161
915265
|
// ../init/lib/createWorkspace.js
|
|
915162
915266
|
async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context: context3, apiName = "api" }) {
|
|
915163
915267
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
915164
|
-
await (0,
|
|
915268
|
+
await (0, import_promises119.mkdir)(directoryOfWorkspace);
|
|
915165
915269
|
}
|
|
915166
915270
|
await writeGeneratorsConfiguration({
|
|
915167
915271
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -915176,7 +915280,7 @@ async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context:
|
|
|
915176
915280
|
}
|
|
915177
915281
|
async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, cliVersion, context: context3 }) {
|
|
915178
915282
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
915179
|
-
await (0,
|
|
915283
|
+
await (0, import_promises119.mkdir)(directoryOfWorkspace);
|
|
915180
915284
|
}
|
|
915181
915285
|
await writeGeneratorsConfiguration({
|
|
915182
915286
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -915189,10 +915293,10 @@ async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, c
|
|
|
915189
915293
|
}
|
|
915190
915294
|
async function createDefaultOpenAPIWorkspace({ directoryOfWorkspace, cliVersion, context: context3 }) {
|
|
915191
915295
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
915192
|
-
await (0,
|
|
915296
|
+
await (0, import_promises119.mkdir)(directoryOfWorkspace, { recursive: true });
|
|
915193
915297
|
}
|
|
915194
915298
|
const openApiFilePath = join8(directoryOfWorkspace, RelativeFilePath2.of("openapi.yml"));
|
|
915195
|
-
await (0,
|
|
915299
|
+
await (0, import_promises119.writeFile)(openApiFilePath, SAMPLE_OPENAPI);
|
|
915196
915300
|
await writeGeneratorsConfiguration({
|
|
915197
915301
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
915198
915302
|
cliVersion,
|
|
@@ -915237,7 +915341,7 @@ async function getDefaultGeneratorsConfiguration({ cliVersion, context: context3
|
|
|
915237
915341
|
return config5;
|
|
915238
915342
|
}
|
|
915239
915343
|
async function writeGeneratorsConfiguration({ filepath, cliVersion, context: context3, apiConfiguration }) {
|
|
915240
|
-
await (0,
|
|
915344
|
+
await (0, import_promises119.writeFile)(filepath, "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(await getDefaultGeneratorsConfiguration({ cliVersion, context: context3, apiConfiguration }), {
|
|
915241
915345
|
sortKeys: (a3, b8) => {
|
|
915242
915346
|
if (a3 === "api") {
|
|
915243
915347
|
return -1;
|
|
@@ -915256,8 +915360,8 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
915256
915360
|
strategy: "status-code"
|
|
915257
915361
|
}
|
|
915258
915362
|
};
|
|
915259
|
-
await (0,
|
|
915260
|
-
await (0,
|
|
915363
|
+
await (0, import_promises119.mkdir)(directoryOfDefinition);
|
|
915364
|
+
await (0, import_promises119.writeFile)(join8(directoryOfDefinition, RelativeFilePath2.of(ROOT_API_FILENAME)), jsYaml.dump(rootApi));
|
|
915261
915365
|
const absoluteFilepathToImdbYaml = join8(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
|
|
915262
915366
|
let formattedContent;
|
|
915263
915367
|
try {
|
|
@@ -915273,7 +915377,7 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
915273
915377
|
code: CliError.Code.ParseError
|
|
915274
915378
|
});
|
|
915275
915379
|
}
|
|
915276
|
-
await (0,
|
|
915380
|
+
await (0, import_promises119.writeFile)(absoluteFilepathToImdbYaml, formattedContent);
|
|
915277
915381
|
}
|
|
915278
915382
|
|
|
915279
915383
|
// ../init/lib/initializeAPI.js
|
|
@@ -915324,7 +915428,7 @@ async function getDirectoryOfNewAPIWorkspace({ absolutePathToFernDirectory, task
|
|
|
915324
915428
|
if (inlinedApiDefinition || inlinedOpenApiWorkspace) {
|
|
915325
915429
|
taskContext.logger.info("Creating workspaces to support multiple API Definitions.");
|
|
915326
915430
|
const apiWorkspaceDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api"));
|
|
915327
|
-
await (0,
|
|
915431
|
+
await (0, import_promises120.mkdir)(apiWorkspaceDirectory, { recursive: true });
|
|
915328
915432
|
if (inlinedApiDefinition) {
|
|
915329
915433
|
const inlinedDefinitionDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
915330
915434
|
const workspaceDefinitionDirectory = join8(apiWorkspaceDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
@@ -915361,7 +915465,7 @@ async function hasInlinedOpenAPIWorkspace({ absolutePathToFernDirectory }) {
|
|
|
915361
915465
|
// ../init/lib/initializeDocs.js
|
|
915362
915466
|
init_lib4();
|
|
915363
915467
|
init_lib6();
|
|
915364
|
-
var
|
|
915468
|
+
var import_promises121 = require("fs/promises");
|
|
915365
915469
|
init_js_yaml();
|
|
915366
915470
|
async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
915367
915471
|
const createDirectoryResponse = await createFernDirectoryAndWorkspace({
|
|
@@ -915377,7 +915481,7 @@ async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
|
915377
915481
|
} else {
|
|
915378
915482
|
try {
|
|
915379
915483
|
const docsConfig = getDocsConfig(createDirectoryResponse.organization);
|
|
915380
|
-
await (0,
|
|
915484
|
+
await (0, import_promises121.writeFile)(docsYmlPath, jsYaml.dump(docsConfig));
|
|
915381
915485
|
taskContext.logger.info(source_default.green("Created docs configuration"));
|
|
915382
915486
|
return;
|
|
915383
915487
|
} catch (writeError) {
|
|
@@ -915432,7 +915536,7 @@ var FernDocsBuilder = class {
|
|
|
915432
915536
|
|
|
915433
915537
|
// ../docs-importers/commons/lib/FernDocsBuilderImpl.js
|
|
915434
915538
|
init_lib6();
|
|
915435
|
-
var
|
|
915539
|
+
var import_promises122 = require("fs/promises");
|
|
915436
915540
|
init_js_yaml();
|
|
915437
915541
|
var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
915438
915542
|
openApiSpecs = {};
|
|
@@ -915492,7 +915596,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
915492
915596
|
}
|
|
915493
915597
|
async build({ outputDirectory }) {
|
|
915494
915598
|
const absolutePathToFernDirectory = join8(outputDirectory, RelativeFilePath2.of(FERN_DIRECTORY));
|
|
915495
|
-
await (0,
|
|
915599
|
+
await (0, import_promises122.mkdir)(absolutePathToFernDirectory, { recursive: true });
|
|
915496
915600
|
if (Object.keys(this.tabbedNavigation).length > 0) {
|
|
915497
915601
|
this.docsYml.tabs = Object.fromEntries(Object.entries(this.tabbedNavigation).map(([key2, value2]) => {
|
|
915498
915602
|
return [value2.tabId, value2.tabConfig];
|
|
@@ -915517,27 +915621,27 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
915517
915621
|
}))
|
|
915518
915622
|
};
|
|
915519
915623
|
}
|
|
915520
|
-
await (0,
|
|
915624
|
+
await (0, import_promises122.writeFile)(join8(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)), jsYaml.dump(generators_yml_exports.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml)));
|
|
915521
915625
|
await Promise.all(Object.entries(this.openApiSpecs).map(async ([relativePath, absolutePath]) => {
|
|
915522
915626
|
const absolutePathToOpenAPI = join8(absolutePathToFernDirectory, RelativeFilePath2.of(relativePath));
|
|
915523
|
-
await (0,
|
|
915524
|
-
await (0,
|
|
915627
|
+
await (0, import_promises122.mkdir)(dirname6(absolutePathToOpenAPI), { recursive: true });
|
|
915628
|
+
await (0, import_promises122.cp)(absolutePath, absolutePathToOpenAPI);
|
|
915525
915629
|
}));
|
|
915526
915630
|
}
|
|
915527
|
-
await (0,
|
|
915631
|
+
await (0, import_promises122.writeFile)(join8(absolutePathToFernDirectory, RelativeFilePath2.of(DOCS_CONFIGURATION_FILENAME)), jsYaml.dump(docs_yml_exports.RawSchemas.Serializer.DocsConfiguration.jsonOrThrow(this.docsYml, { omitUndefined: true })));
|
|
915528
915632
|
await Promise.all(Object.entries(this.markdownPages).map(async ([filepath, page]) => {
|
|
915529
915633
|
const absoluteFilepathToMarkdownPage = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
915530
|
-
await (0,
|
|
915634
|
+
await (0, import_promises122.mkdir)(dirname6(absoluteFilepathToMarkdownPage), { recursive: true });
|
|
915531
915635
|
const frontmatter = Object.keys(page.frontmatter).length > 0 ? `---
|
|
915532
915636
|
${jsYaml.dump(JSON.parse(JSON.stringify(page.frontmatter)))}---
|
|
915533
915637
|
|
|
915534
915638
|
` : "";
|
|
915535
|
-
await (0,
|
|
915639
|
+
await (0, import_promises122.writeFile)(absoluteFilepathToMarkdownPage, `${frontmatter}${page.markdown}`);
|
|
915536
915640
|
}));
|
|
915537
915641
|
await Promise.all(Object.entries(this.assets).map(async ([filepath, asset]) => {
|
|
915538
915642
|
const absolutePathToAsset = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
915539
|
-
await (0,
|
|
915540
|
-
await (0,
|
|
915643
|
+
await (0, import_promises122.mkdir)(dirname6(absolutePathToAsset), { recursive: true });
|
|
915644
|
+
await (0, import_promises122.cp)(asset.absoluteFilePathToAsset, absolutePathToAsset);
|
|
915541
915645
|
}));
|
|
915542
915646
|
}
|
|
915543
915647
|
setInstance({ companyName }) {
|
|
@@ -915570,7 +915674,7 @@ var NonTabbedNavigationBuilderImpl = class {
|
|
|
915570
915674
|
|
|
915571
915675
|
// ../docs-importers/mintlify/lib/MintlifyImporter.js
|
|
915572
915676
|
init_lib6();
|
|
915573
|
-
var
|
|
915677
|
+
var import_promises124 = require("fs/promises");
|
|
915574
915678
|
|
|
915575
915679
|
// ../docs-importers/mintlify/lib/convertColors.js
|
|
915576
915680
|
function convertColors(colors19) {
|
|
@@ -915631,10 +915735,10 @@ init_lib6();
|
|
|
915631
915735
|
|
|
915632
915736
|
// ../docs-importers/mintlify/lib/convertMarkdown.js
|
|
915633
915737
|
init_lib6();
|
|
915634
|
-
var
|
|
915738
|
+
var import_promises123 = require("fs/promises");
|
|
915635
915739
|
var import_gray_matter10 = __toESM(require_gray_matter(), 1);
|
|
915636
915740
|
async function convertMarkdown({ absolutePathToMintJson, absoluteFilepathToMarkdown, relativeFilepathFromRoot, builder }) {
|
|
915637
|
-
const text9 = await (0,
|
|
915741
|
+
const text9 = await (0, import_promises123.readFile)(absoluteFilepathToMarkdown, "utf-8");
|
|
915638
915742
|
const { data: data2, content: content5 } = parseMintlifyFrontmatter(text9);
|
|
915639
915743
|
const slug = relativeFilepathFromRoot.replace(/\.(md|mdx)$/, "");
|
|
915640
915744
|
const transformedContent = markReferencedAssets({
|
|
@@ -915797,7 +915901,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
915797
915901
|
documentationTab = void 0;
|
|
915798
915902
|
tabUrlToInfo = {};
|
|
915799
915903
|
async import({ args, builder }) {
|
|
915800
|
-
const mintJsonContent = await (0,
|
|
915904
|
+
const mintJsonContent = await (0, import_promises124.readFile)(args.absolutePathToMintJson, "utf-8");
|
|
915801
915905
|
const mint = JSON.parse(mintJsonContent);
|
|
915802
915906
|
builder.setTitle({ title: mint.name });
|
|
915803
915907
|
const relativePathToFavicon = RelativeFilePath2.of(mint.favicon.substring(1));
|
|
@@ -915923,7 +916027,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
915923
916027
|
|
|
915924
916028
|
// ../docs-importers/mintlify/lib/runMintlifyMigration.js
|
|
915925
916029
|
init_lib6();
|
|
915926
|
-
var
|
|
916030
|
+
var import_promises125 = require("fs/promises");
|
|
915927
916031
|
async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskContext, versionOfCli, organization }) {
|
|
915928
916032
|
const mintlifyImporter = new MintlifyImporter({
|
|
915929
916033
|
context: taskContext
|
|
@@ -915934,7 +916038,7 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
|
|
|
915934
916038
|
builder
|
|
915935
916039
|
});
|
|
915936
916040
|
await builder.build({ outputDirectory: outputPath });
|
|
915937
|
-
await (0,
|
|
916041
|
+
await (0, import_promises125.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
915938
916042
|
version: versionOfCli,
|
|
915939
916043
|
organization
|
|
915940
916044
|
}, void 0, 4));
|
|
@@ -915993,7 +916097,7 @@ function assertIsStringArray(val) {
|
|
|
915993
916097
|
// ../docs-importers/readme/lib/ReadmeImporter.js
|
|
915994
916098
|
init_lib4();
|
|
915995
916099
|
init_lib6();
|
|
915996
|
-
var
|
|
916100
|
+
var import_promises130 = require("fs/promises");
|
|
915997
916101
|
|
|
915998
916102
|
// ../docs-importers/readme/lib/extract/favicon.js
|
|
915999
916103
|
async function getFavicon(hast) {
|
|
@@ -927411,7 +927515,7 @@ init_disposable();
|
|
|
927411
927515
|
init_incremental_id_generator();
|
|
927412
927516
|
|
|
927413
927517
|
// ../../../node_modules/.pnpm/puppeteer-core@24.40.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js
|
|
927414
|
-
var
|
|
927518
|
+
var import_promises128 = require("fs/promises");
|
|
927415
927519
|
var import_node_os11 = __toESM(require("os"), 1);
|
|
927416
927520
|
var import_node_path36 = __toESM(require("path"), 1);
|
|
927417
927521
|
init_main();
|
|
@@ -927855,7 +927959,7 @@ var ChromeLauncher = class extends BrowserLauncher {
|
|
|
927855
927959
|
});
|
|
927856
927960
|
if (userDataDirIndex < 0) {
|
|
927857
927961
|
isTempUserDataDir = true;
|
|
927858
|
-
chromeArguments.push(`--user-data-dir=${await (0,
|
|
927962
|
+
chromeArguments.push(`--user-data-dir=${await (0, import_promises128.mkdtemp)(this.getProfilePath())}`);
|
|
927859
927963
|
userDataDirIndex = chromeArguments.length - 1;
|
|
927860
927964
|
}
|
|
927861
927965
|
const userDataDir = chromeArguments[userDataDirIndex].split("=", 2)[1];
|
|
@@ -928012,7 +928116,7 @@ function removeMatchingFlags(array3, flag) {
|
|
|
928012
928116
|
|
|
928013
928117
|
// ../../../node_modules/.pnpm/puppeteer-core@24.40.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/FirefoxLauncher.js
|
|
928014
928118
|
var import_node_fs28 = __toESM(require("fs"), 1);
|
|
928015
|
-
var
|
|
928119
|
+
var import_promises129 = require("fs/promises");
|
|
928016
928120
|
var import_node_os12 = __toESM(require("os"), 1);
|
|
928017
928121
|
var import_node_path37 = __toESM(require("path"), 1);
|
|
928018
928122
|
init_main();
|
|
@@ -928066,7 +928170,7 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
928066
928170
|
}
|
|
928067
928171
|
isTempUserDataDir = false;
|
|
928068
928172
|
} else {
|
|
928069
|
-
userDataDir = await (0,
|
|
928173
|
+
userDataDir = await (0, import_promises129.mkdtemp)(this.getProfilePath());
|
|
928070
928174
|
firefoxArguments.push("--profile");
|
|
928071
928175
|
firefoxArguments.push(userDataDir);
|
|
928072
928176
|
}
|
|
@@ -928107,8 +928211,8 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
928107
928211
|
const prefsBackupPath = import_node_path37.default.join(userDataDir, file4 + backupSuffix);
|
|
928108
928212
|
if (import_node_fs28.default.existsSync(prefsBackupPath)) {
|
|
928109
928213
|
const prefsPath = import_node_path37.default.join(userDataDir, file4);
|
|
928110
|
-
await (0,
|
|
928111
|
-
await (0,
|
|
928214
|
+
await (0, import_promises129.unlink)(prefsPath);
|
|
928215
|
+
await (0, import_promises129.rename)(prefsBackupPath, prefsPath);
|
|
928112
928216
|
}
|
|
928113
928217
|
}));
|
|
928114
928218
|
for (const result of results) {
|
|
@@ -929153,7 +929257,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
929153
929257
|
if (response.ok) {
|
|
929154
929258
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
929155
929259
|
const faviconPath = join8(assetsDirectory, RelativeFilePath2.of("favicon"));
|
|
929156
|
-
await (0,
|
|
929260
|
+
await (0, import_promises130.writeFile)(faviconPath, new Uint8Array(imageBuffer));
|
|
929157
929261
|
builder.setFavicon({ favicon: relativize(this.absolutePathToFernDirectory, faviconPath) });
|
|
929158
929262
|
}
|
|
929159
929263
|
}
|
|
@@ -929170,7 +929274,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
929170
929274
|
*/
|
|
929171
929275
|
async getAndCreateAssetsDirectory() {
|
|
929172
929276
|
const assetsDirectory = join8(this.absolutePathToFernDirectory, RelativeFilePath2.of("assets"));
|
|
929173
|
-
await (0,
|
|
929277
|
+
await (0, import_promises130.mkdir)(assetsDirectory, { recursive: true });
|
|
929174
929278
|
return assetsDirectory;
|
|
929175
929279
|
}
|
|
929176
929280
|
/**
|
|
@@ -929220,7 +929324,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
929220
929324
|
absolutePathToOutputDirectory,
|
|
929221
929325
|
section
|
|
929222
929326
|
});
|
|
929223
|
-
await (0,
|
|
929327
|
+
await (0, import_promises130.mkdir)(absolutePathToOutputDirectoryForSection, { recursive: true });
|
|
929224
929328
|
await Promise.all(section.pages.filter((page) => page.type === "page").map(async (page) => {
|
|
929225
929329
|
const url3 = new URL(page.slug.toString(), this.url);
|
|
929226
929330
|
this.logger.debug(`Fetching page: ${url3.toString()}`);
|
|
@@ -929235,7 +929339,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
929235
929339
|
absolutePathToOutputDirectoryForSection,
|
|
929236
929340
|
page: page.slug
|
|
929237
929341
|
});
|
|
929238
|
-
await (0,
|
|
929342
|
+
await (0, import_promises130.writeFile)(absolutePathForPage, result.data.mdx);
|
|
929239
929343
|
if (result.data.images.imageURLs.length > 0) {
|
|
929240
929344
|
this.logger.debug(`Found ${result.data.images.imageURLs.length} images to download for ${url3.toString()}`);
|
|
929241
929345
|
await Promise.all(Object.entries(result.data.images.imageURLToFilename).map(async ([imageUrl, filename]) => {
|
|
@@ -929248,8 +929352,8 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
929248
929352
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
929249
929353
|
const imagePath = join8(absolutePathToOutputDirectoryForSection, RelativeFilePath2.of(filename));
|
|
929250
929354
|
const imageDir = dirname6(imagePath);
|
|
929251
|
-
await (0,
|
|
929252
|
-
await (0,
|
|
929355
|
+
await (0, import_promises130.mkdir)(imageDir, { recursive: true });
|
|
929356
|
+
await (0, import_promises130.writeFile)(imagePath, new Uint8Array(imageBuffer));
|
|
929253
929357
|
this.logger.debug(`Saved image to ${imagePath}`);
|
|
929254
929358
|
} catch (error50) {
|
|
929255
929359
|
this.logger.warn(`Error downloading image ${imageUrl}: ${error50}`);
|
|
@@ -929332,7 +929436,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
929332
929436
|
|
|
929333
929437
|
// ../docs-importers/readme/lib/runReadmeMigration.js
|
|
929334
929438
|
init_lib6();
|
|
929335
|
-
var
|
|
929439
|
+
var import_promises131 = require("fs/promises");
|
|
929336
929440
|
async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionOfCli, organization }) {
|
|
929337
929441
|
const builder = new FernDocsBuilderImpl();
|
|
929338
929442
|
builder.setInstance({ companyName: organization });
|
|
@@ -929347,7 +929451,7 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
|
|
|
929347
929451
|
builder
|
|
929348
929452
|
});
|
|
929349
929453
|
await builder.build({ outputDirectory: outputPath });
|
|
929350
|
-
await (0,
|
|
929454
|
+
await (0, import_promises131.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
929351
929455
|
version: versionOfCli,
|
|
929352
929456
|
organization
|
|
929353
929457
|
}, void 0, 4));
|
|
@@ -929372,7 +929476,7 @@ var initializeWithReadme = async ({ readmeUrl, organization, taskContext, versio
|
|
|
929372
929476
|
};
|
|
929373
929477
|
|
|
929374
929478
|
// ../init/lib/utils/loadOpenApiFromUrl.js
|
|
929375
|
-
var
|
|
929479
|
+
var import_promises132 = require("fs/promises");
|
|
929376
929480
|
init_js_yaml();
|
|
929377
929481
|
var import_path86 = require("path");
|
|
929378
929482
|
var import_tmp_promise16 = __toESM(require_tmp_promise(), 1);
|
|
@@ -929388,7 +929492,7 @@ async function loadOpenAPIFromUrl({ url: url3, logger: logger4 }) {
|
|
|
929388
929492
|
const filePath = (0, import_path86.join)(tmpDir.path, url3.endsWith(".json") ? "openapi.json" : "openapi.yaml");
|
|
929389
929493
|
logger4.debug("tmpDir", tmpDir.path);
|
|
929390
929494
|
logger4.debug("filePath", filePath);
|
|
929391
|
-
await (0,
|
|
929495
|
+
await (0, import_promises132.writeFile)(filePath, data2);
|
|
929392
929496
|
return {
|
|
929393
929497
|
status: LoadOpenAPIStatus.Success,
|
|
929394
929498
|
filePath
|
|
@@ -933739,7 +933843,7 @@ var CliContext = class _CliContext {
|
|
|
933739
933843
|
if (false) {
|
|
933740
933844
|
this.logger.error("CLI_VERSION is not defined");
|
|
933741
933845
|
}
|
|
933742
|
-
return "5.6.
|
|
933846
|
+
return "5.6.1";
|
|
933743
933847
|
}
|
|
933744
933848
|
getCliName() {
|
|
933745
933849
|
if (false) {
|
|
@@ -934037,7 +934141,7 @@ function wrapWorkspaceNameForPrefix(workspaceName) {
|
|
|
934037
934141
|
|
|
934038
934142
|
// ../project-loader/lib/loadProject.js
|
|
934039
934143
|
init_lib6();
|
|
934040
|
-
var
|
|
934144
|
+
var import_promises133 = require("fs/promises");
|
|
934041
934145
|
|
|
934042
934146
|
// ../project-loader/lib/normalizeCommandLineApiWorkspace.js
|
|
934043
934147
|
function normalizeCommandLineApiWorkspace(input3) {
|
|
@@ -934119,7 +934223,7 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
934119
934223
|
const apisDirectory = join8(fernDirectory, RelativeFilePath2.of(APIS_DIRECTORY));
|
|
934120
934224
|
const apisDirectoryExists = await doesPathExist(apisDirectory);
|
|
934121
934225
|
if (apisDirectoryExists) {
|
|
934122
|
-
const apiDirectoryContents = await (0,
|
|
934226
|
+
const apiDirectoryContents = await (0, import_promises133.readdir)(apisDirectory, { withFileTypes: true });
|
|
934123
934227
|
const apiWorkspaceDirectoryNames = apiDirectoryContents.reduce((all9, item) => {
|
|
934124
934228
|
if (item.isDirectory()) {
|
|
934125
934229
|
all9.push(item.name);
|
|
@@ -934195,11 +934299,11 @@ async function loadProjectAndRegisterWorkspacesWithContext(cliContext, args, reg
|
|
|
934195
934299
|
|
|
934196
934300
|
// src/cliV2.ts
|
|
934197
934301
|
var import_generators_sdk5 = __toESM(require_generators_sdk(), 1);
|
|
934198
|
-
var
|
|
934302
|
+
var import_promises138 = require("fs/promises");
|
|
934199
934303
|
|
|
934200
934304
|
// src/commands/generator-list/getGeneratorList.ts
|
|
934201
934305
|
init_lib4();
|
|
934202
|
-
var
|
|
934306
|
+
var import_promises134 = require("fs/promises");
|
|
934203
934307
|
init_js_yaml();
|
|
934204
934308
|
var GenerationModeFilter = {
|
|
934205
934309
|
GitHub: "github",
|
|
@@ -934260,7 +934364,7 @@ async function getGeneratorList({
|
|
|
934260
934364
|
return;
|
|
934261
934365
|
}
|
|
934262
934366
|
try {
|
|
934263
|
-
await (0,
|
|
934367
|
+
await (0, import_promises134.writeFile)(outputLocation, generatorsListYaml);
|
|
934264
934368
|
} catch (error50) {
|
|
934265
934369
|
cliContext.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
934266
934370
|
code: CliError.Code.ConfigError
|
|
@@ -934328,7 +934432,7 @@ async function getGeneratorMetadata({
|
|
|
934328
934432
|
}
|
|
934329
934433
|
|
|
934330
934434
|
// src/commands/organization/getOrganization.ts
|
|
934331
|
-
var
|
|
934435
|
+
var import_promises135 = require("fs/promises");
|
|
934332
934436
|
async function getOrganization({
|
|
934333
934437
|
project,
|
|
934334
934438
|
outputLocation,
|
|
@@ -934340,7 +934444,7 @@ async function getOrganization({
|
|
|
934340
934444
|
return;
|
|
934341
934445
|
}
|
|
934342
934446
|
try {
|
|
934343
|
-
await (0,
|
|
934447
|
+
await (0, import_promises135.writeFile)(outputLocation, org);
|
|
934344
934448
|
} catch (error50) {
|
|
934345
934449
|
context3.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
934346
934450
|
code: CliError.Code.ConfigError
|
|
@@ -934350,7 +934454,7 @@ async function getOrganization({
|
|
|
934350
934454
|
|
|
934351
934455
|
// src/commands/upgrade/upgradeGenerator.ts
|
|
934352
934456
|
init_lib6();
|
|
934353
|
-
var
|
|
934457
|
+
var import_promises137 = require("fs/promises");
|
|
934354
934458
|
var import_path88 = __toESM(require("path"), 1);
|
|
934355
934459
|
var import_semver16 = __toESM(require_semver2(), 1);
|
|
934356
934460
|
var import_yaml6 = __toESM(require_dist9(), 1);
|
|
@@ -934359,7 +934463,7 @@ var import_yaml6 = __toESM(require_dist9(), 1);
|
|
|
934359
934463
|
init_lib4();
|
|
934360
934464
|
init_lib10();
|
|
934361
934465
|
var import_fs36 = require("fs");
|
|
934362
|
-
var
|
|
934466
|
+
var import_promises136 = require("fs/promises");
|
|
934363
934467
|
var import_os15 = require("os");
|
|
934364
934468
|
var import_path87 = require("path");
|
|
934365
934469
|
var import_semver15 = __toESM(require_semver2(), 1);
|
|
@@ -934387,7 +934491,7 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
934387
934491
|
const myPid = String(process.pid);
|
|
934388
934492
|
while (true) {
|
|
934389
934493
|
try {
|
|
934390
|
-
const fh = await (0,
|
|
934494
|
+
const fh = await (0, import_promises136.open)(lockPath, "wx");
|
|
934391
934495
|
await fh.writeFile(myPid);
|
|
934392
934496
|
await fh.close();
|
|
934393
934497
|
const exitHandler = () => {
|
|
@@ -934404,9 +934508,9 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
934404
934508
|
return async () => {
|
|
934405
934509
|
process.removeListener("exit", exitHandler);
|
|
934406
934510
|
try {
|
|
934407
|
-
const currentContent = await (0,
|
|
934511
|
+
const currentContent = await (0, import_promises136.readFile)(lockPath, "utf-8");
|
|
934408
934512
|
if (currentContent.trim() === myPid) {
|
|
934409
|
-
await (0,
|
|
934513
|
+
await (0, import_promises136.unlink)(lockPath);
|
|
934410
934514
|
} else {
|
|
934411
934515
|
logger4.debug(
|
|
934412
934516
|
`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`
|
|
@@ -934422,14 +934526,14 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
934422
934526
|
throw err;
|
|
934423
934527
|
}
|
|
934424
934528
|
try {
|
|
934425
|
-
const lockContent = await (0,
|
|
934529
|
+
const lockContent = await (0, import_promises136.readFile)(lockPath, "utf-8");
|
|
934426
934530
|
const lockPid = Number(lockContent.trim());
|
|
934427
|
-
const lockStat = await (0,
|
|
934531
|
+
const lockStat = await (0, import_promises136.stat)(lockPath);
|
|
934428
934532
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
934429
934533
|
if (lockAge > LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !isProcessAlive(lockPid)) {
|
|
934430
934534
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
934431
934535
|
try {
|
|
934432
|
-
await (0,
|
|
934536
|
+
await (0, import_promises136.unlink)(lockPath);
|
|
934433
934537
|
} catch (unlinkErr) {
|
|
934434
934538
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
934435
934539
|
}
|
|
@@ -934453,7 +934557,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
934453
934557
|
}
|
|
934454
934558
|
migrationsInstallPromise = (async () => {
|
|
934455
934559
|
const cacheDir = getMigrationCacheDir();
|
|
934456
|
-
await (0,
|
|
934560
|
+
await (0, import_promises136.mkdir)(cacheDir, { recursive: true });
|
|
934457
934561
|
const npmCacheDir = (0, import_path87.join)(cacheDir, ".npm-cache");
|
|
934458
934562
|
const packageDir = (0, import_path87.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME2);
|
|
934459
934563
|
const packageJsonPath = (0, import_path87.join)(packageDir, "package.json");
|
|
@@ -934470,7 +934574,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
934470
934574
|
"--no-audit",
|
|
934471
934575
|
"--no-fund"
|
|
934472
934576
|
]);
|
|
934473
|
-
const packageJsonContent = await (0,
|
|
934577
|
+
const packageJsonContent = await (0, import_promises136.readFile)(packageJsonPath, "utf-8");
|
|
934474
934578
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
934475
934579
|
if (packageJson2.main == null) {
|
|
934476
934580
|
throw new CliError({
|
|
@@ -934650,7 +934754,7 @@ async function loadAndUpdateGenerators({
|
|
|
934650
934754
|
skippedAutoreleaseDisabled: []
|
|
934651
934755
|
};
|
|
934652
934756
|
}
|
|
934653
|
-
const contents = await (0,
|
|
934757
|
+
const contents = await (0, import_promises137.readFile)(filepath);
|
|
934654
934758
|
context3.logger.debug(`Found generators: ${contents.toString()}`);
|
|
934655
934759
|
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
934656
934760
|
const generatorGroups = parsedDocument.get("groups");
|
|
@@ -934887,7 +934991,7 @@ async function upgradeGenerator({
|
|
|
934887
934991
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
934888
934992
|
});
|
|
934889
934993
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
934890
|
-
await (0,
|
|
934994
|
+
await (0, import_promises137.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
934891
934995
|
}
|
|
934892
934996
|
allSkippedMajorUpgrades.push(...result.skippedMajorUpgrades);
|
|
934893
934997
|
if (result.appliedUpgrades.length > 0) {
|
|
@@ -935287,7 +935391,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
935287
935391
|
}
|
|
935288
935392
|
if (argv.output) {
|
|
935289
935393
|
try {
|
|
935290
|
-
await (0,
|
|
935394
|
+
await (0, import_promises138.writeFile)(argv.output, JSON.stringify(generatorMetadata, null, 2));
|
|
935291
935395
|
} catch (error50) {
|
|
935292
935396
|
cliContext.failAndThrow(
|
|
935293
935397
|
`Could not write file to the specified location: ${argv.output}`,
|
|
@@ -935302,7 +935406,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
935302
935406
|
}
|
|
935303
935407
|
|
|
935304
935408
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
935305
|
-
var
|
|
935409
|
+
var import_promises139 = require("fs/promises");
|
|
935306
935410
|
init_js_yaml();
|
|
935307
935411
|
async function addGeneratorToWorkspaces({
|
|
935308
935412
|
project: { apiWorkspaces },
|
|
@@ -935330,7 +935434,7 @@ async function addGeneratorToWorkspaces({
|
|
|
935330
935434
|
if (absolutePathToGeneratorsConfiguration == null) {
|
|
935331
935435
|
return;
|
|
935332
935436
|
}
|
|
935333
|
-
await (0,
|
|
935437
|
+
await (0, import_promises139.writeFile)(
|
|
935334
935438
|
absolutePathToGeneratorsConfiguration,
|
|
935335
935439
|
"# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(newConfiguration)
|
|
935336
935440
|
);
|
|
@@ -935393,11 +935497,11 @@ var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
|
|
|
935393
935497
|
|
|
935394
935498
|
// src/commands/generate/checkOutputDirectory.ts
|
|
935395
935499
|
init_lib6();
|
|
935396
|
-
var
|
|
935500
|
+
var import_promises142 = require("fs/promises");
|
|
935397
935501
|
|
|
935398
935502
|
// src/persistence/output-directories/getOutputDirectories.ts
|
|
935399
935503
|
init_lib6();
|
|
935400
|
-
var
|
|
935504
|
+
var import_promises140 = require("fs/promises");
|
|
935401
935505
|
|
|
935402
935506
|
// src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
|
|
935403
935507
|
init_lib6();
|
|
@@ -935417,17 +935521,17 @@ async function getOutputDirectories() {
|
|
|
935417
935521
|
if (!doesOutputDirectoriesFileExist) {
|
|
935418
935522
|
return [];
|
|
935419
935523
|
}
|
|
935420
|
-
const outputDirectoriesFileContents = await (0,
|
|
935524
|
+
const outputDirectoriesFileContents = await (0, import_promises140.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
|
|
935421
935525
|
const outputDirectories = JSON.parse(outputDirectoriesFileContents);
|
|
935422
935526
|
return outputDirectories;
|
|
935423
935527
|
}
|
|
935424
935528
|
|
|
935425
935529
|
// src/persistence/output-directories/storeOutputDirectories.ts
|
|
935426
|
-
var
|
|
935530
|
+
var import_promises141 = require("fs/promises");
|
|
935427
935531
|
var import_path89 = __toESM(require("path"), 1);
|
|
935428
935532
|
async function storeOutputDirectories(outputDirectories) {
|
|
935429
|
-
await (0,
|
|
935430
|
-
await (0,
|
|
935533
|
+
await (0, import_promises141.mkdir)(import_path89.default.dirname(getPathToOutputDirectoriesFile()), { recursive: true });
|
|
935534
|
+
await (0, import_promises141.writeFile)(getPathToOutputDirectoriesFile(), JSON.stringify(outputDirectories, null, 2));
|
|
935431
935535
|
}
|
|
935432
935536
|
|
|
935433
935537
|
// src/commands/generate/checkOutputDirectory.ts
|
|
@@ -935449,7 +935553,7 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
|
935449
935553
|
shouldProceed: true
|
|
935450
935554
|
};
|
|
935451
935555
|
}
|
|
935452
|
-
const files = await (0,
|
|
935556
|
+
const files = await (0, import_promises142.readdir)(outputPath);
|
|
935453
935557
|
if (files.length === 0) {
|
|
935454
935558
|
return {
|
|
935455
935559
|
shouldProceed: true
|
|
@@ -936337,7 +936441,7 @@ var GeneratorRunCollector = class {
|
|
|
936337
936441
|
// src/commands/automations/generate/reportGenerateResults.ts
|
|
936338
936442
|
init_lib4();
|
|
936339
936443
|
var import_fs37 = require("fs");
|
|
936340
|
-
var
|
|
936444
|
+
var import_promises143 = require("fs/promises");
|
|
936341
936445
|
var JSON_SCHEMA_VERSION = 1;
|
|
936342
936446
|
function renderStdoutSummary(results) {
|
|
936343
936447
|
return formatCounts(countResults(results));
|
|
@@ -936527,12 +936631,12 @@ async function writeResults({
|
|
|
936527
936631
|
const stepSummaryPath = getGithubStepSummaryPath();
|
|
936528
936632
|
if (stepSummaryPath != null) {
|
|
936529
936633
|
try {
|
|
936530
|
-
await (0,
|
|
936634
|
+
await (0, import_promises143.appendFile)(stepSummaryPath, renderMarkdownSummary(results), "utf8");
|
|
936531
936635
|
} catch {
|
|
936532
936636
|
}
|
|
936533
936637
|
}
|
|
936534
936638
|
if (jsonOutputPath != null) {
|
|
936535
|
-
await (0,
|
|
936639
|
+
await (0, import_promises143.writeFile)(jsonOutputPath, JSON.stringify(renderJsonSummary(results), null, 2), "utf8");
|
|
936536
936640
|
}
|
|
936537
936641
|
}
|
|
936538
936642
|
function writeResultsSync({
|
|
@@ -936836,13 +936940,13 @@ function listPreviewGroups({
|
|
|
936836
936940
|
}
|
|
936837
936941
|
|
|
936838
936942
|
// src/commands/automations/upgrade/executeAutomationsUpgrade.ts
|
|
936839
|
-
var
|
|
936943
|
+
var import_promises172 = require("fs/promises");
|
|
936840
936944
|
|
|
936841
936945
|
// ../cli-migrations/lib/runMigrations.js
|
|
936842
936946
|
init_lib4();
|
|
936843
936947
|
|
|
936844
936948
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
936845
|
-
var
|
|
936949
|
+
var import_promises144 = require("fs/promises");
|
|
936846
936950
|
|
|
936847
936951
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
936848
936952
|
init_lib6();
|
|
@@ -936878,7 +936982,7 @@ var migration = {
|
|
|
936878
936982
|
try {
|
|
936879
936983
|
const fileContents = await getFileContents(yamlFilepath);
|
|
936880
936984
|
const newContents = addDiscriminantToFile(fileContents);
|
|
936881
|
-
await (0,
|
|
936985
|
+
await (0, import_promises144.writeFile)(yamlFilepath, newContents);
|
|
936882
936986
|
} catch (error50) {
|
|
936883
936987
|
context3.failAndThrow("Failed to migrate " + yamlFilepath, error50);
|
|
936884
936988
|
}
|
|
@@ -936886,7 +936990,7 @@ var migration = {
|
|
|
936886
936990
|
}
|
|
936887
936991
|
};
|
|
936888
936992
|
async function getFileContents(filepath) {
|
|
936889
|
-
const buffer = await (0,
|
|
936993
|
+
const buffer = await (0, import_promises144.readFile)(filepath);
|
|
936890
936994
|
return buffer.toString();
|
|
936891
936995
|
}
|
|
936892
936996
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -936915,7 +937019,7 @@ var versionMigrations = {
|
|
|
936915
937019
|
var __default = versionMigrations;
|
|
936916
937020
|
|
|
936917
937021
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
936918
|
-
var
|
|
937022
|
+
var import_promises145 = require("fs/promises");
|
|
936919
937023
|
var import_yaml7 = __toESM(require_dist9(), 1);
|
|
936920
937024
|
|
|
936921
937025
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
@@ -936958,7 +937062,7 @@ var migration2 = {
|
|
|
936958
937062
|
}
|
|
936959
937063
|
};
|
|
936960
937064
|
async function migrateFile(filepath, context3) {
|
|
936961
|
-
const contents = await (0,
|
|
937065
|
+
const contents = await (0, import_promises145.readFile)(filepath);
|
|
936962
937066
|
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
936963
937067
|
const types4 = parsedDocument.get("types");
|
|
936964
937068
|
if (types4 == null) {
|
|
@@ -936990,7 +937094,7 @@ async function migrateFile(filepath, context3) {
|
|
|
936990
937094
|
}
|
|
936991
937095
|
}
|
|
936992
937096
|
}
|
|
936993
|
-
await (0,
|
|
937097
|
+
await (0, import_promises145.writeFile)(filepath, parsedDocument.toString());
|
|
936994
937098
|
}
|
|
936995
937099
|
|
|
936996
937100
|
// ../cli-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -937001,7 +937105,7 @@ var versionMigrations2 = {
|
|
|
937001
937105
|
var __default2 = versionMigrations2;
|
|
937002
937106
|
|
|
937003
937107
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
937004
|
-
var
|
|
937108
|
+
var import_promises146 = require("fs/promises");
|
|
937005
937109
|
var import_yaml8 = __toESM(require_dist9(), 1);
|
|
937006
937110
|
|
|
937007
937111
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
@@ -937044,7 +937148,7 @@ var migration3 = {
|
|
|
937044
937148
|
}
|
|
937045
937149
|
};
|
|
937046
937150
|
async function migrateGeneratorsYml(filepath, context3) {
|
|
937047
|
-
const contents = await (0,
|
|
937151
|
+
const contents = await (0, import_promises146.readFile)(filepath);
|
|
937048
937152
|
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
937049
937153
|
const draftGenerators = parsedDocument.get("draft");
|
|
937050
937154
|
if (draftGenerators == null) {
|
|
@@ -937071,7 +937175,7 @@ async function migrateGeneratorsYml(filepath, context3) {
|
|
|
937071
937175
|
draftGenerator.set("output-path", name2.value.includes("openapi") ? "./generated-openapi" : name2.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
937072
937176
|
}
|
|
937073
937177
|
});
|
|
937074
|
-
await (0,
|
|
937178
|
+
await (0, import_promises146.writeFile)(filepath, parsedDocument.toString());
|
|
937075
937179
|
}
|
|
937076
937180
|
|
|
937077
937181
|
// ../cli-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -937082,7 +937186,7 @@ var versionMigrations3 = {
|
|
|
937082
937186
|
var __default3 = versionMigrations3;
|
|
937083
937187
|
|
|
937084
937188
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
937085
|
-
var
|
|
937189
|
+
var import_promises147 = require("fs/promises");
|
|
937086
937190
|
var import_yaml9 = __toESM(require_dist9(), 1);
|
|
937087
937191
|
|
|
937088
937192
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
@@ -937125,7 +937229,7 @@ var migration4 = {
|
|
|
937125
937229
|
}
|
|
937126
937230
|
};
|
|
937127
937231
|
async function migrateFile2(filepath, context3) {
|
|
937128
|
-
const contents = await (0,
|
|
937232
|
+
const contents = await (0, import_promises147.readFile)(filepath);
|
|
937129
937233
|
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
937130
937234
|
const addType = (typeName, typeDeclaration2) => {
|
|
937131
937235
|
const types4 = parsedDocument.get("types");
|
|
@@ -937169,7 +937273,7 @@ async function migrateFile2(filepath, context3) {
|
|
|
937169
937273
|
}
|
|
937170
937274
|
}
|
|
937171
937275
|
}
|
|
937172
|
-
await (0,
|
|
937276
|
+
await (0, import_promises147.writeFile)(filepath, parsedDocument.toString());
|
|
937173
937277
|
}
|
|
937174
937278
|
|
|
937175
937279
|
// ../cli-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -937180,7 +937284,7 @@ var versionMigrations4 = {
|
|
|
937180
937284
|
var __default4 = versionMigrations4;
|
|
937181
937285
|
|
|
937182
937286
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
937183
|
-
var
|
|
937287
|
+
var import_promises148 = require("fs/promises");
|
|
937184
937288
|
var import_yaml10 = __toESM(require_dist9(), 1);
|
|
937185
937289
|
|
|
937186
937290
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
@@ -937223,7 +937327,7 @@ var migration5 = {
|
|
|
937223
937327
|
}
|
|
937224
937328
|
};
|
|
937225
937329
|
async function migrateGeneratorsYml2(filepath, context3) {
|
|
937226
|
-
const contents = await (0,
|
|
937330
|
+
const contents = await (0, import_promises148.readFile)(filepath);
|
|
937227
937331
|
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
937228
937332
|
const releaseGenerators = parsedDocument.get("release");
|
|
937229
937333
|
if (releaseGenerators == null) {
|
|
@@ -937261,7 +937365,7 @@ async function migrateGeneratorsYml2(filepath, context3) {
|
|
|
937261
937365
|
}
|
|
937262
937366
|
releaseGenerator.delete("outputs");
|
|
937263
937367
|
});
|
|
937264
|
-
await (0,
|
|
937368
|
+
await (0, import_promises148.writeFile)(filepath, parsedDocument.toString());
|
|
937265
937369
|
}
|
|
937266
937370
|
|
|
937267
937371
|
// ../cli-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -937272,7 +937376,7 @@ var versionMigrations5 = {
|
|
|
937272
937376
|
var __default5 = versionMigrations5;
|
|
937273
937377
|
|
|
937274
937378
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
937275
|
-
var
|
|
937379
|
+
var import_promises149 = require("fs/promises");
|
|
937276
937380
|
|
|
937277
937381
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
937278
937382
|
init_lib6();
|
|
@@ -937305,9 +937409,9 @@ var migration6 = {
|
|
|
937305
937409
|
run: async ({ context: context3 }) => {
|
|
937306
937410
|
const yamlFiles = await getAllYamlFiles4(context3);
|
|
937307
937411
|
for (const filepath of yamlFiles) {
|
|
937308
|
-
const contents = await (0,
|
|
937412
|
+
const contents = await (0, import_promises149.readFile)(filepath);
|
|
937309
937413
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
937310
|
-
await (0,
|
|
937414
|
+
await (0, import_promises149.writeFile)(filepath, newContents);
|
|
937311
937415
|
}
|
|
937312
937416
|
}
|
|
937313
937417
|
};
|
|
@@ -937320,7 +937424,7 @@ var versionMigrations6 = {
|
|
|
937320
937424
|
var __default6 = versionMigrations6;
|
|
937321
937425
|
|
|
937322
937426
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
937323
|
-
var
|
|
937427
|
+
var import_promises150 = require("fs/promises");
|
|
937324
937428
|
|
|
937325
937429
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
937326
937430
|
init_lib6();
|
|
@@ -937353,9 +937457,9 @@ var migration7 = {
|
|
|
937353
937457
|
run: async ({ context: context3 }) => {
|
|
937354
937458
|
const yamlFiles = await getAllRootApiYamlFiles(context3);
|
|
937355
937459
|
for (const filepath of yamlFiles) {
|
|
937356
|
-
const contents = await (0,
|
|
937460
|
+
const contents = await (0, import_promises150.readFile)(filepath);
|
|
937357
937461
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
937358
|
-
await (0,
|
|
937462
|
+
await (0, import_promises150.writeFile)(filepath, newContents);
|
|
937359
937463
|
}
|
|
937360
937464
|
}
|
|
937361
937465
|
};
|
|
@@ -937369,7 +937473,7 @@ var __default7 = versionMigrations7;
|
|
|
937369
937473
|
|
|
937370
937474
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
937371
937475
|
init_lib4();
|
|
937372
|
-
var
|
|
937476
|
+
var import_promises151 = require("fs/promises");
|
|
937373
937477
|
init_js_yaml();
|
|
937374
937478
|
|
|
937375
937479
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
@@ -937502,7 +937606,7 @@ var migration8 = {
|
|
|
937502
937606
|
}
|
|
937503
937607
|
};
|
|
937504
937608
|
async function migrateGeneratorsYml3(filepath) {
|
|
937505
|
-
const contentsStr = await (0,
|
|
937609
|
+
const contentsStr = await (0, import_promises151.readFile)(filepath);
|
|
937506
937610
|
const contents = jsYaml.load(contentsStr.toString());
|
|
937507
937611
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
937508
937612
|
let newGeneratorsConfiguration = {};
|
|
@@ -937520,7 +937624,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
937520
937624
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
937521
937625
|
};
|
|
937522
937626
|
}
|
|
937523
|
-
await (0,
|
|
937627
|
+
await (0, import_promises151.writeFile)(filepath, jsYaml.dump(newGeneratorsConfiguration));
|
|
937524
937628
|
}
|
|
937525
937629
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
937526
937630
|
const newSchema = {
|
|
@@ -937595,7 +937699,7 @@ var versionMigrations8 = {
|
|
|
937595
937699
|
var __default8 = versionMigrations8;
|
|
937596
937700
|
|
|
937597
937701
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
937598
|
-
var
|
|
937702
|
+
var import_promises152 = require("fs/promises");
|
|
937599
937703
|
var import_yaml11 = __toESM(require_dist9(), 1);
|
|
937600
937704
|
|
|
937601
937705
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
@@ -937638,7 +937742,7 @@ var migration9 = {
|
|
|
937638
937742
|
}
|
|
937639
937743
|
};
|
|
937640
937744
|
async function migrateRootApiFile(filepath) {
|
|
937641
|
-
const contents = await (0,
|
|
937745
|
+
const contents = await (0, import_promises152.readFile)(filepath);
|
|
937642
937746
|
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
937643
937747
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
937644
937748
|
if (errorDiscriminant == null || !import_yaml11.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
@@ -937649,7 +937753,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
937649
937753
|
"property-name": errorDiscriminant.value
|
|
937650
937754
|
});
|
|
937651
937755
|
parsedDocument.delete("error-discriminant");
|
|
937652
|
-
await (0,
|
|
937756
|
+
await (0, import_promises152.writeFile)(filepath, parsedDocument.toString());
|
|
937653
937757
|
}
|
|
937654
937758
|
|
|
937655
937759
|
// ../cli-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -937660,7 +937764,7 @@ var versionMigrations9 = {
|
|
|
937660
937764
|
var __default9 = versionMigrations9;
|
|
937661
937765
|
|
|
937662
937766
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
937663
|
-
var
|
|
937767
|
+
var import_promises153 = require("fs/promises");
|
|
937664
937768
|
var import_yaml12 = __toESM(require_dist9(), 1);
|
|
937665
937769
|
|
|
937666
937770
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
@@ -937703,7 +937807,7 @@ var migration10 = {
|
|
|
937703
937807
|
}
|
|
937704
937808
|
};
|
|
937705
937809
|
async function migrateYamlFile(filepath, context3) {
|
|
937706
|
-
const contents = await (0,
|
|
937810
|
+
const contents = await (0, import_promises153.readFile)(filepath);
|
|
937707
937811
|
const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
|
|
937708
937812
|
const services = parsedDocument.get("services");
|
|
937709
937813
|
if (services == null) {
|
|
@@ -937743,7 +937847,7 @@ async function migrateYamlFile(filepath, context3) {
|
|
|
937743
937847
|
context3.failWithoutThrowing("Failed to convert endpoint", e8);
|
|
937744
937848
|
}
|
|
937745
937849
|
}
|
|
937746
|
-
await (0,
|
|
937850
|
+
await (0, import_promises153.writeFile)(filepath, parsedDocument.toString());
|
|
937747
937851
|
}
|
|
937748
937852
|
}
|
|
937749
937853
|
function convertEndpoint4({ document: document4, endpoint: endpoint3 }) {
|
|
@@ -937822,7 +937926,7 @@ var versionMigrations10 = {
|
|
|
937822
937926
|
var __default10 = versionMigrations10;
|
|
937823
937927
|
|
|
937824
937928
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
937825
|
-
var
|
|
937929
|
+
var import_promises154 = require("fs/promises");
|
|
937826
937930
|
var import_yaml13 = __toESM(require_dist9(), 1);
|
|
937827
937931
|
|
|
937828
937932
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
@@ -937865,7 +937969,7 @@ var migration11 = {
|
|
|
937865
937969
|
}
|
|
937866
937970
|
};
|
|
937867
937971
|
async function migrateYamlFile2(filepath, context3) {
|
|
937868
|
-
const contents = await (0,
|
|
937972
|
+
const contents = await (0, import_promises154.readFile)(filepath);
|
|
937869
937973
|
const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
|
|
937870
937974
|
const types4 = parsedDocument.get("types");
|
|
937871
937975
|
if (types4 == null) {
|
|
@@ -937891,7 +937995,7 @@ async function migrateYamlFile2(filepath, context3) {
|
|
|
937891
937995
|
examples.set(i9, { value: value2 });
|
|
937892
937996
|
}
|
|
937893
937997
|
}
|
|
937894
|
-
await (0,
|
|
937998
|
+
await (0, import_promises154.writeFile)(filepath, parsedDocument.toString());
|
|
937895
937999
|
}
|
|
937896
938000
|
|
|
937897
938001
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -937902,7 +938006,7 @@ var versionMigrations11 = {
|
|
|
937902
938006
|
var __default11 = versionMigrations11;
|
|
937903
938007
|
|
|
937904
938008
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
937905
|
-
var
|
|
938009
|
+
var import_promises155 = require("fs/promises");
|
|
937906
938010
|
var import_yaml14 = __toESM(require_dist9(), 1);
|
|
937907
938011
|
|
|
937908
938012
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
@@ -937945,7 +938049,7 @@ var migration12 = {
|
|
|
937945
938049
|
}
|
|
937946
938050
|
};
|
|
937947
938051
|
async function migrateYamlFile3(filepath, context3) {
|
|
937948
|
-
const contents = await (0,
|
|
938052
|
+
const contents = await (0, import_promises155.readFile)(filepath);
|
|
937949
938053
|
const parsedDocument = import_yaml14.default.parseDocument(contents.toString());
|
|
937950
938054
|
if (!import_yaml14.default.isMap(parsedDocument.contents)) {
|
|
937951
938055
|
return context3.failAndThrow("File is not a map");
|
|
@@ -937975,7 +938079,7 @@ async function migrateYamlFile3(filepath, context3) {
|
|
|
937975
938079
|
pair.value = firstService.value;
|
|
937976
938080
|
}
|
|
937977
938081
|
}
|
|
937978
|
-
await (0,
|
|
938082
|
+
await (0, import_promises155.writeFile)(filepath, parsedDocument.toString());
|
|
937979
938083
|
}
|
|
937980
938084
|
|
|
937981
938085
|
// ../cli-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -937986,7 +938090,7 @@ var versionMigrations12 = {
|
|
|
937986
938090
|
var __default12 = versionMigrations12;
|
|
937987
938091
|
|
|
937988
938092
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
937989
|
-
var
|
|
938093
|
+
var import_promises156 = require("fs/promises");
|
|
937990
938094
|
var import_yaml15 = __toESM(require_dist9(), 1);
|
|
937991
938095
|
|
|
937992
938096
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
@@ -938029,7 +938133,7 @@ var migration13 = {
|
|
|
938029
938133
|
}
|
|
938030
938134
|
};
|
|
938031
938135
|
async function migrateYamlFile4(filepath, context3) {
|
|
938032
|
-
const contents = await (0,
|
|
938136
|
+
const contents = await (0, import_promises156.readFile)(filepath);
|
|
938033
938137
|
const parsedDocument = import_yaml15.default.parseDocument(contents.toString());
|
|
938034
938138
|
if (!import_yaml15.default.isMap(parsedDocument.contents)) {
|
|
938035
938139
|
return context3.failAndThrow("File is not a map");
|
|
@@ -938048,7 +938152,7 @@ async function migrateYamlFile4(filepath, context3) {
|
|
|
938048
938152
|
}
|
|
938049
938153
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
938050
938154
|
parsedDocument.contents.items.unshift(docsPair);
|
|
938051
|
-
await (0,
|
|
938155
|
+
await (0, import_promises156.writeFile)(filepath, parsedDocument.toString());
|
|
938052
938156
|
}
|
|
938053
938157
|
|
|
938054
938158
|
// ../cli-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -938059,7 +938163,7 @@ var versionMigrations13 = {
|
|
|
938059
938163
|
var __default13 = versionMigrations13;
|
|
938060
938164
|
|
|
938061
938165
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
938062
|
-
var
|
|
938166
|
+
var import_promises157 = require("fs/promises");
|
|
938063
938167
|
|
|
938064
938168
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
938065
938169
|
init_lib6();
|
|
@@ -938101,14 +938205,14 @@ var migration14 = {
|
|
|
938101
938205
|
}
|
|
938102
938206
|
};
|
|
938103
938207
|
async function migrateYamlFile5(filepath) {
|
|
938104
|
-
const contents = await (0,
|
|
938208
|
+
const contents = await (0, import_promises157.readFile)(filepath);
|
|
938105
938209
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
938106
938210
|
const regex5 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
938107
938211
|
const updatedSnapshot = contents.toString().replace(regex5, (_match, _prefix, domain3) => {
|
|
938108
938212
|
return `docs:
|
|
938109
938213
|
domain: "${domain3}.${domainSuffix}"`;
|
|
938110
938214
|
});
|
|
938111
|
-
await (0,
|
|
938215
|
+
await (0, import_promises157.writeFile)(filepath, updatedSnapshot.toString());
|
|
938112
938216
|
}
|
|
938113
938217
|
|
|
938114
938218
|
// ../cli-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -938128,11 +938232,11 @@ var LegacyDocsSerializers = __toESM(require_serialization4(), 1);
|
|
|
938128
938232
|
|
|
938129
938233
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
938130
938234
|
init_lib6();
|
|
938131
|
-
var
|
|
938235
|
+
var import_promises158 = require("fs/promises");
|
|
938132
938236
|
init_js_yaml();
|
|
938133
938237
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
938134
938238
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
938135
|
-
const contentsStr = await (0,
|
|
938239
|
+
const contentsStr = await (0, import_promises158.readFile)(filepath);
|
|
938136
938240
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
938137
938241
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
938138
938242
|
if (result.ok) {
|
|
@@ -938151,7 +938255,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
938151
938255
|
|
|
938152
938256
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
938153
938257
|
init_lib6();
|
|
938154
|
-
var
|
|
938258
|
+
var import_promises160 = require("fs/promises");
|
|
938155
938259
|
init_js_yaml();
|
|
938156
938260
|
|
|
938157
938261
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
@@ -938360,11 +938464,11 @@ __export(legacy_exports, {
|
|
|
938360
938464
|
|
|
938361
938465
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
938362
938466
|
init_lib6();
|
|
938363
|
-
var
|
|
938467
|
+
var import_promises159 = require("fs/promises");
|
|
938364
938468
|
init_js_yaml();
|
|
938365
938469
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
938366
938470
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
938367
|
-
const contentsStr = await (0,
|
|
938471
|
+
const contentsStr = await (0, import_promises159.readFile)(filepath);
|
|
938368
938472
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
938369
938473
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
938370
938474
|
if (result.success) {
|
|
@@ -938394,7 +938498,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
938394
938498
|
var APIS_DIRECTORY2 = "apis";
|
|
938395
938499
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
938396
938500
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY2));
|
|
938397
|
-
await (0,
|
|
938501
|
+
await (0, import_promises160.mkdir)(absolutePathToApisDirectory);
|
|
938398
938502
|
for (const workspace of workspaces) {
|
|
938399
938503
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
938400
938504
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -938402,11 +938506,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
938402
938506
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
938403
938507
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
938404
938508
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
938405
|
-
await (0,
|
|
938509
|
+
await (0, import_promises160.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
938406
938510
|
}
|
|
938407
938511
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
938408
938512
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
938409
|
-
await (0,
|
|
938513
|
+
await (0, import_promises160.rm)(absolutePathToWorkspace, { recursive: true });
|
|
938410
938514
|
}
|
|
938411
938515
|
}
|
|
938412
938516
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -938419,7 +938523,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
938419
938523
|
generatorsConfiguration,
|
|
938420
938524
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
938421
938525
|
});
|
|
938422
|
-
await (0,
|
|
938526
|
+
await (0, import_promises160.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
938423
938527
|
return convertedResponse.docsURLs;
|
|
938424
938528
|
}
|
|
938425
938529
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -938433,12 +938537,12 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
938433
938537
|
apiName
|
|
938434
938538
|
});
|
|
938435
938539
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
938436
|
-
await (0,
|
|
938540
|
+
await (0, import_promises160.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
938437
938541
|
}
|
|
938438
938542
|
|
|
938439
938543
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
938440
938544
|
init_lib6();
|
|
938441
|
-
var
|
|
938545
|
+
var import_promises161 = require("fs/promises");
|
|
938442
938546
|
init_js_yaml();
|
|
938443
938547
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
938444
938548
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
@@ -938446,8 +938550,8 @@ async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePa
|
|
|
938446
938550
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
938447
938551
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
938448
938552
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
938449
|
-
await (0,
|
|
938450
|
-
await (0,
|
|
938553
|
+
await (0, import_promises161.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
938554
|
+
await (0, import_promises161.rm)(absolutePathToWorkspace, { recursive: true });
|
|
938451
938555
|
}
|
|
938452
938556
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
938453
938557
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -938460,7 +938564,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
938460
938564
|
apiName: void 0
|
|
938461
938565
|
});
|
|
938462
938566
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
938463
|
-
await (0,
|
|
938567
|
+
await (0, import_promises161.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
938464
938568
|
}
|
|
938465
938569
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
938466
938570
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -938472,24 +938576,24 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
938472
938576
|
generatorsConfiguration,
|
|
938473
938577
|
pathModificationStrategy: "MoveUp"
|
|
938474
938578
|
});
|
|
938475
|
-
await (0,
|
|
938579
|
+
await (0, import_promises161.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
938476
938580
|
return convertedResponse.docsURLs;
|
|
938477
938581
|
}
|
|
938478
938582
|
|
|
938479
938583
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
938480
938584
|
init_lib6();
|
|
938481
|
-
var
|
|
938585
|
+
var import_promises162 = require("fs/promises");
|
|
938482
938586
|
init_js_yaml();
|
|
938483
938587
|
var APIS_DIRECTORY3 = "apis";
|
|
938484
938588
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
938485
938589
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY3));
|
|
938486
|
-
await (0,
|
|
938590
|
+
await (0, import_promises162.mkdir)(absolutePathToApisDirectory);
|
|
938487
938591
|
for (const workspace of workspaces) {
|
|
938488
938592
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
938489
938593
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
938490
938594
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
938491
938595
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
938492
|
-
await (0,
|
|
938596
|
+
await (0, import_promises162.rm)(absolutePathToWorkspace, { recursive: true });
|
|
938493
938597
|
}
|
|
938494
938598
|
}
|
|
938495
938599
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -938502,17 +938606,17 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
938502
938606
|
generatorsConfiguration,
|
|
938503
938607
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
938504
938608
|
});
|
|
938505
|
-
await (0,
|
|
938609
|
+
await (0, import_promises162.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
938506
938610
|
}
|
|
938507
938611
|
|
|
938508
938612
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
938509
938613
|
init_lib6();
|
|
938510
|
-
var
|
|
938614
|
+
var import_promises163 = require("fs/promises");
|
|
938511
938615
|
init_js_yaml();
|
|
938512
938616
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
938513
938617
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
938514
938618
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
938515
|
-
await (0,
|
|
938619
|
+
await (0, import_promises163.rm)(absolutePathToWorkspace, { recursive: true });
|
|
938516
938620
|
}
|
|
938517
938621
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
938518
938622
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -938524,7 +938628,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
938524
938628
|
generatorsConfiguration,
|
|
938525
938629
|
pathModificationStrategy: "MoveUp"
|
|
938526
938630
|
});
|
|
938527
|
-
await (0,
|
|
938631
|
+
await (0, import_promises163.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
938528
938632
|
}
|
|
938529
938633
|
|
|
938530
938634
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -938602,7 +938706,7 @@ var __default15 = versionMigrations15;
|
|
|
938602
938706
|
|
|
938603
938707
|
// ../cli-migrations/lib/migrations/0.41.0-rc0/require-generators-yml/migration.js
|
|
938604
938708
|
init_lib6();
|
|
938605
|
-
var
|
|
938709
|
+
var import_promises164 = require("fs/promises");
|
|
938606
938710
|
init_js_yaml();
|
|
938607
938711
|
var import_yaml16 = __toESM(require_dist9(), 1);
|
|
938608
938712
|
var migration16 = {
|
|
@@ -938646,7 +938750,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
938646
938750
|
if (existingGeneratorsYml == null) {
|
|
938647
938751
|
if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
938648
938752
|
const absolutePathToGeneratorsYml = join8(absoluteFilepathToWorkspace, RelativeFilePath2.of("generators.yml"));
|
|
938649
|
-
await (0,
|
|
938753
|
+
await (0, import_promises164.writeFile)(absolutePathToGeneratorsYml, jsYaml.dump({
|
|
938650
938754
|
api: {
|
|
938651
938755
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
938652
938756
|
}
|
|
@@ -938661,7 +938765,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
938661
938765
|
parsedDocument.set("api", {
|
|
938662
938766
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
938663
938767
|
});
|
|
938664
|
-
await (0,
|
|
938768
|
+
await (0, import_promises164.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
|
|
938665
938769
|
context3.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
|
|
938666
938770
|
}
|
|
938667
938771
|
}
|
|
@@ -938689,7 +938793,7 @@ var __default16 = versionMigrations16;
|
|
|
938689
938793
|
|
|
938690
938794
|
// ../cli-migrations/lib/migrations/0.54.0-rc0/use-generators-yml-specs/migration.js
|
|
938691
938795
|
init_lib6();
|
|
938692
|
-
var
|
|
938796
|
+
var import_promises165 = require("fs/promises");
|
|
938693
938797
|
init_js_yaml();
|
|
938694
938798
|
var import_yaml17 = __toESM(require_dist9(), 1);
|
|
938695
938799
|
var migration17 = {
|
|
@@ -938870,7 +938974,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
|
|
|
938870
938974
|
if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
|
|
938871
938975
|
documentToWrite = `${schemaComment}${documentToWrite}`;
|
|
938872
938976
|
}
|
|
938873
|
-
await (0,
|
|
938977
|
+
await (0, import_promises165.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
938874
938978
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
938875
938979
|
}
|
|
938876
938980
|
async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, directories, context: context3, namespace }) {
|
|
@@ -938917,7 +939021,7 @@ async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, direc
|
|
|
938917
939021
|
}
|
|
938918
939022
|
let specContent;
|
|
938919
939023
|
try {
|
|
938920
|
-
const fileContents = await (0,
|
|
939024
|
+
const fileContents = await (0, import_promises165.readFile)(absoluteSpecPath, { encoding: "utf-8" });
|
|
938921
939025
|
specContent = jsYaml.load(fileContents);
|
|
938922
939026
|
} catch (e8) {
|
|
938923
939027
|
context3.logger.warn(`Failed to read API spec file ${spec.path}. Error: ${e8}. Skipping...`);
|
|
@@ -939021,7 +939125,7 @@ var __default17 = versionMigrations17;
|
|
|
939021
939125
|
|
|
939022
939126
|
// ../cli-migrations/lib/migrations/0.82.1/add-path-parameter-order-setting/migration.js
|
|
939023
939127
|
init_lib6();
|
|
939024
|
-
var
|
|
939128
|
+
var import_promises166 = require("fs/promises");
|
|
939025
939129
|
init_js_yaml();
|
|
939026
939130
|
var migration18 = {
|
|
939027
939131
|
name: "add-path-parameter-order-setting",
|
|
@@ -939110,7 +939214,7 @@ async function updateGeneratorsYml({ context: context3, files }) {
|
|
|
939110
939214
|
documentToWrite = `${schemaComment}
|
|
939111
939215
|
${documentToWrite}`;
|
|
939112
939216
|
}
|
|
939113
|
-
await (0,
|
|
939217
|
+
await (0, import_promises166.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
939114
939218
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
939115
939219
|
}
|
|
939116
939220
|
async function getFilesAndDirectories3(absoluteFilepath) {
|
|
@@ -939147,7 +939251,7 @@ var __default18 = versionMigrations18;
|
|
|
939147
939251
|
|
|
939148
939252
|
// ../cli-migrations/lib/migrations/1.0.0/update-settings-defaults/migration.js
|
|
939149
939253
|
init_lib6();
|
|
939150
|
-
var
|
|
939254
|
+
var import_promises167 = require("fs/promises");
|
|
939151
939255
|
init_js_yaml();
|
|
939152
939256
|
var migration19 = {
|
|
939153
939257
|
name: "update-1_0_0-defaults",
|
|
@@ -939323,7 +939427,7 @@ async function updateGeneratorsYml2({ context: context3, files }) {
|
|
|
939323
939427
|
documentToWrite = `${schemaComment}
|
|
939324
939428
|
${documentToWrite}`;
|
|
939325
939429
|
}
|
|
939326
|
-
await (0,
|
|
939430
|
+
await (0, import_promises167.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
939327
939431
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
939328
939432
|
}
|
|
939329
939433
|
async function getFilesAndDirectories4(absoluteFilepath) {
|
|
@@ -939393,7 +939497,7 @@ var __default19 = versionMigrations19;
|
|
|
939393
939497
|
|
|
939394
939498
|
// ../cli-migrations/lib/migrations/2.0.0-rc0/update-settings-defaults/migration.js
|
|
939395
939499
|
init_lib6();
|
|
939396
|
-
var
|
|
939500
|
+
var import_promises168 = require("fs/promises");
|
|
939397
939501
|
init_js_yaml();
|
|
939398
939502
|
var migration20 = {
|
|
939399
939503
|
name: "update-2_0_0-defaults",
|
|
@@ -939569,7 +939673,7 @@ async function updateGeneratorsYml3({ context: context3, files }) {
|
|
|
939569
939673
|
documentToWrite = `${schemaComment}
|
|
939570
939674
|
${documentToWrite}`;
|
|
939571
939675
|
}
|
|
939572
|
-
await (0,
|
|
939676
|
+
await (0, import_promises168.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
939573
939677
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
939574
939678
|
}
|
|
939575
939679
|
async function getFilesAndDirectories5(absoluteFilepath) {
|
|
@@ -939616,7 +939720,7 @@ var __default20 = versionMigrations20;
|
|
|
939616
939720
|
|
|
939617
939721
|
// ../cli-migrations/lib/migrations/2.13.0/migrate-deprecated-generator-api-settings/migration.js
|
|
939618
939722
|
init_lib6();
|
|
939619
|
-
var
|
|
939723
|
+
var import_promises169 = require("fs/promises");
|
|
939620
939724
|
init_js_yaml();
|
|
939621
939725
|
var migration21 = {
|
|
939622
939726
|
name: "migrate-deprecated-generator-api-settings",
|
|
@@ -939708,7 +939812,7 @@ async function updateGeneratorsYml4({ context: context3, files }) {
|
|
|
939708
939812
|
documentToWrite = `${schemaComment}
|
|
939709
939813
|
${documentToWrite}`;
|
|
939710
939814
|
}
|
|
939711
|
-
await (0,
|
|
939815
|
+
await (0, import_promises169.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
939712
939816
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
939713
939817
|
}
|
|
939714
939818
|
function migrateDeprecatedSettings(settings, context3) {
|
|
@@ -939755,7 +939859,7 @@ var __default21 = versionMigrations21;
|
|
|
939755
939859
|
|
|
939756
939860
|
// ../cli-migrations/lib/migrations/3.0.0/enable-smart-casing/migration.js
|
|
939757
939861
|
init_lib6();
|
|
939758
|
-
var
|
|
939862
|
+
var import_promises170 = require("fs/promises");
|
|
939759
939863
|
init_js_yaml();
|
|
939760
939864
|
var migration22 = {
|
|
939761
939865
|
name: "enable-smart-casing",
|
|
@@ -939840,7 +939944,7 @@ async function updateGeneratorsYml5({ context: context3, files }) {
|
|
|
939840
939944
|
documentToWrite = `${schemaComment}
|
|
939841
939945
|
${documentToWrite}`;
|
|
939842
939946
|
}
|
|
939843
|
-
await (0,
|
|
939947
|
+
await (0, import_promises170.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
939844
939948
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
939845
939949
|
}
|
|
939846
939950
|
function setSmartCasingFalseIfNotConfigured(generator, context3) {
|
|
@@ -939982,7 +940086,7 @@ ${source_default.dim(migration23.summary)}`
|
|
|
939982
940086
|
|
|
939983
940087
|
// src/commands/upgrade/upgrade.ts
|
|
939984
940088
|
init_lib10();
|
|
939985
|
-
var
|
|
940089
|
+
var import_promises171 = require("fs/promises");
|
|
939986
940090
|
|
|
939987
940091
|
// ../../../node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.mjs
|
|
939988
940092
|
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
@@ -941036,7 +941140,7 @@ async function upgrade({
|
|
|
941036
941140
|
const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
|
|
941037
941141
|
draft.version = resolvedTargetVersion;
|
|
941038
941142
|
});
|
|
941039
|
-
await (0,
|
|
941143
|
+
await (0, import_promises171.writeFile)(
|
|
941040
941144
|
projectConfig2._absolutePath,
|
|
941041
941145
|
ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2))
|
|
941042
941146
|
);
|
|
@@ -941189,7 +941293,7 @@ async function upgradeGeneratorsForAllWorkspaces({
|
|
|
941189
941293
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
941190
941294
|
});
|
|
941191
941295
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
941192
|
-
await (0,
|
|
941296
|
+
await (0, import_promises172.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
941193
941297
|
}
|
|
941194
941298
|
for (const upgrade2 of result.appliedUpgrades) {
|
|
941195
941299
|
const normalizedName = addDefaultDockerOrgIfNotPresent(upgrade2.generatorName);
|
|
@@ -941589,7 +941693,7 @@ async function previewDocsWorkspace({
|
|
|
941589
941693
|
|
|
941590
941694
|
// src/commands/docs-diff/docsDiff.ts
|
|
941591
941695
|
init_lib6();
|
|
941592
|
-
var
|
|
941696
|
+
var import_promises173 = require("fs/promises");
|
|
941593
941697
|
var import_pngjs = __toESM(require_png2(), 1);
|
|
941594
941698
|
async function getSlugForFiles({
|
|
941595
941699
|
previewUrl,
|
|
@@ -941812,8 +941916,8 @@ async function generateComparisons({
|
|
|
941812
941916
|
afterPath,
|
|
941813
941917
|
comparisonBasePath
|
|
941814
941918
|
}) {
|
|
941815
|
-
const beforePng = import_pngjs.PNG.sync.read(await (0,
|
|
941816
|
-
const afterPng = import_pngjs.PNG.sync.read(await (0,
|
|
941919
|
+
const beforePng = import_pngjs.PNG.sync.read(await (0, import_promises173.readFile)(beforePath));
|
|
941920
|
+
const afterPng = import_pngjs.PNG.sync.read(await (0, import_promises173.readFile)(afterPath));
|
|
941817
941921
|
const beforeOriginalHeight = beforePng.height;
|
|
941818
941922
|
const afterOriginalHeight = afterPng.height;
|
|
941819
941923
|
const width = Math.max(beforePng.width, afterPng.width);
|
|
@@ -941851,7 +941955,7 @@ async function generateComparisons({
|
|
|
941851
941955
|
const sideBySide = createSideBySideComparison(croppedBefore, croppedAfter, 20, true);
|
|
941852
941956
|
const outPath = `${base4}-region-${i9 + 1}.png`;
|
|
941853
941957
|
const pngBuffer = import_pngjs.PNG.sync.write(sideBySide);
|
|
941854
|
-
await (0,
|
|
941958
|
+
await (0, import_promises173.writeFile)(outPath, new Uint8Array(pngBuffer));
|
|
941855
941959
|
results.push({ changePercent, boundingBox, comparisonPath: outPath });
|
|
941856
941960
|
}
|
|
941857
941961
|
return results;
|
|
@@ -941930,7 +942034,7 @@ async function docsDiff({
|
|
|
941930
942034
|
outputDir.startsWith("/") ? outputDir : join8(cwd(), RelativeFilePath2.of(outputDir))
|
|
941931
942035
|
);
|
|
941932
942036
|
if (!await doesPathExist(outputPath)) {
|
|
941933
|
-
await (0,
|
|
942037
|
+
await (0, import_promises173.mkdir)(outputPath, { recursive: true });
|
|
941934
942038
|
}
|
|
941935
942039
|
const results = [];
|
|
941936
942040
|
await cliContext.runTask(async (context3) => {
|
|
@@ -946350,7 +946454,7 @@ function renderModuleTree(module4, ctx, writer2, parentPath) {
|
|
|
946350
946454
|
}
|
|
946351
946455
|
|
|
946352
946456
|
// src/commands/docs-md-generate/generateLibraryDocs.ts
|
|
946353
|
-
var
|
|
946457
|
+
var import_promises174 = require("fs/promises");
|
|
946354
946458
|
function createLibraryDocsClient2({ token }) {
|
|
946355
946459
|
const defaultOrigin = "https://registry-dev2.buildwithfern.com";
|
|
946356
946460
|
const baseUrl = process.env.FERN_FDR_ORIGIN ?? process.env.OVERRIDE_FDR_ORIGIN ?? defaultOrigin;
|
|
@@ -946476,7 +946580,7 @@ async function generateSingleLibrary({
|
|
|
946476
946580
|
if (config5.lang === "cpp" && config5.config?.doxyfile != null) {
|
|
946477
946581
|
const doxyfilePath = resolve6(docsWorkspace.absoluteFilePath, config5.config.doxyfile);
|
|
946478
946582
|
try {
|
|
946479
|
-
doxyfileContent = await (0,
|
|
946583
|
+
doxyfileContent = await (0, import_promises174.readFile)(doxyfilePath, "utf-8");
|
|
946480
946584
|
} catch {
|
|
946481
946585
|
return interactiveTaskContext.failAndThrow(
|
|
946482
946586
|
`Library '${name2}': Could not read Doxyfile at '${config5.config.doxyfile}' (resolved to ${doxyfilePath})`,
|
|
@@ -946828,7 +946932,7 @@ Found ${previewDeployments.length} preview deployment(s):
|
|
|
946828
946932
|
|
|
946829
946933
|
// src/commands/docs-theme/ThemeExporter.ts
|
|
946830
946934
|
init_lib6();
|
|
946831
|
-
var
|
|
946935
|
+
var import_promises175 = require("fs/promises");
|
|
946832
946936
|
init_js_yaml();
|
|
946833
946937
|
var import_path92 = __toESM(require("path"), 1);
|
|
946834
946938
|
var THEME_ELIGIBLE_KEYS2 = /* @__PURE__ */ new Set([
|
|
@@ -946857,18 +946961,18 @@ var ThemeExporter = class {
|
|
|
946857
946961
|
const docsDir = import_path92.default.dirname(docsYmlPath);
|
|
946858
946962
|
const outDir = output2 != null ? import_path92.default.resolve(process.cwd(), output2) : import_path92.default.join(this.docsWorkspace.absoluteFilePath, "theme");
|
|
946859
946963
|
context3.logger.info(`Exporting theme-eligible fields from docs.yml \u2192 ${outDir}`);
|
|
946860
|
-
const raw = jsYaml.load(await (0,
|
|
946964
|
+
const raw = jsYaml.load(await (0, import_promises175.readFile)(docsYmlPath, "utf-8"));
|
|
946861
946965
|
const themeConfig = {};
|
|
946862
946966
|
for (const [k5, v9] of Object.entries(raw)) {
|
|
946863
946967
|
if (THEME_ELIGIBLE_KEYS2.has(k5)) {
|
|
946864
946968
|
themeConfig[k5] = v9;
|
|
946865
946969
|
}
|
|
946866
946970
|
}
|
|
946867
|
-
await (0,
|
|
946971
|
+
await (0, import_promises175.mkdir)(outDir, { recursive: true });
|
|
946868
946972
|
const assetsDir = import_path92.default.join(outDir, "assets");
|
|
946869
|
-
await (0,
|
|
946973
|
+
await (0, import_promises175.mkdir)(assetsDir, { recursive: true });
|
|
946870
946974
|
const exported = await copyLocalFiles(themeConfig, docsDir, assetsDir);
|
|
946871
|
-
await (0,
|
|
946975
|
+
await (0, import_promises175.writeFile)(import_path92.default.join(outDir, "theme.yml"), jsYaml.dump(exported), "utf-8");
|
|
946872
946976
|
context3.logger.info(`Theme exported to ${outDir}/theme.yml`);
|
|
946873
946977
|
}
|
|
946874
946978
|
};
|
|
@@ -946882,8 +946986,8 @@ async function copyLocalFiles(obj, sourceDir, assetsDir) {
|
|
|
946882
946986
|
const destRelative = relFromSource.startsWith("..") ? relFromProject.startsWith("..") ? import_path92.default.basename(abs) : relFromProject : relFromSource;
|
|
946883
946987
|
const dest = import_path92.default.join(assetsDir, destRelative);
|
|
946884
946988
|
try {
|
|
946885
|
-
await (0,
|
|
946886
|
-
await (0,
|
|
946989
|
+
await (0, import_promises175.mkdir)(import_path92.default.dirname(dest), { recursive: true });
|
|
946990
|
+
await (0, import_promises175.copyFile)(abs, dest);
|
|
946887
946991
|
return `./assets/${destRelative.split(import_path92.default.sep).join("/")}`;
|
|
946888
946992
|
} catch {
|
|
946889
946993
|
return obj;
|
|
@@ -946997,7 +947101,7 @@ async function listDocsThemes({
|
|
|
946997
947101
|
}
|
|
946998
947102
|
|
|
946999
947103
|
// src/commands/docs-theme/uploadDocsTheme.ts
|
|
947000
|
-
var
|
|
947104
|
+
var import_promises177 = require("fs/promises");
|
|
947001
947105
|
init_js_yaml();
|
|
947002
947106
|
var import_path94 = __toESM(require("path"), 1);
|
|
947003
947107
|
|
|
@@ -947005,7 +947109,7 @@ var import_path94 = __toESM(require("path"), 1);
|
|
|
947005
947109
|
init_lib6();
|
|
947006
947110
|
var import_child_process12 = require("child_process");
|
|
947007
947111
|
var import_crypto9 = require("crypto");
|
|
947008
|
-
var
|
|
947112
|
+
var import_promises176 = require("fs/promises");
|
|
947009
947113
|
var import_mime_types2 = __toESM(require_mime_types(), 1);
|
|
947010
947114
|
var import_path93 = __toESM(require("path"), 1);
|
|
947011
947115
|
function getGitRoot() {
|
|
@@ -947049,7 +947153,7 @@ var ThemeConfigProcessor = class {
|
|
|
947049
947153
|
filePaths.map(async (filePath) => {
|
|
947050
947154
|
const abs = import_path93.default.resolve(this.themeDir, filePath);
|
|
947051
947155
|
try {
|
|
947052
|
-
await (0,
|
|
947156
|
+
await (0, import_promises176.access)(abs);
|
|
947053
947157
|
} catch {
|
|
947054
947158
|
errors4.push(`Referenced file not found: ${abs}`);
|
|
947055
947159
|
}
|
|
@@ -947214,7 +947318,7 @@ ${errors4.map((e8) => ` - ${e8}`).join("\n")}`,
|
|
|
947214
947318
|
return { config: cfg, filesUploaded };
|
|
947215
947319
|
}
|
|
947216
947320
|
async uploadFileToCas(absolutePath) {
|
|
947217
|
-
const content5 = await (0,
|
|
947321
|
+
const content5 = await (0, import_promises176.readFile)(absolutePath);
|
|
947218
947322
|
const contentType = import_mime_types2.default.lookup(absolutePath) || "application/octet-stream";
|
|
947219
947323
|
const bindPath = posixBindPath(this.gitRoot, absolutePath);
|
|
947220
947324
|
return this.uploadToCas(content5, contentType, bindPath, import_path93.default.basename(absolutePath));
|
|
@@ -947329,7 +947433,7 @@ async function uploadDocsTheme({
|
|
|
947329
947433
|
await cliContext.runTask(async (context3) => {
|
|
947330
947434
|
let rawYaml;
|
|
947331
947435
|
try {
|
|
947332
|
-
const content5 = await (0,
|
|
947436
|
+
const content5 = await (0, import_promises177.readFile)(themeYmlPath, "utf-8");
|
|
947333
947437
|
rawYaml = jsYaml.load(content5, { schema: jsYaml.JSON_SCHEMA });
|
|
947334
947438
|
} catch {
|
|
947335
947439
|
context3.failAndThrow(
|
|
@@ -947382,7 +947486,7 @@ async function uploadDocsTheme({
|
|
|
947382
947486
|
}
|
|
947383
947487
|
|
|
947384
947488
|
// src/commands/downgrade/downgrade.ts
|
|
947385
|
-
var
|
|
947489
|
+
var import_promises178 = require("fs/promises");
|
|
947386
947490
|
function ensureFinalNewline2(content5) {
|
|
947387
947491
|
return content5.endsWith("\n") ? content5 : content5 + "\n";
|
|
947388
947492
|
}
|
|
@@ -947407,13 +947511,13 @@ async function downgrade({
|
|
|
947407
947511
|
const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
|
|
947408
947512
|
draft.version = targetVersion;
|
|
947409
947513
|
});
|
|
947410
|
-
await (0,
|
|
947514
|
+
await (0, import_promises178.writeFile)(projectConfig._absolutePath, ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2)));
|
|
947411
947515
|
cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
|
|
947412
947516
|
}
|
|
947413
947517
|
|
|
947414
947518
|
// src/commands/export/generateOpenAPIForWorkspaces.ts
|
|
947415
947519
|
init_lib6();
|
|
947416
|
-
var
|
|
947520
|
+
var import_promises179 = require("fs/promises");
|
|
947417
947521
|
init_js_yaml();
|
|
947418
947522
|
|
|
947419
947523
|
// src/commands/export/converters/servicesConverter.ts
|
|
@@ -948797,8 +948901,8 @@ async function generateOpenAPIForWorkspaces({
|
|
|
948797
948901
|
ir: ir11,
|
|
948798
948902
|
mode: "openapi"
|
|
948799
948903
|
});
|
|
948800
|
-
await (0,
|
|
948801
|
-
await (0,
|
|
948904
|
+
await (0, import_promises179.mkdir)(dirname6(outputPath), { recursive: true });
|
|
948905
|
+
await (0, import_promises179.writeFile)(
|
|
948802
948906
|
outputPath,
|
|
948803
948907
|
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent4) : jsYaml.dump(openapi, { indent: indent4 })
|
|
948804
948908
|
);
|
|
@@ -949357,7 +949461,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
949357
949461
|
|
|
949358
949462
|
// src/commands/generate-overrides/compareOpenAPISpecs.ts
|
|
949359
949463
|
init_lib6();
|
|
949360
|
-
var
|
|
949464
|
+
var import_promises180 = require("fs/promises");
|
|
949361
949465
|
init_js_yaml();
|
|
949362
949466
|
async function compareOpenAPISpecs({
|
|
949363
949467
|
originalPath,
|
|
@@ -949399,12 +949503,12 @@ async function compareOpenAPISpecs({
|
|
|
949399
949503
|
}
|
|
949400
949504
|
outputPath = join8(dirname6(originalPath), RelativeFilePath2.of(overridesFilename));
|
|
949401
949505
|
}
|
|
949402
|
-
await (0,
|
|
949506
|
+
await (0, import_promises180.writeFile)(outputPath, jsYaml.dump(overrides, { lineWidth: -1, noRefs: true }));
|
|
949403
949507
|
context3.logger.info(`Overrides written to ${outputPath}`);
|
|
949404
949508
|
});
|
|
949405
949509
|
}
|
|
949406
949510
|
async function loadSpec2(filepath, context3) {
|
|
949407
|
-
const contents = await (0,
|
|
949511
|
+
const contents = await (0, import_promises180.readFile)(filepath, "utf8");
|
|
949408
949512
|
try {
|
|
949409
949513
|
return JSON.parse(contents);
|
|
949410
949514
|
} catch {
|
|
@@ -949508,7 +949612,7 @@ function deepEqual(a3, b8) {
|
|
|
949508
949612
|
|
|
949509
949613
|
// src/commands/generate-overrides/writeOverridesForWorkspaces.ts
|
|
949510
949614
|
init_lib6();
|
|
949511
|
-
var
|
|
949615
|
+
var import_promises181 = require("fs/promises");
|
|
949512
949616
|
init_js_yaml();
|
|
949513
949617
|
async function writeOverridesForWorkspaces({
|
|
949514
949618
|
project,
|
|
@@ -949534,7 +949638,7 @@ async function writeOverridesForWorkspaces({
|
|
|
949534
949638
|
async function readExistingOverrides(overridesFilepath, context3) {
|
|
949535
949639
|
let parsedOverrides = null;
|
|
949536
949640
|
try {
|
|
949537
|
-
const contents = (await (0,
|
|
949641
|
+
const contents = (await (0, import_promises181.readFile)(overridesFilepath, "utf8")).toString();
|
|
949538
949642
|
try {
|
|
949539
949643
|
parsedOverrides = JSON.parse(contents);
|
|
949540
949644
|
} catch (err) {
|
|
@@ -949599,7 +949703,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
949599
949703
|
for (const overridesPath of overridesPaths) {
|
|
949600
949704
|
const existingOverrides = await readExistingOverrides(overridesPath, context3);
|
|
949601
949705
|
const content5 = generateOverridesContent({ ir: ir11, existingOverrides, includeModels, context: context3 });
|
|
949602
|
-
await (0,
|
|
949706
|
+
await (0, import_promises181.writeFile)(overridesPath, jsYaml.dump(content5));
|
|
949603
949707
|
}
|
|
949604
949708
|
} else {
|
|
949605
949709
|
const content5 = generateOverridesContent({ ir: ir11, existingOverrides: {}, includeModels, context: context3 });
|
|
@@ -949613,7 +949717,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
949613
949717
|
overridesFilename = `${nameWithoutExt}-overrides${extension4}`;
|
|
949614
949718
|
}
|
|
949615
949719
|
}
|
|
949616
|
-
await (0,
|
|
949720
|
+
await (0, import_promises181.writeFile)(
|
|
949617
949721
|
join8(dirname6(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
|
|
949618
949722
|
jsYaml.dump(content5)
|
|
949619
949723
|
);
|
|
@@ -950029,7 +950133,7 @@ function convertIRtoJsonSchema(args) {
|
|
|
950029
950133
|
}
|
|
950030
950134
|
|
|
950031
950135
|
// src/commands/jsonschema/generateJsonschemaForWorkspace.ts
|
|
950032
|
-
var
|
|
950136
|
+
var import_promises182 = require("fs/promises");
|
|
950033
950137
|
async function generateJsonschemaForWorkspaces({
|
|
950034
950138
|
typeLocator,
|
|
950035
950139
|
project,
|
|
@@ -950077,9 +950181,9 @@ async function generateJsonschemaForWorkspaces({
|
|
|
950077
950181
|
context: context3
|
|
950078
950182
|
});
|
|
950079
950183
|
if (!await doesPathExist(dirname6(jsonschemaFilepath))) {
|
|
950080
|
-
await (0,
|
|
950184
|
+
await (0, import_promises182.mkdir)(dirname6(jsonschemaFilepath), { recursive: true });
|
|
950081
950185
|
}
|
|
950082
|
-
await (0,
|
|
950186
|
+
await (0, import_promises182.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
|
|
950083
950187
|
context3.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
|
|
950084
950188
|
});
|
|
950085
950189
|
})
|
|
@@ -950088,7 +950192,7 @@ async function generateJsonschemaForWorkspaces({
|
|
|
950088
950192
|
|
|
950089
950193
|
// src/commands/merge/mergeOpenAPIWithOverrides.ts
|
|
950090
950194
|
init_lib6();
|
|
950091
|
-
var
|
|
950195
|
+
var import_promises183 = require("fs/promises");
|
|
950092
950196
|
init_js_yaml();
|
|
950093
950197
|
var HTTP_METHODS2 = /* @__PURE__ */ new Set(["get", "put", "post", "delete", "options", "head", "patch", "trace"]);
|
|
950094
950198
|
async function mergeOpenAPIWithOverrides({
|
|
@@ -950114,12 +950218,12 @@ async function mergeOpenAPIWithOverrides({
|
|
|
950114
950218
|
const merged = mergeExamplesIntoSpec(openapi, overrides, context3);
|
|
950115
950219
|
const isJson = outputPath.endsWith(".json");
|
|
950116
950220
|
const output2 = isJson ? JSON.stringify(merged, null, 2) : jsYaml.dump(merged, { lineWidth: -1, noRefs: true });
|
|
950117
|
-
await (0,
|
|
950221
|
+
await (0, import_promises183.writeFile)(outputPath, output2);
|
|
950118
950222
|
context3.logger.info(`Merged output written to ${outputPath}`);
|
|
950119
950223
|
});
|
|
950120
950224
|
}
|
|
950121
950225
|
async function loadYamlOrJson(filepath, context3) {
|
|
950122
|
-
const contents = await (0,
|
|
950226
|
+
const contents = await (0, import_promises183.readFile)(filepath, "utf8");
|
|
950123
950227
|
try {
|
|
950124
950228
|
return JSON.parse(contents);
|
|
950125
950229
|
} catch {
|
|
@@ -950753,7 +950857,7 @@ async function mockServer({
|
|
|
950753
950857
|
}
|
|
950754
950858
|
|
|
950755
950859
|
// src/commands/register/registerWorkspacesV1.ts
|
|
950756
|
-
var
|
|
950860
|
+
var import_promises184 = require("fs/promises");
|
|
950757
950861
|
var import_path100 = __toESM(require("path"), 1);
|
|
950758
950862
|
var import_tmp_promise17 = __toESM(require_tmp_promise(), 1);
|
|
950759
950863
|
async function registerWorkspacesV1({
|
|
@@ -950806,7 +950910,7 @@ async function registerWorkspacesV1({
|
|
|
950806
950910
|
context3.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
950807
950911
|
await Zn8({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
|
|
950808
950912
|
context3.logger.info("Uploading definition...");
|
|
950809
|
-
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
950913
|
+
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises184.readFile)(tarPath));
|
|
950810
950914
|
context3.logger.info(
|
|
950811
950915
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
950812
950916
|
);
|
|
@@ -951050,7 +951154,7 @@ async function generateDiff({
|
|
|
951050
951154
|
|
|
951051
951155
|
// src/commands/sdk-preview/sdkPreview.ts
|
|
951052
951156
|
init_lib6();
|
|
951053
|
-
var
|
|
951157
|
+
var import_promises185 = __toESM(require("fs/promises"), 1);
|
|
951054
951158
|
|
|
951055
951159
|
// src/commands/sdk-preview/computePreviewVersion.ts
|
|
951056
951160
|
var BASE_VERSION = "0.0.1";
|
|
@@ -951170,7 +951274,7 @@ async function sdkPreview({
|
|
|
951170
951274
|
const firstPath = pathOutputs[0];
|
|
951171
951275
|
const absolutePathToOutput = firstPath != null ? AbsoluteFilePath2.of(resolve6(cwd(), firstPath)) : void 0;
|
|
951172
951276
|
if (absolutePathToOutput != null) {
|
|
951173
|
-
await
|
|
951277
|
+
await import_promises185.default.mkdir(absolutePathToOutput, { recursive: true });
|
|
951174
951278
|
}
|
|
951175
951279
|
for (const workspace of project.apiWorkspaces) {
|
|
951176
951280
|
if (workspace.generatorsConfiguration == null) {
|
|
@@ -951356,7 +951460,7 @@ async function sdkPreview({
|
|
|
951356
951460
|
|
|
951357
951461
|
// src/commands/self-update/selfUpdate.ts
|
|
951358
951462
|
init_lib10();
|
|
951359
|
-
var
|
|
951463
|
+
var import_promises186 = require("fs/promises");
|
|
951360
951464
|
var import_path101 = require("path");
|
|
951361
951465
|
async function getPackageManagerBinDir(logger4, pm2) {
|
|
951362
951466
|
let command3;
|
|
@@ -951402,7 +951506,7 @@ async function detectInstallationMethod(logger4) {
|
|
|
951402
951506
|
logger4.debug(`Found fern at: ${fernPath}`);
|
|
951403
951507
|
let resolvedPath;
|
|
951404
951508
|
try {
|
|
951405
|
-
resolvedPath = await (0,
|
|
951509
|
+
resolvedPath = await (0, import_promises186.realpath)(fernPath);
|
|
951406
951510
|
logger4.debug(`Resolved to: ${resolvedPath}`);
|
|
951407
951511
|
} catch (error50) {
|
|
951408
951512
|
logger4.debug(`Failed to resolve symlink: ${error50}`);
|
|
@@ -951706,22 +951810,22 @@ async function generateToken({
|
|
|
951706
951810
|
// src/commands/upgrade/updateApiSpec.ts
|
|
951707
951811
|
init_lib6();
|
|
951708
951812
|
var fs27 = __toESM(require("fs"), 1);
|
|
951709
|
-
var
|
|
951813
|
+
var import_promises187 = require("fs/promises");
|
|
951710
951814
|
init_graphql();
|
|
951711
951815
|
init_js_yaml();
|
|
951712
951816
|
var import_stream16 = require("stream");
|
|
951713
|
-
var
|
|
951817
|
+
var import_promises188 = require("stream/promises");
|
|
951714
951818
|
async function fetchAndWriteFile(url3, path106, logger4, indent4) {
|
|
951715
951819
|
const resp = await fetch(url3);
|
|
951716
951820
|
if (resp.ok && resp.body) {
|
|
951717
951821
|
logger4.debug("Origin successfully fetched, writing to file");
|
|
951718
951822
|
const fileStream = fs27.createWriteStream(path106);
|
|
951719
|
-
await (0,
|
|
951720
|
-
const fileContents = await (0,
|
|
951823
|
+
await (0, import_promises188.finished)(import_stream16.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
951824
|
+
const fileContents = await (0, import_promises187.readFile)(path106, "utf8");
|
|
951721
951825
|
try {
|
|
951722
|
-
await (0,
|
|
951826
|
+
await (0, import_promises187.writeFile)(path106, JSON.stringify(JSON.parse(fileContents), void 0, indent4), "utf8");
|
|
951723
951827
|
} catch (e8) {
|
|
951724
|
-
await (0,
|
|
951828
|
+
await (0, import_promises187.writeFile)(path106, jsYaml.dump(jsYaml.load(fileContents), { indent: indent4 }), "utf8");
|
|
951725
951829
|
}
|
|
951726
951830
|
logger4.debug("File written successfully");
|
|
951727
951831
|
}
|
|
@@ -951877,14 +951981,14 @@ async function tryDirectJSONFetch(url3, logger4) {
|
|
|
951877
951981
|
async function fetchGraphQLSchemaWithAutoDetection(url3, path106, logger4) {
|
|
951878
951982
|
const postResult = await tryGraphQLIntrospection(url3, logger4);
|
|
951879
951983
|
if (postResult.success) {
|
|
951880
|
-
await (0,
|
|
951984
|
+
await (0, import_promises187.writeFile)(path106, postResult.result, "utf8");
|
|
951881
951985
|
logger4.info("Successfully fetched GraphQL schema using POST introspection");
|
|
951882
951986
|
return;
|
|
951883
951987
|
}
|
|
951884
951988
|
logger4.debug(`POST introspection failed: ${postResult.error}`);
|
|
951885
951989
|
const getResult = await tryDirectJSONFetch(url3, logger4);
|
|
951886
951990
|
if (getResult.success) {
|
|
951887
|
-
await (0,
|
|
951991
|
+
await (0, import_promises187.writeFile)(path106, getResult.result, "utf8");
|
|
951888
951992
|
logger4.info("Successfully fetched GraphQL schema using direct JSON fetch");
|
|
951889
951993
|
return;
|
|
951890
951994
|
}
|
|
@@ -952549,7 +952653,7 @@ async function validateWorkspaces({
|
|
|
952549
952653
|
|
|
952550
952654
|
// src/commands/write-definition/writeDefinitionForWorkspaces.ts
|
|
952551
952655
|
init_lib6();
|
|
952552
|
-
var
|
|
952656
|
+
var import_promises189 = require("fs/promises");
|
|
952553
952657
|
init_js_yaml();
|
|
952554
952658
|
var import_path103 = __toESM(require("path"), 1);
|
|
952555
952659
|
async function writeDefinitionForWorkspaces({
|
|
@@ -952631,28 +952735,28 @@ async function writeFernDefinition({
|
|
|
952631
952735
|
return a3.localeCompare(b8);
|
|
952632
952736
|
};
|
|
952633
952737
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
952634
|
-
await (0,
|
|
952738
|
+
await (0, import_promises189.rm)(absolutePathToOutputDirectory, { recursive: true });
|
|
952635
952739
|
}
|
|
952636
|
-
await (0,
|
|
952637
|
-
await (0,
|
|
952740
|
+
await (0, import_promises189.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
952741
|
+
await (0, import_promises189.writeFile)(
|
|
952638
952742
|
join8(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
|
|
952639
952743
|
jsYaml.dump(definition3.rootApiFile.contents, { sortKeys })
|
|
952640
952744
|
);
|
|
952641
952745
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
952642
952746
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
952643
|
-
await (0,
|
|
952644
|
-
await (0,
|
|
952747
|
+
await (0, import_promises189.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
952748
|
+
await (0, import_promises189.writeFile)(absoluteFilepath, jsYaml.dump(packageMarker.contents, { sortKeys }));
|
|
952645
952749
|
}
|
|
952646
952750
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
952647
952751
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
952648
|
-
await (0,
|
|
952649
|
-
await (0,
|
|
952752
|
+
await (0, import_promises189.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
952753
|
+
await (0, import_promises189.writeFile)(absoluteFilepath, jsYaml.dump(definitionFile.contents, { sortKeys }));
|
|
952650
952754
|
}
|
|
952651
952755
|
}
|
|
952652
952756
|
|
|
952653
952757
|
// src/commands/write-docs-definition/writeDocsDefinitionForProject.ts
|
|
952654
952758
|
init_lib6();
|
|
952655
|
-
var
|
|
952759
|
+
var import_promises190 = require("fs/promises");
|
|
952656
952760
|
async function writeDocsDefinitionForProject({
|
|
952657
952761
|
project,
|
|
952658
952762
|
outputPath,
|
|
@@ -952684,7 +952788,7 @@ async function writeDocsDefinitionForProject({
|
|
|
952684
952788
|
targetAudiences: docsWorkspace.config.instances[0]?.audiences ? Array.isArray(docsWorkspace.config.instances[0].audiences) ? docsWorkspace.config.instances[0].audiences : [docsWorkspace.config.instances[0].audiences] : void 0
|
|
952685
952789
|
});
|
|
952686
952790
|
const docsDefinition = await docsResolver.resolve();
|
|
952687
|
-
await (0,
|
|
952791
|
+
await (0, import_promises190.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
|
|
952688
952792
|
context3.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
|
|
952689
952793
|
});
|
|
952690
952794
|
}
|
|
@@ -952693,7 +952797,7 @@ async function writeDocsDefinitionForProject({
|
|
|
952693
952797
|
init_lib6();
|
|
952694
952798
|
var import_cli_progress2 = __toESM(require_cli_progress(), 1);
|
|
952695
952799
|
var import_fs43 = require("fs");
|
|
952696
|
-
var
|
|
952800
|
+
var import_promises194 = require("fs/promises");
|
|
952697
952801
|
var import_is_ci4 = __toESM(require_is_ci(), 1);
|
|
952698
952802
|
var import_path106 = __toESM(require("path"), 1);
|
|
952699
952803
|
|
|
@@ -953187,7 +953291,7 @@ function shouldProcessFile(filePath, stub) {
|
|
|
953187
953291
|
|
|
953188
953292
|
// src/commands/write-translation/docs-config-utils.ts
|
|
953189
953293
|
init_lib6();
|
|
953190
|
-
var
|
|
953294
|
+
var import_promises191 = require("fs/promises");
|
|
953191
953295
|
init_js_yaml();
|
|
953192
953296
|
|
|
953193
953297
|
// src/commands/write-translation/url-utils.ts
|
|
@@ -953345,7 +953449,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
953345
953449
|
stub = false
|
|
953346
953450
|
}) {
|
|
953347
953451
|
try {
|
|
953348
|
-
const originalConfigContent = await (0,
|
|
953452
|
+
const originalConfigContent = await (0, import_promises191.readFile)(originalDocsConfigPath, "utf-8");
|
|
953349
953453
|
const transformation = {
|
|
953350
953454
|
filePath: DOCS_CONFIGURATION_FILENAME,
|
|
953351
953455
|
language,
|
|
@@ -953359,7 +953463,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
953359
953463
|
const modifiedConfigContent = jsYaml.dump(modifiedConfig, {
|
|
953360
953464
|
sortKeys: false
|
|
953361
953465
|
});
|
|
953362
|
-
await (0,
|
|
953466
|
+
await (0, import_promises191.writeFile)(modifiedConfigPath, modifiedConfigContent, "utf-8");
|
|
953363
953467
|
context3.logger.debug(`Created language-specific docs config: ${modifiedConfigPath}`);
|
|
953364
953468
|
} catch (error50) {
|
|
953365
953469
|
if (error50 instanceof Error && error50.message.includes("403")) {
|
|
@@ -953372,11 +953476,11 @@ async function createLanguageSpecificDocsConfig({
|
|
|
953372
953476
|
// src/commands/write-translation/file-collection-utils.ts
|
|
953373
953477
|
init_lib6();
|
|
953374
953478
|
var import_fs41 = require("fs");
|
|
953375
|
-
var
|
|
953479
|
+
var import_promises192 = require("fs/promises");
|
|
953376
953480
|
var import_path104 = __toESM(require("path"), 1);
|
|
953377
953481
|
async function collectFiles(baseDirectory, relativeBase) {
|
|
953378
953482
|
const discoveredFiles = {};
|
|
953379
|
-
const entries24 = await (0,
|
|
953483
|
+
const entries24 = await (0, import_promises192.readdir)(baseDirectory);
|
|
953380
953484
|
for (const entry of entries24) {
|
|
953381
953485
|
if (entry === "translations") {
|
|
953382
953486
|
continue;
|
|
@@ -953399,7 +953503,7 @@ async function collectFiles(baseDirectory, relativeBase) {
|
|
|
953399
953503
|
// src/commands/write-translation/hash-utils.ts
|
|
953400
953504
|
var import_crypto11 = require("crypto");
|
|
953401
953505
|
var import_fs42 = require("fs");
|
|
953402
|
-
var
|
|
953506
|
+
var import_promises193 = require("fs/promises");
|
|
953403
953507
|
var import_path105 = __toESM(require("path"), 1);
|
|
953404
953508
|
function calculateContentHash(content5) {
|
|
953405
953509
|
return (0, import_crypto11.createHash)("sha256").update(content5, "utf-8").digest("hex");
|
|
@@ -953410,7 +953514,7 @@ async function loadHashMappings(translationsDirectory) {
|
|
|
953410
953514
|
return {};
|
|
953411
953515
|
}
|
|
953412
953516
|
try {
|
|
953413
|
-
const hashesContent = await (0,
|
|
953517
|
+
const hashesContent = await (0, import_promises193.readFile)(hashesFilePath, "utf-8");
|
|
953414
953518
|
const parsed = JSON.parse(hashesContent);
|
|
953415
953519
|
const { _comment, ...hashMappings } = parsed;
|
|
953416
953520
|
return hashMappings;
|
|
@@ -953431,11 +953535,11 @@ async function saveHashMappings(translationsDirectory, hashMappings) {
|
|
|
953431
953535
|
_comment: "This file is auto-generated by Fern to track source file changes for translation purposes. Do not edit manually - it will be overwritten on the next translation update.",
|
|
953432
953536
|
...sortedMappings
|
|
953433
953537
|
};
|
|
953434
|
-
await (0,
|
|
953538
|
+
await (0, import_promises193.writeFile)(hashesFilePath, JSON.stringify(fileContent, null, 2), "utf-8");
|
|
953435
953539
|
}
|
|
953436
953540
|
async function hasFileChanged(filePath, relativePath, previousHashes) {
|
|
953437
953541
|
try {
|
|
953438
|
-
const content5 = await (0,
|
|
953542
|
+
const content5 = await (0, import_promises193.readFile)(filePath, "utf-8");
|
|
953439
953543
|
const currentHash = calculateContentHash(content5);
|
|
953440
953544
|
const previousHash = previousHashes[relativePath];
|
|
953441
953545
|
return currentHash !== previousHash;
|
|
@@ -953491,7 +953595,7 @@ async function writeTranslationForProject({
|
|
|
953491
953595
|
}
|
|
953492
953596
|
if (!(0, import_fs43.existsSync)(translationsDirectory)) {
|
|
953493
953597
|
context3.logger.debug(`Creating translations directory at: ${translationsDirectory}`);
|
|
953494
|
-
await (0,
|
|
953598
|
+
await (0, import_promises194.mkdir)(translationsDirectory, { recursive: true });
|
|
953495
953599
|
}
|
|
953496
953600
|
const languageStats = {};
|
|
953497
953601
|
const targetLanguages = languages.filter((lang) => lang !== sourceLanguage);
|
|
@@ -953504,7 +953608,7 @@ async function writeTranslationForProject({
|
|
|
953504
953608
|
RelativeFilePath2.of("fern")
|
|
953505
953609
|
);
|
|
953506
953610
|
if (!(0, import_fs43.existsSync)(languageDirectory)) {
|
|
953507
|
-
await (0,
|
|
953611
|
+
await (0, import_promises194.mkdir)(languageDirectory, { recursive: true });
|
|
953508
953612
|
}
|
|
953509
953613
|
languageStats[language] = {
|
|
953510
953614
|
filesProcessed: 0,
|
|
@@ -953606,7 +953710,7 @@ async function writeTranslationForProject({
|
|
|
953606
953710
|
`[COMPLETED] ${DOCS_CONFIGURATION_FILENAME} -> ${language}/${DOCS_CONFIGURATION_FILENAME}`
|
|
953607
953711
|
);
|
|
953608
953712
|
}
|
|
953609
|
-
const originalConfigContent = await (0,
|
|
953713
|
+
const originalConfigContent = await (0, import_promises194.readFile)(originalDocsConfigPath, "utf-8");
|
|
953610
953714
|
await updateAndSaveHashForFile(
|
|
953611
953715
|
translationsDirectory,
|
|
953612
953716
|
hashMappings,
|
|
@@ -953651,7 +953755,7 @@ async function writeTranslationForProject({
|
|
|
953651
953755
|
continue;
|
|
953652
953756
|
}
|
|
953653
953757
|
cliContext.logger.debug(`[PROCESSING] ${relativePath} (detected changes)`);
|
|
953654
|
-
const originalContent = await (0,
|
|
953758
|
+
const originalContent = await (0, import_promises194.readFile)(filePath, "utf-8");
|
|
953655
953759
|
await updateAndSaveHashForFile(translationsDirectory, hashMappings, relativePath, originalContent);
|
|
953656
953760
|
const sourceStats = languageStats[sourceLanguage];
|
|
953657
953761
|
if (sourceStats) {
|
|
@@ -953676,7 +953780,7 @@ async function writeTranslationForProject({
|
|
|
953676
953780
|
const destPath = join8(languageDirectory, relativePath);
|
|
953677
953781
|
const destDir = import_path106.default.dirname(destPath);
|
|
953678
953782
|
if (!(0, import_fs43.existsSync)(destDir)) {
|
|
953679
|
-
await (0,
|
|
953783
|
+
await (0, import_promises194.mkdir)(destDir, { recursive: true });
|
|
953680
953784
|
}
|
|
953681
953785
|
const transformation = {
|
|
953682
953786
|
filePath: relativePath,
|
|
@@ -953689,7 +953793,7 @@ async function writeTranslationForProject({
|
|
|
953689
953793
|
cliContext,
|
|
953690
953794
|
stub
|
|
953691
953795
|
});
|
|
953692
|
-
await (0,
|
|
953796
|
+
await (0, import_promises194.writeFile)(destPath, transformedContent, "utf-8");
|
|
953693
953797
|
const languageStatsForLang = languageStats[language];
|
|
953694
953798
|
if (languageStatsForLang) {
|
|
953695
953799
|
languageStatsForLang.filesProcessed++;
|
|
@@ -953720,9 +953824,9 @@ async function writeTranslationForProject({
|
|
|
953720
953824
|
const destPath = join8(languageDirectory, relativePath);
|
|
953721
953825
|
const destDir = import_path106.default.dirname(destPath);
|
|
953722
953826
|
if (!(0, import_fs43.existsSync)(destDir)) {
|
|
953723
|
-
await (0,
|
|
953827
|
+
await (0, import_promises194.mkdir)(destDir, { recursive: true });
|
|
953724
953828
|
}
|
|
953725
|
-
await (0,
|
|
953829
|
+
await (0, import_promises194.copyFile)(filePath, destPath);
|
|
953726
953830
|
assetsCopied++;
|
|
953727
953831
|
cliContext.logger.debug(`[ASSET COPIED] ${relativePath} -> ${language}/${relativePath}`);
|
|
953728
953832
|
}
|