@fern-api/fern-api-dev 4.71.6 → 4.72.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +526 -455
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -68360,8 +68360,8 @@ var require_graceful_fs = __commonJS({
|
|
|
68360
68360
|
fs30.createReadStream = createReadStream5;
|
|
68361
68361
|
fs30.createWriteStream = createWriteStream7;
|
|
68362
68362
|
var fs$readFile = fs30.readFile;
|
|
68363
|
-
fs30.readFile =
|
|
68364
|
-
function
|
|
68363
|
+
fs30.readFile = readFile103;
|
|
68364
|
+
function readFile103(path97, options2, cb2) {
|
|
68365
68365
|
if (typeof options2 === "function")
|
|
68366
68366
|
cb2 = options2, options2 = null;
|
|
68367
68367
|
return go$readFile(path97, options2, cb2);
|
|
@@ -68377,8 +68377,8 @@ var require_graceful_fs = __commonJS({
|
|
|
68377
68377
|
}
|
|
68378
68378
|
}
|
|
68379
68379
|
var fs$writeFile = fs30.writeFile;
|
|
68380
|
-
fs30.writeFile =
|
|
68381
|
-
function
|
|
68380
|
+
fs30.writeFile = writeFile90;
|
|
68381
|
+
function writeFile90(path97, data2, options2, cb2) {
|
|
68382
68382
|
if (typeof options2 === "function")
|
|
68383
68383
|
cb2 = options2, options2 = null;
|
|
68384
68384
|
return go$writeFile(path97, data2, options2, cb2);
|
|
@@ -68432,9 +68432,9 @@ var require_graceful_fs = __commonJS({
|
|
|
68432
68432
|
}
|
|
68433
68433
|
}
|
|
68434
68434
|
var fs$readdir = fs30.readdir;
|
|
68435
|
-
fs30.readdir =
|
|
68435
|
+
fs30.readdir = readdir22;
|
|
68436
68436
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
68437
|
-
function
|
|
68437
|
+
function readdir22(path97, options2, cb2) {
|
|
68438
68438
|
if (typeof options2 === "function")
|
|
68439
68439
|
cb2 = options2, options2 = null;
|
|
68440
68440
|
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path98, options3, cb3, startTime) {
|
|
@@ -294064,8 +294064,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
294064
294064
|
fs30.createReadStream = createReadStream5;
|
|
294065
294065
|
fs30.createWriteStream = createWriteStream7;
|
|
294066
294066
|
var fs$readFile = fs30.readFile;
|
|
294067
|
-
fs30.readFile =
|
|
294068
|
-
function
|
|
294067
|
+
fs30.readFile = readFile103;
|
|
294068
|
+
function readFile103(path97, options2, cb2) {
|
|
294069
294069
|
if (typeof options2 === "function")
|
|
294070
294070
|
cb2 = options2, options2 = null;
|
|
294071
294071
|
return go$readFile(path97, options2, cb2);
|
|
@@ -294081,8 +294081,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
294081
294081
|
}
|
|
294082
294082
|
}
|
|
294083
294083
|
var fs$writeFile = fs30.writeFile;
|
|
294084
|
-
fs30.writeFile =
|
|
294085
|
-
function
|
|
294084
|
+
fs30.writeFile = writeFile90;
|
|
294085
|
+
function writeFile90(path97, data2, options2, cb2) {
|
|
294086
294086
|
if (typeof options2 === "function")
|
|
294087
294087
|
cb2 = options2, options2 = null;
|
|
294088
294088
|
return go$writeFile(path97, data2, options2, cb2);
|
|
@@ -294136,9 +294136,9 @@ var require_graceful_fs2 = __commonJS({
|
|
|
294136
294136
|
}
|
|
294137
294137
|
}
|
|
294138
294138
|
var fs$readdir = fs30.readdir;
|
|
294139
|
-
fs30.readdir =
|
|
294139
|
+
fs30.readdir = readdir22;
|
|
294140
294140
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
294141
|
-
function
|
|
294141
|
+
function readdir22(path97, options2, cb2) {
|
|
294142
294142
|
if (typeof options2 === "function")
|
|
294143
294143
|
cb2 = options2, options2 = null;
|
|
294144
294144
|
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path98, options3, cb3, startTime) {
|
|
@@ -351974,7 +351974,7 @@ var require_dist14 = __commonJS({
|
|
|
351974
351974
|
}
|
|
351975
351975
|
return result;
|
|
351976
351976
|
}
|
|
351977
|
-
var
|
|
351977
|
+
var import_promises183 = require("fs/promises");
|
|
351978
351978
|
var import_node_os15 = require("os");
|
|
351979
351979
|
var import_node_path210 = require("path");
|
|
351980
351980
|
var import_minimatch8 = require_commonjs3();
|
|
@@ -352173,9 +352173,9 @@ var require_dist14 = __commonJS({
|
|
|
352173
352173
|
if (laterFiles.has(fileResult.file) || laterFiles.has(originalPath)) {
|
|
352174
352174
|
const filePath = (0, import_node_path210.join)(this.outputDir, fileResult.file);
|
|
352175
352175
|
try {
|
|
352176
|
-
const content5 = await (0,
|
|
352176
|
+
const content5 = await (0, import_promises183.readFile)(filePath, "utf-8");
|
|
352177
352177
|
const stripped = stripConflictMarkers(content5);
|
|
352178
|
-
await (0,
|
|
352178
|
+
await (0, import_promises183.writeFile)(filePath, stripped);
|
|
352179
352179
|
} catch {
|
|
352180
352180
|
}
|
|
352181
352181
|
}
|
|
@@ -352187,7 +352187,7 @@ var require_dist14 = __commonJS({
|
|
|
352187
352187
|
/** Populate accumulator after git apply succeeds. */
|
|
352188
352188
|
async populateAccumulatorForPatch(patch5, baseGen, currentTreeHash) {
|
|
352189
352189
|
if (!baseGen) return;
|
|
352190
|
-
const tempDir2 = await (0,
|
|
352190
|
+
const tempDir2 = await (0, import_promises183.mkdtemp)((0, import_node_path210.join)((0, import_node_os15.tmpdir)(), "replay-acc-"));
|
|
352191
352191
|
const { GitClient: GitClient22 } = await Promise.resolve().then(() => (init_GitClient(), GitClient_exports));
|
|
352192
352192
|
const tempGit = new GitClient22(tempDir2);
|
|
352193
352193
|
await tempGit.exec(["init"]);
|
|
@@ -352199,7 +352199,7 @@ var require_dist14 = __commonJS({
|
|
|
352199
352199
|
const resolvedPath = await this.resolveFilePath(filePath, baseGen.tree_hash, currentTreeHash);
|
|
352200
352200
|
const base4 = await this.git.showFile(baseGen.tree_hash, filePath);
|
|
352201
352201
|
const theirs = await this.applyPatchToContent(base4, patch5.patch_content, filePath, tempGit, tempDir2);
|
|
352202
|
-
const effectiveTheirs = theirs ?? await (0,
|
|
352202
|
+
const effectiveTheirs = theirs ?? await (0, import_promises183.readFile)((0, import_node_path210.join)(this.outputDir, resolvedPath), "utf-8").catch(() => null);
|
|
352203
352203
|
if (effectiveTheirs) {
|
|
352204
352204
|
this.fileTheirsAccumulator.set(resolvedPath, {
|
|
352205
352205
|
content: effectiveTheirs,
|
|
@@ -352208,7 +352208,7 @@ var require_dist14 = __commonJS({
|
|
|
352208
352208
|
}
|
|
352209
352209
|
}
|
|
352210
352210
|
} finally {
|
|
352211
|
-
await (0,
|
|
352211
|
+
await (0, import_promises183.rm)(tempDir2, { recursive: true }).catch(() => {
|
|
352212
352212
|
});
|
|
352213
352213
|
}
|
|
352214
352214
|
}
|
|
@@ -352233,7 +352233,7 @@ var require_dist14 = __commonJS({
|
|
|
352233
352233
|
resolvedFiles[filePath] = resolvedPath;
|
|
352234
352234
|
}
|
|
352235
352235
|
const fullPath = (0, import_node_path210.join)(this.outputDir, resolvedPath);
|
|
352236
|
-
snapshots.set(resolvedPath, await (0,
|
|
352236
|
+
snapshots.set(resolvedPath, await (0, import_promises183.readFile)(fullPath, "utf-8").catch(() => null));
|
|
352237
352237
|
}
|
|
352238
352238
|
try {
|
|
352239
352239
|
await this.git.execWithInput(["apply", "--3way"], patch5.patch_content);
|
|
@@ -352248,9 +352248,9 @@ var require_dist14 = __commonJS({
|
|
|
352248
352248
|
for (const [resolvedPath, content5] of snapshots) {
|
|
352249
352249
|
const fullPath = (0, import_node_path210.join)(this.outputDir, resolvedPath);
|
|
352250
352250
|
if (content5 != null) {
|
|
352251
|
-
await (0,
|
|
352251
|
+
await (0, import_promises183.writeFile)(fullPath, content5);
|
|
352252
352252
|
} else {
|
|
352253
|
-
await (0,
|
|
352253
|
+
await (0, import_promises183.unlink)(fullPath).catch(() => {
|
|
352254
352254
|
});
|
|
352255
352255
|
}
|
|
352256
352256
|
}
|
|
@@ -352261,7 +352261,7 @@ var require_dist14 = __commonJS({
|
|
|
352261
352261
|
async applyWithThreeWayMerge(patch5) {
|
|
352262
352262
|
const fileResults = [];
|
|
352263
352263
|
const resolvedFiles = {};
|
|
352264
|
-
const tempDir2 = await (0,
|
|
352264
|
+
const tempDir2 = await (0, import_promises183.mkdtemp)((0, import_node_path210.join)((0, import_node_os15.tmpdir)(), "replay-"));
|
|
352265
352265
|
const { GitClient: GitClient22 } = await Promise.resolve().then(() => (init_GitClient(), GitClient_exports));
|
|
352266
352266
|
const tempGit = new GitClient22(tempDir2);
|
|
352267
352267
|
await tempGit.exec(["init"]);
|
|
@@ -352284,7 +352284,7 @@ var require_dist14 = __commonJS({
|
|
|
352284
352284
|
fileResults.push(result);
|
|
352285
352285
|
}
|
|
352286
352286
|
} finally {
|
|
352287
|
-
await (0,
|
|
352287
|
+
await (0, import_promises183.rm)(tempDir2, { recursive: true }).catch(() => {
|
|
352288
352288
|
});
|
|
352289
352289
|
}
|
|
352290
352290
|
const conflictFiles = fileResults.filter((r23) => r23.status === "conflict");
|
|
@@ -352325,7 +352325,7 @@ var require_dist14 = __commonJS({
|
|
|
352325
352325
|
}
|
|
352326
352326
|
}
|
|
352327
352327
|
const oursPath = (0, import_node_path210.join)(this.outputDir, resolvedPath);
|
|
352328
|
-
const ours = await (0,
|
|
352328
|
+
const ours = await (0, import_promises183.readFile)(oursPath, "utf-8").catch(() => null);
|
|
352329
352329
|
let ghostReconstructed = false;
|
|
352330
352330
|
let theirs = null;
|
|
352331
352331
|
if (!base4 && ours && !renameSourcePath) {
|
|
@@ -352413,15 +352413,15 @@ var require_dist14 = __commonJS({
|
|
|
352413
352413
|
baseGeneration: patch5.base_generation
|
|
352414
352414
|
});
|
|
352415
352415
|
const outDir2 = (0, import_node_path210.dirname)(oursPath);
|
|
352416
|
-
await (0,
|
|
352417
|
-
await (0,
|
|
352416
|
+
await (0, import_promises183.mkdir)(outDir2, { recursive: true });
|
|
352417
|
+
await (0, import_promises183.writeFile)(oursPath, effective_theirs);
|
|
352418
352418
|
return { file: resolvedPath, status: "merged", reason: "new-file" };
|
|
352419
352419
|
}
|
|
352420
352420
|
if (base4 == null && ours && effective_theirs && !useAccumulatorAsMergeBase) {
|
|
352421
352421
|
const merged2 = threeWayMerge("", ours, effective_theirs);
|
|
352422
352422
|
const outDir2 = (0, import_node_path210.dirname)(oursPath);
|
|
352423
|
-
await (0,
|
|
352424
|
-
await (0,
|
|
352423
|
+
await (0, import_promises183.mkdir)(outDir2, { recursive: true });
|
|
352424
|
+
await (0, import_promises183.writeFile)(oursPath, merged2.content);
|
|
352425
352425
|
if (merged2.hasConflicts) {
|
|
352426
352426
|
return {
|
|
352427
352427
|
file: resolvedPath,
|
|
@@ -352457,8 +352457,8 @@ var require_dist14 = __commonJS({
|
|
|
352457
352457
|
}
|
|
352458
352458
|
const merged = threeWayMerge(mergeBase, ours, effective_theirs);
|
|
352459
352459
|
const outDir = (0, import_node_path210.dirname)(oursPath);
|
|
352460
|
-
await (0,
|
|
352461
|
-
await (0,
|
|
352460
|
+
await (0, import_promises183.mkdir)(outDir, { recursive: true });
|
|
352461
|
+
await (0, import_promises183.writeFile)(oursPath, merged.content);
|
|
352462
352462
|
if (effective_theirs && !merged.hasConflicts) {
|
|
352463
352463
|
this.fileTheirsAccumulator.set(resolvedPath, {
|
|
352464
352464
|
content: effective_theirs,
|
|
@@ -352533,8 +352533,8 @@ var require_dist14 = __commonJS({
|
|
|
352533
352533
|
try {
|
|
352534
352534
|
if (sourceFilePath) {
|
|
352535
352535
|
const tempSourcePath = (0, import_node_path210.join)(tempDir2, sourceFilePath);
|
|
352536
|
-
await (0,
|
|
352537
|
-
await (0,
|
|
352536
|
+
await (0, import_promises183.mkdir)((0, import_node_path210.dirname)(tempSourcePath), { recursive: true });
|
|
352537
|
+
await (0, import_promises183.writeFile)(tempSourcePath, base4);
|
|
352538
352538
|
await tempGit.exec(["add", sourceFilePath]);
|
|
352539
352539
|
await tempGit.exec([
|
|
352540
352540
|
"commit",
|
|
@@ -352544,15 +352544,15 @@ var require_dist14 = __commonJS({
|
|
|
352544
352544
|
]);
|
|
352545
352545
|
await tempGit.execWithInput(["apply", "--allow-empty"], fileDiff);
|
|
352546
352546
|
const tempTargetPath = (0, import_node_path210.join)(tempDir2, filePath);
|
|
352547
|
-
return await (0,
|
|
352547
|
+
return await (0, import_promises183.readFile)(tempTargetPath, "utf-8");
|
|
352548
352548
|
}
|
|
352549
352549
|
const tempFilePath = (0, import_node_path210.join)(tempDir2, filePath);
|
|
352550
|
-
await (0,
|
|
352551
|
-
await (0,
|
|
352550
|
+
await (0, import_promises183.mkdir)((0, import_node_path210.dirname)(tempFilePath), { recursive: true });
|
|
352551
|
+
await (0, import_promises183.writeFile)(tempFilePath, base4);
|
|
352552
352552
|
await tempGit.exec(["add", filePath]);
|
|
352553
352553
|
await tempGit.exec(["commit", "-m", `base for ${filePath}`, "--allow-empty"]);
|
|
352554
352554
|
await tempGit.execWithInput(["apply", "--allow-empty"], fileDiff);
|
|
352555
|
-
return await (0,
|
|
352555
|
+
return await (0, import_promises183.readFile)(tempFilePath, "utf-8");
|
|
352556
352556
|
} catch {
|
|
352557
352557
|
return null;
|
|
352558
352558
|
}
|
|
@@ -355822,7 +355822,7 @@ var require_jsonfile = __commonJS({
|
|
|
355822
355822
|
}
|
|
355823
355823
|
return obj;
|
|
355824
355824
|
}
|
|
355825
|
-
var
|
|
355825
|
+
var readFile103 = universalify.fromPromise(_readFile);
|
|
355826
355826
|
function readFileSync19(file4, options2 = {}) {
|
|
355827
355827
|
if (typeof options2 === "string") {
|
|
355828
355828
|
options2 = { encoding: options2 };
|
|
@@ -355847,16 +355847,16 @@ var require_jsonfile = __commonJS({
|
|
|
355847
355847
|
const str3 = stringify5(obj, options2);
|
|
355848
355848
|
await universalify.fromCallback(fs29.writeFile)(file4, str3, options2);
|
|
355849
355849
|
}
|
|
355850
|
-
var
|
|
355850
|
+
var writeFile90 = universalify.fromPromise(_writeFile);
|
|
355851
355851
|
function writeFileSync7(file4, obj, options2 = {}) {
|
|
355852
355852
|
const fs29 = options2.fs || _fs;
|
|
355853
355853
|
const str3 = stringify5(obj, options2);
|
|
355854
355854
|
return fs29.writeFileSync(file4, str3, options2);
|
|
355855
355855
|
}
|
|
355856
355856
|
module4.exports = {
|
|
355857
|
-
readFile:
|
|
355857
|
+
readFile: readFile103,
|
|
355858
355858
|
readFileSync: readFileSync19,
|
|
355859
|
-
writeFile:
|
|
355859
|
+
writeFile: writeFile90,
|
|
355860
355860
|
writeFileSync: writeFileSync7
|
|
355861
355861
|
};
|
|
355862
355862
|
}
|
|
@@ -419233,7 +419233,7 @@ async function unpackArchive(archivePath, folderPath) {
|
|
|
419233
419233
|
} else if (archivePath.endsWith(".tar.bz2")) {
|
|
419234
419234
|
await extractTar(archivePath, folderPath, "bzip2");
|
|
419235
419235
|
} else if (archivePath.endsWith(".dmg")) {
|
|
419236
|
-
await (0,
|
|
419236
|
+
await (0, import_promises119.mkdir)(folderPath);
|
|
419237
419237
|
await installDMG(archivePath, folderPath);
|
|
419238
419238
|
} else if (archivePath.endsWith(".exe")) {
|
|
419239
419239
|
const result = (0, import_node_child_process4.spawnSync)(archivePath, [`/ExtractDir=${folderPath}`], {
|
|
@@ -419322,7 +419322,7 @@ async function installDMG(dmgPath, folderPath) {
|
|
|
419322
419322
|
}
|
|
419323
419323
|
const mountPath = volumes[0];
|
|
419324
419324
|
try {
|
|
419325
|
-
const fileNames = await (0,
|
|
419325
|
+
const fileNames = await (0, import_promises119.readdir)(mountPath);
|
|
419326
419326
|
const appName = fileNames.find((item) => {
|
|
419327
419327
|
return typeof item === "string" && item.endsWith(".app");
|
|
419328
419328
|
});
|
|
@@ -419335,13 +419335,13 @@ async function installDMG(dmgPath, folderPath) {
|
|
|
419335
419335
|
(0, import_node_child_process4.spawnSync)("hdiutil", ["detach", mountPath, "-quiet"]);
|
|
419336
419336
|
}
|
|
419337
419337
|
}
|
|
419338
|
-
var import_node_child_process4, import_node_fs24,
|
|
419338
|
+
var import_node_child_process4, import_node_fs24, import_promises119, path79, import_node_stream6, import_debug8, debugFileUtil, internalConstantsForTesting;
|
|
419339
419339
|
var init_fileUtil = __esm({
|
|
419340
419340
|
"../../../node_modules/.pnpm/@puppeteer+browsers@2.13.0/node_modules/@puppeteer/browsers/lib/esm/fileUtil.js"() {
|
|
419341
419341
|
"use strict";
|
|
419342
419342
|
import_node_child_process4 = require("child_process");
|
|
419343
419343
|
import_node_fs24 = require("fs");
|
|
419344
|
-
|
|
419344
|
+
import_promises119 = require("fs/promises");
|
|
419345
419345
|
path79 = __toESM(require("path"), 1);
|
|
419346
419346
|
import_node_stream6 = require("stream");
|
|
419347
419347
|
import_debug8 = __toESM(require_src(), 1);
|
|
@@ -419404,7 +419404,7 @@ async function installWithProviders(options2) {
|
|
|
419404
419404
|
}
|
|
419405
419405
|
debugInstall(`Successfully got URL from ${provider.getName()}: ${url3}`);
|
|
419406
419406
|
if (!(0, import_node_fs25.existsSync)(browserRoot)) {
|
|
419407
|
-
await (0,
|
|
419407
|
+
await (0, import_promises120.mkdir)(browserRoot, { recursive: true });
|
|
419408
419408
|
}
|
|
419409
419409
|
return await installUrl(url3, options2, provider);
|
|
419410
419410
|
} catch (err) {
|
|
@@ -419477,7 +419477,7 @@ async function installUrl(url3, options2, provider) {
|
|
|
419477
419477
|
const browserRoot = cache2.browserRoot(options2.browser);
|
|
419478
419478
|
const archivePath = import_node_path33.default.join(browserRoot, `${options2.buildId}-${fileName}`);
|
|
419479
419479
|
if (!(0, import_node_fs25.existsSync)(browserRoot)) {
|
|
419480
|
-
await (0,
|
|
419480
|
+
await (0, import_promises120.mkdir)(browserRoot, { recursive: true });
|
|
419481
419481
|
}
|
|
419482
419482
|
if (!options2.unpack) {
|
|
419483
419483
|
if ((0, import_node_fs25.existsSync)(archivePath)) {
|
|
@@ -419541,7 +419541,7 @@ async function installUrl(url3, options2, provider) {
|
|
|
419541
419541
|
return installedBrowser;
|
|
419542
419542
|
} finally {
|
|
419543
419543
|
if ((0, import_node_fs25.existsSync)(archivePath)) {
|
|
419544
|
-
await (0,
|
|
419544
|
+
await (0, import_promises120.unlink)(archivePath);
|
|
419545
419545
|
}
|
|
419546
419546
|
}
|
|
419547
419547
|
}
|
|
@@ -419621,14 +419621,14 @@ function toMegabytes(bytes) {
|
|
|
419621
419621
|
const mb2 = bytes / 1e3 / 1e3;
|
|
419622
419622
|
return `${Math.round(mb2 * 10) / 10} MB`;
|
|
419623
419623
|
}
|
|
419624
|
-
var import_node_assert3, import_node_child_process5, import_node_fs25,
|
|
419624
|
+
var import_node_assert3, import_node_child_process5, import_node_fs25, import_promises120, import_node_os9, import_node_path33, import_progress, debugInstall, times;
|
|
419625
419625
|
var init_install = __esm({
|
|
419626
419626
|
"../../../node_modules/.pnpm/@puppeteer+browsers@2.13.0/node_modules/@puppeteer/browsers/lib/esm/install.js"() {
|
|
419627
419627
|
"use strict";
|
|
419628
419628
|
import_node_assert3 = __toESM(require("assert"), 1);
|
|
419629
419629
|
import_node_child_process5 = require("child_process");
|
|
419630
419630
|
import_node_fs25 = require("fs");
|
|
419631
|
-
|
|
419631
|
+
import_promises120 = require("fs/promises");
|
|
419632
419632
|
import_node_os9 = __toESM(require("os"), 1);
|
|
419633
419633
|
import_node_path33 = __toESM(require("path"), 1);
|
|
419634
419634
|
import_progress = __toESM(require_progress(), 1);
|
|
@@ -621394,7 +621394,7 @@ var AccessTokenPosthogManager = class {
|
|
|
621394
621394
|
properties: {
|
|
621395
621395
|
...event,
|
|
621396
621396
|
...event.properties,
|
|
621397
|
-
version: "4.
|
|
621397
|
+
version: "4.72.0",
|
|
621398
621398
|
usingAccessToken: true
|
|
621399
621399
|
}
|
|
621400
621400
|
});
|
|
@@ -621448,7 +621448,7 @@ var UserPosthogManager = class {
|
|
|
621448
621448
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
621449
621449
|
event: "CLI",
|
|
621450
621450
|
properties: {
|
|
621451
|
-
version: "4.
|
|
621451
|
+
version: "4.72.0",
|
|
621452
621452
|
...event,
|
|
621453
621453
|
...event.properties,
|
|
621454
621454
|
usingAccessToken: false,
|
|
@@ -795489,13 +795489,13 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context3 }) {
|
|
|
795489
795489
|
}
|
|
795490
795490
|
}
|
|
795491
795491
|
}
|
|
795492
|
-
const { writeFile:
|
|
795492
|
+
const { writeFile: writeFile90 } = await import("fs/promises");
|
|
795493
795493
|
const yamlContent = jsYaml.dump(parsed, {
|
|
795494
795494
|
indent: 2,
|
|
795495
795495
|
lineWidth: -1,
|
|
795496
795496
|
noRefs: true
|
|
795497
795497
|
});
|
|
795498
|
-
await
|
|
795498
|
+
await writeFile90(overrideFilePath, yamlContent, "utf-8");
|
|
795499
795499
|
context3.logger.info(`Removed ${validationResult.invalidCount} invalid AI examples from ai_examples_override.yml`);
|
|
795500
795500
|
return {
|
|
795501
795501
|
removedCount: validationResult.invalidCount,
|
|
@@ -833544,7 +833544,7 @@ var MDX_NODE_TYPES = [
|
|
|
833544
833544
|
"mdxTextExpression",
|
|
833545
833545
|
"mdxjsEsm"
|
|
833546
833546
|
];
|
|
833547
|
-
function collectLinksAndSources({ readFile:
|
|
833547
|
+
function collectLinksAndSources({ readFile: readFile103 = (path97) => (0, import_node_fs14.readFileSync)(path97, "utf-8"), ...opts }) {
|
|
833548
833548
|
const visitedAbsoluteFilepaths = /* @__PURE__ */ new Set();
|
|
833549
833549
|
const contentQueue = [opts];
|
|
833550
833550
|
const links = [];
|
|
@@ -833582,7 +833582,7 @@ function collectLinksAndSources({ readFile: readFile102 = (path97) => (0, import
|
|
|
833582
833582
|
const resolvedImportPath = resolve6(dirname6(absoluteFilepath), importPath);
|
|
833583
833583
|
if (resolvedImportPath.endsWith(".mdx") || resolvedImportPath.endsWith(".md")) {
|
|
833584
833584
|
contentQueue.push({
|
|
833585
|
-
content:
|
|
833585
|
+
content: readFile103(resolvedImportPath),
|
|
833586
833586
|
absoluteFilepath: resolvedImportPath
|
|
833587
833587
|
});
|
|
833588
833588
|
}
|
|
@@ -833625,7 +833625,7 @@ function collectLinksAndSources({ readFile: readFile102 = (path97) => (0, import
|
|
|
833625
833625
|
if (absoluteFilepath && typeof src === "string") {
|
|
833626
833626
|
const resolvedImportPath = resolve6(dirname6(absoluteFilepath), src);
|
|
833627
833627
|
contentQueue.push({
|
|
833628
|
-
content:
|
|
833628
|
+
content: readFile103(resolvedImportPath),
|
|
833629
833629
|
absoluteFilepath: resolvedImportPath
|
|
833630
833630
|
});
|
|
833631
833631
|
}
|
|
@@ -835180,7 +835180,7 @@ function addCheckCommand2(cli) {
|
|
|
835180
835180
|
|
|
835181
835181
|
// ../cli-v2/lib/migrator/Migrator.js
|
|
835182
835182
|
init_lib6();
|
|
835183
|
-
var
|
|
835183
|
+
var import_promises76 = require("fs/promises");
|
|
835184
835184
|
|
|
835185
835185
|
// ../cli-v2/lib/migrator/converters/convertApiSpecs.js
|
|
835186
835186
|
init_lib6();
|
|
@@ -835190,6 +835190,7 @@ var import_promises72 = require("fs/promises");
|
|
|
835190
835190
|
var SETTINGS_KEY_MAP = {
|
|
835191
835191
|
// Base settings
|
|
835192
835192
|
"use-title": "titleAsSchemaName",
|
|
835193
|
+
"title-as-schema-name": "titleAsSchemaName",
|
|
835193
835194
|
"respect-nullable-schemas": "respectNullableSchemas",
|
|
835194
835195
|
"wrap-references-to-nullable-in-optional": "wrapReferencesToNullableInOptional",
|
|
835195
835196
|
"coerce-optional-schemas-to-nullable": "coerceOptionalSchemasToNullable",
|
|
@@ -835752,9 +835753,6 @@ function convertSdkTargetsFromRaw(options2) {
|
|
|
835752
835753
|
}
|
|
835753
835754
|
}
|
|
835754
835755
|
const sdks = { targets: targets2 };
|
|
835755
|
-
if (defaultGroup != null) {
|
|
835756
|
-
sdks.defaultGroup = defaultGroup;
|
|
835757
|
-
}
|
|
835758
835756
|
if (autorelease != null) {
|
|
835759
835757
|
sdks.autorelease = autorelease;
|
|
835760
835758
|
}
|
|
@@ -835808,12 +835806,42 @@ function convertRawGeneratorToTarget(options2) {
|
|
|
835808
835806
|
if (generator.config != null) {
|
|
835809
835807
|
target.config = generator.config;
|
|
835810
835808
|
}
|
|
835811
|
-
target.group = [groupName];
|
|
835812
835809
|
const outputResult = convertRawOutputConfig(generator, warnings);
|
|
835813
835810
|
target.output = outputResult.output;
|
|
835814
835811
|
if (outputResult.publish != null) {
|
|
835815
835812
|
target.publish = outputResult.publish;
|
|
835816
835813
|
}
|
|
835814
|
+
const generatorMetadata = generator.metadata;
|
|
835815
|
+
if (generatorMetadata != null) {
|
|
835816
|
+
const targetMetadata = {};
|
|
835817
|
+
if (generatorMetadata["package-description"] != null) {
|
|
835818
|
+
targetMetadata.description = generatorMetadata["package-description"];
|
|
835819
|
+
}
|
|
835820
|
+
if (generatorMetadata.author != null || generatorMetadata.email != null) {
|
|
835821
|
+
targetMetadata.authors = [{ name: generatorMetadata.author ?? "", email: generatorMetadata.email ?? "" }];
|
|
835822
|
+
}
|
|
835823
|
+
if (generatorMetadata["reference-url"] != null) {
|
|
835824
|
+
warnings.push({
|
|
835825
|
+
type: "unsupported",
|
|
835826
|
+
message: `metadata.reference-url is not supported in fern.yml`,
|
|
835827
|
+
suggestion: "Remove reference-url from metadata"
|
|
835828
|
+
});
|
|
835829
|
+
}
|
|
835830
|
+
if (generatorMetadata.license != null && typeof target.output !== "string" && target.output.git != null) {
|
|
835831
|
+
const license = generatorMetadata.license;
|
|
835832
|
+
target.output.git.license = typeof license === "string" ? license : license.custom;
|
|
835833
|
+
}
|
|
835834
|
+
if (targetMetadata.description != null || targetMetadata.authors != null) {
|
|
835835
|
+
target.metadata = targetMetadata;
|
|
835836
|
+
}
|
|
835837
|
+
}
|
|
835838
|
+
if (generator["smart-casing"] != null) {
|
|
835839
|
+
warnings.push({
|
|
835840
|
+
type: "unsupported",
|
|
835841
|
+
message: `smart-casing is not supported in fern.yml`,
|
|
835842
|
+
suggestion: "Remove smart-casing from your generator configuration"
|
|
835843
|
+
});
|
|
835844
|
+
}
|
|
835817
835845
|
if (generator["ir-version"] != null) {
|
|
835818
835846
|
warnings.push({
|
|
835819
835847
|
type: "deprecated",
|
|
@@ -836073,6 +836101,16 @@ function convertRawReadme(readme) {
|
|
|
836073
836101
|
return hasFields ? result : void 0;
|
|
836074
836102
|
}
|
|
836075
836103
|
|
|
836104
|
+
// ../cli-v2/lib/migrator/docs-yml/DocsYmlMigrator.js
|
|
836105
|
+
init_lib6();
|
|
836106
|
+
async function migrateDocsYml(fernDir) {
|
|
836107
|
+
const filePath = join8(fernDir, RelativeFilePath2.of(DOCS_CONFIGURATION_FILENAME));
|
|
836108
|
+
if (!await doesPathExist(filePath, "file")) {
|
|
836109
|
+
return { found: false };
|
|
836110
|
+
}
|
|
836111
|
+
return { docsRef: { $ref: `./${DOCS_CONFIGURATION_FILENAME}` }, found: true };
|
|
836112
|
+
}
|
|
836113
|
+
|
|
836076
836114
|
// ../cli-v2/lib/migrator/fern-config-json/FernConfigJsonMigrator.js
|
|
836077
836115
|
init_lib4();
|
|
836078
836116
|
init_lib6();
|
|
@@ -836323,6 +836361,38 @@ var GeneratorsYmlMigrator = class {
|
|
|
836323
836361
|
}
|
|
836324
836362
|
};
|
|
836325
836363
|
|
|
836364
|
+
// ../cli-v2/lib/migrator/github-workflows/GithubWorkflowMigrator.js
|
|
836365
|
+
init_lib6();
|
|
836366
|
+
var import_promises75 = require("fs/promises");
|
|
836367
|
+
var WORKFLOWS_DIR = ".github/workflows";
|
|
836368
|
+
async function migrateGithubWorkflows(cwd2) {
|
|
836369
|
+
const warnings = [];
|
|
836370
|
+
const workflowsDir = join8(cwd2, RelativeFilePath2.of(WORKFLOWS_DIR));
|
|
836371
|
+
if (!await doesPathExist(workflowsDir, "directory")) {
|
|
836372
|
+
return warnings;
|
|
836373
|
+
}
|
|
836374
|
+
const entries23 = await (0, import_promises75.readdir)(workflowsDir, { withFileTypes: true });
|
|
836375
|
+
const files = entries23.filter((e6) => e6.isFile() && (e6.name.endsWith(".yml") || e6.name.endsWith(".yaml")));
|
|
836376
|
+
for (const entry of files) {
|
|
836377
|
+
const filePath = join8(workflowsDir, RelativeFilePath2.of(entry.name));
|
|
836378
|
+
const original = await (0, import_promises75.readFile)(filePath, "utf-8");
|
|
836379
|
+
const migrated = migrateFernCommands(original);
|
|
836380
|
+
if (migrated !== original) {
|
|
836381
|
+
await (0, import_promises75.writeFile)(filePath, migrated, "utf-8");
|
|
836382
|
+
warnings.push({ type: "info", message: `Updated workflow file: ${WORKFLOWS_DIR}/${entry.name}` });
|
|
836383
|
+
}
|
|
836384
|
+
}
|
|
836385
|
+
return warnings;
|
|
836386
|
+
}
|
|
836387
|
+
function migrateFernCommands(content5) {
|
|
836388
|
+
return content5.split("\n").map((line) => {
|
|
836389
|
+
if (!/\bfern(?:-api)?\s+generate\b/.test(line)) {
|
|
836390
|
+
return line;
|
|
836391
|
+
}
|
|
836392
|
+
return line.replace(/(\bfern(?:-api)?\s+)generate\b/g, "$1sdk generate").replace(/--group\b/g, "--target");
|
|
836393
|
+
}).join("\n");
|
|
836394
|
+
}
|
|
836395
|
+
|
|
836326
836396
|
// ../cli-v2/lib/migrator/Migrator.js
|
|
836327
836397
|
var Migrator = class {
|
|
836328
836398
|
cwd;
|
|
@@ -836407,13 +836477,17 @@ var Migrator = class {
|
|
|
836407
836477
|
}
|
|
836408
836478
|
fernYml = singleApiResult.fernYml;
|
|
836409
836479
|
}
|
|
836480
|
+
const docsResult = await migrateDocsYml(fernDir);
|
|
836481
|
+
if (docsResult.docsRef != null) {
|
|
836482
|
+
fernYml.docs = docsResult.docsRef;
|
|
836483
|
+
}
|
|
836410
836484
|
const fernYmlPath = join8(this.cwd, RelativeFilePath2.of(FERN_YML_FILENAME));
|
|
836411
836485
|
const yamlContent = this.serializeFernYml(fernYml);
|
|
836412
|
-
await (0,
|
|
836486
|
+
await (0, import_promises76.writeFile)(fernYmlPath, yamlContent, "utf-8");
|
|
836413
836487
|
if (this.deleteOriginals) {
|
|
836414
836488
|
for (const absoluteFilePath of migratedFiles) {
|
|
836415
836489
|
try {
|
|
836416
|
-
await (0,
|
|
836490
|
+
await (0, import_promises76.rm)(absoluteFilePath);
|
|
836417
836491
|
this.logger.debug(`Deleted ${absoluteFilePath}`);
|
|
836418
836492
|
} catch {
|
|
836419
836493
|
warnings.push({
|
|
@@ -836424,6 +836498,7 @@ var Migrator = class {
|
|
|
836424
836498
|
}
|
|
836425
836499
|
}
|
|
836426
836500
|
this.logger.info(`Created ${fernYmlPath}`);
|
|
836501
|
+
warnings.push(...await migrateGithubWorkflows(this.cwd));
|
|
836427
836502
|
return {
|
|
836428
836503
|
success: true,
|
|
836429
836504
|
warnings,
|
|
@@ -836457,7 +836532,7 @@ var Migrator = class {
|
|
|
836457
836532
|
}
|
|
836458
836533
|
async migrateMultiApi(options2) {
|
|
836459
836534
|
const { fernDir, apisDir, org, warnings, migratedFiles } = options2;
|
|
836460
|
-
const apiDirs = await (0,
|
|
836535
|
+
const apiDirs = await (0, import_promises76.readdir)(apisDir, { withFileTypes: true });
|
|
836461
836536
|
const apiNames = apiDirs.filter((d14) => d14.isDirectory()).map((d14) => d14.name);
|
|
836462
836537
|
if (apiNames.length === 0) {
|
|
836463
836538
|
warnings.push({
|
|
@@ -836468,7 +836543,6 @@ var Migrator = class {
|
|
|
836468
836543
|
}
|
|
836469
836544
|
const generatorsYmlApis = {};
|
|
836470
836545
|
let combinedSdks = { targets: {} };
|
|
836471
|
-
let defaultGroup;
|
|
836472
836546
|
let autorelease;
|
|
836473
836547
|
for (const apiName of apiNames) {
|
|
836474
836548
|
const apiDir = join8(apisDir, RelativeFilePath2.of(apiName));
|
|
@@ -836483,9 +836557,6 @@ var Migrator = class {
|
|
|
836483
836557
|
for (const [targetName, target] of Object.entries(generatorsResult.sdks.targets)) {
|
|
836484
836558
|
combinedSdks.targets[targetName] = target;
|
|
836485
836559
|
}
|
|
836486
|
-
if (generatorsResult.sdks.defaultGroup != null && defaultGroup == null) {
|
|
836487
|
-
defaultGroup = generatorsResult.sdks.defaultGroup;
|
|
836488
|
-
}
|
|
836489
836560
|
if (generatorsResult.sdks.autorelease != null && autorelease == null) {
|
|
836490
836561
|
autorelease = generatorsResult.sdks.autorelease;
|
|
836491
836562
|
}
|
|
@@ -836502,9 +836573,6 @@ var Migrator = class {
|
|
|
836502
836573
|
apis: apisResult.apis
|
|
836503
836574
|
};
|
|
836504
836575
|
if (Object.keys(combinedSdks.targets).length > 0) {
|
|
836505
|
-
if (defaultGroup != null) {
|
|
836506
|
-
combinedSdks.defaultGroup = defaultGroup;
|
|
836507
|
-
}
|
|
836508
836576
|
if (autorelease != null) {
|
|
836509
836577
|
combinedSdks.autorelease = autorelease;
|
|
836510
836578
|
}
|
|
@@ -836550,6 +836618,9 @@ var Migrator = class {
|
|
|
836550
836618
|
if (fernYml.cli != null) {
|
|
836551
836619
|
doc.cli = fernYml.cli;
|
|
836552
836620
|
}
|
|
836621
|
+
if (fernYml.docs != null) {
|
|
836622
|
+
doc.docs = fernYml.docs;
|
|
836623
|
+
}
|
|
836553
836624
|
if (fernYml.sdks != null) {
|
|
836554
836625
|
doc.sdks = this.simplifySdks(fernYml.sdks);
|
|
836555
836626
|
}
|
|
@@ -836867,7 +836938,7 @@ var import_child_process6 = require("child_process");
|
|
|
836867
836938
|
var import_cors = __toESM(require_lib14(), 1);
|
|
836868
836939
|
var import_express2 = __toESM(require_express3(), 1);
|
|
836869
836940
|
var import_fs25 = __toESM(require("fs"), 1);
|
|
836870
|
-
var
|
|
836941
|
+
var import_promises80 = require("fs/promises");
|
|
836871
836942
|
var import_http9 = __toESM(require("http"), 1);
|
|
836872
836943
|
var import_path55 = __toESM(require("path"), 1);
|
|
836873
836944
|
|
|
@@ -837283,7 +837354,7 @@ var isFunction8 = (value) => {
|
|
|
837283
837354
|
};
|
|
837284
837355
|
|
|
837285
837356
|
// ../../../node_modules/.pnpm/tiny-readdir@2.7.4/node_modules/tiny-readdir/dist/index.js
|
|
837286
|
-
var
|
|
837357
|
+
var readdir12 = (rootPath, options2) => {
|
|
837287
837358
|
const followSymlinks = options2?.followSymlinks ?? false;
|
|
837288
837359
|
const maxDepth = options2?.depth ?? Infinity;
|
|
837289
837360
|
const maxPaths = options2?.limit ?? Infinity;
|
|
@@ -837449,7 +837520,7 @@ var readdir11 = (rootPath, options2) => {
|
|
|
837449
837520
|
};
|
|
837450
837521
|
return populateResultFromRoot(rootPath);
|
|
837451
837522
|
};
|
|
837452
|
-
var dist_default4 =
|
|
837523
|
+
var dist_default4 = readdir12;
|
|
837453
837524
|
|
|
837454
837525
|
// ../../../node_modules/.pnpm/watcher@2.3.1/node_modules/watcher/dist/utils.js
|
|
837455
837526
|
var Utils = {
|
|
@@ -838540,14 +838611,14 @@ init_wrapper();
|
|
|
838540
838611
|
|
|
838541
838612
|
// ../docs-preview/lib/DebugLogger.js
|
|
838542
838613
|
init_lib6();
|
|
838543
|
-
var
|
|
838614
|
+
var import_promises77 = require("fs/promises");
|
|
838544
838615
|
var import_os9 = require("os");
|
|
838545
838616
|
var import_path54 = __toESM(require("path"), 1);
|
|
838546
838617
|
var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
838547
838618
|
var LOGS_FOLDER_NAME = "logs";
|
|
838548
838619
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
838549
838620
|
function getCliSource() {
|
|
838550
|
-
const version7 = "4.
|
|
838621
|
+
const version7 = "4.72.0";
|
|
838551
838622
|
return `cli@${version7}`;
|
|
838552
838623
|
}
|
|
838553
838624
|
var DebugLogger = class {
|
|
@@ -838569,7 +838640,7 @@ var DebugLogger = class {
|
|
|
838569
838640
|
const localStorageFolder = join8(AbsoluteFilePath2.of((0, import_os9.homedir)()), RelativeFilePath2.of(LOCAL_STORAGE_FOLDER4));
|
|
838570
838641
|
const logsDir = join8(localStorageFolder, RelativeFilePath2.of(LOGS_FOLDER_NAME));
|
|
838571
838642
|
if (!await doesPathExist(logsDir)) {
|
|
838572
|
-
await (0,
|
|
838643
|
+
await (0, import_promises77.mkdir)(logsDir, { recursive: true });
|
|
838573
838644
|
}
|
|
838574
838645
|
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
838575
838646
|
const logFileName = `${timestamp2}.debug.log`;
|
|
@@ -838582,7 +838653,7 @@ var DebugLogger = class {
|
|
|
838582
838653
|
"================================================================================",
|
|
838583
838654
|
""
|
|
838584
838655
|
].join("\n");
|
|
838585
|
-
await (0,
|
|
838656
|
+
await (0, import_promises77.writeFile)(this.logFilePath, header, "utf-8");
|
|
838586
838657
|
this.initialized = true;
|
|
838587
838658
|
void this.enforceLogSizeLimit(logsDir);
|
|
838588
838659
|
}
|
|
@@ -838601,7 +838672,7 @@ var DebugLogger = class {
|
|
|
838601
838672
|
}
|
|
838602
838673
|
const line = JSON.stringify(entry) + "\n";
|
|
838603
838674
|
try {
|
|
838604
|
-
await (0,
|
|
838675
|
+
await (0, import_promises77.appendFile)(this.logFilePath, line, "utf-8");
|
|
838605
838676
|
} catch (error50) {
|
|
838606
838677
|
}
|
|
838607
838678
|
}
|
|
@@ -838706,13 +838777,13 @@ var DebugLogger = class {
|
|
|
838706
838777
|
*/
|
|
838707
838778
|
async enforceLogSizeLimit(logsDir) {
|
|
838708
838779
|
try {
|
|
838709
|
-
const entries23 = await (0,
|
|
838780
|
+
const entries23 = await (0, import_promises77.readdir)(logsDir);
|
|
838710
838781
|
const logFiles = entries23.filter((name2) => name2.endsWith(".log"));
|
|
838711
838782
|
const fileInfos = [];
|
|
838712
838783
|
for (const name2 of logFiles) {
|
|
838713
838784
|
const fullPath = import_path54.default.join(logsDir, name2);
|
|
838714
838785
|
try {
|
|
838715
|
-
const stats = await (0,
|
|
838786
|
+
const stats = await (0, import_promises77.stat)(fullPath);
|
|
838716
838787
|
fileInfos.push({ name: name2, fullPath, size: stats.size, mtimeMs: stats.mtimeMs });
|
|
838717
838788
|
} catch {
|
|
838718
838789
|
}
|
|
@@ -838734,7 +838805,7 @@ var DebugLogger = class {
|
|
|
838734
838805
|
continue;
|
|
838735
838806
|
}
|
|
838736
838807
|
try {
|
|
838737
|
-
await (0,
|
|
838808
|
+
await (0, import_promises77.unlink)(file4.fullPath);
|
|
838738
838809
|
totalSize -= file4.size;
|
|
838739
838810
|
} catch {
|
|
838740
838811
|
}
|
|
@@ -838877,7 +838948,7 @@ function getBun() {
|
|
|
838877
838948
|
init_lib6();
|
|
838878
838949
|
var import_cli_progress = __toESM(require_cli_progress(), 1);
|
|
838879
838950
|
var import_decompress = __toESM(require_decompress(), 1);
|
|
838880
|
-
var
|
|
838951
|
+
var import_promises78 = require("fs/promises");
|
|
838881
838952
|
var import_os10 = require("os");
|
|
838882
838953
|
var import_tmp_promise8 = __toESM(require_tmp_promise(), 1);
|
|
838883
838954
|
var import_xml2js = __toESM(require_xml2js(), 1);
|
|
@@ -838965,7 +839036,7 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
838965
839036
|
let currentETag = void 0;
|
|
838966
839037
|
if (currentETagExists) {
|
|
838967
839038
|
logger4.debug("Reading existing ETag");
|
|
838968
|
-
currentETag = (await (0,
|
|
839039
|
+
currentETag = (await (0, import_promises78.readFile)(eTagFilepath)).toString();
|
|
838969
839040
|
}
|
|
838970
839041
|
if (currentETag != null && currentETag === eTag) {
|
|
838971
839042
|
logger4.debug("ETag matches. Using already downloaded bundle");
|
|
@@ -839029,20 +839100,20 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
839029
839100
|
}
|
|
839030
839101
|
}
|
|
839031
839102
|
const nodeBuffer = Buffer.concat(chunks);
|
|
839032
|
-
await (0,
|
|
839103
|
+
await (0, import_promises78.writeFile)(outputZipPath, new Uint8Array(nodeBuffer));
|
|
839033
839104
|
logger4.debug(`Wrote ${tryTar ? "output.tar.gz" : "output.zip"} to ${outputZipPath}`);
|
|
839034
839105
|
const absolutePathToPreviewFolder = getPathToPreviewFolder({ app });
|
|
839035
839106
|
if (await doesPathExist(absolutePathToPreviewFolder)) {
|
|
839036
839107
|
const oldBundlePath = AbsoluteFilePath2.of(`${absolutePathToPreviewFolder}-old-${Date.now()}`);
|
|
839037
839108
|
logger4.debug(`Moving previously cached bundle to: ${oldBundlePath}`);
|
|
839038
|
-
await (0,
|
|
839039
|
-
(0,
|
|
839109
|
+
await (0, import_promises78.rename)(absolutePathToPreviewFolder, oldBundlePath);
|
|
839110
|
+
(0, import_promises78.rm)(oldBundlePath, { recursive: true }).catch((error50) => {
|
|
839040
839111
|
logger4.debug(`Failed to remove old bundle at ${oldBundlePath}: ${error50}`);
|
|
839041
839112
|
});
|
|
839042
839113
|
}
|
|
839043
|
-
await (0,
|
|
839114
|
+
await (0, import_promises78.mkdir)(absolutePathToPreviewFolder, { recursive: true });
|
|
839044
839115
|
const absolutePathToBundleFolder = getPathToBundleFolder({ app });
|
|
839045
|
-
await (0,
|
|
839116
|
+
await (0, import_promises78.mkdir)(absolutePathToBundleFolder, { recursive: true });
|
|
839046
839117
|
logger4.debug(`Decompressing bundle from ${outputZipPath} to ${absolutePathToBundleFolder}`);
|
|
839047
839118
|
let unzipProgressBar;
|
|
839048
839119
|
let unzipInterval;
|
|
@@ -839077,7 +839148,7 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
839077
839148
|
unzipProgressBar.stop();
|
|
839078
839149
|
}
|
|
839079
839150
|
}
|
|
839080
|
-
await (0,
|
|
839151
|
+
await (0, import_promises78.writeFile)(eTagFilepath, eTag);
|
|
839081
839152
|
logger4.debug(`Downloaded bundle to ${absolutePathToBundleFolder}`);
|
|
839082
839153
|
if (app) {
|
|
839083
839154
|
logger4.debug("Checking if pnpm is installed");
|
|
@@ -839159,15 +839230,15 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
839159
839230
|
}
|
|
839160
839231
|
if (!pnpmfileExists) {
|
|
839161
839232
|
logger4.debug(`Writing pnpmfile.cjs at ${pnpmfilePath}`);
|
|
839162
|
-
await (0,
|
|
839233
|
+
await (0, import_promises78.writeFile)(pnpmfilePath, PNPMFILE_CJS_CONTENTS);
|
|
839163
839234
|
}
|
|
839164
839235
|
if (!npmrcExists) {
|
|
839165
839236
|
logger4.debug(`Writing .npmrc at ${npmrcPath}`);
|
|
839166
|
-
await (0,
|
|
839237
|
+
await (0, import_promises78.writeFile)(npmrcPath, NPMRC_CONTENTS);
|
|
839167
839238
|
}
|
|
839168
839239
|
if (instrumentationJsExists) {
|
|
839169
839240
|
logger4.debug(`Removing instrumentation.js at ${absPathToInstrumentationJs}`);
|
|
839170
|
-
await (0,
|
|
839241
|
+
await (0, import_promises78.rm)(absPathToInstrumentationJs);
|
|
839171
839242
|
}
|
|
839172
839243
|
try {
|
|
839173
839244
|
logger4.debug("Running pnpm install within standalone");
|
|
@@ -839187,7 +839258,7 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
839187
839258
|
logger4.error(`Error: ${error50}`);
|
|
839188
839259
|
const absolutePathToPreviewFolder = getPathToPreviewFolder({ app });
|
|
839189
839260
|
if (await doesPathExist(absolutePathToPreviewFolder)) {
|
|
839190
|
-
await (0,
|
|
839261
|
+
await (0, import_promises78.rm)(absolutePathToPreviewFolder, { recursive: true });
|
|
839191
839262
|
}
|
|
839192
839263
|
logger4.debug(`Removing incomplete bundle: rm -rf ${absolutePathToPreviewFolder}`);
|
|
839193
839264
|
return {
|
|
@@ -839200,7 +839271,7 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
839200
839271
|
init_lib4();
|
|
839201
839272
|
init_js();
|
|
839202
839273
|
init_lib6();
|
|
839203
|
-
var
|
|
839274
|
+
var import_promises79 = require("fs/promises");
|
|
839204
839275
|
var import_gray_matter8 = __toESM(require_gray_matter(), 1);
|
|
839205
839276
|
var frontmatterPositionCache = /* @__PURE__ */ new Map();
|
|
839206
839277
|
var frontmatterSidebarTitleCache = /* @__PURE__ */ new Map();
|
|
@@ -839270,7 +839341,7 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
|
|
|
839270
839341
|
navAffectingChange = true;
|
|
839271
839342
|
continue;
|
|
839272
839343
|
}
|
|
839273
|
-
const markdown = (await (0,
|
|
839344
|
+
const markdown = (await (0, import_promises79.readFile)(absoluteFilePath)).toString();
|
|
839274
839345
|
const isNewFile = previousValue == null;
|
|
839275
839346
|
if (isNewFile) {
|
|
839276
839347
|
navAffectingChange = true;
|
|
@@ -839675,7 +839746,7 @@ var SnippetDependencyTracker = class {
|
|
|
839675
839746
|
const markdownFiles = await this.findMarkdownFiles(docsWorkspace.absoluteFilePath);
|
|
839676
839747
|
for (const markdownFile of markdownFiles) {
|
|
839677
839748
|
try {
|
|
839678
|
-
const content5 = await (0,
|
|
839749
|
+
const content5 = await (0, import_promises80.readFile)(markdownFile, "utf-8");
|
|
839679
839750
|
const referencedFiles = this.extractReferences(content5, markdownFile, docsWorkspace.absoluteFilePath);
|
|
839680
839751
|
this.pageToSnippets.set(markdownFile, referencedFiles);
|
|
839681
839752
|
for (const referencedFile of referencedFiles) {
|
|
@@ -839761,7 +839832,7 @@ async function cleanFernDocsCache(bundleRoot, context3) {
|
|
|
839761
839832
|
const cacheExists = await doesPathExist(AbsoluteFilePath2.of(cachePath));
|
|
839762
839833
|
if (cacheExists) {
|
|
839763
839834
|
context3.logger.debug(`Cleaning Fern Docs cache at ${cachePath}`);
|
|
839764
|
-
await (0,
|
|
839835
|
+
await (0, import_promises80.rm)(cachePath, { recursive: true });
|
|
839765
839836
|
context3.logger.debug("Fern Docs cache cleaned successfully");
|
|
839766
839837
|
} else {
|
|
839767
839838
|
context3.logger.debug("No Fern Docs cache to clean");
|
|
@@ -839814,7 +839885,7 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
|
|
|
839814
839885
|
const appPreviewFolder = getPathToPreviewFolder({ app: true });
|
|
839815
839886
|
if (await doesPathExist(appPreviewFolder)) {
|
|
839816
839887
|
context3.logger.info("Force download requested. Deleting cached bundle...");
|
|
839817
|
-
await (0,
|
|
839888
|
+
await (0, import_promises80.rm)(appPreviewFolder, { recursive: true });
|
|
839818
839889
|
}
|
|
839819
839890
|
}
|
|
839820
839891
|
if (bundlePath != null) {
|
|
@@ -841294,7 +841365,7 @@ init_lib6();
|
|
|
841294
841365
|
|
|
841295
841366
|
// ../workspace/loader/lib/listFernFiles.js
|
|
841296
841367
|
init_lib6();
|
|
841297
|
-
var
|
|
841368
|
+
var import_promises81 = require("fs/promises");
|
|
841298
841369
|
async function listFernFiles2(root6, extensionGlob) {
|
|
841299
841370
|
const files = [];
|
|
841300
841371
|
for (const absoluteFilepath of await listFiles(root6, extensionGlob)) {
|
|
@@ -841309,7 +841380,7 @@ async function createFernFile2({ relativeFilepath, absoluteFilepath }) {
|
|
|
841309
841380
|
return {
|
|
841310
841381
|
relativeFilepath,
|
|
841311
841382
|
absoluteFilepath,
|
|
841312
|
-
fileContents: (await (0,
|
|
841383
|
+
fileContents: (await (0, import_promises81.readFile)(absoluteFilepath)).toString()
|
|
841313
841384
|
};
|
|
841314
841385
|
}
|
|
841315
841386
|
|
|
@@ -841616,7 +841687,7 @@ async function loadAPIWorkspace({ absolutePathToWorkspace, context: context3, cl
|
|
|
841616
841687
|
// ../workspace/loader/lib/loadDocsWorkspace.js
|
|
841617
841688
|
init_lib4();
|
|
841618
841689
|
init_lib6();
|
|
841619
|
-
var
|
|
841690
|
+
var import_promises82 = require("fs/promises");
|
|
841620
841691
|
|
|
841621
841692
|
// ../workspace/loader/lib/docs-yml.schema.json
|
|
841622
841693
|
var docs_yml_schema_exports = {};
|
|
@@ -847559,7 +847630,7 @@ async function loadDocsConfiguration({ absolutePathToDocsDefinition, context: co
|
|
|
847559
847630
|
});
|
|
847560
847631
|
}
|
|
847561
847632
|
async function loadRawDocsConfiguration({ absolutePathOfConfiguration, context: context3 }) {
|
|
847562
|
-
const contentsStr = await (0,
|
|
847633
|
+
const contentsStr = await (0, import_promises82.readFile)(absolutePathOfConfiguration);
|
|
847563
847634
|
const contentsJson = jsYaml.load(contentsStr.toString());
|
|
847564
847635
|
const result = validateAgainstJsonSchema(contentsJson, docs_yml_schema_exports, {
|
|
847565
847636
|
filePath: absolutePathOfConfiguration
|
|
@@ -847590,8 +847661,8 @@ ${result.error?.message ?? "Unknown error"}`);
|
|
|
847590
847661
|
// ../generation/remote-generation/remote-workspace-runner/lib/downloadSnippetsForTask.js
|
|
847591
847662
|
init_lib6();
|
|
847592
847663
|
var import_fs26 = require("fs");
|
|
847593
|
-
var
|
|
847594
|
-
var
|
|
847664
|
+
var import_promises83 = require("fs/promises");
|
|
847665
|
+
var import_promises84 = require("stream/promises");
|
|
847595
847666
|
async function downloadSnippetsForTask({ snippetsS3PreSignedReadUrl, absolutePathToLocalSnippetJSON, context: context3 }) {
|
|
847596
847667
|
try {
|
|
847597
847668
|
await downloadFileForTask({
|
|
@@ -847608,10 +847679,10 @@ async function downloadFileForTask({ s3PreSignedReadUrl, absolutePathToLocalOutp
|
|
|
847608
847679
|
responseType: "stream"
|
|
847609
847680
|
});
|
|
847610
847681
|
if (await doesPathExist(absolutePathToLocalOutput)) {
|
|
847611
|
-
await (0,
|
|
847682
|
+
await (0, import_promises83.rm)(absolutePathToLocalOutput, { recursive: true });
|
|
847612
847683
|
}
|
|
847613
|
-
await (0,
|
|
847614
|
-
await (0,
|
|
847684
|
+
await (0, import_promises83.mkdir)(dirname6(absolutePathToLocalOutput), { recursive: true });
|
|
847685
|
+
await (0, import_promises84.pipeline)(request7.data, (0, import_fs26.createWriteStream)(absolutePathToLocalOutput));
|
|
847615
847686
|
}
|
|
847616
847687
|
|
|
847617
847688
|
// ../generation/remote-generation/remote-workspace-runner/lib/resolveAutoDiscoveredFernignorePath.js
|
|
@@ -847635,7 +847706,7 @@ init_js();
|
|
|
847635
847706
|
// ../generation/remote-generation/remote-workspace-runner/lib/createAndStartJob.js
|
|
847636
847707
|
init_lib6();
|
|
847637
847708
|
var import_form_data4 = __toESM(require_form_data(), 1);
|
|
847638
|
-
var
|
|
847709
|
+
var import_promises85 = require("fs/promises");
|
|
847639
847710
|
var import_url_join23 = __toESM(require_url_join(), 1);
|
|
847640
847711
|
var import_util19 = require("util");
|
|
847641
847712
|
var import_zlib5 = require("zlib");
|
|
@@ -847688,7 +847759,7 @@ async function createAndStartJob({ projectConfig, workspace, organization, inter
|
|
|
847688
847759
|
fernignoreContents = "";
|
|
847689
847760
|
} else if (fernignorePath != null) {
|
|
847690
847761
|
try {
|
|
847691
|
-
fernignoreContents = await (0,
|
|
847762
|
+
fernignoreContents = await (0, import_promises85.readFile)(fernignorePath, "utf-8");
|
|
847692
847763
|
} catch (error50) {
|
|
847693
847764
|
context3.failAndThrow(`Failed to read fernignore file at ${fernignorePath}: ${error50}`);
|
|
847694
847765
|
}
|
|
@@ -847935,9 +848006,9 @@ function pollJobAndReportStatus({ job, taskId, taskHandler, context: context3 })
|
|
|
847935
848006
|
init_lib4();
|
|
847936
848007
|
init_lib6();
|
|
847937
848008
|
var import_fs27 = require("fs");
|
|
847938
|
-
var
|
|
848009
|
+
var import_promises86 = require("fs/promises");
|
|
847939
848010
|
var import_path57 = __toESM(require("path"), 1);
|
|
847940
|
-
var
|
|
848011
|
+
var import_promises87 = require("stream/promises");
|
|
847941
848012
|
|
|
847942
848013
|
// ../../../node_modules/.pnpm/terminal-link@3.0.0/node_modules/terminal-link/index.js
|
|
847943
848014
|
var import_supports_hyperlinks = __toESM(require_supports_hyperlinks(), 1);
|
|
@@ -848106,9 +848177,9 @@ async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutpu
|
|
|
848106
848177
|
});
|
|
848107
848178
|
const tmpDir = await import_tmp_promise9.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
848108
848179
|
const outputZipPath = import_path57.default.join(tmpDir.path, "output.zip");
|
|
848109
|
-
await (0,
|
|
848180
|
+
await (0, import_promises87.pipeline)(request7.data, (0, import_fs27.createWriteStream)(outputZipPath));
|
|
848110
848181
|
await forceRemoveDirectory(absolutePathToLocalOutput);
|
|
848111
|
-
await (0,
|
|
848182
|
+
await (0, import_promises86.mkdir)(absolutePathToLocalOutput, { recursive: true });
|
|
848112
848183
|
await extractZipToDirectory(outputZipPath, absolutePathToLocalOutput);
|
|
848113
848184
|
}
|
|
848114
848185
|
async function forceRemoveDirectory(dirPath) {
|
|
@@ -848116,22 +848187,22 @@ async function forceRemoveDirectory(dirPath) {
|
|
|
848116
848187
|
return;
|
|
848117
848188
|
}
|
|
848118
848189
|
await makeWritableRecursive(dirPath);
|
|
848119
|
-
await (0,
|
|
848190
|
+
await (0, import_promises86.rm)(dirPath, { recursive: true, force: true });
|
|
848120
848191
|
}
|
|
848121
848192
|
async function makeWritableRecursive(dirPath) {
|
|
848122
848193
|
try {
|
|
848123
|
-
const entries23 = await (0,
|
|
848194
|
+
const entries23 = await (0, import_promises86.readdir)(dirPath, { withFileTypes: true });
|
|
848124
848195
|
for (const entry of entries23) {
|
|
848125
848196
|
const fullPath = AbsoluteFilePath2.of(import_path57.default.join(dirPath, entry.name));
|
|
848126
848197
|
if (entry.isDirectory()) {
|
|
848127
848198
|
await makeWritableRecursive(fullPath);
|
|
848128
848199
|
}
|
|
848129
848200
|
try {
|
|
848130
|
-
await (0,
|
|
848201
|
+
await (0, import_promises86.chmod)(fullPath, 493);
|
|
848131
848202
|
} catch {
|
|
848132
848203
|
}
|
|
848133
848204
|
}
|
|
848134
|
-
await (0,
|
|
848205
|
+
await (0, import_promises86.chmod)(dirPath, 493);
|
|
848135
848206
|
} catch {
|
|
848136
848207
|
}
|
|
848137
848208
|
}
|
|
@@ -848177,7 +848248,7 @@ async function downloadFilesWithFernIgnoreInTempRepo({ s3PreSignedReadUrl, absol
|
|
|
848177
848248
|
const tmpOutputResolutionDir = AbsoluteFilePath2.of((await import_tmp_promise9.default.dir({})).path);
|
|
848178
848249
|
const absolutePathToFernignore = join8(absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME));
|
|
848179
848250
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
848180
|
-
await (0,
|
|
848251
|
+
await (0, import_promises86.cp)(absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
848181
848252
|
await runGitCommand(["init"], tmpOutputResolutionDir, context3);
|
|
848182
848253
|
await runGitCommand(["add", "."], tmpOutputResolutionDir, context3);
|
|
848183
848254
|
await runGitCommand([
|
|
@@ -848200,7 +848271,7 @@ async function downloadFilesWithFernIgnoreInTempRepo({ s3PreSignedReadUrl, absol
|
|
|
848200
848271
|
await runGitCommand(["restore", "."], tmpOutputResolutionDir, context3);
|
|
848201
848272
|
await forceRemoveDirectory(join8(tmpOutputResolutionDir, RelativeFilePath2.of(".git")));
|
|
848202
848273
|
await forceRemoveDirectory(absolutePathToLocalOutput);
|
|
848203
|
-
await (0,
|
|
848274
|
+
await (0, import_promises86.cp)(tmpOutputResolutionDir, absolutePathToLocalOutput, { recursive: true });
|
|
848204
848275
|
}
|
|
848205
848276
|
async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath }) {
|
|
848206
848277
|
const request7 = await axios_default.get(s3PreSignedReadUrl, {
|
|
@@ -848208,7 +848279,7 @@ async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath
|
|
|
848208
848279
|
});
|
|
848209
848280
|
const tmpDir = await import_tmp_promise9.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
848210
848281
|
const outputZipPath = import_path57.default.join(tmpDir.path, "output.zip");
|
|
848211
|
-
await (0,
|
|
848282
|
+
await (0, import_promises87.pipeline)(request7.data, (0, import_fs27.createWriteStream)(outputZipPath));
|
|
848212
848283
|
await extractZipToDirectory(outputZipPath, outputPath);
|
|
848213
848284
|
}
|
|
848214
848285
|
async function extractZipToDirectory(zipPath, outputDir) {
|
|
@@ -848223,10 +848294,10 @@ async function extractZipToDirectory(zipPath, outputDir) {
|
|
|
848223
848294
|
zipFile.on("entry", (entry) => {
|
|
848224
848295
|
const outputPath = import_path57.default.join(outputDir, entry.fileName);
|
|
848225
848296
|
if (entry.fileName.endsWith("/")) {
|
|
848226
|
-
(0,
|
|
848297
|
+
(0, import_promises86.mkdir)(outputPath, { recursive: true }).then(() => zipFile.readEntry()).catch(reject);
|
|
848227
848298
|
return;
|
|
848228
848299
|
}
|
|
848229
|
-
(0,
|
|
848300
|
+
(0, import_promises86.mkdir)(import_path57.default.dirname(outputPath), { recursive: true }).then(() => {
|
|
848230
848301
|
zipFile.openReadStream(entry, (streamErr, readStream2) => {
|
|
848231
848302
|
if (streamErr || !readStream2) {
|
|
848232
848303
|
reject(streamErr ?? new Error("Failed to open read stream"));
|
|
@@ -848243,7 +848314,7 @@ async function extractZipToDirectory(zipPath, outputDir) {
|
|
|
848243
848314
|
|
|
848244
848315
|
// ../generation/remote-generation/remote-workspace-runner/lib/SourceUploader.js
|
|
848245
848316
|
init_lib6();
|
|
848246
|
-
var
|
|
848317
|
+
var import_promises88 = require("fs/promises");
|
|
848247
848318
|
var import_tmp_promise10 = __toESM(require_tmp_promise(), 1);
|
|
848248
848319
|
var PROTOBUF_ZIP_FILENAME = "proto.zip";
|
|
848249
848320
|
var SourceUploader = class {
|
|
@@ -848264,7 +848335,7 @@ var SourceUploader = class {
|
|
|
848264
848335
|
}
|
|
848265
848336
|
async uploadSource(source2, uploadURL) {
|
|
848266
848337
|
const uploadCommand = await this.getUploadCommand(source2);
|
|
848267
|
-
const fileData = await (0,
|
|
848338
|
+
const fileData = await (0, import_promises88.readFile)(uploadCommand.absoluteFilePath);
|
|
848268
848339
|
const response = await fetch(uploadURL, {
|
|
848269
848340
|
method: "PUT",
|
|
848270
848341
|
body: fileData,
|
|
@@ -848284,7 +848355,7 @@ var SourceUploader = class {
|
|
|
848284
848355
|
absoluteFilePath,
|
|
848285
848356
|
cleanup: async () => {
|
|
848286
848357
|
this.context.logger.debug(`Removing ${absoluteFilePath}`);
|
|
848287
|
-
await (0,
|
|
848358
|
+
await (0, import_promises88.unlink)(absoluteFilePath);
|
|
848288
848359
|
}
|
|
848289
848360
|
};
|
|
848290
848361
|
}
|
|
@@ -848735,7 +848806,7 @@ init_lib4();
|
|
|
848735
848806
|
init_js();
|
|
848736
848807
|
init_lib6();
|
|
848737
848808
|
var import_crypto10 = require("crypto");
|
|
848738
|
-
var
|
|
848809
|
+
var import_promises89 = require("fs/promises");
|
|
848739
848810
|
init_lodash();
|
|
848740
848811
|
var mime = __toESM(require_mime_types(), 1);
|
|
848741
848812
|
|
|
@@ -848814,7 +848885,7 @@ async function unlockDeploy({ fdrOrigin, token, domain: domain3, basepath }) {
|
|
|
848814
848885
|
}
|
|
848815
848886
|
}
|
|
848816
848887
|
async function calculateFileHash(absoluteFilePath) {
|
|
848817
|
-
const fileBuffer = await (0,
|
|
848888
|
+
const fileBuffer = await (0, import_promises89.readFile)(absoluteFilePath);
|
|
848818
848889
|
return (0, import_crypto10.createHash)("sha256").update(new Uint8Array(fileBuffer)).digest("hex");
|
|
848819
848890
|
}
|
|
848820
848891
|
function sanitizeRelativePathForS3(relativeFilePath) {
|
|
@@ -849166,7 +849237,7 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context3, batchSize
|
|
|
849166
849237
|
const absoluteFilePath = sanitizedToAbsoluteMap.get(key2) || resolve6(docsWorkspacePath, RelativeFilePath2.of(key2));
|
|
849167
849238
|
try {
|
|
849168
849239
|
const mimeType = mime.lookup(absoluteFilePath);
|
|
849169
|
-
await axios_default.put(uploadUrl, await (0,
|
|
849240
|
+
await axios_default.put(uploadUrl, await (0, import_promises89.readFile)(absoluteFilePath), {
|
|
849170
849241
|
headers: {
|
|
849171
849242
|
"Content-Type": mimeType === false ? "application/octet-stream" : mimeType,
|
|
849172
849243
|
// Set max cache control for S3 uploads
|
|
@@ -849794,7 +849865,7 @@ var LegacyDocsPublisher = class {
|
|
|
849794
849865
|
previewId,
|
|
849795
849866
|
disableTemplates: void 0,
|
|
849796
849867
|
skipUpload,
|
|
849797
|
-
cliVersion: "4.
|
|
849868
|
+
cliVersion: "4.72.0"
|
|
849798
849869
|
});
|
|
849799
849870
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
849800
849871
|
return { success: false };
|
|
@@ -850719,7 +850790,7 @@ function addDocsCommand(cli) {
|
|
|
850719
850790
|
// ../cli-v2/lib/commands/init/command.js
|
|
850720
850791
|
init_lib4();
|
|
850721
850792
|
init_lib6();
|
|
850722
|
-
var
|
|
850793
|
+
var import_promises90 = require("fs/promises");
|
|
850723
850794
|
var import_path59 = __toESM(require("path"), 1);
|
|
850724
850795
|
|
|
850725
850796
|
// ../cli-v2/lib/config/fern-yml/FernYmlBuilder.js
|
|
@@ -851594,7 +851665,7 @@ var InitCommand = class {
|
|
|
851594
851665
|
apiPath,
|
|
851595
851666
|
defaultGroup: result.defaultGroup
|
|
851596
851667
|
});
|
|
851597
|
-
await (0,
|
|
851668
|
+
await (0, import_promises90.writeFile)(fernYmlPath, fernYmlContent, "utf-8");
|
|
851598
851669
|
context3.stderr.info(`
|
|
851599
851670
|
${Icons.success} Created ${FERN_YML_FILENAME}`);
|
|
851600
851671
|
}
|
|
@@ -851616,9 +851687,9 @@ var InitCommand = class {
|
|
|
851616
851687
|
}
|
|
851617
851688
|
async writeSpecFile(cwd2, filename, content5) {
|
|
851618
851689
|
const specsDir = join8(cwd2, RelativeFilePath2.of(SPECS_DIR));
|
|
851619
|
-
await (0,
|
|
851690
|
+
await (0, import_promises90.mkdir)(specsDir, { recursive: true });
|
|
851620
851691
|
const filePath = join8(specsDir, RelativeFilePath2.of(filename));
|
|
851621
|
-
await (0,
|
|
851692
|
+
await (0, import_promises90.writeFile)(filePath, content5, "utf-8");
|
|
851622
851693
|
}
|
|
851623
851694
|
resolveApiPath(apiSource) {
|
|
851624
851695
|
switch (apiSource.type) {
|
|
@@ -852568,11 +852639,11 @@ function addCheckCommand4(cli) {
|
|
|
852568
852639
|
// ../cli-v2/lib/commands/sdk/generate/command.js
|
|
852569
852640
|
init_lib4();
|
|
852570
852641
|
init_lib6();
|
|
852571
|
-
var
|
|
852642
|
+
var import_promises108 = require("fs/promises");
|
|
852572
852643
|
|
|
852573
852644
|
// ../cli-v2/lib/api/resolver/ApiSpecResolver.js
|
|
852574
852645
|
init_lib6();
|
|
852575
|
-
var
|
|
852646
|
+
var import_promises91 = require("fs/promises");
|
|
852576
852647
|
var import_os11 = require("os");
|
|
852577
852648
|
var import_path60 = __toESM(require("path"), 1);
|
|
852578
852649
|
|
|
@@ -852620,9 +852691,9 @@ var ApiSpecResolver = class {
|
|
|
852620
852691
|
async resolveUrl({ reference: reference4 }) {
|
|
852621
852692
|
const { content: content5, contentType } = await this.fetchContent({ url: reference4 });
|
|
852622
852693
|
const extension4 = this.inferExtension({ url: reference4, contentType });
|
|
852623
|
-
const tempDir2 = await (0,
|
|
852694
|
+
const tempDir2 = await (0, import_promises91.mkdtemp)(import_path60.default.join((0, import_os11.tmpdir)(), "fern-"));
|
|
852624
852695
|
const absoluteFilePath = AbsoluteFilePath2.of(import_path60.default.join(tempDir2, `spec${extension4}`));
|
|
852625
|
-
await (0,
|
|
852696
|
+
await (0, import_promises91.writeFile)(absoluteFilePath, content5, "utf-8");
|
|
852626
852697
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
852627
852698
|
return {
|
|
852628
852699
|
absoluteFilePath,
|
|
@@ -852635,7 +852706,7 @@ var ApiSpecResolver = class {
|
|
|
852635
852706
|
if (!await doesPathExist(absoluteFilePath)) {
|
|
852636
852707
|
throw new Error(`API spec file does not exist: ${reference4}`);
|
|
852637
852708
|
}
|
|
852638
|
-
const content5 = await (0,
|
|
852709
|
+
const content5 = await (0, import_promises91.readFile)(absoluteFilePath, "utf-8");
|
|
852639
852710
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
852640
852711
|
return {
|
|
852641
852712
|
absoluteFilePath,
|
|
@@ -852722,7 +852793,7 @@ var AutoVersioningCache = class {
|
|
|
852722
852793
|
|
|
852723
852794
|
// ../generation/local-generation/local-workspace-runner/lib/AutoVersioningService.js
|
|
852724
852795
|
var import_fs28 = require("fs");
|
|
852725
|
-
var
|
|
852796
|
+
var import_promises92 = require("fs/promises");
|
|
852726
852797
|
var import_path61 = require("path");
|
|
852727
852798
|
var import_semver12 = __toESM(require_semver2(), 1);
|
|
852728
852799
|
var AutoVersioningException = class extends Error {
|
|
@@ -853429,7 +853500,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
853429
853500
|
* Reads the module path from a go.mod file.
|
|
853430
853501
|
*/
|
|
853431
853502
|
async readGoModulePath(goModPath) {
|
|
853432
|
-
const content5 = await (0,
|
|
853503
|
+
const content5 = await (0, import_promises92.readFile)(goModPath, "utf-8");
|
|
853433
853504
|
for (const line of content5.split("\n")) {
|
|
853434
853505
|
const trimmed2 = line.trim();
|
|
853435
853506
|
if (trimmed2.startsWith("module ")) {
|
|
@@ -853442,7 +853513,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
853442
853513
|
* Adds a version suffix to the module line in go.mod.
|
|
853443
853514
|
*/
|
|
853444
853515
|
async addSuffixToGoMod(goModPath, modulePath, suffix) {
|
|
853445
|
-
const content5 = await (0,
|
|
853516
|
+
const content5 = await (0, import_promises92.readFile)(goModPath, "utf-8");
|
|
853446
853517
|
const lines = content5.split("\n");
|
|
853447
853518
|
let changed = false;
|
|
853448
853519
|
for (let i11 = 0; i11 < lines.length; i11++) {
|
|
@@ -853454,7 +853525,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
853454
853525
|
}
|
|
853455
853526
|
}
|
|
853456
853527
|
if (changed) {
|
|
853457
|
-
await (0,
|
|
853528
|
+
await (0, import_promises92.writeFile)(goModPath, lines.join("\n"), "utf-8");
|
|
853458
853529
|
this.logger.debug(`Updated go.mod: added ${suffix} to module path`);
|
|
853459
853530
|
}
|
|
853460
853531
|
}
|
|
@@ -853463,10 +853534,10 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
853463
853534
|
*/
|
|
853464
853535
|
async walkDirectory(dir, filter8) {
|
|
853465
853536
|
const results = [];
|
|
853466
|
-
const entries23 = await (0,
|
|
853537
|
+
const entries23 = await (0, import_promises92.readdir)(dir);
|
|
853467
853538
|
for (const entry of entries23) {
|
|
853468
853539
|
const fullPath = (0, import_path61.join)(dir, entry);
|
|
853469
|
-
const entryStat = await (0,
|
|
853540
|
+
const entryStat = await (0, import_promises92.stat)(fullPath);
|
|
853470
853541
|
if (entryStat.isDirectory()) {
|
|
853471
853542
|
if (entry === ".git" || entry === "vendor") {
|
|
853472
853543
|
continue;
|
|
@@ -853493,7 +853564,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
853493
853564
|
* Replaces occurrences of the module path with modulePath + suffix in import statements.
|
|
853494
853565
|
*/
|
|
853495
853566
|
async addSuffixToGoFile(filePath, modulePath, suffix) {
|
|
853496
|
-
const content5 = await (0,
|
|
853567
|
+
const content5 = await (0, import_promises92.readFile)(filePath, "utf-8");
|
|
853497
853568
|
const lines = content5.split("\n");
|
|
853498
853569
|
let changed = false;
|
|
853499
853570
|
let inImportBlock = false;
|
|
@@ -853522,7 +853593,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
853522
853593
|
}
|
|
853523
853594
|
}
|
|
853524
853595
|
if (changed) {
|
|
853525
|
-
await (0,
|
|
853596
|
+
await (0, import_promises92.writeFile)(filePath, lines.join("\n"), "utf-8");
|
|
853526
853597
|
this.logger.debug(`Updated Go imports in ${filePath}`);
|
|
853527
853598
|
}
|
|
853528
853599
|
}
|
|
@@ -853575,7 +853646,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
853575
853646
|
};
|
|
853576
853647
|
|
|
853577
853648
|
// ../generation/local-generation/docker-utils/lib/runDocker.js
|
|
853578
|
-
var
|
|
853649
|
+
var import_promises93 = require("fs/promises");
|
|
853579
853650
|
var import_tmp_promise11 = __toESM(require_tmp_promise(), 1);
|
|
853580
853651
|
async function runContainer({ logger: logger4, imageName, args = [], binds = [], envVars = {}, ports = {}, writeLogsToFile = true, removeAfterCompletion = false, runner, signal }) {
|
|
853581
853652
|
const tryRun = () => tryRunContainer({
|
|
@@ -853626,7 +853697,7 @@ async function tryRunContainer({ logger: logger4, imageName, args, binds, envVar
|
|
|
853626
853697
|
const logs4 = stdout + stderr;
|
|
853627
853698
|
if (writeLogsToFile) {
|
|
853628
853699
|
const tmpFile = await import_tmp_promise11.default.file();
|
|
853629
|
-
await (0,
|
|
853700
|
+
await (0, import_promises93.writeFile)(tmpFile.path, logs4);
|
|
853630
853701
|
logger4.info(`Generator logs here: ${tmpFile.path}`);
|
|
853631
853702
|
}
|
|
853632
853703
|
if (exitCode == null) {
|
|
@@ -872145,7 +872216,7 @@ var DynamicSnippetsGenerator = class extends AbstractDynamicSnippetsGenerator {
|
|
|
872145
872216
|
|
|
872146
872217
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/csharp/DynamicSnippetsCsharpTestGenerator.js
|
|
872147
872218
|
init_lib6();
|
|
872148
|
-
var
|
|
872219
|
+
var import_promises94 = require("fs/promises");
|
|
872149
872220
|
var import_path63 = __toESM(require("path"), 1);
|
|
872150
872221
|
|
|
872151
872222
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/utils/convertEndpointSnippetRequest.js
|
|
@@ -872277,8 +872348,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
872277
872348
|
endpointId
|
|
872278
872349
|
});
|
|
872279
872350
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
872280
|
-
await (0,
|
|
872281
|
-
await (0,
|
|
872351
|
+
await (0, import_promises94.mkdir)(import_path63.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
872352
|
+
await (0, import_promises94.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
872282
872353
|
} catch (error50) {
|
|
872283
872354
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
872284
872355
|
}
|
|
@@ -872287,8 +872358,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
872287
872358
|
}
|
|
872288
872359
|
async initializeProject(outputDir) {
|
|
872289
872360
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Snippets"));
|
|
872290
|
-
await (0,
|
|
872291
|
-
await (0,
|
|
872361
|
+
await (0, import_promises94.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
872362
|
+
await (0, import_promises94.writeFile)(join8(absolutePathToOutputDir, RelativeFilePath2.of("Snippets.csproj")), PROJECT_FILE_CONTENT);
|
|
872292
872363
|
return absolutePathToOutputDir;
|
|
872293
872364
|
}
|
|
872294
872365
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -875728,7 +875799,7 @@ var DynamicSnippetsGenerator2 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
875728
875799
|
};
|
|
875729
875800
|
|
|
875730
875801
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/go/DynamicSnippetsGoTestGenerator.js
|
|
875731
|
-
var
|
|
875802
|
+
var import_promises95 = require("fs/promises");
|
|
875732
875803
|
var import_path65 = __toESM(require("path"), 1);
|
|
875733
875804
|
var DynamicSnippetsGoTestGenerator = class {
|
|
875734
875805
|
context;
|
|
@@ -875757,8 +875828,8 @@ var DynamicSnippetsGoTestGenerator = class {
|
|
|
875757
875828
|
endpointId
|
|
875758
875829
|
});
|
|
875759
875830
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
875760
|
-
await (0,
|
|
875761
|
-
await (0,
|
|
875831
|
+
await (0, import_promises95.mkdir)(import_path65.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
875832
|
+
await (0, import_promises95.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
875762
875833
|
} catch (error50) {
|
|
875763
875834
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
875764
875835
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -879135,7 +879206,7 @@ var DynamicSnippetsGenerator3 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
879135
879206
|
};
|
|
879136
879207
|
|
|
879137
879208
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/java/DynamicSnippetsJavaTestGenerator.js
|
|
879138
|
-
var
|
|
879209
|
+
var import_promises96 = require("fs/promises");
|
|
879139
879210
|
var import_path66 = __toESM(require("path"), 1);
|
|
879140
879211
|
var DynamicSnippetsJavaTestGenerator = class {
|
|
879141
879212
|
context;
|
|
@@ -879170,8 +879241,8 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
879170
879241
|
endpointId
|
|
879171
879242
|
});
|
|
879172
879243
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
879173
|
-
await (0,
|
|
879174
|
-
await (0,
|
|
879244
|
+
await (0, import_promises96.mkdir)(import_path66.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
879245
|
+
await (0, import_promises96.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
879175
879246
|
} catch (error50) {
|
|
879176
879247
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
879177
879248
|
}
|
|
@@ -879198,7 +879269,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
879198
879269
|
const reportsPath = join8(outputDir, RelativeFilePath2.of("reports"));
|
|
879199
879270
|
const buildReportsExists = await doesPathExist(buildReportsPath, "directory");
|
|
879200
879271
|
if (buildReportsExists) {
|
|
879201
|
-
await (0,
|
|
879272
|
+
await (0, import_promises96.cp)(buildReportsPath, reportsPath, { recursive: true });
|
|
879202
879273
|
this.context.logger.info("Gradle profiling report copied to reports/");
|
|
879203
879274
|
} else {
|
|
879204
879275
|
this.context.logger.info("No profiling report found in build/reports/");
|
|
@@ -879212,7 +879283,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
879212
879283
|
}
|
|
879213
879284
|
async initializeProject(outputDir) {
|
|
879214
879285
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("src/main/java/com/snippets"));
|
|
879215
|
-
await (0,
|
|
879286
|
+
await (0, import_promises96.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
879216
879287
|
return absolutePathToOutputDir;
|
|
879217
879288
|
}
|
|
879218
879289
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -882600,7 +882671,7 @@ var DynamicSnippetsGenerator4 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
882600
882671
|
};
|
|
882601
882672
|
|
|
882602
882673
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/php/DynamicSnippetsPhpTestGenerator.js
|
|
882603
|
-
var
|
|
882674
|
+
var import_promises97 = require("fs/promises");
|
|
882604
882675
|
var import_path67 = __toESM(require("path"), 1);
|
|
882605
882676
|
var DynamicSnippetsPhpTestGenerator = class {
|
|
882606
882677
|
context;
|
|
@@ -882629,8 +882700,8 @@ var DynamicSnippetsPhpTestGenerator = class {
|
|
|
882629
882700
|
endpointId
|
|
882630
882701
|
});
|
|
882631
882702
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
882632
|
-
await (0,
|
|
882633
|
-
await (0,
|
|
882703
|
+
await (0, import_promises97.mkdir)(import_path67.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
882704
|
+
await (0, import_promises97.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
882634
882705
|
} catch (error50) {
|
|
882635
882706
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
882636
882707
|
}
|
|
@@ -885831,7 +885902,7 @@ var DynamicSnippetsGenerator5 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
885831
885902
|
};
|
|
885832
885903
|
|
|
885833
885904
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/python/DynamicSnippetsPythonTestGenerator.js
|
|
885834
|
-
var
|
|
885905
|
+
var import_promises98 = require("fs/promises");
|
|
885835
885906
|
var import_path68 = __toESM(require("path"), 1);
|
|
885836
885907
|
var DynamicSnippetsPythonTestGenerator = class {
|
|
885837
885908
|
context;
|
|
@@ -885860,8 +885931,8 @@ var DynamicSnippetsPythonTestGenerator = class {
|
|
|
885860
885931
|
endpointId
|
|
885861
885932
|
});
|
|
885862
885933
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
885863
|
-
await (0,
|
|
885864
|
-
await (0,
|
|
885934
|
+
await (0, import_promises98.mkdir)(import_path68.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
885935
|
+
await (0, import_promises98.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
885865
885936
|
} catch (error50) {
|
|
885866
885937
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
885867
885938
|
}
|
|
@@ -888466,7 +888537,7 @@ var DynamicSnippetsGenerator6 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
888466
888537
|
};
|
|
888467
888538
|
|
|
888468
888539
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/ruby/DynamicSnippetsRubyTestGenerator.js
|
|
888469
|
-
var
|
|
888540
|
+
var import_promises99 = require("fs/promises");
|
|
888470
888541
|
var import_path69 = __toESM(require("path"), 1);
|
|
888471
888542
|
var DynamicSnippetsRubyTestGenerator = class {
|
|
888472
888543
|
context;
|
|
@@ -888495,8 +888566,8 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
888495
888566
|
endpointId
|
|
888496
888567
|
});
|
|
888497
888568
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
888498
|
-
await (0,
|
|
888499
|
-
await (0,
|
|
888569
|
+
await (0, import_promises99.mkdir)(import_path69.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
888570
|
+
await (0, import_promises99.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
888500
888571
|
} catch (error50) {
|
|
888501
888572
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
888502
888573
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -888512,7 +888583,7 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
888512
888583
|
};
|
|
888513
888584
|
|
|
888514
888585
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/rust/DynamicSnippetsRustTestGenerator.js
|
|
888515
|
-
var
|
|
888586
|
+
var import_promises100 = require("fs/promises");
|
|
888516
888587
|
var import_node_path24 = __toESM(require("path"), 1);
|
|
888517
888588
|
init_lib6();
|
|
888518
888589
|
|
|
@@ -893746,8 +893817,8 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
893746
893817
|
absolutePathToOutputDir,
|
|
893747
893818
|
idx
|
|
893748
893819
|
});
|
|
893749
|
-
await (0,
|
|
893750
|
-
await (0,
|
|
893820
|
+
await (0, import_promises100.mkdir)(import_node_path24.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
893821
|
+
await (0, import_promises100.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
893751
893822
|
} catch (error50) {
|
|
893752
893823
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
893753
893824
|
}
|
|
@@ -893756,7 +893827,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
893756
893827
|
}
|
|
893757
893828
|
async initializeProject(outputDir) {
|
|
893758
893829
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("dynamic-snippets"));
|
|
893759
|
-
await (0,
|
|
893830
|
+
await (0, import_promises100.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
893760
893831
|
return absolutePathToOutputDir;
|
|
893761
893832
|
}
|
|
893762
893833
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -893765,7 +893836,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
893765
893836
|
};
|
|
893766
893837
|
|
|
893767
893838
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/swift/DynamicSnippetsSwiftTestGenerator.js
|
|
893768
|
-
var
|
|
893839
|
+
var import_promises101 = require("fs/promises");
|
|
893769
893840
|
var import_node_path25 = __toESM(require("path"), 1);
|
|
893770
893841
|
init_lib6();
|
|
893771
893842
|
|
|
@@ -898260,8 +898331,8 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
898260
898331
|
absolutePathToOutputDir,
|
|
898261
898332
|
idx
|
|
898262
898333
|
});
|
|
898263
|
-
await (0,
|
|
898264
|
-
await (0,
|
|
898334
|
+
await (0, import_promises101.mkdir)(import_node_path25.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
898335
|
+
await (0, import_promises101.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
898265
898336
|
} catch (error50) {
|
|
898266
898337
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
898267
898338
|
}
|
|
@@ -898270,7 +898341,7 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
898270
898341
|
}
|
|
898271
898342
|
async initializeProject(outputDir) {
|
|
898272
898343
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Snippets"));
|
|
898273
|
-
await (0,
|
|
898344
|
+
await (0, import_promises101.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
898274
898345
|
return absolutePathToOutputDir;
|
|
898275
898346
|
}
|
|
898276
898347
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -900598,7 +900669,7 @@ var DynamicSnippetsGenerator9 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
900598
900669
|
};
|
|
900599
900670
|
|
|
900600
900671
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/typescript/DynamicSnippetsTypeScriptTestGenerator.js
|
|
900601
|
-
var
|
|
900672
|
+
var import_promises102 = require("fs/promises");
|
|
900602
900673
|
var import_path70 = __toESM(require("path"), 1);
|
|
900603
900674
|
var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
900604
900675
|
context;
|
|
@@ -900627,8 +900698,8 @@ var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
|
900627
900698
|
endpointId
|
|
900628
900699
|
});
|
|
900629
900700
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
900630
|
-
await (0,
|
|
900631
|
-
await (0,
|
|
900701
|
+
await (0, import_promises102.mkdir)(import_path70.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
900702
|
+
await (0, import_promises102.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
900632
900703
|
} catch (error50) {
|
|
900633
900704
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
900634
900705
|
}
|
|
@@ -900727,7 +900798,7 @@ async function generateDynamicSnippetTests({ context: context3, ir: ir15, config
|
|
|
900727
900798
|
// ../generation/local-generation/local-workspace-runner/lib/runGenerator.js
|
|
900728
900799
|
init_lib6();
|
|
900729
900800
|
var import_serialization = __toESM(require_serialization2(), 1);
|
|
900730
|
-
var
|
|
900801
|
+
var import_promises104 = require("fs/promises");
|
|
900731
900802
|
var path70 = __toESM(require("path"), 1);
|
|
900732
900803
|
var import_path72 = require("path");
|
|
900733
900804
|
var import_tmp_promise13 = __toESM(require_tmp_promise(), 1);
|
|
@@ -901594,7 +901665,7 @@ function configureBamlClient(config5) {
|
|
|
901594
901665
|
init_lib4();
|
|
901595
901666
|
init_lib6();
|
|
901596
901667
|
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
901597
|
-
var
|
|
901668
|
+
var import_promises103 = require("fs/promises");
|
|
901598
901669
|
var import_os12 = require("os");
|
|
901599
901670
|
var import_path71 = require("path");
|
|
901600
901671
|
var import_semver13 = __toESM(require_semver2(), 1);
|
|
@@ -901774,7 +901845,7 @@ var LocalTaskHandler = class {
|
|
|
901774
901845
|
try {
|
|
901775
901846
|
this.context.logger.info("Analyzing SDK changes for automatic semantic versioning");
|
|
901776
901847
|
diffFile = await this.generateDiffFile();
|
|
901777
|
-
const diffContent = await (0,
|
|
901848
|
+
const diffContent = await (0, import_promises103.readFile)(diffFile, "utf-8");
|
|
901778
901849
|
if (diffContent.trim().length === 0) {
|
|
901779
901850
|
this.context.logger.info("No changes detected in generated SDK");
|
|
901780
901851
|
return null;
|
|
@@ -901972,7 +902043,7 @@ var LocalTaskHandler = class {
|
|
|
901972
902043
|
} finally {
|
|
901973
902044
|
if (diffFile) {
|
|
901974
902045
|
try {
|
|
901975
|
-
await (0,
|
|
902046
|
+
await (0, import_promises103.rm)(diffFile);
|
|
901976
902047
|
} catch (cleanupError) {
|
|
901977
902048
|
this.context.logger.warn(`Failed to delete temp diff file: ${diffFile}`, String(cleanupError));
|
|
901978
902049
|
}
|
|
@@ -902134,7 +902205,7 @@ var LocalTaskHandler = class {
|
|
|
902134
902205
|
const absolutePathToFernignore = AbsoluteFilePath2.of(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
|
|
902135
902206
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
902136
902207
|
const pathsToPreserve = await this.getPathsToPreserve(fernIgnorePaths);
|
|
902137
|
-
await (0,
|
|
902208
|
+
await (0, import_promises103.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
902138
902209
|
await this.runThrowawayGitCommand(["init"], tmpOutputResolutionDir);
|
|
902139
902210
|
await this.runThrowawayGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
902140
902211
|
await this.runThrowawayGitCommand([
|
|
@@ -902154,17 +902225,17 @@ var LocalTaskHandler = class {
|
|
|
902154
902225
|
await this.runThrowawayGitCommand(["reset", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
902155
902226
|
await this.runThrowawayGitCommand(["clean", "-fd", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
902156
902227
|
await this.runThrowawayGitCommand(["restore", "."], tmpOutputResolutionDir);
|
|
902157
|
-
await (0,
|
|
902158
|
-
await (0,
|
|
902159
|
-
await (0,
|
|
902228
|
+
await (0, import_promises103.rm)(join8(tmpOutputResolutionDir, RelativeFilePath2.of(".git")), { recursive: true });
|
|
902229
|
+
await (0, import_promises103.rm)(this.absolutePathToLocalOutput, { recursive: true });
|
|
902230
|
+
await (0, import_promises103.cp)(tmpOutputResolutionDir, this.absolutePathToLocalOutput, { recursive: true });
|
|
902160
902231
|
}
|
|
902161
902232
|
async copyGeneratedFilesNoFernIgnorePreservingGit() {
|
|
902162
|
-
const contents = await (0,
|
|
902233
|
+
const contents = await (0, import_promises103.readdir)(this.absolutePathToLocalOutput);
|
|
902163
902234
|
const itemsToPreserve = [".git"];
|
|
902164
902235
|
if (await this.generatedOutputMissingReadme()) {
|
|
902165
902236
|
itemsToPreserve.push("README.md");
|
|
902166
902237
|
}
|
|
902167
|
-
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0,
|
|
902238
|
+
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0, import_promises103.rm)(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(item)), {
|
|
902168
902239
|
force: true,
|
|
902169
902240
|
recursive: true
|
|
902170
902241
|
})));
|
|
@@ -902172,11 +902243,11 @@ var LocalTaskHandler = class {
|
|
|
902172
902243
|
}
|
|
902173
902244
|
async copyGeneratedFilesNoFernIgnoreDeleteAll() {
|
|
902174
902245
|
this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
|
|
902175
|
-
await (0,
|
|
902246
|
+
await (0, import_promises103.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
|
|
902176
902247
|
await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
|
|
902177
902248
|
}
|
|
902178
902249
|
async copyGeneratedFilesToDirectory(outputPath) {
|
|
902179
|
-
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0,
|
|
902250
|
+
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises103.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
902180
902251
|
if (firstLocalOutputItem == null) {
|
|
902181
902252
|
return;
|
|
902182
902253
|
}
|
|
@@ -902184,15 +902255,15 @@ var LocalTaskHandler = class {
|
|
|
902184
902255
|
if (firstLocalOutputItem.endsWith(".zip")) {
|
|
902185
902256
|
await (0, import_decompress2.default)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(firstLocalOutputItem)), outputPath);
|
|
902186
902257
|
for (const localOutputItem of remaininglocalOutputItems) {
|
|
902187
|
-
await (0,
|
|
902258
|
+
await (0, import_promises103.cp)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(localOutputItem)), join8(outputPath, RelativeFilePath2.of(localOutputItem)), { recursive: true });
|
|
902188
902259
|
}
|
|
902189
902260
|
} else {
|
|
902190
|
-
await (0,
|
|
902261
|
+
await (0, import_promises103.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true });
|
|
902191
902262
|
}
|
|
902192
902263
|
}
|
|
902193
902264
|
async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
|
|
902194
902265
|
this.context.logger.debug(`Copying generated snippets to ${absolutePathToLocalSnippetJSON}`);
|
|
902195
|
-
await (0,
|
|
902266
|
+
await (0, import_promises103.cp)(absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON);
|
|
902196
902267
|
}
|
|
902197
902268
|
/**
|
|
902198
902269
|
* Checks whether the generated output is missing README.md.
|
|
@@ -902201,7 +902272,7 @@ var LocalTaskHandler = class {
|
|
|
902201
902272
|
*/
|
|
902202
902273
|
async generatedOutputMissingReadme() {
|
|
902203
902274
|
try {
|
|
902204
|
-
const contents = await (0,
|
|
902275
|
+
const contents = await (0, import_promises103.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
902205
902276
|
if (contents.length === 1 && contents[0] != null && contents[0].endsWith(".zip")) {
|
|
902206
902277
|
return false;
|
|
902207
902278
|
}
|
|
@@ -902244,13 +902315,13 @@ var LocalTaskHandler = class {
|
|
|
902244
902315
|
async readPriorChangelog(maxEntries) {
|
|
902245
902316
|
const MAX_CHANGELOG_SIZE = 2048;
|
|
902246
902317
|
try {
|
|
902247
|
-
const files = await (0,
|
|
902318
|
+
const files = await (0, import_promises103.readdir)(this.absolutePathToLocalOutput);
|
|
902248
902319
|
const changelogFile = files.find((f10) => f10.toLowerCase() === "changelog.md");
|
|
902249
902320
|
if (!changelogFile) {
|
|
902250
902321
|
return "";
|
|
902251
902322
|
}
|
|
902252
902323
|
const changelogPath = join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(changelogFile));
|
|
902253
|
-
const content5 = await (0,
|
|
902324
|
+
const content5 = await (0, import_promises103.readFile)(changelogPath, "utf-8");
|
|
902254
902325
|
if (content5.trim().length === 0) {
|
|
902255
902326
|
return "";
|
|
902256
902327
|
}
|
|
@@ -902360,24 +902431,24 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
902360
902431
|
context3.logger.debug("Wrote IR to: " + absolutePathToIr);
|
|
902361
902432
|
const configJsonFile = (0, import_path72.join)(workspaceTempDir.path, GENERATOR_CONFIG_FILENAME);
|
|
902362
902433
|
const absolutePathToWriteConfigJson = AbsoluteFilePath2.of(configJsonFile);
|
|
902363
|
-
await (0,
|
|
902434
|
+
await (0, import_promises104.writeFile)(configJsonFile, "");
|
|
902364
902435
|
context3.logger.debug("Will write config.json to: " + absolutePathToWriteConfigJson);
|
|
902365
902436
|
const tmpOutputDirectory = (0, import_path72.join)(workspaceTempDir.path, CODEGEN_OUTPUT_DIRECTORY_NAME);
|
|
902366
902437
|
const absolutePathToTmpOutputDirectory = AbsoluteFilePath2.of(tmpOutputDirectory);
|
|
902367
|
-
await (0,
|
|
902438
|
+
await (0, import_promises104.mkdir)(tmpOutputDirectory, { recursive: true });
|
|
902368
902439
|
context3.logger.debug("Will write output to: " + absolutePathToTmpOutputDirectory);
|
|
902369
902440
|
let absolutePathToTmpSnippetJSON = void 0;
|
|
902370
902441
|
if (absolutePathToLocalSnippetJSON != null) {
|
|
902371
902442
|
const snippetJsonFile = (0, import_path72.join)(workspaceTempDir.path, "snippet.json");
|
|
902372
902443
|
absolutePathToTmpSnippetJSON = AbsoluteFilePath2.of(snippetJsonFile);
|
|
902373
|
-
await (0,
|
|
902444
|
+
await (0, import_promises104.writeFile)(snippetJsonFile, "");
|
|
902374
902445
|
context3.logger.debug("Will write snippet.json to: " + absolutePathToTmpSnippetJSON);
|
|
902375
902446
|
}
|
|
902376
902447
|
let absolutePathToTmpSnippetTemplatesJSON = void 0;
|
|
902377
902448
|
if (absolutePathToLocalSnippetTemplateJSON != null) {
|
|
902378
902449
|
const snippetTemplatesJsonFile = (0, import_path72.join)(workspaceTempDir.path, SNIPPET_TEMPLATES_JSON_FILENAME);
|
|
902379
902450
|
absolutePathToTmpSnippetTemplatesJSON = AbsoluteFilePath2.of(snippetTemplatesJsonFile);
|
|
902380
|
-
await (0,
|
|
902451
|
+
await (0, import_promises104.writeFile)(snippetTemplatesJsonFile, "");
|
|
902381
902452
|
context3.logger.debug("Will write snippet-templates.json to: " + absolutePathToTmpSnippetTemplatesJSON);
|
|
902382
902453
|
}
|
|
902383
902454
|
const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
|
|
@@ -902416,7 +902487,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
902416
902487
|
publishToRegistry,
|
|
902417
902488
|
paths
|
|
902418
902489
|
});
|
|
902419
|
-
await (0,
|
|
902490
|
+
await (0, import_promises104.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(await import_serialization.GeneratorConfig.jsonOrThrow(config5), void 0, 4));
|
|
902420
902491
|
const absolutePathToLicenseFile = extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig);
|
|
902421
902492
|
const sourceMounts = workspace.getSources().filter((source2) => source2.type === "protobuf").map((source2) => ({
|
|
902422
902493
|
hostPath: source2.absoluteFilePath,
|
|
@@ -903040,13 +903111,13 @@ var GenerationRunner = class {
|
|
|
903040
903111
|
};
|
|
903041
903112
|
|
|
903042
903113
|
// ../cli-v2/lib/sdk/generator/LegacyLocalGenerationRunner.js
|
|
903043
|
-
var
|
|
903114
|
+
var import_promises106 = require("fs/promises");
|
|
903044
903115
|
|
|
903045
903116
|
// ../cli-v2/lib/sdk/adapter/LegacyGeneratorInvocationAdapter.js
|
|
903046
903117
|
init_lib4();
|
|
903047
903118
|
init_lib6();
|
|
903048
903119
|
init_lib7();
|
|
903049
|
-
var
|
|
903120
|
+
var import_promises105 = require("fs/promises");
|
|
903050
903121
|
var LegacyGeneratorInvocationAdapter = class {
|
|
903051
903122
|
context;
|
|
903052
903123
|
constructor(config5) {
|
|
@@ -903286,7 +903357,7 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
903286
903357
|
if (!await doesPathExist(absolutePath, "file")) {
|
|
903287
903358
|
throw new Error(`Custom license file "${absolutePath}" does not exist; did you mean to use either MIT or Apache-2.0?`);
|
|
903288
903359
|
}
|
|
903289
|
-
const contents = await (0,
|
|
903360
|
+
const contents = await (0, import_promises105.readFile)(absolutePath, "utf-8");
|
|
903290
903361
|
return api_exports5.GithubLicense.custom({ contents });
|
|
903291
903362
|
}
|
|
903292
903363
|
buildReadme(target) {
|
|
@@ -903510,7 +903581,7 @@ var LegacyLocalGenerationRunner = class {
|
|
|
903510
903581
|
});
|
|
903511
903582
|
if (args.target.output.path != null && generatorInvocation.absolutePathToLocalOutput != null) {
|
|
903512
903583
|
const snippetPath = join8(generatorInvocation.absolutePathToLocalOutput, RelativeFilePath2.of(SNIPPET_JSON_FILENAME));
|
|
903513
|
-
await (0,
|
|
903584
|
+
await (0, import_promises106.rm)(snippetPath, { force: true });
|
|
903514
903585
|
}
|
|
903515
903586
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
903516
903587
|
return {
|
|
@@ -903527,7 +903598,7 @@ var LegacyLocalGenerationRunner = class {
|
|
|
903527
903598
|
// ../cli-v2/lib/sdk/generator/LegacyRemoteGenerationRunner.js
|
|
903528
903599
|
init_lib4();
|
|
903529
903600
|
init_lib6();
|
|
903530
|
-
var
|
|
903601
|
+
var import_promises107 = require("fs/promises");
|
|
903531
903602
|
var import_os14 = require("os");
|
|
903532
903603
|
var LegacyRemoteGenerationRunner = class {
|
|
903533
903604
|
context;
|
|
@@ -903582,13 +903653,13 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
903582
903653
|
const previewOutputDirectory = join8(absolutePathToPreview, RelativeFilePath2.of(generatorName));
|
|
903583
903654
|
const targetOutputDirectory = generatorInvocation.absolutePathToLocalOutput;
|
|
903584
903655
|
if (targetOutputDirectory != null) {
|
|
903585
|
-
await (0,
|
|
903586
|
-
await (0,
|
|
903656
|
+
await (0, import_promises107.cp)(previewOutputDirectory, targetOutputDirectory, { recursive: true });
|
|
903657
|
+
await (0, import_promises107.rm)(join8(targetOutputDirectory, RelativeFilePath2.of(".git")), {
|
|
903587
903658
|
recursive: true,
|
|
903588
903659
|
force: true
|
|
903589
903660
|
});
|
|
903590
903661
|
}
|
|
903591
|
-
await (0,
|
|
903662
|
+
await (0, import_promises107.rm)(absolutePathToPreview, { recursive: true, force: true });
|
|
903592
903663
|
}
|
|
903593
903664
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
903594
903665
|
return {
|
|
@@ -903617,7 +903688,7 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
903617
903688
|
}
|
|
903618
903689
|
async getAbsolutePathToPreview(args) {
|
|
903619
903690
|
if (this.isLocalGitCombo(args)) {
|
|
903620
|
-
const tmpPreviewDirectory = await (0,
|
|
903691
|
+
const tmpPreviewDirectory = await (0, import_promises107.mkdtemp)(join8(AbsoluteFilePath2.of((0, import_os14.tmpdir)()), RelativeFilePath2.of("fern-preview-")));
|
|
903621
903692
|
return AbsoluteFilePath2.of(tmpPreviewDirectory);
|
|
903622
903693
|
}
|
|
903623
903694
|
if (!args.preview) {
|
|
@@ -904279,7 +904350,7 @@ Example:
|
|
|
904279
904350
|
if (!exists2) {
|
|
904280
904351
|
return { shouldProceed: true };
|
|
904281
904352
|
}
|
|
904282
|
-
const files = await (0,
|
|
904353
|
+
const files = await (0, import_promises108.readdir)(outputPath);
|
|
904283
904354
|
if (files.length === 0) {
|
|
904284
904355
|
return { shouldProceed: true };
|
|
904285
904356
|
}
|
|
@@ -904505,7 +904576,7 @@ init_lib4();
|
|
|
904505
904576
|
// ../cli-v2/lib/sdk/updater/GeneratorMigrator.js
|
|
904506
904577
|
init_lib4();
|
|
904507
904578
|
var import_fs29 = require("fs");
|
|
904508
|
-
var
|
|
904579
|
+
var import_promises109 = require("fs/promises");
|
|
904509
904580
|
var import_path75 = require("path");
|
|
904510
904581
|
var import_semver14 = __toESM(require_semver2(), 1);
|
|
904511
904582
|
var import_url8 = require("url");
|
|
@@ -904615,7 +904686,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
904615
904686
|
}
|
|
904616
904687
|
this.migrationsInstallPromise = (async () => {
|
|
904617
904688
|
const cacheDir = this.cachePath;
|
|
904618
|
-
await (0,
|
|
904689
|
+
await (0, import_promises109.mkdir)(cacheDir, { recursive: true });
|
|
904619
904690
|
const npmCacheDir = (0, import_path75.join)(cacheDir, ".npm-cache");
|
|
904620
904691
|
const packageDir = (0, import_path75.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME);
|
|
904621
904692
|
const packageJsonPath = (0, import_path75.join)(packageDir, "package.json");
|
|
@@ -904632,7 +904703,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
904632
904703
|
"--no-audit",
|
|
904633
904704
|
"--no-fund"
|
|
904634
904705
|
], { doNotPipeOutput: true });
|
|
904635
|
-
const packageJsonContent = await (0,
|
|
904706
|
+
const packageJsonContent = await (0, import_promises109.readFile)(packageJsonPath, "utf-8");
|
|
904636
904707
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
904637
904708
|
if (packageJson2.main == null) {
|
|
904638
904709
|
throw new Error(`No main field found in package.json for ${MIGRATION_PACKAGE_NAME}`);
|
|
@@ -904674,7 +904745,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
904674
904745
|
const myPid = String(process.pid);
|
|
904675
904746
|
while (true) {
|
|
904676
904747
|
try {
|
|
904677
|
-
const fh = await (0,
|
|
904748
|
+
const fh = await (0, import_promises109.open)(lockPath, "wx");
|
|
904678
904749
|
await fh.writeFile(myPid);
|
|
904679
904750
|
await fh.close();
|
|
904680
904751
|
const exitHandler = () => {
|
|
@@ -904691,9 +904762,9 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
904691
904762
|
return async () => {
|
|
904692
904763
|
process.removeListener("exit", exitHandler);
|
|
904693
904764
|
try {
|
|
904694
|
-
const currentContent = await (0,
|
|
904765
|
+
const currentContent = await (0, import_promises109.readFile)(lockPath, "utf-8");
|
|
904695
904766
|
if (currentContent.trim() === myPid) {
|
|
904696
|
-
await (0,
|
|
904767
|
+
await (0, import_promises109.unlink)(lockPath);
|
|
904697
904768
|
} else {
|
|
904698
904769
|
logger4.debug(`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`);
|
|
904699
904770
|
}
|
|
@@ -904707,14 +904778,14 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
904707
904778
|
throw err;
|
|
904708
904779
|
}
|
|
904709
904780
|
try {
|
|
904710
|
-
const lockContent = await (0,
|
|
904781
|
+
const lockContent = await (0, import_promises109.readFile)(lockPath, "utf-8");
|
|
904711
904782
|
const lockPid = Number(lockContent.trim());
|
|
904712
|
-
const lockStat = await (0,
|
|
904783
|
+
const lockStat = await (0, import_promises109.stat)(lockPath);
|
|
904713
904784
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
904714
904785
|
if (lockAge > _GeneratorMigrator.LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !_GeneratorMigrator.isProcessAlive(lockPid)) {
|
|
904715
904786
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
904716
904787
|
try {
|
|
904717
|
-
await (0,
|
|
904788
|
+
await (0, import_promises109.unlink)(lockPath);
|
|
904718
904789
|
} catch (unlinkErr) {
|
|
904719
904790
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
904720
904791
|
}
|
|
@@ -905189,13 +905260,13 @@ var import_generator_cli2 = __toESM(require_api4(), 1);
|
|
|
905189
905260
|
|
|
905190
905261
|
// ../init/lib/initializeAPI.js
|
|
905191
905262
|
init_lib6();
|
|
905192
|
-
var
|
|
905263
|
+
var import_promises113 = require("fs/promises");
|
|
905193
905264
|
var import_fs_extra = __toESM(require_lib19(), 1);
|
|
905194
905265
|
var import_path76 = __toESM(require("path"), 1);
|
|
905195
905266
|
|
|
905196
905267
|
// ../init/lib/createFernDirectoryAndOrganization.js
|
|
905197
905268
|
init_lib6();
|
|
905198
|
-
var
|
|
905269
|
+
var import_promises110 = require("fs/promises");
|
|
905199
905270
|
init_lodash();
|
|
905200
905271
|
var GITIGNORE_CONTENT = "**/.preview\n**/.definition\n";
|
|
905201
905272
|
async function createFernDirectoryAndWorkspace({ organization, taskContext, versionOfCli }) {
|
|
@@ -905225,7 +905296,7 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
|
|
|
905225
905296
|
}
|
|
905226
905297
|
}
|
|
905227
905298
|
}
|
|
905228
|
-
await (0,
|
|
905299
|
+
await (0, import_promises110.mkdir)(FERN_DIRECTORY);
|
|
905229
905300
|
await writeProjectConfig({
|
|
905230
905301
|
filepath: join8(pathToFernDirectory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)),
|
|
905231
905302
|
organization,
|
|
@@ -905249,11 +905320,11 @@ async function writeProjectConfig({ organization, filepath, versionOfCli }) {
|
|
|
905249
905320
|
organization,
|
|
905250
905321
|
version: versionOfCli
|
|
905251
905322
|
};
|
|
905252
|
-
await (0,
|
|
905323
|
+
await (0, import_promises110.writeFile)(filepath, JSON.stringify(projectConfig, void 0, 4));
|
|
905253
905324
|
}
|
|
905254
905325
|
async function writeGitignore({ absolutePathToFernDirectory }) {
|
|
905255
905326
|
const gitignorePath = join8(absolutePathToFernDirectory, RelativeFilePath2.of(".gitignore"));
|
|
905256
|
-
await (0,
|
|
905327
|
+
await (0, import_promises110.writeFile)(gitignorePath, GITIGNORE_CONTENT);
|
|
905257
905328
|
}
|
|
905258
905329
|
|
|
905259
905330
|
// ../fern-definition/formatter/lib/FernDefinitionFileFormatter.js
|
|
@@ -905442,7 +905513,7 @@ async function formatDefinitionFile({ fileContents }) {
|
|
|
905442
905513
|
|
|
905443
905514
|
// ../fern-definition/formatter/lib/formatWorkspace.js
|
|
905444
905515
|
init_lib4();
|
|
905445
|
-
var
|
|
905516
|
+
var import_promises111 = require("fs/promises");
|
|
905446
905517
|
async function formatFernWorkspace({ workspace, context: context3, shouldFix }) {
|
|
905447
905518
|
for (const [relativeFilepath, file4] of entries(workspace.definition.namedDefinitionFiles)) {
|
|
905448
905519
|
const formatted = await formatDefinitionFile({
|
|
@@ -905450,7 +905521,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
905450
905521
|
});
|
|
905451
905522
|
if (formatted !== file4.rawContents) {
|
|
905452
905523
|
if (shouldFix) {
|
|
905453
|
-
await (0,
|
|
905524
|
+
await (0, import_promises111.writeFile)(file4.absoluteFilePath, formatted);
|
|
905454
905525
|
context3.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
|
|
905455
905526
|
} else {
|
|
905456
905527
|
context3.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
|
|
@@ -905462,7 +905533,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
905462
905533
|
|
|
905463
905534
|
// ../init/lib/createWorkspace.js
|
|
905464
905535
|
init_lib6();
|
|
905465
|
-
var
|
|
905536
|
+
var import_promises112 = require("fs/promises");
|
|
905466
905537
|
|
|
905467
905538
|
// ../init/lib/sampleImdbApi.js
|
|
905468
905539
|
var SAMPLE_IMDB_API = `
|
|
@@ -905662,7 +905733,7 @@ components:
|
|
|
905662
905733
|
// ../init/lib/createWorkspace.js
|
|
905663
905734
|
async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context: context3, apiName = "api" }) {
|
|
905664
905735
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
905665
|
-
await (0,
|
|
905736
|
+
await (0, import_promises112.mkdir)(directoryOfWorkspace);
|
|
905666
905737
|
}
|
|
905667
905738
|
await writeGeneratorsConfiguration({
|
|
905668
905739
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -905677,7 +905748,7 @@ async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context:
|
|
|
905677
905748
|
}
|
|
905678
905749
|
async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, cliVersion, context: context3 }) {
|
|
905679
905750
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
905680
|
-
await (0,
|
|
905751
|
+
await (0, import_promises112.mkdir)(directoryOfWorkspace);
|
|
905681
905752
|
}
|
|
905682
905753
|
await writeGeneratorsConfiguration({
|
|
905683
905754
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -905690,10 +905761,10 @@ async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, c
|
|
|
905690
905761
|
}
|
|
905691
905762
|
async function createDefaultOpenAPIWorkspace({ directoryOfWorkspace, cliVersion, context: context3 }) {
|
|
905692
905763
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
905693
|
-
await (0,
|
|
905764
|
+
await (0, import_promises112.mkdir)(directoryOfWorkspace, { recursive: true });
|
|
905694
905765
|
}
|
|
905695
905766
|
const openApiFilePath = join8(directoryOfWorkspace, RelativeFilePath2.of("openapi.yml"));
|
|
905696
|
-
await (0,
|
|
905767
|
+
await (0, import_promises112.writeFile)(openApiFilePath, SAMPLE_OPENAPI);
|
|
905697
905768
|
await writeGeneratorsConfiguration({
|
|
905698
905769
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
905699
905770
|
cliVersion,
|
|
@@ -905738,7 +905809,7 @@ async function getDefaultGeneratorsConfiguration({ cliVersion, context: context3
|
|
|
905738
905809
|
return config5;
|
|
905739
905810
|
}
|
|
905740
905811
|
async function writeGeneratorsConfiguration({ filepath, cliVersion, context: context3, apiConfiguration }) {
|
|
905741
|
-
await (0,
|
|
905812
|
+
await (0, import_promises112.writeFile)(filepath, "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(await getDefaultGeneratorsConfiguration({ cliVersion, context: context3, apiConfiguration }), {
|
|
905742
905813
|
sortKeys: (a10, b19) => {
|
|
905743
905814
|
if (a10 === "api") {
|
|
905744
905815
|
return -1;
|
|
@@ -905757,10 +905828,10 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
905757
905828
|
strategy: "status-code"
|
|
905758
905829
|
}
|
|
905759
905830
|
};
|
|
905760
|
-
await (0,
|
|
905761
|
-
await (0,
|
|
905831
|
+
await (0, import_promises112.mkdir)(directoryOfDefinition);
|
|
905832
|
+
await (0, import_promises112.writeFile)(join8(directoryOfDefinition, RelativeFilePath2.of(ROOT_API_FILENAME)), jsYaml.dump(rootApi));
|
|
905762
905833
|
const absoluteFilepathToImdbYaml = join8(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
|
|
905763
|
-
await (0,
|
|
905834
|
+
await (0, import_promises112.writeFile)(absoluteFilepathToImdbYaml, await formatDefinitionFile({
|
|
905764
905835
|
fileContents: SAMPLE_IMDB_API
|
|
905765
905836
|
}));
|
|
905766
905837
|
}
|
|
@@ -905813,7 +905884,7 @@ async function getDirectoryOfNewAPIWorkspace({ absolutePathToFernDirectory, task
|
|
|
905813
905884
|
if (inlinedApiDefinition || inlinedOpenApiWorkspace) {
|
|
905814
905885
|
taskContext.logger.info("Creating workspaces to support multiple API Definitions.");
|
|
905815
905886
|
const apiWorkspaceDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api"));
|
|
905816
|
-
await (0,
|
|
905887
|
+
await (0, import_promises113.mkdir)(apiWorkspaceDirectory, { recursive: true });
|
|
905817
905888
|
if (inlinedApiDefinition) {
|
|
905818
905889
|
const inlinedDefinitionDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
905819
905890
|
const workspaceDefinitionDirectory = join8(apiWorkspaceDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
@@ -905850,7 +905921,7 @@ async function hasInlinedOpenAPIWorkspace({ absolutePathToFernDirectory }) {
|
|
|
905850
905921
|
// ../init/lib/initializeDocs.js
|
|
905851
905922
|
init_lib4();
|
|
905852
905923
|
init_lib6();
|
|
905853
|
-
var
|
|
905924
|
+
var import_promises114 = require("fs/promises");
|
|
905854
905925
|
async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
905855
905926
|
const createDirectoryResponse = await createFernDirectoryAndWorkspace({
|
|
905856
905927
|
organization,
|
|
@@ -905865,7 +905936,7 @@ async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
|
905865
905936
|
} else {
|
|
905866
905937
|
try {
|
|
905867
905938
|
const docsConfig = getDocsConfig(createDirectoryResponse.organization);
|
|
905868
|
-
await (0,
|
|
905939
|
+
await (0, import_promises114.writeFile)(docsYmlPath, jsYaml.dump(docsConfig));
|
|
905869
905940
|
taskContext.logger.info(source_default.green("Created docs configuration"));
|
|
905870
905941
|
return;
|
|
905871
905942
|
} catch (writeError) {
|
|
@@ -905920,7 +905991,7 @@ var FernDocsBuilder = class {
|
|
|
905920
905991
|
|
|
905921
905992
|
// ../docs-importers/commons/lib/FernDocsBuilderImpl.js
|
|
905922
905993
|
init_lib6();
|
|
905923
|
-
var
|
|
905994
|
+
var import_promises115 = require("fs/promises");
|
|
905924
905995
|
var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
905925
905996
|
openApiSpecs = {};
|
|
905926
905997
|
nonTabbedNavigation = new NonTabbedNavigationBuilderImpl();
|
|
@@ -905979,7 +906050,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
905979
906050
|
}
|
|
905980
906051
|
async build({ outputDirectory }) {
|
|
905981
906052
|
const absolutePathToFernDirectory = join8(outputDirectory, RelativeFilePath2.of(FERN_DIRECTORY));
|
|
905982
|
-
await (0,
|
|
906053
|
+
await (0, import_promises115.mkdir)(absolutePathToFernDirectory, { recursive: true });
|
|
905983
906054
|
if (Object.keys(this.tabbedNavigation).length > 0) {
|
|
905984
906055
|
this.docsYml.tabs = Object.fromEntries(Object.entries(this.tabbedNavigation).map(([key2, value]) => {
|
|
905985
906056
|
return [value.tabId, value.tabConfig];
|
|
@@ -906004,27 +906075,27 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
906004
906075
|
}))
|
|
906005
906076
|
};
|
|
906006
906077
|
}
|
|
906007
|
-
await (0,
|
|
906078
|
+
await (0, import_promises115.writeFile)(join8(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)), jsYaml.dump(generators_yml_exports.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml)));
|
|
906008
906079
|
await Promise.all(Object.entries(this.openApiSpecs).map(async ([relativePath, absolutePath]) => {
|
|
906009
906080
|
const absolutePathToOpenAPI = join8(absolutePathToFernDirectory, RelativeFilePath2.of(relativePath));
|
|
906010
|
-
await (0,
|
|
906011
|
-
await (0,
|
|
906081
|
+
await (0, import_promises115.mkdir)(dirname6(absolutePathToOpenAPI), { recursive: true });
|
|
906082
|
+
await (0, import_promises115.cp)(absolutePath, absolutePathToOpenAPI);
|
|
906012
906083
|
}));
|
|
906013
906084
|
}
|
|
906014
|
-
await (0,
|
|
906085
|
+
await (0, import_promises115.writeFile)(join8(absolutePathToFernDirectory, RelativeFilePath2.of(DOCS_CONFIGURATION_FILENAME)), jsYaml.dump(docs_yml_exports.RawSchemas.Serializer.DocsConfiguration.jsonOrThrow(this.docsYml, { omitUndefined: true })));
|
|
906015
906086
|
await Promise.all(Object.entries(this.markdownPages).map(async ([filepath, page]) => {
|
|
906016
906087
|
const absoluteFilepathToMarkdownPage = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
906017
|
-
await (0,
|
|
906088
|
+
await (0, import_promises115.mkdir)(dirname6(absoluteFilepathToMarkdownPage), { recursive: true });
|
|
906018
906089
|
const frontmatter = Object.keys(page.frontmatter).length > 0 ? `---
|
|
906019
906090
|
${jsYaml.dump(JSON.parse(JSON.stringify(page.frontmatter)))}---
|
|
906020
906091
|
|
|
906021
906092
|
` : "";
|
|
906022
|
-
await (0,
|
|
906093
|
+
await (0, import_promises115.writeFile)(absoluteFilepathToMarkdownPage, `${frontmatter}${page.markdown}`);
|
|
906023
906094
|
}));
|
|
906024
906095
|
await Promise.all(Object.entries(this.assets).map(async ([filepath, asset]) => {
|
|
906025
906096
|
const absolutePathToAsset = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
906026
|
-
await (0,
|
|
906027
|
-
await (0,
|
|
906097
|
+
await (0, import_promises115.mkdir)(dirname6(absolutePathToAsset), { recursive: true });
|
|
906098
|
+
await (0, import_promises115.cp)(asset.absoluteFilePathToAsset, absolutePathToAsset);
|
|
906028
906099
|
}));
|
|
906029
906100
|
}
|
|
906030
906101
|
setInstance({ companyName }) {
|
|
@@ -906057,7 +906128,7 @@ var NonTabbedNavigationBuilderImpl = class {
|
|
|
906057
906128
|
|
|
906058
906129
|
// ../docs-importers/mintlify/lib/MintlifyImporter.js
|
|
906059
906130
|
init_lib6();
|
|
906060
|
-
var
|
|
906131
|
+
var import_promises117 = require("fs/promises");
|
|
906061
906132
|
|
|
906062
906133
|
// ../docs-importers/mintlify/lib/convertColors.js
|
|
906063
906134
|
function convertColors(colors19) {
|
|
@@ -906118,10 +906189,10 @@ init_lib6();
|
|
|
906118
906189
|
|
|
906119
906190
|
// ../docs-importers/mintlify/lib/convertMarkdown.js
|
|
906120
906191
|
init_lib6();
|
|
906121
|
-
var
|
|
906192
|
+
var import_promises116 = require("fs/promises");
|
|
906122
906193
|
var import_gray_matter9 = __toESM(require_gray_matter(), 1);
|
|
906123
906194
|
async function convertMarkdown({ absolutePathToMintJson, absoluteFilepathToMarkdown, relativeFilepathFromRoot, builder }) {
|
|
906124
|
-
const text9 = await (0,
|
|
906195
|
+
const text9 = await (0, import_promises116.readFile)(absoluteFilepathToMarkdown, "utf-8");
|
|
906125
906196
|
const { data: data2, content: content5 } = parseMintlifyFrontmatter(text9);
|
|
906126
906197
|
const slug = relativeFilepathFromRoot.replace(/\.(md|mdx)$/, "");
|
|
906127
906198
|
const transformedContent = markReferencedAssets({
|
|
@@ -906284,7 +906355,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
906284
906355
|
documentationTab = void 0;
|
|
906285
906356
|
tabUrlToInfo = {};
|
|
906286
906357
|
async import({ args, builder }) {
|
|
906287
|
-
const mintJsonContent = await (0,
|
|
906358
|
+
const mintJsonContent = await (0, import_promises117.readFile)(args.absolutePathToMintJson, "utf-8");
|
|
906288
906359
|
const mint = JSON.parse(mintJsonContent);
|
|
906289
906360
|
builder.setTitle({ title: mint.name });
|
|
906290
906361
|
const relativePathToFavicon = RelativeFilePath2.of(mint.favicon.substring(1));
|
|
@@ -906410,7 +906481,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
906410
906481
|
|
|
906411
906482
|
// ../docs-importers/mintlify/lib/runMintlifyMigration.js
|
|
906412
906483
|
init_lib6();
|
|
906413
|
-
var
|
|
906484
|
+
var import_promises118 = require("fs/promises");
|
|
906414
906485
|
async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskContext, versionOfCli, organization }) {
|
|
906415
906486
|
const mintlifyImporter = new MintlifyImporter({
|
|
906416
906487
|
context: taskContext
|
|
@@ -906421,7 +906492,7 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
|
|
|
906421
906492
|
builder
|
|
906422
906493
|
});
|
|
906423
906494
|
await builder.build({ outputDirectory: outputPath });
|
|
906424
|
-
await (0,
|
|
906495
|
+
await (0, import_promises118.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
906425
906496
|
version: versionOfCli,
|
|
906426
906497
|
organization
|
|
906427
906498
|
}, void 0, 4));
|
|
@@ -906475,7 +906546,7 @@ function assertIsStringArray(val) {
|
|
|
906475
906546
|
// ../docs-importers/readme/lib/ReadmeImporter.js
|
|
906476
906547
|
init_lib4();
|
|
906477
906548
|
init_lib6();
|
|
906478
|
-
var
|
|
906549
|
+
var import_promises123 = require("fs/promises");
|
|
906479
906550
|
|
|
906480
906551
|
// ../docs-importers/readme/lib/extract/favicon.js
|
|
906481
906552
|
async function getFavicon(hast) {
|
|
@@ -917893,7 +917964,7 @@ init_disposable();
|
|
|
917893
917964
|
init_incremental_id_generator();
|
|
917894
917965
|
|
|
917895
917966
|
// ../../../node_modules/.pnpm/puppeteer-core@24.40.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js
|
|
917896
|
-
var
|
|
917967
|
+
var import_promises121 = require("fs/promises");
|
|
917897
917968
|
var import_node_os11 = __toESM(require("os"), 1);
|
|
917898
917969
|
var import_node_path35 = __toESM(require("path"), 1);
|
|
917899
917970
|
init_main();
|
|
@@ -918337,7 +918408,7 @@ var ChromeLauncher = class extends BrowserLauncher {
|
|
|
918337
918408
|
});
|
|
918338
918409
|
if (userDataDirIndex < 0) {
|
|
918339
918410
|
isTempUserDataDir = true;
|
|
918340
|
-
chromeArguments.push(`--user-data-dir=${await (0,
|
|
918411
|
+
chromeArguments.push(`--user-data-dir=${await (0, import_promises121.mkdtemp)(this.getProfilePath())}`);
|
|
918341
918412
|
userDataDirIndex = chromeArguments.length - 1;
|
|
918342
918413
|
}
|
|
918343
918414
|
const userDataDir = chromeArguments[userDataDirIndex].split("=", 2)[1];
|
|
@@ -918494,7 +918565,7 @@ function removeMatchingFlags(array3, flag) {
|
|
|
918494
918565
|
|
|
918495
918566
|
// ../../../node_modules/.pnpm/puppeteer-core@24.40.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/FirefoxLauncher.js
|
|
918496
918567
|
var import_node_fs28 = __toESM(require("fs"), 1);
|
|
918497
|
-
var
|
|
918568
|
+
var import_promises122 = require("fs/promises");
|
|
918498
918569
|
var import_node_os12 = __toESM(require("os"), 1);
|
|
918499
918570
|
var import_node_path36 = __toESM(require("path"), 1);
|
|
918500
918571
|
init_main();
|
|
@@ -918548,7 +918619,7 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
918548
918619
|
}
|
|
918549
918620
|
isTempUserDataDir = false;
|
|
918550
918621
|
} else {
|
|
918551
|
-
userDataDir = await (0,
|
|
918622
|
+
userDataDir = await (0, import_promises122.mkdtemp)(this.getProfilePath());
|
|
918552
918623
|
firefoxArguments.push("--profile");
|
|
918553
918624
|
firefoxArguments.push(userDataDir);
|
|
918554
918625
|
}
|
|
@@ -918589,8 +918660,8 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
918589
918660
|
const prefsBackupPath = import_node_path36.default.join(userDataDir, file4 + backupSuffix);
|
|
918590
918661
|
if (import_node_fs28.default.existsSync(prefsBackupPath)) {
|
|
918591
918662
|
const prefsPath = import_node_path36.default.join(userDataDir, file4);
|
|
918592
|
-
await (0,
|
|
918593
|
-
await (0,
|
|
918663
|
+
await (0, import_promises122.unlink)(prefsPath);
|
|
918664
|
+
await (0, import_promises122.rename)(prefsBackupPath, prefsPath);
|
|
918594
918665
|
}
|
|
918595
918666
|
}));
|
|
918596
918667
|
for (const result of results) {
|
|
@@ -919623,7 +919694,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
919623
919694
|
if (response.ok) {
|
|
919624
919695
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
919625
919696
|
const faviconPath = join8(assetsDirectory, RelativeFilePath2.of("favicon"));
|
|
919626
|
-
await (0,
|
|
919697
|
+
await (0, import_promises123.writeFile)(faviconPath, new Uint8Array(imageBuffer));
|
|
919627
919698
|
builder.setFavicon({ favicon: relativize(this.absolutePathToFernDirectory, faviconPath) });
|
|
919628
919699
|
}
|
|
919629
919700
|
}
|
|
@@ -919640,7 +919711,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
919640
919711
|
*/
|
|
919641
919712
|
async getAndCreateAssetsDirectory() {
|
|
919642
919713
|
const assetsDirectory = join8(this.absolutePathToFernDirectory, RelativeFilePath2.of("assets"));
|
|
919643
|
-
await (0,
|
|
919714
|
+
await (0, import_promises123.mkdir)(assetsDirectory, { recursive: true });
|
|
919644
919715
|
return assetsDirectory;
|
|
919645
919716
|
}
|
|
919646
919717
|
/**
|
|
@@ -919690,7 +919761,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
919690
919761
|
absolutePathToOutputDirectory,
|
|
919691
919762
|
section
|
|
919692
919763
|
});
|
|
919693
|
-
await (0,
|
|
919764
|
+
await (0, import_promises123.mkdir)(absolutePathToOutputDirectoryForSection, { recursive: true });
|
|
919694
919765
|
await Promise.all(section.pages.filter((page) => page.type === "page").map(async (page) => {
|
|
919695
919766
|
const url3 = new URL(page.slug.toString(), this.url);
|
|
919696
919767
|
this.logger.debug(`Fetching page: ${url3.toString()}`);
|
|
@@ -919705,7 +919776,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
919705
919776
|
absolutePathToOutputDirectoryForSection,
|
|
919706
919777
|
page: page.slug
|
|
919707
919778
|
});
|
|
919708
|
-
await (0,
|
|
919779
|
+
await (0, import_promises123.writeFile)(absolutePathForPage, result.data.mdx);
|
|
919709
919780
|
if (result.data.images.imageURLs.length > 0) {
|
|
919710
919781
|
this.logger.debug(`Found ${result.data.images.imageURLs.length} images to download for ${url3.toString()}`);
|
|
919711
919782
|
await Promise.all(Object.entries(result.data.images.imageURLToFilename).map(async ([imageUrl, filename]) => {
|
|
@@ -919718,8 +919789,8 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
919718
919789
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
919719
919790
|
const imagePath = join8(absolutePathToOutputDirectoryForSection, RelativeFilePath2.of(filename));
|
|
919720
919791
|
const imageDir = dirname6(imagePath);
|
|
919721
|
-
await (0,
|
|
919722
|
-
await (0,
|
|
919792
|
+
await (0, import_promises123.mkdir)(imageDir, { recursive: true });
|
|
919793
|
+
await (0, import_promises123.writeFile)(imagePath, new Uint8Array(imageBuffer));
|
|
919723
919794
|
this.logger.debug(`Saved image to ${imagePath}`);
|
|
919724
919795
|
} catch (error50) {
|
|
919725
919796
|
this.logger.warn(`Error downloading image ${imageUrl}: ${error50}`);
|
|
@@ -919802,7 +919873,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
919802
919873
|
|
|
919803
919874
|
// ../docs-importers/readme/lib/runReadmeMigration.js
|
|
919804
919875
|
init_lib6();
|
|
919805
|
-
var
|
|
919876
|
+
var import_promises124 = require("fs/promises");
|
|
919806
919877
|
async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionOfCli, organization }) {
|
|
919807
919878
|
const builder = new FernDocsBuilderImpl();
|
|
919808
919879
|
builder.setInstance({ companyName: organization });
|
|
@@ -919817,7 +919888,7 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
|
|
|
919817
919888
|
builder
|
|
919818
919889
|
});
|
|
919819
919890
|
await builder.build({ outputDirectory: outputPath });
|
|
919820
|
-
await (0,
|
|
919891
|
+
await (0, import_promises124.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
919821
919892
|
version: versionOfCli,
|
|
919822
919893
|
organization
|
|
919823
919894
|
}, void 0, 4));
|
|
@@ -919840,7 +919911,7 @@ var initializeWithReadme = async ({ readmeUrl, organization, taskContext, versio
|
|
|
919840
919911
|
};
|
|
919841
919912
|
|
|
919842
919913
|
// ../init/lib/utils/loadOpenApiFromUrl.js
|
|
919843
|
-
var
|
|
919914
|
+
var import_promises125 = require("fs/promises");
|
|
919844
919915
|
var import_path77 = require("path");
|
|
919845
919916
|
var import_tmp_promise15 = __toESM(require_tmp_promise(), 1);
|
|
919846
919917
|
var LoadOpenAPIStatus;
|
|
@@ -919855,7 +919926,7 @@ async function loadOpenAPIFromUrl({ url: url3, logger: logger4 }) {
|
|
|
919855
919926
|
const filePath = (0, import_path77.join)(tmpDir.path, url3.endsWith(".json") ? "openapi.json" : "openapi.yaml");
|
|
919856
919927
|
logger4.debug("tmpDir", tmpDir.path);
|
|
919857
919928
|
logger4.debug("filePath", filePath);
|
|
919858
|
-
await (0,
|
|
919929
|
+
await (0, import_promises125.writeFile)(filePath, data2);
|
|
919859
919930
|
return {
|
|
919860
919931
|
status: LoadOpenAPIStatus.Success,
|
|
919861
919932
|
filePath
|
|
@@ -924147,7 +924218,7 @@ var CliContext = class _CliContext {
|
|
|
924147
924218
|
if (false) {
|
|
924148
924219
|
this.logger.error("CLI_VERSION is not defined");
|
|
924149
924220
|
}
|
|
924150
|
-
return "4.
|
|
924221
|
+
return "4.72.0";
|
|
924151
924222
|
}
|
|
924152
924223
|
getCliName() {
|
|
924153
924224
|
if (false) {
|
|
@@ -924445,7 +924516,7 @@ function wrapWorkspaceNameForPrefix(workspaceName) {
|
|
|
924445
924516
|
|
|
924446
924517
|
// ../project-loader/lib/loadProject.js
|
|
924447
924518
|
init_lib6();
|
|
924448
|
-
var
|
|
924519
|
+
var import_promises126 = require("fs/promises");
|
|
924449
924520
|
async function loadProject({ context: context3, nameOverride, ...args }) {
|
|
924450
924521
|
const fernDirectory = await getFernDirectory(nameOverride);
|
|
924451
924522
|
if (fernDirectory == null) {
|
|
@@ -924508,7 +924579,7 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
924508
924579
|
const apisDirectory = join8(fernDirectory, RelativeFilePath2.of(APIS_DIRECTORY));
|
|
924509
924580
|
const apisDirectoryExists = await doesPathExist(apisDirectory);
|
|
924510
924581
|
if (apisDirectoryExists) {
|
|
924511
|
-
const apiDirectoryContents = await (0,
|
|
924582
|
+
const apiDirectoryContents = await (0, import_promises126.readdir)(apisDirectory, { withFileTypes: true });
|
|
924512
924583
|
const apiWorkspaceDirectoryNames = apiDirectoryContents.reduce((all9, item) => {
|
|
924513
924584
|
if (item.isDirectory()) {
|
|
924514
924585
|
all9.push(item.name);
|
|
@@ -924585,11 +924656,11 @@ async function loadProjectAndRegisterWorkspacesWithContext(cliContext, args, reg
|
|
|
924585
924656
|
|
|
924586
924657
|
// src/cliV2.ts
|
|
924587
924658
|
var import_generators_sdk5 = __toESM(require_generators_sdk(), 1);
|
|
924588
|
-
var
|
|
924659
|
+
var import_promises131 = require("fs/promises");
|
|
924589
924660
|
|
|
924590
924661
|
// src/commands/generator-list/getGeneratorList.ts
|
|
924591
924662
|
init_lib4();
|
|
924592
|
-
var
|
|
924663
|
+
var import_promises127 = require("fs/promises");
|
|
924593
924664
|
var GenerationModeFilter = {
|
|
924594
924665
|
GitHub: "github",
|
|
924595
924666
|
Local: "local-file-system",
|
|
@@ -924649,7 +924720,7 @@ async function getGeneratorList({
|
|
|
924649
924720
|
return;
|
|
924650
924721
|
}
|
|
924651
924722
|
try {
|
|
924652
|
-
await (0,
|
|
924723
|
+
await (0, import_promises127.writeFile)(outputLocation, generatorsListYaml);
|
|
924653
924724
|
} catch (error50) {
|
|
924654
924725
|
cliContext.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
924655
924726
|
code: CliError.Code.ConfigError
|
|
@@ -924717,7 +924788,7 @@ async function getGeneratorMetadata({
|
|
|
924717
924788
|
}
|
|
924718
924789
|
|
|
924719
924790
|
// src/commands/organization/getOrganization.ts
|
|
924720
|
-
var
|
|
924791
|
+
var import_promises128 = require("fs/promises");
|
|
924721
924792
|
async function getOrganization({
|
|
924722
924793
|
project,
|
|
924723
924794
|
outputLocation,
|
|
@@ -924729,7 +924800,7 @@ async function getOrganization({
|
|
|
924729
924800
|
return;
|
|
924730
924801
|
}
|
|
924731
924802
|
try {
|
|
924732
|
-
await (0,
|
|
924803
|
+
await (0, import_promises128.writeFile)(outputLocation, org);
|
|
924733
924804
|
} catch (error50) {
|
|
924734
924805
|
context3.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
924735
924806
|
code: CliError.Code.ConfigError
|
|
@@ -924739,7 +924810,7 @@ async function getOrganization({
|
|
|
924739
924810
|
|
|
924740
924811
|
// src/commands/upgrade/upgradeGenerator.ts
|
|
924741
924812
|
init_lib6();
|
|
924742
|
-
var
|
|
924813
|
+
var import_promises130 = require("fs/promises");
|
|
924743
924814
|
var import_path79 = __toESM(require("path"), 1);
|
|
924744
924815
|
var import_semver17 = __toESM(require_semver2(), 1);
|
|
924745
924816
|
var import_yaml6 = __toESM(require_dist9(), 1);
|
|
@@ -924747,7 +924818,7 @@ var import_yaml6 = __toESM(require_dist9(), 1);
|
|
|
924747
924818
|
// src/commands/upgrade/migrations/loader.ts
|
|
924748
924819
|
init_lib4();
|
|
924749
924820
|
var import_fs32 = require("fs");
|
|
924750
|
-
var
|
|
924821
|
+
var import_promises129 = require("fs/promises");
|
|
924751
924822
|
var import_os15 = require("os");
|
|
924752
924823
|
var import_path78 = require("path");
|
|
924753
924824
|
var import_semver16 = __toESM(require_semver2(), 1);
|
|
@@ -924775,7 +924846,7 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
924775
924846
|
const myPid = String(process.pid);
|
|
924776
924847
|
while (true) {
|
|
924777
924848
|
try {
|
|
924778
|
-
const fh = await (0,
|
|
924849
|
+
const fh = await (0, import_promises129.open)(lockPath, "wx");
|
|
924779
924850
|
await fh.writeFile(myPid);
|
|
924780
924851
|
await fh.close();
|
|
924781
924852
|
const exitHandler = () => {
|
|
@@ -924792,9 +924863,9 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
924792
924863
|
return async () => {
|
|
924793
924864
|
process.removeListener("exit", exitHandler);
|
|
924794
924865
|
try {
|
|
924795
|
-
const currentContent = await (0,
|
|
924866
|
+
const currentContent = await (0, import_promises129.readFile)(lockPath, "utf-8");
|
|
924796
924867
|
if (currentContent.trim() === myPid) {
|
|
924797
|
-
await (0,
|
|
924868
|
+
await (0, import_promises129.unlink)(lockPath);
|
|
924798
924869
|
} else {
|
|
924799
924870
|
logger4.debug(
|
|
924800
924871
|
`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`
|
|
@@ -924810,14 +924881,14 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
924810
924881
|
throw err;
|
|
924811
924882
|
}
|
|
924812
924883
|
try {
|
|
924813
|
-
const lockContent = await (0,
|
|
924884
|
+
const lockContent = await (0, import_promises129.readFile)(lockPath, "utf-8");
|
|
924814
924885
|
const lockPid = Number(lockContent.trim());
|
|
924815
|
-
const lockStat = await (0,
|
|
924886
|
+
const lockStat = await (0, import_promises129.stat)(lockPath);
|
|
924816
924887
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
924817
924888
|
if (lockAge > LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !isProcessAlive(lockPid)) {
|
|
924818
924889
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
924819
924890
|
try {
|
|
924820
|
-
await (0,
|
|
924891
|
+
await (0, import_promises129.unlink)(lockPath);
|
|
924821
924892
|
} catch (unlinkErr) {
|
|
924822
924893
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
924823
924894
|
}
|
|
@@ -924841,7 +924912,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
924841
924912
|
}
|
|
924842
924913
|
migrationsInstallPromise = (async () => {
|
|
924843
924914
|
const cacheDir = getMigrationCacheDir();
|
|
924844
|
-
await (0,
|
|
924915
|
+
await (0, import_promises129.mkdir)(cacheDir, { recursive: true });
|
|
924845
924916
|
const npmCacheDir = (0, import_path78.join)(cacheDir, ".npm-cache");
|
|
924846
924917
|
const packageDir = (0, import_path78.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME2);
|
|
924847
924918
|
const packageJsonPath = (0, import_path78.join)(packageDir, "package.json");
|
|
@@ -924858,7 +924929,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
924858
924929
|
"--no-audit",
|
|
924859
924930
|
"--no-fund"
|
|
924860
924931
|
]);
|
|
924861
|
-
const packageJsonContent = await (0,
|
|
924932
|
+
const packageJsonContent = await (0, import_promises129.readFile)(packageJsonPath, "utf-8");
|
|
924862
924933
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
924863
924934
|
if (packageJson2.main == null) {
|
|
924864
924935
|
throw new CliError({
|
|
@@ -925044,7 +925115,7 @@ async function loadAndUpdateGenerators({
|
|
|
925044
925115
|
skippedAutoreleaseDisabled: []
|
|
925045
925116
|
};
|
|
925046
925117
|
}
|
|
925047
|
-
const contents = await (0,
|
|
925118
|
+
const contents = await (0, import_promises130.readFile)(filepath);
|
|
925048
925119
|
context3.logger.debug(`Found generators: ${contents.toString()}`);
|
|
925049
925120
|
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
925050
925121
|
const generatorGroups = parsedDocument.get("groups");
|
|
@@ -925281,7 +925352,7 @@ async function upgradeGenerator({
|
|
|
925281
925352
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
925282
925353
|
});
|
|
925283
925354
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
925284
|
-
await (0,
|
|
925355
|
+
await (0, import_promises130.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
925285
925356
|
}
|
|
925286
925357
|
allSkippedMajorUpgrades.push(...result.skippedMajorUpgrades);
|
|
925287
925358
|
if (result.appliedUpgrades.length > 0) {
|
|
@@ -925681,7 +925752,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
925681
925752
|
}
|
|
925682
925753
|
if (argv.output) {
|
|
925683
925754
|
try {
|
|
925684
|
-
await (0,
|
|
925755
|
+
await (0, import_promises131.writeFile)(argv.output, JSON.stringify(generatorMetadata, null, 2));
|
|
925685
925756
|
} catch (error50) {
|
|
925686
925757
|
cliContext.failAndThrow(
|
|
925687
925758
|
`Could not write file to the specified location: ${argv.output}`,
|
|
@@ -925696,7 +925767,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
925696
925767
|
}
|
|
925697
925768
|
|
|
925698
925769
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
925699
|
-
var
|
|
925770
|
+
var import_promises132 = require("fs/promises");
|
|
925700
925771
|
async function addGeneratorToWorkspaces({
|
|
925701
925772
|
project: { apiWorkspaces },
|
|
925702
925773
|
generatorName,
|
|
@@ -925723,7 +925794,7 @@ async function addGeneratorToWorkspaces({
|
|
|
925723
925794
|
if (absolutePathToGeneratorsConfiguration == null) {
|
|
925724
925795
|
return;
|
|
925725
925796
|
}
|
|
925726
|
-
await (0,
|
|
925797
|
+
await (0, import_promises132.writeFile)(
|
|
925727
925798
|
absolutePathToGeneratorsConfiguration,
|
|
925728
925799
|
"# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(newConfiguration)
|
|
925729
925800
|
);
|
|
@@ -926092,7 +926163,7 @@ async function previewDocsWorkspace({
|
|
|
926092
926163
|
|
|
926093
926164
|
// src/commands/docs-diff/docsDiff.ts
|
|
926094
926165
|
init_lib6();
|
|
926095
|
-
var
|
|
926166
|
+
var import_promises133 = require("fs/promises");
|
|
926096
926167
|
var import_pngjs = __toESM(require_png2(), 1);
|
|
926097
926168
|
async function getSlugForFiles({
|
|
926098
926169
|
previewUrl,
|
|
@@ -926315,8 +926386,8 @@ async function generateComparisons({
|
|
|
926315
926386
|
afterPath,
|
|
926316
926387
|
comparisonBasePath
|
|
926317
926388
|
}) {
|
|
926318
|
-
const beforePng = import_pngjs.PNG.sync.read(await (0,
|
|
926319
|
-
const afterPng = import_pngjs.PNG.sync.read(await (0,
|
|
926389
|
+
const beforePng = import_pngjs.PNG.sync.read(await (0, import_promises133.readFile)(beforePath));
|
|
926390
|
+
const afterPng = import_pngjs.PNG.sync.read(await (0, import_promises133.readFile)(afterPath));
|
|
926320
926391
|
const beforeOriginalHeight = beforePng.height;
|
|
926321
926392
|
const afterOriginalHeight = afterPng.height;
|
|
926322
926393
|
const width = Math.max(beforePng.width, afterPng.width);
|
|
@@ -926354,7 +926425,7 @@ async function generateComparisons({
|
|
|
926354
926425
|
const sideBySide = createSideBySideComparison(croppedBefore, croppedAfter, 20, true);
|
|
926355
926426
|
const outPath = `${base4}-region-${i11 + 1}.png`;
|
|
926356
926427
|
const pngBuffer = import_pngjs.PNG.sync.write(sideBySide);
|
|
926357
|
-
await (0,
|
|
926428
|
+
await (0, import_promises133.writeFile)(outPath, new Uint8Array(pngBuffer));
|
|
926358
926429
|
results.push({ changePercent, boundingBox, comparisonPath: outPath });
|
|
926359
926430
|
}
|
|
926360
926431
|
return results;
|
|
@@ -926433,7 +926504,7 @@ async function docsDiff({
|
|
|
926433
926504
|
outputDir.startsWith("/") ? outputDir : join8(cwd(), RelativeFilePath2.of(outputDir))
|
|
926434
926505
|
);
|
|
926435
926506
|
if (!await doesPathExist(outputPath)) {
|
|
926436
|
-
await (0,
|
|
926507
|
+
await (0, import_promises133.mkdir)(outputPath, { recursive: true });
|
|
926437
926508
|
}
|
|
926438
926509
|
const results = [];
|
|
926439
926510
|
await cliContext.runTask(async (context3) => {
|
|
@@ -930846,7 +930917,7 @@ function renderModuleTree(module4, ctx, writer2, parentPath) {
|
|
|
930846
930917
|
}
|
|
930847
930918
|
|
|
930848
930919
|
// src/commands/docs-md-generate/generateLibraryDocs.ts
|
|
930849
|
-
var
|
|
930920
|
+
var import_promises134 = require("fs/promises");
|
|
930850
930921
|
function createLibraryDocsClient({ token }) {
|
|
930851
930922
|
const defaultOrigin = "https://registry-dev2.buildwithfern.com";
|
|
930852
930923
|
const baseUrl = process.env.FERN_FDR_ORIGIN ?? process.env.OVERRIDE_FDR_ORIGIN ?? defaultOrigin;
|
|
@@ -930972,7 +931043,7 @@ async function generateSingleLibrary({
|
|
|
930972
931043
|
if (config5.lang === "cpp" && config5.config?.doxyfile != null) {
|
|
930973
931044
|
const doxyfilePath = resolve6(docsWorkspace.absoluteFilePath, config5.config.doxyfile);
|
|
930974
931045
|
try {
|
|
930975
|
-
doxyfileContent = await (0,
|
|
931046
|
+
doxyfileContent = await (0, import_promises134.readFile)(doxyfilePath, "utf-8");
|
|
930976
931047
|
} catch {
|
|
930977
931048
|
return interactiveTaskContext.failAndThrow(
|
|
930978
931049
|
`Library '${name2}': Could not read Doxyfile at '${config5.config.doxyfile}' (resolved to ${doxyfilePath})`,
|
|
@@ -931313,7 +931384,7 @@ Found ${previewDeployments.length} preview deployment(s):
|
|
|
931313
931384
|
}
|
|
931314
931385
|
|
|
931315
931386
|
// src/commands/downgrade/downgrade.ts
|
|
931316
|
-
var
|
|
931387
|
+
var import_promises135 = require("fs/promises");
|
|
931317
931388
|
|
|
931318
931389
|
// ../../../node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.mjs
|
|
931319
931390
|
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
@@ -932064,13 +932135,13 @@ async function downgrade({
|
|
|
932064
932135
|
const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
|
|
932065
932136
|
draft.version = targetVersion;
|
|
932066
932137
|
});
|
|
932067
|
-
await (0,
|
|
932138
|
+
await (0, import_promises135.writeFile)(projectConfig._absolutePath, ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2)));
|
|
932068
932139
|
cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
|
|
932069
932140
|
}
|
|
932070
932141
|
|
|
932071
932142
|
// src/commands/export/generateOpenAPIForWorkspaces.ts
|
|
932072
932143
|
init_lib6();
|
|
932073
|
-
var
|
|
932144
|
+
var import_promises136 = require("fs/promises");
|
|
932074
932145
|
|
|
932075
932146
|
// src/commands/export/converters/servicesConverter.ts
|
|
932076
932147
|
init_lib4();
|
|
@@ -933453,8 +933524,8 @@ async function generateOpenAPIForWorkspaces({
|
|
|
933453
933524
|
ir: ir15,
|
|
933454
933525
|
mode: "openapi"
|
|
933455
933526
|
});
|
|
933456
|
-
await (0,
|
|
933457
|
-
await (0,
|
|
933527
|
+
await (0, import_promises136.mkdir)(dirname6(outputPath), { recursive: true });
|
|
933528
|
+
await (0, import_promises136.writeFile)(
|
|
933458
933529
|
outputPath,
|
|
933459
933530
|
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent4) : jsYaml.dump(openapi, { indent: indent4 })
|
|
933460
933531
|
);
|
|
@@ -933538,11 +933609,11 @@ var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
|
|
|
933538
933609
|
|
|
933539
933610
|
// src/commands/generate/checkOutputDirectory.ts
|
|
933540
933611
|
init_lib6();
|
|
933541
|
-
var
|
|
933612
|
+
var import_promises139 = require("fs/promises");
|
|
933542
933613
|
|
|
933543
933614
|
// src/persistence/output-directories/getOutputDirectories.ts
|
|
933544
933615
|
init_lib6();
|
|
933545
|
-
var
|
|
933616
|
+
var import_promises137 = require("fs/promises");
|
|
933546
933617
|
|
|
933547
933618
|
// src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
|
|
933548
933619
|
init_lib6();
|
|
@@ -933562,17 +933633,17 @@ async function getOutputDirectories() {
|
|
|
933562
933633
|
if (!doesOutputDirectoriesFileExist) {
|
|
933563
933634
|
return [];
|
|
933564
933635
|
}
|
|
933565
|
-
const outputDirectoriesFileContents = await (0,
|
|
933636
|
+
const outputDirectoriesFileContents = await (0, import_promises137.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
|
|
933566
933637
|
const outputDirectories = JSON.parse(outputDirectoriesFileContents);
|
|
933567
933638
|
return outputDirectories;
|
|
933568
933639
|
}
|
|
933569
933640
|
|
|
933570
933641
|
// src/persistence/output-directories/storeOutputDirectories.ts
|
|
933571
|
-
var
|
|
933642
|
+
var import_promises138 = require("fs/promises");
|
|
933572
933643
|
var import_path82 = __toESM(require("path"), 1);
|
|
933573
933644
|
async function storeOutputDirectories(outputDirectories) {
|
|
933574
|
-
await (0,
|
|
933575
|
-
await (0,
|
|
933645
|
+
await (0, import_promises138.mkdir)(import_path82.default.dirname(getPathToOutputDirectoriesFile()), { recursive: true });
|
|
933646
|
+
await (0, import_promises138.writeFile)(getPathToOutputDirectoriesFile(), JSON.stringify(outputDirectories, null, 2));
|
|
933576
933647
|
}
|
|
933577
933648
|
|
|
933578
933649
|
// src/commands/generate/checkOutputDirectory.ts
|
|
@@ -933594,7 +933665,7 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
|
933594
933665
|
shouldProceed: true
|
|
933595
933666
|
};
|
|
933596
933667
|
}
|
|
933597
|
-
const files = await (0,
|
|
933668
|
+
const files = await (0, import_promises139.readdir)(outputPath);
|
|
933598
933669
|
if (files.length === 0) {
|
|
933599
933670
|
return {
|
|
933600
933671
|
shouldProceed: true
|
|
@@ -934531,7 +934602,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
934531
934602
|
|
|
934532
934603
|
// src/commands/generate-overrides/compareOpenAPISpecs.ts
|
|
934533
934604
|
init_lib6();
|
|
934534
|
-
var
|
|
934605
|
+
var import_promises140 = require("fs/promises");
|
|
934535
934606
|
async function compareOpenAPISpecs({
|
|
934536
934607
|
originalPath,
|
|
934537
934608
|
modifiedPath,
|
|
@@ -934572,12 +934643,12 @@ async function compareOpenAPISpecs({
|
|
|
934572
934643
|
}
|
|
934573
934644
|
outputPath = join8(dirname6(originalPath), RelativeFilePath2.of(overridesFilename));
|
|
934574
934645
|
}
|
|
934575
|
-
await (0,
|
|
934646
|
+
await (0, import_promises140.writeFile)(outputPath, jsYaml.dump(overrides, { lineWidth: -1, noRefs: true }));
|
|
934576
934647
|
context3.logger.info(`Overrides written to ${outputPath}`);
|
|
934577
934648
|
});
|
|
934578
934649
|
}
|
|
934579
934650
|
async function loadSpec2(filepath, context3) {
|
|
934580
|
-
const contents = await (0,
|
|
934651
|
+
const contents = await (0, import_promises140.readFile)(filepath, "utf8");
|
|
934581
934652
|
try {
|
|
934582
934653
|
return JSON.parse(contents);
|
|
934583
934654
|
} catch {
|
|
@@ -934681,7 +934752,7 @@ function deepEqual(a10, b19) {
|
|
|
934681
934752
|
|
|
934682
934753
|
// src/commands/generate-overrides/writeOverridesForWorkspaces.ts
|
|
934683
934754
|
init_lib6();
|
|
934684
|
-
var
|
|
934755
|
+
var import_promises141 = require("fs/promises");
|
|
934685
934756
|
async function writeOverridesForWorkspaces({
|
|
934686
934757
|
project,
|
|
934687
934758
|
includeModels,
|
|
@@ -934706,7 +934777,7 @@ async function writeOverridesForWorkspaces({
|
|
|
934706
934777
|
async function readExistingOverrides(overridesFilepath, context3) {
|
|
934707
934778
|
let parsedOverrides = null;
|
|
934708
934779
|
try {
|
|
934709
|
-
const contents = (await (0,
|
|
934780
|
+
const contents = (await (0, import_promises141.readFile)(overridesFilepath, "utf8")).toString();
|
|
934710
934781
|
try {
|
|
934711
934782
|
parsedOverrides = JSON.parse(contents);
|
|
934712
934783
|
} catch (err) {
|
|
@@ -934771,7 +934842,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
934771
934842
|
for (const overridesPath of overridesPaths) {
|
|
934772
934843
|
const existingOverrides = await readExistingOverrides(overridesPath, context3);
|
|
934773
934844
|
const content5 = generateOverridesContent({ ir: ir15, existingOverrides, includeModels, context: context3 });
|
|
934774
|
-
await (0,
|
|
934845
|
+
await (0, import_promises141.writeFile)(overridesPath, jsYaml.dump(content5));
|
|
934775
934846
|
}
|
|
934776
934847
|
} else {
|
|
934777
934848
|
const content5 = generateOverridesContent({ ir: ir15, existingOverrides: {}, includeModels, context: context3 });
|
|
@@ -934785,7 +934856,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
934785
934856
|
overridesFilename = `${nameWithoutExt}-overrides${extension4}`;
|
|
934786
934857
|
}
|
|
934787
934858
|
}
|
|
934788
|
-
await (0,
|
|
934859
|
+
await (0, import_promises141.writeFile)(
|
|
934789
934860
|
join8(dirname6(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
|
|
934790
934861
|
jsYaml.dump(content5)
|
|
934791
934862
|
);
|
|
@@ -935201,7 +935272,7 @@ function convertIRtoJsonSchema(args) {
|
|
|
935201
935272
|
}
|
|
935202
935273
|
|
|
935203
935274
|
// src/commands/jsonschema/generateJsonschemaForWorkspace.ts
|
|
935204
|
-
var
|
|
935275
|
+
var import_promises142 = require("fs/promises");
|
|
935205
935276
|
async function generateJsonschemaForWorkspaces({
|
|
935206
935277
|
typeLocator,
|
|
935207
935278
|
project,
|
|
@@ -935249,9 +935320,9 @@ async function generateJsonschemaForWorkspaces({
|
|
|
935249
935320
|
context: context3
|
|
935250
935321
|
});
|
|
935251
935322
|
if (!await doesPathExist(dirname6(jsonschemaFilepath))) {
|
|
935252
|
-
await (0,
|
|
935323
|
+
await (0, import_promises142.mkdir)(dirname6(jsonschemaFilepath), { recursive: true });
|
|
935253
935324
|
}
|
|
935254
|
-
await (0,
|
|
935325
|
+
await (0, import_promises142.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
|
|
935255
935326
|
context3.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
|
|
935256
935327
|
});
|
|
935257
935328
|
})
|
|
@@ -935260,7 +935331,7 @@ async function generateJsonschemaForWorkspaces({
|
|
|
935260
935331
|
|
|
935261
935332
|
// src/commands/merge/mergeOpenAPIWithOverrides.ts
|
|
935262
935333
|
init_lib6();
|
|
935263
|
-
var
|
|
935334
|
+
var import_promises143 = require("fs/promises");
|
|
935264
935335
|
var HTTP_METHODS2 = /* @__PURE__ */ new Set(["get", "put", "post", "delete", "options", "head", "patch", "trace"]);
|
|
935265
935336
|
async function mergeOpenAPIWithOverrides({
|
|
935266
935337
|
openapiPath,
|
|
@@ -935285,12 +935356,12 @@ async function mergeOpenAPIWithOverrides({
|
|
|
935285
935356
|
const merged = mergeExamplesIntoSpec(openapi, overrides, context3);
|
|
935286
935357
|
const isJson = outputPath.endsWith(".json");
|
|
935287
935358
|
const output2 = isJson ? JSON.stringify(merged, null, 2) : jsYaml.dump(merged, { lineWidth: -1, noRefs: true });
|
|
935288
|
-
await (0,
|
|
935359
|
+
await (0, import_promises143.writeFile)(outputPath, output2);
|
|
935289
935360
|
context3.logger.info(`Merged output written to ${outputPath}`);
|
|
935290
935361
|
});
|
|
935291
935362
|
}
|
|
935292
935363
|
async function loadYamlOrJson(filepath, context3) {
|
|
935293
|
-
const contents = await (0,
|
|
935364
|
+
const contents = await (0, import_promises143.readFile)(filepath, "utf8");
|
|
935294
935365
|
try {
|
|
935295
935366
|
return JSON.parse(contents);
|
|
935296
935367
|
} catch {
|
|
@@ -935924,7 +935995,7 @@ async function mockServer({
|
|
|
935924
935995
|
}
|
|
935925
935996
|
|
|
935926
935997
|
// src/commands/register/registerWorkspacesV1.ts
|
|
935927
|
-
var
|
|
935998
|
+
var import_promises144 = require("fs/promises");
|
|
935928
935999
|
var import_path88 = __toESM(require("path"), 1);
|
|
935929
936000
|
var import_tmp_promise16 = __toESM(require_tmp_promise(), 1);
|
|
935930
936001
|
async function registerWorkspacesV1({
|
|
@@ -935977,7 +936048,7 @@ async function registerWorkspacesV1({
|
|
|
935977
936048
|
context3.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
935978
936049
|
await Zn3({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
|
|
935979
936050
|
context3.logger.info("Uploading definition...");
|
|
935980
|
-
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
936051
|
+
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises144.readFile)(tarPath));
|
|
935981
936052
|
context3.logger.info(
|
|
935982
936053
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
935983
936054
|
);
|
|
@@ -936219,7 +936290,7 @@ async function generateDiff({
|
|
|
936219
936290
|
|
|
936220
936291
|
// src/commands/sdk-preview/sdkPreview.ts
|
|
936221
936292
|
init_lib6();
|
|
936222
|
-
var
|
|
936293
|
+
var import_promises145 = __toESM(require("fs/promises"), 1);
|
|
936223
936294
|
|
|
936224
936295
|
// src/commands/sdk-preview/computePreviewVersion.ts
|
|
936225
936296
|
var BASE_VERSION = "0.0.1";
|
|
@@ -936435,7 +936506,7 @@ async function sdkPreview({
|
|
|
936435
936506
|
const firstPath = pathOutputs[0];
|
|
936436
936507
|
const absolutePathToOutput = firstPath != null ? AbsoluteFilePath2.of(resolve6(cwd(), firstPath)) : void 0;
|
|
936437
936508
|
if (absolutePathToOutput != null) {
|
|
936438
|
-
await
|
|
936509
|
+
await import_promises145.default.mkdir(absolutePathToOutput, { recursive: true });
|
|
936439
936510
|
}
|
|
936440
936511
|
for (const workspace of project.apiWorkspaces) {
|
|
936441
936512
|
if (workspace.generatorsConfiguration == null) {
|
|
@@ -936643,7 +936714,7 @@ async function sdkPreview({
|
|
|
936643
936714
|
}
|
|
936644
936715
|
|
|
936645
936716
|
// src/commands/self-update/selfUpdate.ts
|
|
936646
|
-
var
|
|
936717
|
+
var import_promises146 = require("fs/promises");
|
|
936647
936718
|
var import_path89 = require("path");
|
|
936648
936719
|
async function getPackageManagerBinDir(logger4, pm) {
|
|
936649
936720
|
let command3;
|
|
@@ -936689,7 +936760,7 @@ async function detectInstallationMethod(logger4) {
|
|
|
936689
936760
|
logger4.debug(`Found fern at: ${fernPath}`);
|
|
936690
936761
|
let resolvedPath;
|
|
936691
936762
|
try {
|
|
936692
|
-
resolvedPath = await (0,
|
|
936763
|
+
resolvedPath = await (0, import_promises146.realpath)(fernPath);
|
|
936693
936764
|
logger4.debug(`Resolved to: ${resolvedPath}`);
|
|
936694
936765
|
} catch (error50) {
|
|
936695
936766
|
logger4.debug(`Failed to resolve symlink: ${error50}`);
|
|
@@ -936992,21 +937063,21 @@ async function generateToken({
|
|
|
936992
937063
|
// src/commands/upgrade/updateApiSpec.ts
|
|
936993
937064
|
init_lib6();
|
|
936994
937065
|
var fs28 = __toESM(require("fs"), 1);
|
|
936995
|
-
var
|
|
937066
|
+
var import_promises147 = require("fs/promises");
|
|
936996
937067
|
init_graphql();
|
|
936997
937068
|
var import_stream16 = require("stream");
|
|
936998
|
-
var
|
|
937069
|
+
var import_promises148 = require("stream/promises");
|
|
936999
937070
|
async function fetchAndWriteFile(url3, path97, logger4, indent4) {
|
|
937000
937071
|
const resp = await fetch(url3);
|
|
937001
937072
|
if (resp.ok && resp.body) {
|
|
937002
937073
|
logger4.debug("Origin successfully fetched, writing to file");
|
|
937003
937074
|
const fileStream = fs28.createWriteStream(path97);
|
|
937004
|
-
await (0,
|
|
937005
|
-
const fileContents = await (0,
|
|
937075
|
+
await (0, import_promises148.finished)(import_stream16.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
937076
|
+
const fileContents = await (0, import_promises147.readFile)(path97, "utf8");
|
|
937006
937077
|
try {
|
|
937007
|
-
await (0,
|
|
937078
|
+
await (0, import_promises147.writeFile)(path97, JSON.stringify(JSON.parse(fileContents), void 0, indent4), "utf8");
|
|
937008
937079
|
} catch (e6) {
|
|
937009
|
-
await (0,
|
|
937080
|
+
await (0, import_promises147.writeFile)(path97, jsYaml.dump(jsYaml.load(fileContents), { indent: indent4 }), "utf8");
|
|
937010
937081
|
}
|
|
937011
937082
|
logger4.debug("File written successfully");
|
|
937012
937083
|
}
|
|
@@ -937162,14 +937233,14 @@ async function tryDirectJSONFetch(url3, logger4) {
|
|
|
937162
937233
|
async function fetchGraphQLSchemaWithAutoDetection(url3, path97, logger4) {
|
|
937163
937234
|
const postResult = await tryGraphQLIntrospection(url3, logger4);
|
|
937164
937235
|
if (postResult.success) {
|
|
937165
|
-
await (0,
|
|
937236
|
+
await (0, import_promises147.writeFile)(path97, postResult.result, "utf8");
|
|
937166
937237
|
logger4.info("Successfully fetched GraphQL schema using POST introspection");
|
|
937167
937238
|
return;
|
|
937168
937239
|
}
|
|
937169
937240
|
logger4.debug(`POST introspection failed: ${postResult.error}`);
|
|
937170
937241
|
const getResult = await tryDirectJSONFetch(url3, logger4);
|
|
937171
937242
|
if (getResult.success) {
|
|
937172
|
-
await (0,
|
|
937243
|
+
await (0, import_promises147.writeFile)(path97, getResult.result, "utf8");
|
|
937173
937244
|
logger4.info("Successfully fetched GraphQL schema using direct JSON fetch");
|
|
937174
937245
|
return;
|
|
937175
937246
|
}
|
|
@@ -937278,7 +937349,7 @@ async function processDefinitions({
|
|
|
937278
937349
|
init_lib4();
|
|
937279
937350
|
|
|
937280
937351
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
937281
|
-
var
|
|
937352
|
+
var import_promises149 = require("fs/promises");
|
|
937282
937353
|
|
|
937283
937354
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
937284
937355
|
init_lib6();
|
|
@@ -937314,7 +937385,7 @@ var migration = {
|
|
|
937314
937385
|
try {
|
|
937315
937386
|
const fileContents = await getFileContents(yamlFilepath);
|
|
937316
937387
|
const newContents = addDiscriminantToFile(fileContents);
|
|
937317
|
-
await (0,
|
|
937388
|
+
await (0, import_promises149.writeFile)(yamlFilepath, newContents);
|
|
937318
937389
|
} catch (error50) {
|
|
937319
937390
|
context3.failAndThrow("Failed to migrate " + yamlFilepath, error50);
|
|
937320
937391
|
}
|
|
@@ -937322,7 +937393,7 @@ var migration = {
|
|
|
937322
937393
|
}
|
|
937323
937394
|
};
|
|
937324
937395
|
async function getFileContents(filepath) {
|
|
937325
|
-
const buffer = await (0,
|
|
937396
|
+
const buffer = await (0, import_promises149.readFile)(filepath);
|
|
937326
937397
|
return buffer.toString();
|
|
937327
937398
|
}
|
|
937328
937399
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -937351,7 +937422,7 @@ var versionMigrations = {
|
|
|
937351
937422
|
var __default = versionMigrations;
|
|
937352
937423
|
|
|
937353
937424
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
937354
|
-
var
|
|
937425
|
+
var import_promises150 = require("fs/promises");
|
|
937355
937426
|
var import_yaml7 = __toESM(require_dist9(), 1);
|
|
937356
937427
|
|
|
937357
937428
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
@@ -937394,7 +937465,7 @@ var migration2 = {
|
|
|
937394
937465
|
}
|
|
937395
937466
|
};
|
|
937396
937467
|
async function migrateFile(filepath, context3) {
|
|
937397
|
-
const contents = await (0,
|
|
937468
|
+
const contents = await (0, import_promises150.readFile)(filepath);
|
|
937398
937469
|
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
937399
937470
|
const types4 = parsedDocument.get("types");
|
|
937400
937471
|
if (types4 == null) {
|
|
@@ -937426,7 +937497,7 @@ async function migrateFile(filepath, context3) {
|
|
|
937426
937497
|
}
|
|
937427
937498
|
}
|
|
937428
937499
|
}
|
|
937429
|
-
await (0,
|
|
937500
|
+
await (0, import_promises150.writeFile)(filepath, parsedDocument.toString());
|
|
937430
937501
|
}
|
|
937431
937502
|
|
|
937432
937503
|
// ../cli-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -937437,7 +937508,7 @@ var versionMigrations2 = {
|
|
|
937437
937508
|
var __default2 = versionMigrations2;
|
|
937438
937509
|
|
|
937439
937510
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
937440
|
-
var
|
|
937511
|
+
var import_promises151 = require("fs/promises");
|
|
937441
937512
|
var import_yaml8 = __toESM(require_dist9(), 1);
|
|
937442
937513
|
|
|
937443
937514
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
@@ -937480,7 +937551,7 @@ var migration3 = {
|
|
|
937480
937551
|
}
|
|
937481
937552
|
};
|
|
937482
937553
|
async function migrateGeneratorsYml(filepath, context3) {
|
|
937483
|
-
const contents = await (0,
|
|
937554
|
+
const contents = await (0, import_promises151.readFile)(filepath);
|
|
937484
937555
|
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
937485
937556
|
const draftGenerators = parsedDocument.get("draft");
|
|
937486
937557
|
if (draftGenerators == null) {
|
|
@@ -937507,7 +937578,7 @@ async function migrateGeneratorsYml(filepath, context3) {
|
|
|
937507
937578
|
draftGenerator.set("output-path", name2.value.includes("openapi") ? "./generated-openapi" : name2.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
937508
937579
|
}
|
|
937509
937580
|
});
|
|
937510
|
-
await (0,
|
|
937581
|
+
await (0, import_promises151.writeFile)(filepath, parsedDocument.toString());
|
|
937511
937582
|
}
|
|
937512
937583
|
|
|
937513
937584
|
// ../cli-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -937518,7 +937589,7 @@ var versionMigrations3 = {
|
|
|
937518
937589
|
var __default3 = versionMigrations3;
|
|
937519
937590
|
|
|
937520
937591
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
937521
|
-
var
|
|
937592
|
+
var import_promises152 = require("fs/promises");
|
|
937522
937593
|
var import_yaml9 = __toESM(require_dist9(), 1);
|
|
937523
937594
|
|
|
937524
937595
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
@@ -937561,7 +937632,7 @@ var migration4 = {
|
|
|
937561
937632
|
}
|
|
937562
937633
|
};
|
|
937563
937634
|
async function migrateFile2(filepath, context3) {
|
|
937564
|
-
const contents = await (0,
|
|
937635
|
+
const contents = await (0, import_promises152.readFile)(filepath);
|
|
937565
937636
|
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
937566
937637
|
const addType = (typeName, typeDeclaration2) => {
|
|
937567
937638
|
const types4 = parsedDocument.get("types");
|
|
@@ -937605,7 +937676,7 @@ async function migrateFile2(filepath, context3) {
|
|
|
937605
937676
|
}
|
|
937606
937677
|
}
|
|
937607
937678
|
}
|
|
937608
|
-
await (0,
|
|
937679
|
+
await (0, import_promises152.writeFile)(filepath, parsedDocument.toString());
|
|
937609
937680
|
}
|
|
937610
937681
|
|
|
937611
937682
|
// ../cli-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -937616,7 +937687,7 @@ var versionMigrations4 = {
|
|
|
937616
937687
|
var __default4 = versionMigrations4;
|
|
937617
937688
|
|
|
937618
937689
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
937619
|
-
var
|
|
937690
|
+
var import_promises153 = require("fs/promises");
|
|
937620
937691
|
var import_yaml10 = __toESM(require_dist9(), 1);
|
|
937621
937692
|
|
|
937622
937693
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
@@ -937659,7 +937730,7 @@ var migration5 = {
|
|
|
937659
937730
|
}
|
|
937660
937731
|
};
|
|
937661
937732
|
async function migrateGeneratorsYml2(filepath, context3) {
|
|
937662
|
-
const contents = await (0,
|
|
937733
|
+
const contents = await (0, import_promises153.readFile)(filepath);
|
|
937663
937734
|
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
937664
937735
|
const releaseGenerators = parsedDocument.get("release");
|
|
937665
937736
|
if (releaseGenerators == null) {
|
|
@@ -937697,7 +937768,7 @@ async function migrateGeneratorsYml2(filepath, context3) {
|
|
|
937697
937768
|
}
|
|
937698
937769
|
releaseGenerator.delete("outputs");
|
|
937699
937770
|
});
|
|
937700
|
-
await (0,
|
|
937771
|
+
await (0, import_promises153.writeFile)(filepath, parsedDocument.toString());
|
|
937701
937772
|
}
|
|
937702
937773
|
|
|
937703
937774
|
// ../cli-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -937708,7 +937779,7 @@ var versionMigrations5 = {
|
|
|
937708
937779
|
var __default5 = versionMigrations5;
|
|
937709
937780
|
|
|
937710
937781
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
937711
|
-
var
|
|
937782
|
+
var import_promises154 = require("fs/promises");
|
|
937712
937783
|
|
|
937713
937784
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
937714
937785
|
init_lib6();
|
|
@@ -937741,9 +937812,9 @@ var migration6 = {
|
|
|
937741
937812
|
run: async ({ context: context3 }) => {
|
|
937742
937813
|
const yamlFiles = await getAllYamlFiles4(context3);
|
|
937743
937814
|
for (const filepath of yamlFiles) {
|
|
937744
|
-
const contents = await (0,
|
|
937815
|
+
const contents = await (0, import_promises154.readFile)(filepath);
|
|
937745
937816
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
937746
|
-
await (0,
|
|
937817
|
+
await (0, import_promises154.writeFile)(filepath, newContents);
|
|
937747
937818
|
}
|
|
937748
937819
|
}
|
|
937749
937820
|
};
|
|
@@ -937756,7 +937827,7 @@ var versionMigrations6 = {
|
|
|
937756
937827
|
var __default6 = versionMigrations6;
|
|
937757
937828
|
|
|
937758
937829
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
937759
|
-
var
|
|
937830
|
+
var import_promises155 = require("fs/promises");
|
|
937760
937831
|
|
|
937761
937832
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
937762
937833
|
init_lib6();
|
|
@@ -937789,9 +937860,9 @@ var migration7 = {
|
|
|
937789
937860
|
run: async ({ context: context3 }) => {
|
|
937790
937861
|
const yamlFiles = await getAllRootApiYamlFiles(context3);
|
|
937791
937862
|
for (const filepath of yamlFiles) {
|
|
937792
|
-
const contents = await (0,
|
|
937863
|
+
const contents = await (0, import_promises155.readFile)(filepath);
|
|
937793
937864
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
937794
|
-
await (0,
|
|
937865
|
+
await (0, import_promises155.writeFile)(filepath, newContents);
|
|
937795
937866
|
}
|
|
937796
937867
|
}
|
|
937797
937868
|
};
|
|
@@ -937805,7 +937876,7 @@ var __default7 = versionMigrations7;
|
|
|
937805
937876
|
|
|
937806
937877
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
937807
937878
|
init_lib4();
|
|
937808
|
-
var
|
|
937879
|
+
var import_promises156 = require("fs/promises");
|
|
937809
937880
|
|
|
937810
937881
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
937811
937882
|
init_lib6();
|
|
@@ -937914,7 +937985,7 @@ var migration8 = {
|
|
|
937914
937985
|
}
|
|
937915
937986
|
};
|
|
937916
937987
|
async function migrateGeneratorsYml3(filepath) {
|
|
937917
|
-
const contentsStr = await (0,
|
|
937988
|
+
const contentsStr = await (0, import_promises156.readFile)(filepath);
|
|
937918
937989
|
const contents = jsYaml.load(contentsStr.toString());
|
|
937919
937990
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
937920
937991
|
let newGeneratorsConfiguration = {};
|
|
@@ -937932,7 +938003,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
937932
938003
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
937933
938004
|
};
|
|
937934
938005
|
}
|
|
937935
|
-
await (0,
|
|
938006
|
+
await (0, import_promises156.writeFile)(filepath, jsYaml.dump(newGeneratorsConfiguration));
|
|
937936
938007
|
}
|
|
937937
938008
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
937938
938009
|
const newSchema = {
|
|
@@ -938007,7 +938078,7 @@ var versionMigrations8 = {
|
|
|
938007
938078
|
var __default8 = versionMigrations8;
|
|
938008
938079
|
|
|
938009
938080
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
938010
|
-
var
|
|
938081
|
+
var import_promises157 = require("fs/promises");
|
|
938011
938082
|
var import_yaml11 = __toESM(require_dist9(), 1);
|
|
938012
938083
|
|
|
938013
938084
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
@@ -938050,7 +938121,7 @@ var migration9 = {
|
|
|
938050
938121
|
}
|
|
938051
938122
|
};
|
|
938052
938123
|
async function migrateRootApiFile(filepath) {
|
|
938053
|
-
const contents = await (0,
|
|
938124
|
+
const contents = await (0, import_promises157.readFile)(filepath);
|
|
938054
938125
|
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
938055
938126
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
938056
938127
|
if (errorDiscriminant == null || !import_yaml11.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
@@ -938061,7 +938132,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
938061
938132
|
"property-name": errorDiscriminant.value
|
|
938062
938133
|
});
|
|
938063
938134
|
parsedDocument.delete("error-discriminant");
|
|
938064
|
-
await (0,
|
|
938135
|
+
await (0, import_promises157.writeFile)(filepath, parsedDocument.toString());
|
|
938065
938136
|
}
|
|
938066
938137
|
|
|
938067
938138
|
// ../cli-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -938072,7 +938143,7 @@ var versionMigrations9 = {
|
|
|
938072
938143
|
var __default9 = versionMigrations9;
|
|
938073
938144
|
|
|
938074
938145
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
938075
|
-
var
|
|
938146
|
+
var import_promises158 = require("fs/promises");
|
|
938076
938147
|
var import_yaml12 = __toESM(require_dist9(), 1);
|
|
938077
938148
|
|
|
938078
938149
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
@@ -938115,7 +938186,7 @@ var migration10 = {
|
|
|
938115
938186
|
}
|
|
938116
938187
|
};
|
|
938117
938188
|
async function migrateYamlFile(filepath, context3) {
|
|
938118
|
-
const contents = await (0,
|
|
938189
|
+
const contents = await (0, import_promises158.readFile)(filepath);
|
|
938119
938190
|
const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
|
|
938120
938191
|
const services = parsedDocument.get("services");
|
|
938121
938192
|
if (services == null) {
|
|
@@ -938155,7 +938226,7 @@ async function migrateYamlFile(filepath, context3) {
|
|
|
938155
938226
|
context3.failWithoutThrowing("Failed to convert endpoint", e6);
|
|
938156
938227
|
}
|
|
938157
938228
|
}
|
|
938158
|
-
await (0,
|
|
938229
|
+
await (0, import_promises158.writeFile)(filepath, parsedDocument.toString());
|
|
938159
938230
|
}
|
|
938160
938231
|
}
|
|
938161
938232
|
function convertEndpoint4({ document: document4, endpoint: endpoint3 }) {
|
|
@@ -938234,7 +938305,7 @@ var versionMigrations10 = {
|
|
|
938234
938305
|
var __default10 = versionMigrations10;
|
|
938235
938306
|
|
|
938236
938307
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
938237
|
-
var
|
|
938308
|
+
var import_promises159 = require("fs/promises");
|
|
938238
938309
|
var import_yaml13 = __toESM(require_dist9(), 1);
|
|
938239
938310
|
|
|
938240
938311
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
@@ -938277,7 +938348,7 @@ var migration11 = {
|
|
|
938277
938348
|
}
|
|
938278
938349
|
};
|
|
938279
938350
|
async function migrateYamlFile2(filepath, context3) {
|
|
938280
|
-
const contents = await (0,
|
|
938351
|
+
const contents = await (0, import_promises159.readFile)(filepath);
|
|
938281
938352
|
const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
|
|
938282
938353
|
const types4 = parsedDocument.get("types");
|
|
938283
938354
|
if (types4 == null) {
|
|
@@ -938303,7 +938374,7 @@ async function migrateYamlFile2(filepath, context3) {
|
|
|
938303
938374
|
examples.set(i11, { value });
|
|
938304
938375
|
}
|
|
938305
938376
|
}
|
|
938306
|
-
await (0,
|
|
938377
|
+
await (0, import_promises159.writeFile)(filepath, parsedDocument.toString());
|
|
938307
938378
|
}
|
|
938308
938379
|
|
|
938309
938380
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -938314,7 +938385,7 @@ var versionMigrations11 = {
|
|
|
938314
938385
|
var __default11 = versionMigrations11;
|
|
938315
938386
|
|
|
938316
938387
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
938317
|
-
var
|
|
938388
|
+
var import_promises160 = require("fs/promises");
|
|
938318
938389
|
var import_yaml14 = __toESM(require_dist9(), 1);
|
|
938319
938390
|
|
|
938320
938391
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
@@ -938357,7 +938428,7 @@ var migration12 = {
|
|
|
938357
938428
|
}
|
|
938358
938429
|
};
|
|
938359
938430
|
async function migrateYamlFile3(filepath, context3) {
|
|
938360
|
-
const contents = await (0,
|
|
938431
|
+
const contents = await (0, import_promises160.readFile)(filepath);
|
|
938361
938432
|
const parsedDocument = import_yaml14.default.parseDocument(contents.toString());
|
|
938362
938433
|
if (!import_yaml14.default.isMap(parsedDocument.contents)) {
|
|
938363
938434
|
return context3.failAndThrow("File is not a map");
|
|
@@ -938387,7 +938458,7 @@ async function migrateYamlFile3(filepath, context3) {
|
|
|
938387
938458
|
pair.value = firstService.value;
|
|
938388
938459
|
}
|
|
938389
938460
|
}
|
|
938390
|
-
await (0,
|
|
938461
|
+
await (0, import_promises160.writeFile)(filepath, parsedDocument.toString());
|
|
938391
938462
|
}
|
|
938392
938463
|
|
|
938393
938464
|
// ../cli-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -938398,7 +938469,7 @@ var versionMigrations12 = {
|
|
|
938398
938469
|
var __default12 = versionMigrations12;
|
|
938399
938470
|
|
|
938400
938471
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
938401
|
-
var
|
|
938472
|
+
var import_promises161 = require("fs/promises");
|
|
938402
938473
|
var import_yaml15 = __toESM(require_dist9(), 1);
|
|
938403
938474
|
|
|
938404
938475
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
@@ -938441,7 +938512,7 @@ var migration13 = {
|
|
|
938441
938512
|
}
|
|
938442
938513
|
};
|
|
938443
938514
|
async function migrateYamlFile4(filepath, context3) {
|
|
938444
|
-
const contents = await (0,
|
|
938515
|
+
const contents = await (0, import_promises161.readFile)(filepath);
|
|
938445
938516
|
const parsedDocument = import_yaml15.default.parseDocument(contents.toString());
|
|
938446
938517
|
if (!import_yaml15.default.isMap(parsedDocument.contents)) {
|
|
938447
938518
|
return context3.failAndThrow("File is not a map");
|
|
@@ -938460,7 +938531,7 @@ async function migrateYamlFile4(filepath, context3) {
|
|
|
938460
938531
|
}
|
|
938461
938532
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
938462
938533
|
parsedDocument.contents.items.unshift(docsPair);
|
|
938463
|
-
await (0,
|
|
938534
|
+
await (0, import_promises161.writeFile)(filepath, parsedDocument.toString());
|
|
938464
938535
|
}
|
|
938465
938536
|
|
|
938466
938537
|
// ../cli-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -938471,7 +938542,7 @@ var versionMigrations13 = {
|
|
|
938471
938542
|
var __default13 = versionMigrations13;
|
|
938472
938543
|
|
|
938473
938544
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
938474
|
-
var
|
|
938545
|
+
var import_promises162 = require("fs/promises");
|
|
938475
938546
|
|
|
938476
938547
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
938477
938548
|
init_lib6();
|
|
@@ -938513,14 +938584,14 @@ var migration14 = {
|
|
|
938513
938584
|
}
|
|
938514
938585
|
};
|
|
938515
938586
|
async function migrateYamlFile5(filepath) {
|
|
938516
|
-
const contents = await (0,
|
|
938587
|
+
const contents = await (0, import_promises162.readFile)(filepath);
|
|
938517
938588
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
938518
938589
|
const regex5 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
938519
938590
|
const updatedSnapshot = contents.toString().replace(regex5, (_match, _prefix, domain3) => {
|
|
938520
938591
|
return `docs:
|
|
938521
938592
|
domain: "${domain3}.${domainSuffix}"`;
|
|
938522
938593
|
});
|
|
938523
|
-
await (0,
|
|
938594
|
+
await (0, import_promises162.writeFile)(filepath, updatedSnapshot.toString());
|
|
938524
938595
|
}
|
|
938525
938596
|
|
|
938526
938597
|
// ../cli-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -938540,10 +938611,10 @@ var LegacyDocsSerializers = __toESM(require_serialization4(), 1);
|
|
|
938540
938611
|
|
|
938541
938612
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
938542
938613
|
init_lib6();
|
|
938543
|
-
var
|
|
938614
|
+
var import_promises163 = require("fs/promises");
|
|
938544
938615
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
938545
938616
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
938546
|
-
const contentsStr = await (0,
|
|
938617
|
+
const contentsStr = await (0, import_promises163.readFile)(filepath);
|
|
938547
938618
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
938548
938619
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
938549
938620
|
if (result.ok) {
|
|
@@ -938562,7 +938633,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
938562
938633
|
|
|
938563
938634
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
938564
938635
|
init_lib6();
|
|
938565
|
-
var
|
|
938636
|
+
var import_promises165 = require("fs/promises");
|
|
938566
938637
|
|
|
938567
938638
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
938568
938639
|
function convertLegacyDocsConfig({ docsConfiguration, docsURLs, apiName }) {
|
|
@@ -938745,10 +938816,10 @@ __export(legacy_exports, {
|
|
|
938745
938816
|
|
|
938746
938817
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
938747
938818
|
init_lib6();
|
|
938748
|
-
var
|
|
938819
|
+
var import_promises164 = require("fs/promises");
|
|
938749
938820
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
938750
938821
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
938751
|
-
const contentsStr = await (0,
|
|
938822
|
+
const contentsStr = await (0, import_promises164.readFile)(filepath);
|
|
938752
938823
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
938753
938824
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
938754
938825
|
if (result.success) {
|
|
@@ -938778,7 +938849,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
938778
938849
|
var APIS_DIRECTORY2 = "apis";
|
|
938779
938850
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
938780
938851
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY2));
|
|
938781
|
-
await (0,
|
|
938852
|
+
await (0, import_promises165.mkdir)(absolutePathToApisDirectory);
|
|
938782
938853
|
for (const workspace of workspaces) {
|
|
938783
938854
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
938784
938855
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -938786,11 +938857,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
938786
938857
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
938787
938858
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
938788
938859
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
938789
|
-
await (0,
|
|
938860
|
+
await (0, import_promises165.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
938790
938861
|
}
|
|
938791
938862
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
938792
938863
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
938793
|
-
await (0,
|
|
938864
|
+
await (0, import_promises165.rm)(absolutePathToWorkspace, { recursive: true });
|
|
938794
938865
|
}
|
|
938795
938866
|
}
|
|
938796
938867
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -938803,7 +938874,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
938803
938874
|
generatorsConfiguration,
|
|
938804
938875
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
938805
938876
|
});
|
|
938806
|
-
await (0,
|
|
938877
|
+
await (0, import_promises165.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
938807
938878
|
return convertedResponse.docsURLs;
|
|
938808
938879
|
}
|
|
938809
938880
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -938817,20 +938888,20 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
938817
938888
|
apiName
|
|
938818
938889
|
});
|
|
938819
938890
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
938820
|
-
await (0,
|
|
938891
|
+
await (0, import_promises165.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
938821
938892
|
}
|
|
938822
938893
|
|
|
938823
938894
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
938824
938895
|
init_lib6();
|
|
938825
|
-
var
|
|
938896
|
+
var import_promises166 = require("fs/promises");
|
|
938826
938897
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
938827
938898
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
938828
938899
|
await migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs });
|
|
938829
938900
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
938830
938901
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
938831
938902
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
938832
|
-
await (0,
|
|
938833
|
-
await (0,
|
|
938903
|
+
await (0, import_promises166.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
938904
|
+
await (0, import_promises166.rm)(absolutePathToWorkspace, { recursive: true });
|
|
938834
938905
|
}
|
|
938835
938906
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
938836
938907
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -938843,7 +938914,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
938843
938914
|
apiName: void 0
|
|
938844
938915
|
});
|
|
938845
938916
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
938846
|
-
await (0,
|
|
938917
|
+
await (0, import_promises166.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
938847
938918
|
}
|
|
938848
938919
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
938849
938920
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -938855,23 +938926,23 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
938855
938926
|
generatorsConfiguration,
|
|
938856
938927
|
pathModificationStrategy: "MoveUp"
|
|
938857
938928
|
});
|
|
938858
|
-
await (0,
|
|
938929
|
+
await (0, import_promises166.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
938859
938930
|
return convertedResponse.docsURLs;
|
|
938860
938931
|
}
|
|
938861
938932
|
|
|
938862
938933
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
938863
938934
|
init_lib6();
|
|
938864
|
-
var
|
|
938935
|
+
var import_promises167 = require("fs/promises");
|
|
938865
938936
|
var APIS_DIRECTORY3 = "apis";
|
|
938866
938937
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
938867
938938
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY3));
|
|
938868
|
-
await (0,
|
|
938939
|
+
await (0, import_promises167.mkdir)(absolutePathToApisDirectory);
|
|
938869
938940
|
for (const workspace of workspaces) {
|
|
938870
938941
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
938871
938942
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
938872
938943
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
938873
938944
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
938874
|
-
await (0,
|
|
938945
|
+
await (0, import_promises167.rm)(absolutePathToWorkspace, { recursive: true });
|
|
938875
938946
|
}
|
|
938876
938947
|
}
|
|
938877
938948
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -938884,16 +938955,16 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
938884
938955
|
generatorsConfiguration,
|
|
938885
938956
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
938886
938957
|
});
|
|
938887
|
-
await (0,
|
|
938958
|
+
await (0, import_promises167.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
938888
938959
|
}
|
|
938889
938960
|
|
|
938890
938961
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
938891
938962
|
init_lib6();
|
|
938892
|
-
var
|
|
938963
|
+
var import_promises168 = require("fs/promises");
|
|
938893
938964
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
938894
938965
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
938895
938966
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
938896
|
-
await (0,
|
|
938967
|
+
await (0, import_promises168.rm)(absolutePathToWorkspace, { recursive: true });
|
|
938897
938968
|
}
|
|
938898
938969
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
938899
938970
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -938905,7 +938976,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
938905
938976
|
generatorsConfiguration,
|
|
938906
938977
|
pathModificationStrategy: "MoveUp"
|
|
938907
938978
|
});
|
|
938908
|
-
await (0,
|
|
938979
|
+
await (0, import_promises168.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
938909
938980
|
}
|
|
938910
938981
|
|
|
938911
938982
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -938983,7 +939054,7 @@ var __default15 = versionMigrations15;
|
|
|
938983
939054
|
|
|
938984
939055
|
// ../cli-migrations/lib/migrations/0.41.0-rc0/require-generators-yml/migration.js
|
|
938985
939056
|
init_lib6();
|
|
938986
|
-
var
|
|
939057
|
+
var import_promises169 = require("fs/promises");
|
|
938987
939058
|
var import_yaml16 = __toESM(require_dist9(), 1);
|
|
938988
939059
|
var migration16 = {
|
|
938989
939060
|
name: "require-generators-yml",
|
|
@@ -939026,7 +939097,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
939026
939097
|
if (existingGeneratorsYml == null) {
|
|
939027
939098
|
if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
939028
939099
|
const absolutePathToGeneratorsYml = join8(absoluteFilepathToWorkspace, RelativeFilePath2.of("generators.yml"));
|
|
939029
|
-
await (0,
|
|
939100
|
+
await (0, import_promises169.writeFile)(absolutePathToGeneratorsYml, jsYaml.dump({
|
|
939030
939101
|
api: {
|
|
939031
939102
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
939032
939103
|
}
|
|
@@ -939041,7 +939112,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
939041
939112
|
parsedDocument.set("api", {
|
|
939042
939113
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
939043
939114
|
});
|
|
939044
|
-
await (0,
|
|
939115
|
+
await (0, import_promises169.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
|
|
939045
939116
|
context3.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
|
|
939046
939117
|
}
|
|
939047
939118
|
}
|
|
@@ -939069,7 +939140,7 @@ var __default16 = versionMigrations16;
|
|
|
939069
939140
|
|
|
939070
939141
|
// ../cli-migrations/lib/migrations/0.54.0-rc0/use-generators-yml-specs/migration.js
|
|
939071
939142
|
init_lib6();
|
|
939072
|
-
var
|
|
939143
|
+
var import_promises170 = require("fs/promises");
|
|
939073
939144
|
var import_yaml17 = __toESM(require_dist9(), 1);
|
|
939074
939145
|
var migration17 = {
|
|
939075
939146
|
name: "generators-yml-use-api-specs",
|
|
@@ -939249,7 +939320,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
|
|
|
939249
939320
|
if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
|
|
939250
939321
|
documentToWrite = `${schemaComment}${documentToWrite}`;
|
|
939251
939322
|
}
|
|
939252
|
-
await (0,
|
|
939323
|
+
await (0, import_promises170.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
939253
939324
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
939254
939325
|
}
|
|
939255
939326
|
async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, directories, context: context3, namespace }) {
|
|
@@ -939296,7 +939367,7 @@ async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, direc
|
|
|
939296
939367
|
}
|
|
939297
939368
|
let specContent;
|
|
939298
939369
|
try {
|
|
939299
|
-
const fileContents = await (0,
|
|
939370
|
+
const fileContents = await (0, import_promises170.readFile)(absoluteSpecPath, { encoding: "utf-8" });
|
|
939300
939371
|
specContent = jsYaml.load(fileContents);
|
|
939301
939372
|
} catch (e6) {
|
|
939302
939373
|
context3.logger.warn(`Failed to read API spec file ${spec.path}. Error: ${e6}. Skipping...`);
|
|
@@ -939400,7 +939471,7 @@ var __default17 = versionMigrations17;
|
|
|
939400
939471
|
|
|
939401
939472
|
// ../cli-migrations/lib/migrations/0.82.1/add-path-parameter-order-setting/migration.js
|
|
939402
939473
|
init_lib6();
|
|
939403
|
-
var
|
|
939474
|
+
var import_promises171 = require("fs/promises");
|
|
939404
939475
|
var migration18 = {
|
|
939405
939476
|
name: "add-path-parameter-order-setting",
|
|
939406
939477
|
summary: `Adds the 'path-parameter-order' setting to existing API configurations to maintain backwards compatibility.
|
|
@@ -939488,7 +939559,7 @@ async function updateGeneratorsYml({ context: context3, files }) {
|
|
|
939488
939559
|
documentToWrite = `${schemaComment}
|
|
939489
939560
|
${documentToWrite}`;
|
|
939490
939561
|
}
|
|
939491
|
-
await (0,
|
|
939562
|
+
await (0, import_promises171.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
939492
939563
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
939493
939564
|
}
|
|
939494
939565
|
async function getFilesAndDirectories3(absoluteFilepath) {
|
|
@@ -939525,7 +939596,7 @@ var __default18 = versionMigrations18;
|
|
|
939525
939596
|
|
|
939526
939597
|
// ../cli-migrations/lib/migrations/1.0.0/update-settings-defaults/migration.js
|
|
939527
939598
|
init_lib6();
|
|
939528
|
-
var
|
|
939599
|
+
var import_promises172 = require("fs/promises");
|
|
939529
939600
|
var migration19 = {
|
|
939530
939601
|
name: "update-1_0_0-defaults",
|
|
939531
939602
|
summary: `The defaults of the API spec settings have changed.
|
|
@@ -939700,7 +939771,7 @@ async function updateGeneratorsYml2({ context: context3, files }) {
|
|
|
939700
939771
|
documentToWrite = `${schemaComment}
|
|
939701
939772
|
${documentToWrite}`;
|
|
939702
939773
|
}
|
|
939703
|
-
await (0,
|
|
939774
|
+
await (0, import_promises172.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
939704
939775
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
939705
939776
|
}
|
|
939706
939777
|
async function getFilesAndDirectories4(absoluteFilepath) {
|
|
@@ -939770,7 +939841,7 @@ var __default19 = versionMigrations19;
|
|
|
939770
939841
|
|
|
939771
939842
|
// ../cli-migrations/lib/migrations/2.0.0-rc0/update-settings-defaults/migration.js
|
|
939772
939843
|
init_lib6();
|
|
939773
|
-
var
|
|
939844
|
+
var import_promises173 = require("fs/promises");
|
|
939774
939845
|
var migration20 = {
|
|
939775
939846
|
name: "update-2_0_0-defaults",
|
|
939776
939847
|
summary: `The default of 'coerce-enums-to-literals' has changed from true to false.
|
|
@@ -939945,7 +940016,7 @@ async function updateGeneratorsYml3({ context: context3, files }) {
|
|
|
939945
940016
|
documentToWrite = `${schemaComment}
|
|
939946
940017
|
${documentToWrite}`;
|
|
939947
940018
|
}
|
|
939948
|
-
await (0,
|
|
940019
|
+
await (0, import_promises173.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
939949
940020
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
939950
940021
|
}
|
|
939951
940022
|
async function getFilesAndDirectories5(absoluteFilepath) {
|
|
@@ -939992,7 +940063,7 @@ var __default20 = versionMigrations20;
|
|
|
939992
940063
|
|
|
939993
940064
|
// ../cli-migrations/lib/migrations/2.13.0/migrate-deprecated-generator-api-settings/migration.js
|
|
939994
940065
|
init_lib6();
|
|
939995
|
-
var
|
|
940066
|
+
var import_promises174 = require("fs/promises");
|
|
939996
940067
|
var migration21 = {
|
|
939997
940068
|
name: "migrate-deprecated-generator-api-settings",
|
|
939998
940069
|
summary: `Migrates deprecated generator-level API settings keys to their new equivalents:
|
|
@@ -940083,7 +940154,7 @@ async function updateGeneratorsYml4({ context: context3, files }) {
|
|
|
940083
940154
|
documentToWrite = `${schemaComment}
|
|
940084
940155
|
${documentToWrite}`;
|
|
940085
940156
|
}
|
|
940086
|
-
await (0,
|
|
940157
|
+
await (0, import_promises174.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
940087
940158
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
940088
940159
|
}
|
|
940089
940160
|
function migrateDeprecatedSettings(settings, context3) {
|
|
@@ -940130,7 +940201,7 @@ var __default21 = versionMigrations21;
|
|
|
940130
940201
|
|
|
940131
940202
|
// ../cli-migrations/lib/migrations/3.0.0/enable-smart-casing/migration.js
|
|
940132
940203
|
init_lib6();
|
|
940133
|
-
var
|
|
940204
|
+
var import_promises175 = require("fs/promises");
|
|
940134
940205
|
var migration22 = {
|
|
940135
940206
|
name: "enable-smart-casing",
|
|
940136
940207
|
summary: `Sets 'smart-casing: false' for existing generators to preserve backwards compatibility.
|
|
@@ -940214,7 +940285,7 @@ async function updateGeneratorsYml5({ context: context3, files }) {
|
|
|
940214
940285
|
documentToWrite = `${schemaComment}
|
|
940215
940286
|
${documentToWrite}`;
|
|
940216
940287
|
}
|
|
940217
|
-
await (0,
|
|
940288
|
+
await (0, import_promises175.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
940218
940289
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
940219
940290
|
}
|
|
940220
940291
|
function setSmartCasingFalseIfNotConfigured(generator, context3) {
|
|
@@ -940355,7 +940426,7 @@ ${source_default.dim(migration23.summary)}`
|
|
|
940355
940426
|
}
|
|
940356
940427
|
|
|
940357
940428
|
// src/commands/upgrade/upgrade.ts
|
|
940358
|
-
var
|
|
940429
|
+
var import_promises176 = require("fs/promises");
|
|
940359
940430
|
|
|
940360
940431
|
// src/cwd.ts
|
|
940361
940432
|
var FERN_CWD_ENV_VAR = "FERN_CWD";
|
|
@@ -940682,7 +940753,7 @@ async function upgrade({
|
|
|
940682
940753
|
const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
|
|
940683
940754
|
draft.version = resolvedTargetVersion;
|
|
940684
940755
|
});
|
|
940685
|
-
await (0,
|
|
940756
|
+
await (0, import_promises176.writeFile)(
|
|
940686
940757
|
projectConfig2._absolutePath,
|
|
940687
940758
|
ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2))
|
|
940688
940759
|
);
|
|
@@ -941307,7 +941378,7 @@ async function validateWorkspaces({
|
|
|
941307
941378
|
|
|
941308
941379
|
// src/commands/write-definition/writeDefinitionForWorkspaces.ts
|
|
941309
941380
|
init_lib6();
|
|
941310
|
-
var
|
|
941381
|
+
var import_promises177 = require("fs/promises");
|
|
941311
941382
|
var import_path91 = __toESM(require("path"), 1);
|
|
941312
941383
|
async function writeDefinitionForWorkspaces({
|
|
941313
941384
|
project,
|
|
@@ -941388,28 +941459,28 @@ async function writeFernDefinition({
|
|
|
941388
941459
|
return a10.localeCompare(b19);
|
|
941389
941460
|
};
|
|
941390
941461
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
941391
|
-
await (0,
|
|
941462
|
+
await (0, import_promises177.rm)(absolutePathToOutputDirectory, { recursive: true });
|
|
941392
941463
|
}
|
|
941393
|
-
await (0,
|
|
941394
|
-
await (0,
|
|
941464
|
+
await (0, import_promises177.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
941465
|
+
await (0, import_promises177.writeFile)(
|
|
941395
941466
|
join8(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
|
|
941396
941467
|
jsYaml.dump(definition3.rootApiFile.contents, { sortKeys })
|
|
941397
941468
|
);
|
|
941398
941469
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
941399
941470
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
941400
|
-
await (0,
|
|
941401
|
-
await (0,
|
|
941471
|
+
await (0, import_promises177.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
941472
|
+
await (0, import_promises177.writeFile)(absoluteFilepath, jsYaml.dump(packageMarker.contents, { sortKeys }));
|
|
941402
941473
|
}
|
|
941403
941474
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
941404
941475
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
941405
|
-
await (0,
|
|
941406
|
-
await (0,
|
|
941476
|
+
await (0, import_promises177.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
941477
|
+
await (0, import_promises177.writeFile)(absoluteFilepath, jsYaml.dump(definitionFile.contents, { sortKeys }));
|
|
941407
941478
|
}
|
|
941408
941479
|
}
|
|
941409
941480
|
|
|
941410
941481
|
// src/commands/write-docs-definition/writeDocsDefinitionForProject.ts
|
|
941411
941482
|
init_lib6();
|
|
941412
|
-
var
|
|
941483
|
+
var import_promises178 = require("fs/promises");
|
|
941413
941484
|
async function writeDocsDefinitionForProject({
|
|
941414
941485
|
project,
|
|
941415
941486
|
outputPath,
|
|
@@ -941441,7 +941512,7 @@ async function writeDocsDefinitionForProject({
|
|
|
941441
941512
|
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
|
|
941442
941513
|
});
|
|
941443
941514
|
const docsDefinition = await docsResolver.resolve();
|
|
941444
|
-
await (0,
|
|
941515
|
+
await (0, import_promises178.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
|
|
941445
941516
|
context3.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
|
|
941446
941517
|
});
|
|
941447
941518
|
}
|
|
@@ -941450,7 +941521,7 @@ async function writeDocsDefinitionForProject({
|
|
|
941450
941521
|
init_lib6();
|
|
941451
941522
|
var import_cli_progress2 = __toESM(require_cli_progress(), 1);
|
|
941452
941523
|
var import_fs38 = require("fs");
|
|
941453
|
-
var
|
|
941524
|
+
var import_promises182 = require("fs/promises");
|
|
941454
941525
|
var import_is_ci3 = __toESM(require_is_ci(), 1);
|
|
941455
941526
|
var import_path94 = __toESM(require("path"), 1);
|
|
941456
941527
|
|
|
@@ -941943,7 +942014,7 @@ function shouldProcessFile(filePath, stub) {
|
|
|
941943
942014
|
|
|
941944
942015
|
// src/commands/write-translation/docs-config-utils.ts
|
|
941945
942016
|
init_lib6();
|
|
941946
|
-
var
|
|
942017
|
+
var import_promises179 = require("fs/promises");
|
|
941947
942018
|
|
|
941948
942019
|
// src/commands/write-translation/url-utils.ts
|
|
941949
942020
|
function addLanguageSuffixToUrl(url3, language) {
|
|
@@ -942100,7 +942171,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
942100
942171
|
stub = false
|
|
942101
942172
|
}) {
|
|
942102
942173
|
try {
|
|
942103
|
-
const originalConfigContent = await (0,
|
|
942174
|
+
const originalConfigContent = await (0, import_promises179.readFile)(originalDocsConfigPath, "utf-8");
|
|
942104
942175
|
const transformation = {
|
|
942105
942176
|
filePath: DOCS_CONFIGURATION_FILENAME,
|
|
942106
942177
|
language,
|
|
@@ -942114,7 +942185,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
942114
942185
|
const modifiedConfigContent = jsYaml.dump(modifiedConfig, {
|
|
942115
942186
|
sortKeys: false
|
|
942116
942187
|
});
|
|
942117
|
-
await (0,
|
|
942188
|
+
await (0, import_promises179.writeFile)(modifiedConfigPath, modifiedConfigContent, "utf-8");
|
|
942118
942189
|
context3.logger.debug(`Created language-specific docs config: ${modifiedConfigPath}`);
|
|
942119
942190
|
} catch (error50) {
|
|
942120
942191
|
if (error50 instanceof Error && error50.message.includes("403")) {
|
|
@@ -942127,11 +942198,11 @@ async function createLanguageSpecificDocsConfig({
|
|
|
942127
942198
|
// src/commands/write-translation/file-collection-utils.ts
|
|
942128
942199
|
init_lib6();
|
|
942129
942200
|
var import_fs36 = require("fs");
|
|
942130
|
-
var
|
|
942201
|
+
var import_promises180 = require("fs/promises");
|
|
942131
942202
|
var import_path92 = __toESM(require("path"), 1);
|
|
942132
942203
|
async function collectFiles(baseDirectory, relativeBase) {
|
|
942133
942204
|
const discoveredFiles = {};
|
|
942134
|
-
const entries23 = await (0,
|
|
942205
|
+
const entries23 = await (0, import_promises180.readdir)(baseDirectory);
|
|
942135
942206
|
for (const entry of entries23) {
|
|
942136
942207
|
if (entry === "translations") {
|
|
942137
942208
|
continue;
|
|
@@ -942154,7 +942225,7 @@ async function collectFiles(baseDirectory, relativeBase) {
|
|
|
942154
942225
|
// src/commands/write-translation/hash-utils.ts
|
|
942155
942226
|
var import_crypto13 = require("crypto");
|
|
942156
942227
|
var import_fs37 = require("fs");
|
|
942157
|
-
var
|
|
942228
|
+
var import_promises181 = require("fs/promises");
|
|
942158
942229
|
var import_path93 = __toESM(require("path"), 1);
|
|
942159
942230
|
function calculateContentHash(content5) {
|
|
942160
942231
|
return (0, import_crypto13.createHash)("sha256").update(content5, "utf-8").digest("hex");
|
|
@@ -942165,7 +942236,7 @@ async function loadHashMappings(translationsDirectory) {
|
|
|
942165
942236
|
return {};
|
|
942166
942237
|
}
|
|
942167
942238
|
try {
|
|
942168
|
-
const hashesContent = await (0,
|
|
942239
|
+
const hashesContent = await (0, import_promises181.readFile)(hashesFilePath, "utf-8");
|
|
942169
942240
|
const parsed = JSON.parse(hashesContent);
|
|
942170
942241
|
const { _comment, ...hashMappings } = parsed;
|
|
942171
942242
|
return hashMappings;
|
|
@@ -942186,11 +942257,11 @@ async function saveHashMappings(translationsDirectory, hashMappings) {
|
|
|
942186
942257
|
_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.",
|
|
942187
942258
|
...sortedMappings
|
|
942188
942259
|
};
|
|
942189
|
-
await (0,
|
|
942260
|
+
await (0, import_promises181.writeFile)(hashesFilePath, JSON.stringify(fileContent, null, 2), "utf-8");
|
|
942190
942261
|
}
|
|
942191
942262
|
async function hasFileChanged(filePath, relativePath, previousHashes) {
|
|
942192
942263
|
try {
|
|
942193
|
-
const content5 = await (0,
|
|
942264
|
+
const content5 = await (0, import_promises181.readFile)(filePath, "utf-8");
|
|
942194
942265
|
const currentHash = calculateContentHash(content5);
|
|
942195
942266
|
const previousHash = previousHashes[relativePath];
|
|
942196
942267
|
return currentHash !== previousHash;
|
|
@@ -942246,7 +942317,7 @@ async function writeTranslationForProject({
|
|
|
942246
942317
|
}
|
|
942247
942318
|
if (!(0, import_fs38.existsSync)(translationsDirectory)) {
|
|
942248
942319
|
context3.logger.debug(`Creating translations directory at: ${translationsDirectory}`);
|
|
942249
|
-
await (0,
|
|
942320
|
+
await (0, import_promises182.mkdir)(translationsDirectory, { recursive: true });
|
|
942250
942321
|
}
|
|
942251
942322
|
const languageStats = {};
|
|
942252
942323
|
const targetLanguages = languages.filter((lang) => lang !== sourceLanguage);
|
|
@@ -942259,7 +942330,7 @@ async function writeTranslationForProject({
|
|
|
942259
942330
|
RelativeFilePath2.of("fern")
|
|
942260
942331
|
);
|
|
942261
942332
|
if (!(0, import_fs38.existsSync)(languageDirectory)) {
|
|
942262
|
-
await (0,
|
|
942333
|
+
await (0, import_promises182.mkdir)(languageDirectory, { recursive: true });
|
|
942263
942334
|
}
|
|
942264
942335
|
languageStats[language] = {
|
|
942265
942336
|
filesProcessed: 0,
|
|
@@ -942361,7 +942432,7 @@ async function writeTranslationForProject({
|
|
|
942361
942432
|
`[COMPLETED] ${DOCS_CONFIGURATION_FILENAME} -> ${language}/${DOCS_CONFIGURATION_FILENAME}`
|
|
942362
942433
|
);
|
|
942363
942434
|
}
|
|
942364
|
-
const originalConfigContent = await (0,
|
|
942435
|
+
const originalConfigContent = await (0, import_promises182.readFile)(originalDocsConfigPath, "utf-8");
|
|
942365
942436
|
await updateAndSaveHashForFile(
|
|
942366
942437
|
translationsDirectory,
|
|
942367
942438
|
hashMappings,
|
|
@@ -942406,7 +942477,7 @@ async function writeTranslationForProject({
|
|
|
942406
942477
|
continue;
|
|
942407
942478
|
}
|
|
942408
942479
|
cliContext.logger.debug(`[PROCESSING] ${relativePath} (detected changes)`);
|
|
942409
|
-
const originalContent = await (0,
|
|
942480
|
+
const originalContent = await (0, import_promises182.readFile)(filePath, "utf-8");
|
|
942410
942481
|
await updateAndSaveHashForFile(translationsDirectory, hashMappings, relativePath, originalContent);
|
|
942411
942482
|
const sourceStats = languageStats[sourceLanguage];
|
|
942412
942483
|
if (sourceStats) {
|
|
@@ -942431,7 +942502,7 @@ async function writeTranslationForProject({
|
|
|
942431
942502
|
const destPath = join8(languageDirectory, relativePath);
|
|
942432
942503
|
const destDir = import_path94.default.dirname(destPath);
|
|
942433
942504
|
if (!(0, import_fs38.existsSync)(destDir)) {
|
|
942434
|
-
await (0,
|
|
942505
|
+
await (0, import_promises182.mkdir)(destDir, { recursive: true });
|
|
942435
942506
|
}
|
|
942436
942507
|
const transformation = {
|
|
942437
942508
|
filePath: relativePath,
|
|
@@ -942444,7 +942515,7 @@ async function writeTranslationForProject({
|
|
|
942444
942515
|
cliContext,
|
|
942445
942516
|
stub
|
|
942446
942517
|
});
|
|
942447
|
-
await (0,
|
|
942518
|
+
await (0, import_promises182.writeFile)(destPath, transformedContent, "utf-8");
|
|
942448
942519
|
const languageStatsForLang = languageStats[language];
|
|
942449
942520
|
if (languageStatsForLang) {
|
|
942450
942521
|
languageStatsForLang.filesProcessed++;
|
|
@@ -942475,9 +942546,9 @@ async function writeTranslationForProject({
|
|
|
942475
942546
|
const destPath = join8(languageDirectory, relativePath);
|
|
942476
942547
|
const destDir = import_path94.default.dirname(destPath);
|
|
942477
942548
|
if (!(0, import_fs38.existsSync)(destDir)) {
|
|
942478
|
-
await (0,
|
|
942549
|
+
await (0, import_promises182.mkdir)(destDir, { recursive: true });
|
|
942479
942550
|
}
|
|
942480
|
-
await (0,
|
|
942551
|
+
await (0, import_promises182.copyFile)(filePath, destPath);
|
|
942481
942552
|
assetsCopied++;
|
|
942482
942553
|
cliContext.logger.debug(`[ASSET COPIED] ${relativePath} -> ${language}/${relativePath}`);
|
|
942483
942554
|
}
|