@fern-api/fern-api-dev 4.71.6 → 4.72.0-1-g2825b1479c3
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 +727 -511
- 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-1-g2825b1479c3",
|
|
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-1-g2825b1479c3",
|
|
621452
621452
|
...event,
|
|
621453
621453
|
...event.properties,
|
|
621454
621454
|
usingAccessToken: false,
|
|
@@ -624684,7 +624684,8 @@ var YamlConfigLoader = class {
|
|
|
624684
624684
|
data: parseResult.data,
|
|
624685
624685
|
sourced: sourceResolver.toSourced(parseResult.data),
|
|
624686
624686
|
absoluteFilePath,
|
|
624687
|
-
relativeFilePath: RelativeFilePath2.of(relative4(this.cwd, absoluteFilePath))
|
|
624687
|
+
relativeFilePath: RelativeFilePath2.of(relative4(this.cwd, absoluteFilePath)),
|
|
624688
|
+
pathMappings: resolved.pathMappings
|
|
624688
624689
|
};
|
|
624689
624690
|
}
|
|
624690
624691
|
async parseDocument(absoluteFilePath) {
|
|
@@ -624747,6 +624748,17 @@ var YamlConfigLoader = class {
|
|
|
624747
624748
|
case "unrecognized_keys":
|
|
624748
624749
|
return `unknown key(s): ${issue2.keys.join(", ")}`;
|
|
624749
624750
|
case "invalid_union": {
|
|
624751
|
+
const unknownKeys = [];
|
|
624752
|
+
for (const errorGroup of issue2.errors) {
|
|
624753
|
+
for (const err of errorGroup) {
|
|
624754
|
+
if (err.code === "unrecognized_keys") {
|
|
624755
|
+
unknownKeys.push(...err.keys);
|
|
624756
|
+
}
|
|
624757
|
+
}
|
|
624758
|
+
}
|
|
624759
|
+
if (unknownKeys.length > 0) {
|
|
624760
|
+
return `unknown key(s): ${[...new Set(unknownKeys)].join(", ")}`;
|
|
624761
|
+
}
|
|
624750
624762
|
const expectedTypes = /* @__PURE__ */ new Set();
|
|
624751
624763
|
for (const errorGroup of issue2.errors) {
|
|
624752
624764
|
for (const err of errorGroup) {
|
|
@@ -625075,7 +625087,7 @@ var ApiDefinitionConverter = class {
|
|
|
625075
625087
|
let result = {};
|
|
625076
625088
|
if (api != null && !isNullish2(sourced.api)) {
|
|
625077
625089
|
result = await this.convertApi({
|
|
625078
|
-
absoluteFernYmlPath:
|
|
625090
|
+
absoluteFernYmlPath: this.resolveBasePathForKey("api", fernYml),
|
|
625079
625091
|
api,
|
|
625080
625092
|
sourcedApi: sourced.api
|
|
625081
625093
|
});
|
|
@@ -625083,6 +625095,7 @@ var ApiDefinitionConverter = class {
|
|
|
625083
625095
|
if (apis != null && !isNullish2(sourced.apis)) {
|
|
625084
625096
|
result = await this.convertApis({
|
|
625085
625097
|
absoluteFernYmlPath: fernYml.absoluteFilePath,
|
|
625098
|
+
pathMappings: fernYml.pathMappings,
|
|
625086
625099
|
apis,
|
|
625087
625100
|
sourcedApis: sourced.apis
|
|
625088
625101
|
});
|
|
@@ -625120,14 +625133,15 @@ var ApiDefinitionConverter = class {
|
|
|
625120
625133
|
[DEFAULT_API_NAME]: apiDefinition
|
|
625121
625134
|
};
|
|
625122
625135
|
}
|
|
625123
|
-
async convertApis({ absoluteFernYmlPath, apis, sourcedApis }) {
|
|
625136
|
+
async convertApis({ absoluteFernYmlPath, pathMappings, apis, sourcedApis }) {
|
|
625124
625137
|
if (isNullish2(sourcedApis)) {
|
|
625125
625138
|
return {};
|
|
625126
625139
|
}
|
|
625127
625140
|
const apiEntries = Object.entries(apis).filter(([apiName]) => !isNullish2(sourcedApis[apiName])).map(([apiName, apiDef]) => ({ apiName, apiDef, sourcedApiDef: sourcedApis[apiName] })).filter((entry) => !isNullish2(entry.sourcedApiDef));
|
|
625128
625141
|
const convertedEntries = await Promise.all(apiEntries.map(async ({ apiName, apiDef, sourcedApiDef }) => {
|
|
625142
|
+
const entryBasePath = this.findBasePathInMappings(["apis", apiName], pathMappings) ?? this.findBasePathInMappings(["apis"], pathMappings) ?? absoluteFernYmlPath;
|
|
625129
625143
|
const specs = await this.convertSpecs({
|
|
625130
|
-
absoluteFernYmlPath,
|
|
625144
|
+
absoluteFernYmlPath: entryBasePath,
|
|
625131
625145
|
specs: apiDef.specs,
|
|
625132
625146
|
sourced: sourcedApiDef.specs
|
|
625133
625147
|
});
|
|
@@ -625423,9 +625437,33 @@ var ApiDefinitionConverter = class {
|
|
|
625423
625437
|
}
|
|
625424
625438
|
}
|
|
625425
625439
|
}
|
|
625440
|
+
/**
|
|
625441
|
+
* Returns the file path of the document that provided the content at the
|
|
625442
|
+
* given YAML path prefix (via a `$ref`), or `undefined` if no mapping matches.
|
|
625443
|
+
*
|
|
625444
|
+
* Used to resolve spec paths relative to the correct source file when a
|
|
625445
|
+
* config section (e.g. `api`, `apis`, `apis.my-api`) was loaded via `$ref`.
|
|
625446
|
+
*/
|
|
625447
|
+
findBasePathInMappings(yamlPath, pathMappings) {
|
|
625448
|
+
for (const mapping of pathMappings) {
|
|
625449
|
+
if (mapping.yamlPath.length === yamlPath.length && yamlPath.every((seg, i11) => seg === mapping.yamlPath[i11])) {
|
|
625450
|
+
return mapping.document.absoluteFilePath;
|
|
625451
|
+
}
|
|
625452
|
+
}
|
|
625453
|
+
return void 0;
|
|
625454
|
+
}
|
|
625455
|
+
/**
|
|
625456
|
+
* Returns the base file path to use for resolving paths in the given top-level
|
|
625457
|
+
* key (e.g. "api"). If the key was `$ref`'d, returns the path of the referenced
|
|
625458
|
+
* file; otherwise falls back to the fern.yml path.
|
|
625459
|
+
*/
|
|
625460
|
+
resolveBasePathForKey(key2, fernYml) {
|
|
625461
|
+
return this.findBasePathInMappings([key2], fernYml.pathMappings) ?? fernYml.absoluteFilePath;
|
|
625462
|
+
}
|
|
625426
625463
|
};
|
|
625427
625464
|
|
|
625428
625465
|
// ../cli-v2/lib/docs/config/converter/DocsConfigConverter.js
|
|
625466
|
+
var DOCS_YAML_PATH = "docs";
|
|
625429
625467
|
var DocsConfigConverter = class {
|
|
625430
625468
|
issues = [];
|
|
625431
625469
|
convert({ fernYml }) {
|
|
@@ -625437,10 +625475,13 @@ var DocsConfigConverter = class {
|
|
|
625437
625475
|
if (this.issues.length > 0) {
|
|
625438
625476
|
return { success: false, issues: this.issues };
|
|
625439
625477
|
}
|
|
625478
|
+
const docsPathMapping = fernYml.pathMappings.find((m11) => m11.yamlPath.length === 1 && m11.yamlPath[0] === DOCS_YAML_PATH);
|
|
625479
|
+
const absoluteFilePath = docsPathMapping != null ? docsPathMapping.document.absoluteFilePath : fernYml.absoluteFilePath;
|
|
625440
625480
|
return {
|
|
625441
625481
|
success: true,
|
|
625442
625482
|
config: {
|
|
625443
|
-
raw: docs
|
|
625483
|
+
raw: docs,
|
|
625484
|
+
absoluteFilePath
|
|
625444
625485
|
}
|
|
625445
625486
|
};
|
|
625446
625487
|
}
|
|
@@ -753732,8 +753773,13 @@ var IrCompiler = class {
|
|
|
753732
753773
|
var CompileCommand = class {
|
|
753733
753774
|
async handle(context3, args) {
|
|
753734
753775
|
const workspace = await context3.loadWorkspaceOrThrow();
|
|
753735
|
-
const
|
|
753736
|
-
|
|
753776
|
+
const entries23 = this.resolveApiEntries(args, workspace);
|
|
753777
|
+
if (args.output != null && entries23.length > 1) {
|
|
753778
|
+
throw new CliError({
|
|
753779
|
+
message: `--output requires --api when multiple APIs are configured`,
|
|
753780
|
+
code: CliError.Code.ConfigError
|
|
753781
|
+
});
|
|
753782
|
+
}
|
|
753737
753783
|
const compiler2 = new IrCompiler({
|
|
753738
753784
|
context: context3,
|
|
753739
753785
|
cliVersion: workspace.cliVersion
|
|
@@ -753745,43 +753791,35 @@ var CompileCommand = class {
|
|
|
753745
753791
|
disableExamples: args["disable-examples"],
|
|
753746
753792
|
irVersion: args["ir-version"]
|
|
753747
753793
|
};
|
|
753748
|
-
const
|
|
753749
|
-
|
|
753794
|
+
for (const { apiName, definition: definition3 } of entries23) {
|
|
753795
|
+
await this.checkOrThrow({ context: context3, workspace, apiName });
|
|
753796
|
+
const result = args.dynamic ? await compiler2.compileDynamic({ apiName, definition: definition3, options: options2 }) : await compiler2.compile({ apiName, definition: definition3, options: options2 });
|
|
753797
|
+
await this.writeOutput(context3, args, result.object);
|
|
753798
|
+
}
|
|
753750
753799
|
}
|
|
753751
|
-
|
|
753752
|
-
|
|
753800
|
+
/**
|
|
753801
|
+
* Resolves the set of APIs to compile.
|
|
753802
|
+
*
|
|
753803
|
+
* - If `--api` is provided, returns only that API (throws if not found).
|
|
753804
|
+
* - Otherwise returns all APIs in the workspace, matching the behavior of
|
|
753805
|
+
* `check`, `merge`, and `split` which also run on all APIs by default.
|
|
753806
|
+
*/
|
|
753807
|
+
resolveApiEntries(args, workspace) {
|
|
753808
|
+
const allApiNames = Object.keys(workspace.apis);
|
|
753753
753809
|
if (args.api != null) {
|
|
753754
753810
|
const definition3 = workspace.apis[args.api];
|
|
753755
753811
|
if (definition3 == null) {
|
|
753756
|
-
const
|
|
753812
|
+
const available = allApiNames.join(", ");
|
|
753757
753813
|
throw new CliError({
|
|
753758
|
-
message: `API '${args.api}' not found. Available APIs: ${
|
|
753814
|
+
message: `API '${args.api}' not found. Available APIs: ${available}`,
|
|
753759
753815
|
code: CliError.Code.ConfigError
|
|
753760
753816
|
});
|
|
753761
753817
|
}
|
|
753762
|
-
return { apiName: args.api, definition: definition3 };
|
|
753818
|
+
return [{ apiName: args.api, definition: definition3 }];
|
|
753763
753819
|
}
|
|
753764
|
-
|
|
753765
|
-
const apiName = apiNames[0];
|
|
753766
|
-
if (apiName == null) {
|
|
753767
|
-
throw new CliError({
|
|
753768
|
-
message: "Internal error; no APIs found in workspace",
|
|
753769
|
-
code: CliError.Code.InternalError
|
|
753770
|
-
});
|
|
753771
|
-
}
|
|
753820
|
+
return allApiNames.flatMap((apiName) => {
|
|
753772
753821
|
const definition3 = workspace.apis[apiName];
|
|
753773
|
-
|
|
753774
|
-
throw new CliError({
|
|
753775
|
-
message: `Internal error; API '${apiName}' not found in workspace`,
|
|
753776
|
-
code: CliError.Code.InternalError
|
|
753777
|
-
});
|
|
753778
|
-
}
|
|
753779
|
-
return { apiName, definition: definition3 };
|
|
753780
|
-
}
|
|
753781
|
-
const available = apiNames.join(", ");
|
|
753782
|
-
throw new CliError({
|
|
753783
|
-
message: `Multiple APIs found: ${available}. Use --api to select one.`,
|
|
753784
|
-
code: CliError.Code.ConfigError
|
|
753822
|
+
return definition3 != null ? [{ apiName, definition: definition3 }] : [];
|
|
753785
753823
|
});
|
|
753786
753824
|
}
|
|
753787
753825
|
async checkOrThrow({ context: context3, workspace, apiName }) {
|
|
@@ -795489,13 +795527,13 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context3 }) {
|
|
|
795489
795527
|
}
|
|
795490
795528
|
}
|
|
795491
795529
|
}
|
|
795492
|
-
const { writeFile:
|
|
795530
|
+
const { writeFile: writeFile90 } = await import("fs/promises");
|
|
795493
795531
|
const yamlContent = jsYaml.dump(parsed, {
|
|
795494
795532
|
indent: 2,
|
|
795495
795533
|
lineWidth: -1,
|
|
795496
795534
|
noRefs: true
|
|
795497
795535
|
});
|
|
795498
|
-
await
|
|
795536
|
+
await writeFile90(overrideFilePath, yamlContent, "utf-8");
|
|
795499
795537
|
context3.logger.info(`Removed ${validationResult.invalidCount} invalid AI examples from ai_examples_override.yml`);
|
|
795500
795538
|
return {
|
|
795501
795539
|
removedCount: validationResult.invalidCount,
|
|
@@ -833544,7 +833582,7 @@ var MDX_NODE_TYPES = [
|
|
|
833544
833582
|
"mdxTextExpression",
|
|
833545
833583
|
"mdxjsEsm"
|
|
833546
833584
|
];
|
|
833547
|
-
function collectLinksAndSources({ readFile:
|
|
833585
|
+
function collectLinksAndSources({ readFile: readFile103 = (path97) => (0, import_node_fs14.readFileSync)(path97, "utf-8"), ...opts }) {
|
|
833548
833586
|
const visitedAbsoluteFilepaths = /* @__PURE__ */ new Set();
|
|
833549
833587
|
const contentQueue = [opts];
|
|
833550
833588
|
const links = [];
|
|
@@ -833582,7 +833620,7 @@ function collectLinksAndSources({ readFile: readFile102 = (path97) => (0, import
|
|
|
833582
833620
|
const resolvedImportPath = resolve6(dirname6(absoluteFilepath), importPath);
|
|
833583
833621
|
if (resolvedImportPath.endsWith(".mdx") || resolvedImportPath.endsWith(".md")) {
|
|
833584
833622
|
contentQueue.push({
|
|
833585
|
-
content:
|
|
833623
|
+
content: readFile103(resolvedImportPath),
|
|
833586
833624
|
absoluteFilepath: resolvedImportPath
|
|
833587
833625
|
});
|
|
833588
833626
|
}
|
|
@@ -833625,7 +833663,7 @@ function collectLinksAndSources({ readFile: readFile102 = (path97) => (0, import
|
|
|
833625
833663
|
if (absoluteFilepath && typeof src === "string") {
|
|
833626
833664
|
const resolvedImportPath = resolve6(dirname6(absoluteFilepath), src);
|
|
833627
833665
|
contentQueue.push({
|
|
833628
|
-
content:
|
|
833666
|
+
content: readFile103(resolvedImportPath),
|
|
833629
833667
|
absoluteFilepath: resolvedImportPath
|
|
833630
833668
|
});
|
|
833631
833669
|
}
|
|
@@ -834698,13 +834736,15 @@ async function runRulesOnDocsWorkspace({ workspace, rules: selectedRules, contex
|
|
|
834698
834736
|
}
|
|
834699
834737
|
|
|
834700
834738
|
// ../cli-v2/lib/docs/adapter/LegacyDocsWorkspaceAdapter.js
|
|
834739
|
+
init_lib6();
|
|
834701
834740
|
var LegacyDocsWorkspaceAdapter = class {
|
|
834702
834741
|
adapt({ docsConfig, absoluteFilePath }) {
|
|
834742
|
+
const docsFilePath = docsConfig.absoluteFilePath ?? absoluteFilePath;
|
|
834703
834743
|
return {
|
|
834704
834744
|
type: "docs",
|
|
834705
834745
|
workspaceName: void 0,
|
|
834706
|
-
absoluteFilePath,
|
|
834707
|
-
absoluteFilepathToDocsConfig:
|
|
834746
|
+
absoluteFilePath: dirname6(docsFilePath),
|
|
834747
|
+
absoluteFilepathToDocsConfig: docsFilePath,
|
|
834708
834748
|
config: docsConfig.raw
|
|
834709
834749
|
};
|
|
834710
834750
|
}
|
|
@@ -834721,9 +834761,9 @@ var LegacyProjectAdapter = class {
|
|
|
834721
834761
|
}
|
|
834722
834762
|
adapt(workspace) {
|
|
834723
834763
|
const apiWorkspaces = this.buildApiWorkspaces(workspace);
|
|
834724
|
-
const docsWorkspace = workspace.docs != null
|
|
834764
|
+
const docsWorkspace = workspace.docs != null ? this.docsAdapter.adapt({
|
|
834725
834765
|
docsConfig: workspace.docs,
|
|
834726
|
-
absoluteFilePath: workspace.absoluteFilePath
|
|
834766
|
+
absoluteFilePath: workspace.docs.absoluteFilePath ?? workspace.absoluteFilePath ?? this.context.cwd
|
|
834727
834767
|
}) : void 0;
|
|
834728
834768
|
return {
|
|
834729
834769
|
config: {
|
|
@@ -835180,7 +835220,7 @@ function addCheckCommand2(cli) {
|
|
|
835180
835220
|
|
|
835181
835221
|
// ../cli-v2/lib/migrator/Migrator.js
|
|
835182
835222
|
init_lib6();
|
|
835183
|
-
var
|
|
835223
|
+
var import_promises76 = require("fs/promises");
|
|
835184
835224
|
|
|
835185
835225
|
// ../cli-v2/lib/migrator/converters/convertApiSpecs.js
|
|
835186
835226
|
init_lib6();
|
|
@@ -835190,6 +835230,7 @@ var import_promises72 = require("fs/promises");
|
|
|
835190
835230
|
var SETTINGS_KEY_MAP = {
|
|
835191
835231
|
// Base settings
|
|
835192
835232
|
"use-title": "titleAsSchemaName",
|
|
835233
|
+
"title-as-schema-name": "titleAsSchemaName",
|
|
835193
835234
|
"respect-nullable-schemas": "respectNullableSchemas",
|
|
835194
835235
|
"wrap-references-to-nullable-in-optional": "wrapReferencesToNullableInOptional",
|
|
835195
835236
|
"coerce-optional-schemas-to-nullable": "coerceOptionalSchemasToNullable",
|
|
@@ -835752,9 +835793,6 @@ function convertSdkTargetsFromRaw(options2) {
|
|
|
835752
835793
|
}
|
|
835753
835794
|
}
|
|
835754
835795
|
const sdks = { targets: targets2 };
|
|
835755
|
-
if (defaultGroup != null) {
|
|
835756
|
-
sdks.defaultGroup = defaultGroup;
|
|
835757
|
-
}
|
|
835758
835796
|
if (autorelease != null) {
|
|
835759
835797
|
sdks.autorelease = autorelease;
|
|
835760
835798
|
}
|
|
@@ -835808,12 +835846,42 @@ function convertRawGeneratorToTarget(options2) {
|
|
|
835808
835846
|
if (generator.config != null) {
|
|
835809
835847
|
target.config = generator.config;
|
|
835810
835848
|
}
|
|
835811
|
-
target.group = [groupName];
|
|
835812
835849
|
const outputResult = convertRawOutputConfig(generator, warnings);
|
|
835813
835850
|
target.output = outputResult.output;
|
|
835814
835851
|
if (outputResult.publish != null) {
|
|
835815
835852
|
target.publish = outputResult.publish;
|
|
835816
835853
|
}
|
|
835854
|
+
const generatorMetadata = generator.metadata;
|
|
835855
|
+
if (generatorMetadata != null) {
|
|
835856
|
+
const targetMetadata = {};
|
|
835857
|
+
if (generatorMetadata["package-description"] != null) {
|
|
835858
|
+
targetMetadata.description = generatorMetadata["package-description"];
|
|
835859
|
+
}
|
|
835860
|
+
if (generatorMetadata.author != null || generatorMetadata.email != null) {
|
|
835861
|
+
targetMetadata.authors = [{ name: generatorMetadata.author ?? "", email: generatorMetadata.email ?? "" }];
|
|
835862
|
+
}
|
|
835863
|
+
if (generatorMetadata["reference-url"] != null) {
|
|
835864
|
+
warnings.push({
|
|
835865
|
+
type: "unsupported",
|
|
835866
|
+
message: `metadata.reference-url is not supported in fern.yml`,
|
|
835867
|
+
suggestion: "Remove reference-url from metadata"
|
|
835868
|
+
});
|
|
835869
|
+
}
|
|
835870
|
+
if (generatorMetadata.license != null && typeof target.output !== "string" && target.output.git != null) {
|
|
835871
|
+
const license = generatorMetadata.license;
|
|
835872
|
+
target.output.git.license = typeof license === "string" ? license : license.custom;
|
|
835873
|
+
}
|
|
835874
|
+
if (targetMetadata.description != null || targetMetadata.authors != null) {
|
|
835875
|
+
target.metadata = targetMetadata;
|
|
835876
|
+
}
|
|
835877
|
+
}
|
|
835878
|
+
if (generator["smart-casing"] != null) {
|
|
835879
|
+
warnings.push({
|
|
835880
|
+
type: "unsupported",
|
|
835881
|
+
message: `smart-casing is not supported in fern.yml`,
|
|
835882
|
+
suggestion: "Remove smart-casing from your generator configuration"
|
|
835883
|
+
});
|
|
835884
|
+
}
|
|
835817
835885
|
if (generator["ir-version"] != null) {
|
|
835818
835886
|
warnings.push({
|
|
835819
835887
|
type: "deprecated",
|
|
@@ -836073,6 +836141,16 @@ function convertRawReadme(readme) {
|
|
|
836073
836141
|
return hasFields ? result : void 0;
|
|
836074
836142
|
}
|
|
836075
836143
|
|
|
836144
|
+
// ../cli-v2/lib/migrator/docs-yml/DocsYmlMigrator.js
|
|
836145
|
+
init_lib6();
|
|
836146
|
+
async function migrateDocsYml(fernDir) {
|
|
836147
|
+
const filePath = join8(fernDir, RelativeFilePath2.of(DOCS_CONFIGURATION_FILENAME));
|
|
836148
|
+
if (!await doesPathExist(filePath, "file")) {
|
|
836149
|
+
return { found: false };
|
|
836150
|
+
}
|
|
836151
|
+
return { docsRef: { $ref: `./${DOCS_CONFIGURATION_FILENAME}` }, found: true };
|
|
836152
|
+
}
|
|
836153
|
+
|
|
836076
836154
|
// ../cli-v2/lib/migrator/fern-config-json/FernConfigJsonMigrator.js
|
|
836077
836155
|
init_lib4();
|
|
836078
836156
|
init_lib6();
|
|
@@ -836323,6 +836401,38 @@ var GeneratorsYmlMigrator = class {
|
|
|
836323
836401
|
}
|
|
836324
836402
|
};
|
|
836325
836403
|
|
|
836404
|
+
// ../cli-v2/lib/migrator/github-workflows/GithubWorkflowMigrator.js
|
|
836405
|
+
init_lib6();
|
|
836406
|
+
var import_promises75 = require("fs/promises");
|
|
836407
|
+
var WORKFLOWS_DIR = ".github/workflows";
|
|
836408
|
+
async function migrateGithubWorkflows(cwd2) {
|
|
836409
|
+
const warnings = [];
|
|
836410
|
+
const workflowsDir = join8(cwd2, RelativeFilePath2.of(WORKFLOWS_DIR));
|
|
836411
|
+
if (!await doesPathExist(workflowsDir, "directory")) {
|
|
836412
|
+
return warnings;
|
|
836413
|
+
}
|
|
836414
|
+
const entries23 = await (0, import_promises75.readdir)(workflowsDir, { withFileTypes: true });
|
|
836415
|
+
const files = entries23.filter((e6) => e6.isFile() && (e6.name.endsWith(".yml") || e6.name.endsWith(".yaml")));
|
|
836416
|
+
for (const entry of files) {
|
|
836417
|
+
const filePath = join8(workflowsDir, RelativeFilePath2.of(entry.name));
|
|
836418
|
+
const original = await (0, import_promises75.readFile)(filePath, "utf-8");
|
|
836419
|
+
const migrated = migrateFernCommands(original);
|
|
836420
|
+
if (migrated !== original) {
|
|
836421
|
+
await (0, import_promises75.writeFile)(filePath, migrated, "utf-8");
|
|
836422
|
+
warnings.push({ type: "info", message: `Updated workflow file: ${WORKFLOWS_DIR}/${entry.name}` });
|
|
836423
|
+
}
|
|
836424
|
+
}
|
|
836425
|
+
return warnings;
|
|
836426
|
+
}
|
|
836427
|
+
function migrateFernCommands(content5) {
|
|
836428
|
+
return content5.split("\n").map((line) => {
|
|
836429
|
+
if (!/\bfern(?:-api)?\s+generate\b/.test(line)) {
|
|
836430
|
+
return line;
|
|
836431
|
+
}
|
|
836432
|
+
return line.replace(/(\bfern(?:-api)?\s+)generate\b/g, "$1sdk generate").replace(/--group\b/g, "--target");
|
|
836433
|
+
}).join("\n");
|
|
836434
|
+
}
|
|
836435
|
+
|
|
836326
836436
|
// ../cli-v2/lib/migrator/Migrator.js
|
|
836327
836437
|
var Migrator = class {
|
|
836328
836438
|
cwd;
|
|
@@ -836407,13 +836517,17 @@ var Migrator = class {
|
|
|
836407
836517
|
}
|
|
836408
836518
|
fernYml = singleApiResult.fernYml;
|
|
836409
836519
|
}
|
|
836520
|
+
const docsResult = await migrateDocsYml(fernDir);
|
|
836521
|
+
if (docsResult.docsRef != null) {
|
|
836522
|
+
fernYml.docs = docsResult.docsRef;
|
|
836523
|
+
}
|
|
836410
836524
|
const fernYmlPath = join8(this.cwd, RelativeFilePath2.of(FERN_YML_FILENAME));
|
|
836411
836525
|
const yamlContent = this.serializeFernYml(fernYml);
|
|
836412
|
-
await (0,
|
|
836526
|
+
await (0, import_promises76.writeFile)(fernYmlPath, yamlContent, "utf-8");
|
|
836413
836527
|
if (this.deleteOriginals) {
|
|
836414
836528
|
for (const absoluteFilePath of migratedFiles) {
|
|
836415
836529
|
try {
|
|
836416
|
-
await (0,
|
|
836530
|
+
await (0, import_promises76.rm)(absoluteFilePath);
|
|
836417
836531
|
this.logger.debug(`Deleted ${absoluteFilePath}`);
|
|
836418
836532
|
} catch {
|
|
836419
836533
|
warnings.push({
|
|
@@ -836424,6 +836538,7 @@ var Migrator = class {
|
|
|
836424
836538
|
}
|
|
836425
836539
|
}
|
|
836426
836540
|
this.logger.info(`Created ${fernYmlPath}`);
|
|
836541
|
+
warnings.push(...await migrateGithubWorkflows(this.cwd));
|
|
836427
836542
|
return {
|
|
836428
836543
|
success: true,
|
|
836429
836544
|
warnings,
|
|
@@ -836457,7 +836572,7 @@ var Migrator = class {
|
|
|
836457
836572
|
}
|
|
836458
836573
|
async migrateMultiApi(options2) {
|
|
836459
836574
|
const { fernDir, apisDir, org, warnings, migratedFiles } = options2;
|
|
836460
|
-
const apiDirs = await (0,
|
|
836575
|
+
const apiDirs = await (0, import_promises76.readdir)(apisDir, { withFileTypes: true });
|
|
836461
836576
|
const apiNames = apiDirs.filter((d14) => d14.isDirectory()).map((d14) => d14.name);
|
|
836462
836577
|
if (apiNames.length === 0) {
|
|
836463
836578
|
warnings.push({
|
|
@@ -836468,7 +836583,6 @@ var Migrator = class {
|
|
|
836468
836583
|
}
|
|
836469
836584
|
const generatorsYmlApis = {};
|
|
836470
836585
|
let combinedSdks = { targets: {} };
|
|
836471
|
-
let defaultGroup;
|
|
836472
836586
|
let autorelease;
|
|
836473
836587
|
for (const apiName of apiNames) {
|
|
836474
836588
|
const apiDir = join8(apisDir, RelativeFilePath2.of(apiName));
|
|
@@ -836483,9 +836597,6 @@ var Migrator = class {
|
|
|
836483
836597
|
for (const [targetName, target] of Object.entries(generatorsResult.sdks.targets)) {
|
|
836484
836598
|
combinedSdks.targets[targetName] = target;
|
|
836485
836599
|
}
|
|
836486
|
-
if (generatorsResult.sdks.defaultGroup != null && defaultGroup == null) {
|
|
836487
|
-
defaultGroup = generatorsResult.sdks.defaultGroup;
|
|
836488
|
-
}
|
|
836489
836600
|
if (generatorsResult.sdks.autorelease != null && autorelease == null) {
|
|
836490
836601
|
autorelease = generatorsResult.sdks.autorelease;
|
|
836491
836602
|
}
|
|
@@ -836502,9 +836613,6 @@ var Migrator = class {
|
|
|
836502
836613
|
apis: apisResult.apis
|
|
836503
836614
|
};
|
|
836504
836615
|
if (Object.keys(combinedSdks.targets).length > 0) {
|
|
836505
|
-
if (defaultGroup != null) {
|
|
836506
|
-
combinedSdks.defaultGroup = defaultGroup;
|
|
836507
|
-
}
|
|
836508
836616
|
if (autorelease != null) {
|
|
836509
836617
|
combinedSdks.autorelease = autorelease;
|
|
836510
836618
|
}
|
|
@@ -836550,6 +836658,9 @@ var Migrator = class {
|
|
|
836550
836658
|
if (fernYml.cli != null) {
|
|
836551
836659
|
doc.cli = fernYml.cli;
|
|
836552
836660
|
}
|
|
836661
|
+
if (fernYml.docs != null) {
|
|
836662
|
+
doc.docs = fernYml.docs;
|
|
836663
|
+
}
|
|
836553
836664
|
if (fernYml.sdks != null) {
|
|
836554
836665
|
doc.sdks = this.simplifySdks(fernYml.sdks);
|
|
836555
836666
|
}
|
|
@@ -836867,7 +836978,7 @@ var import_child_process6 = require("child_process");
|
|
|
836867
836978
|
var import_cors = __toESM(require_lib14(), 1);
|
|
836868
836979
|
var import_express2 = __toESM(require_express3(), 1);
|
|
836869
836980
|
var import_fs25 = __toESM(require("fs"), 1);
|
|
836870
|
-
var
|
|
836981
|
+
var import_promises80 = require("fs/promises");
|
|
836871
836982
|
var import_http9 = __toESM(require("http"), 1);
|
|
836872
836983
|
var import_path55 = __toESM(require("path"), 1);
|
|
836873
836984
|
|
|
@@ -837283,7 +837394,7 @@ var isFunction8 = (value) => {
|
|
|
837283
837394
|
};
|
|
837284
837395
|
|
|
837285
837396
|
// ../../../node_modules/.pnpm/tiny-readdir@2.7.4/node_modules/tiny-readdir/dist/index.js
|
|
837286
|
-
var
|
|
837397
|
+
var readdir12 = (rootPath, options2) => {
|
|
837287
837398
|
const followSymlinks = options2?.followSymlinks ?? false;
|
|
837288
837399
|
const maxDepth = options2?.depth ?? Infinity;
|
|
837289
837400
|
const maxPaths = options2?.limit ?? Infinity;
|
|
@@ -837449,7 +837560,7 @@ var readdir11 = (rootPath, options2) => {
|
|
|
837449
837560
|
};
|
|
837450
837561
|
return populateResultFromRoot(rootPath);
|
|
837451
837562
|
};
|
|
837452
|
-
var dist_default4 =
|
|
837563
|
+
var dist_default4 = readdir12;
|
|
837453
837564
|
|
|
837454
837565
|
// ../../../node_modules/.pnpm/watcher@2.3.1/node_modules/watcher/dist/utils.js
|
|
837455
837566
|
var Utils = {
|
|
@@ -838540,14 +838651,14 @@ init_wrapper();
|
|
|
838540
838651
|
|
|
838541
838652
|
// ../docs-preview/lib/DebugLogger.js
|
|
838542
838653
|
init_lib6();
|
|
838543
|
-
var
|
|
838654
|
+
var import_promises77 = require("fs/promises");
|
|
838544
838655
|
var import_os9 = require("os");
|
|
838545
838656
|
var import_path54 = __toESM(require("path"), 1);
|
|
838546
838657
|
var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
838547
838658
|
var LOGS_FOLDER_NAME = "logs";
|
|
838548
838659
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
838549
838660
|
function getCliSource() {
|
|
838550
|
-
const version7 = "4.
|
|
838661
|
+
const version7 = "4.72.0-1-g2825b1479c3";
|
|
838551
838662
|
return `cli@${version7}`;
|
|
838552
838663
|
}
|
|
838553
838664
|
var DebugLogger = class {
|
|
@@ -838569,7 +838680,7 @@ var DebugLogger = class {
|
|
|
838569
838680
|
const localStorageFolder = join8(AbsoluteFilePath2.of((0, import_os9.homedir)()), RelativeFilePath2.of(LOCAL_STORAGE_FOLDER4));
|
|
838570
838681
|
const logsDir = join8(localStorageFolder, RelativeFilePath2.of(LOGS_FOLDER_NAME));
|
|
838571
838682
|
if (!await doesPathExist(logsDir)) {
|
|
838572
|
-
await (0,
|
|
838683
|
+
await (0, import_promises77.mkdir)(logsDir, { recursive: true });
|
|
838573
838684
|
}
|
|
838574
838685
|
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
838575
838686
|
const logFileName = `${timestamp2}.debug.log`;
|
|
@@ -838582,7 +838693,7 @@ var DebugLogger = class {
|
|
|
838582
838693
|
"================================================================================",
|
|
838583
838694
|
""
|
|
838584
838695
|
].join("\n");
|
|
838585
|
-
await (0,
|
|
838696
|
+
await (0, import_promises77.writeFile)(this.logFilePath, header, "utf-8");
|
|
838586
838697
|
this.initialized = true;
|
|
838587
838698
|
void this.enforceLogSizeLimit(logsDir);
|
|
838588
838699
|
}
|
|
@@ -838601,7 +838712,7 @@ var DebugLogger = class {
|
|
|
838601
838712
|
}
|
|
838602
838713
|
const line = JSON.stringify(entry) + "\n";
|
|
838603
838714
|
try {
|
|
838604
|
-
await (0,
|
|
838715
|
+
await (0, import_promises77.appendFile)(this.logFilePath, line, "utf-8");
|
|
838605
838716
|
} catch (error50) {
|
|
838606
838717
|
}
|
|
838607
838718
|
}
|
|
@@ -838706,13 +838817,13 @@ var DebugLogger = class {
|
|
|
838706
838817
|
*/
|
|
838707
838818
|
async enforceLogSizeLimit(logsDir) {
|
|
838708
838819
|
try {
|
|
838709
|
-
const entries23 = await (0,
|
|
838820
|
+
const entries23 = await (0, import_promises77.readdir)(logsDir);
|
|
838710
838821
|
const logFiles = entries23.filter((name2) => name2.endsWith(".log"));
|
|
838711
838822
|
const fileInfos = [];
|
|
838712
838823
|
for (const name2 of logFiles) {
|
|
838713
838824
|
const fullPath = import_path54.default.join(logsDir, name2);
|
|
838714
838825
|
try {
|
|
838715
|
-
const stats = await (0,
|
|
838826
|
+
const stats = await (0, import_promises77.stat)(fullPath);
|
|
838716
838827
|
fileInfos.push({ name: name2, fullPath, size: stats.size, mtimeMs: stats.mtimeMs });
|
|
838717
838828
|
} catch {
|
|
838718
838829
|
}
|
|
@@ -838734,7 +838845,7 @@ var DebugLogger = class {
|
|
|
838734
838845
|
continue;
|
|
838735
838846
|
}
|
|
838736
838847
|
try {
|
|
838737
|
-
await (0,
|
|
838848
|
+
await (0, import_promises77.unlink)(file4.fullPath);
|
|
838738
838849
|
totalSize -= file4.size;
|
|
838739
838850
|
} catch {
|
|
838740
838851
|
}
|
|
@@ -838877,7 +838988,7 @@ function getBun() {
|
|
|
838877
838988
|
init_lib6();
|
|
838878
838989
|
var import_cli_progress = __toESM(require_cli_progress(), 1);
|
|
838879
838990
|
var import_decompress = __toESM(require_decompress(), 1);
|
|
838880
|
-
var
|
|
838991
|
+
var import_promises78 = require("fs/promises");
|
|
838881
838992
|
var import_os10 = require("os");
|
|
838882
838993
|
var import_tmp_promise8 = __toESM(require_tmp_promise(), 1);
|
|
838883
838994
|
var import_xml2js = __toESM(require_xml2js(), 1);
|
|
@@ -838965,7 +839076,7 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
838965
839076
|
let currentETag = void 0;
|
|
838966
839077
|
if (currentETagExists) {
|
|
838967
839078
|
logger4.debug("Reading existing ETag");
|
|
838968
|
-
currentETag = (await (0,
|
|
839079
|
+
currentETag = (await (0, import_promises78.readFile)(eTagFilepath)).toString();
|
|
838969
839080
|
}
|
|
838970
839081
|
if (currentETag != null && currentETag === eTag) {
|
|
838971
839082
|
logger4.debug("ETag matches. Using already downloaded bundle");
|
|
@@ -839029,20 +839140,20 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
839029
839140
|
}
|
|
839030
839141
|
}
|
|
839031
839142
|
const nodeBuffer = Buffer.concat(chunks);
|
|
839032
|
-
await (0,
|
|
839143
|
+
await (0, import_promises78.writeFile)(outputZipPath, new Uint8Array(nodeBuffer));
|
|
839033
839144
|
logger4.debug(`Wrote ${tryTar ? "output.tar.gz" : "output.zip"} to ${outputZipPath}`);
|
|
839034
839145
|
const absolutePathToPreviewFolder = getPathToPreviewFolder({ app });
|
|
839035
839146
|
if (await doesPathExist(absolutePathToPreviewFolder)) {
|
|
839036
839147
|
const oldBundlePath = AbsoluteFilePath2.of(`${absolutePathToPreviewFolder}-old-${Date.now()}`);
|
|
839037
839148
|
logger4.debug(`Moving previously cached bundle to: ${oldBundlePath}`);
|
|
839038
|
-
await (0,
|
|
839039
|
-
(0,
|
|
839149
|
+
await (0, import_promises78.rename)(absolutePathToPreviewFolder, oldBundlePath);
|
|
839150
|
+
(0, import_promises78.rm)(oldBundlePath, { recursive: true }).catch((error50) => {
|
|
839040
839151
|
logger4.debug(`Failed to remove old bundle at ${oldBundlePath}: ${error50}`);
|
|
839041
839152
|
});
|
|
839042
839153
|
}
|
|
839043
|
-
await (0,
|
|
839154
|
+
await (0, import_promises78.mkdir)(absolutePathToPreviewFolder, { recursive: true });
|
|
839044
839155
|
const absolutePathToBundleFolder = getPathToBundleFolder({ app });
|
|
839045
|
-
await (0,
|
|
839156
|
+
await (0, import_promises78.mkdir)(absolutePathToBundleFolder, { recursive: true });
|
|
839046
839157
|
logger4.debug(`Decompressing bundle from ${outputZipPath} to ${absolutePathToBundleFolder}`);
|
|
839047
839158
|
let unzipProgressBar;
|
|
839048
839159
|
let unzipInterval;
|
|
@@ -839077,7 +839188,7 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
839077
839188
|
unzipProgressBar.stop();
|
|
839078
839189
|
}
|
|
839079
839190
|
}
|
|
839080
|
-
await (0,
|
|
839191
|
+
await (0, import_promises78.writeFile)(eTagFilepath, eTag);
|
|
839081
839192
|
logger4.debug(`Downloaded bundle to ${absolutePathToBundleFolder}`);
|
|
839082
839193
|
if (app) {
|
|
839083
839194
|
logger4.debug("Checking if pnpm is installed");
|
|
@@ -839159,15 +839270,15 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
839159
839270
|
}
|
|
839160
839271
|
if (!pnpmfileExists) {
|
|
839161
839272
|
logger4.debug(`Writing pnpmfile.cjs at ${pnpmfilePath}`);
|
|
839162
|
-
await (0,
|
|
839273
|
+
await (0, import_promises78.writeFile)(pnpmfilePath, PNPMFILE_CJS_CONTENTS);
|
|
839163
839274
|
}
|
|
839164
839275
|
if (!npmrcExists) {
|
|
839165
839276
|
logger4.debug(`Writing .npmrc at ${npmrcPath}`);
|
|
839166
|
-
await (0,
|
|
839277
|
+
await (0, import_promises78.writeFile)(npmrcPath, NPMRC_CONTENTS);
|
|
839167
839278
|
}
|
|
839168
839279
|
if (instrumentationJsExists) {
|
|
839169
839280
|
logger4.debug(`Removing instrumentation.js at ${absPathToInstrumentationJs}`);
|
|
839170
|
-
await (0,
|
|
839281
|
+
await (0, import_promises78.rm)(absPathToInstrumentationJs);
|
|
839171
839282
|
}
|
|
839172
839283
|
try {
|
|
839173
839284
|
logger4.debug("Running pnpm install within standalone");
|
|
@@ -839187,7 +839298,7 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
839187
839298
|
logger4.error(`Error: ${error50}`);
|
|
839188
839299
|
const absolutePathToPreviewFolder = getPathToPreviewFolder({ app });
|
|
839189
839300
|
if (await doesPathExist(absolutePathToPreviewFolder)) {
|
|
839190
|
-
await (0,
|
|
839301
|
+
await (0, import_promises78.rm)(absolutePathToPreviewFolder, { recursive: true });
|
|
839191
839302
|
}
|
|
839192
839303
|
logger4.debug(`Removing incomplete bundle: rm -rf ${absolutePathToPreviewFolder}`);
|
|
839193
839304
|
return {
|
|
@@ -839200,7 +839311,7 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
839200
839311
|
init_lib4();
|
|
839201
839312
|
init_js();
|
|
839202
839313
|
init_lib6();
|
|
839203
|
-
var
|
|
839314
|
+
var import_promises79 = require("fs/promises");
|
|
839204
839315
|
var import_gray_matter8 = __toESM(require_gray_matter(), 1);
|
|
839205
839316
|
var frontmatterPositionCache = /* @__PURE__ */ new Map();
|
|
839206
839317
|
var frontmatterSidebarTitleCache = /* @__PURE__ */ new Map();
|
|
@@ -839270,7 +839381,7 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
|
|
|
839270
839381
|
navAffectingChange = true;
|
|
839271
839382
|
continue;
|
|
839272
839383
|
}
|
|
839273
|
-
const markdown = (await (0,
|
|
839384
|
+
const markdown = (await (0, import_promises79.readFile)(absoluteFilePath)).toString();
|
|
839274
839385
|
const isNewFile = previousValue == null;
|
|
839275
839386
|
if (isNewFile) {
|
|
839276
839387
|
navAffectingChange = true;
|
|
@@ -839675,7 +839786,7 @@ var SnippetDependencyTracker = class {
|
|
|
839675
839786
|
const markdownFiles = await this.findMarkdownFiles(docsWorkspace.absoluteFilePath);
|
|
839676
839787
|
for (const markdownFile of markdownFiles) {
|
|
839677
839788
|
try {
|
|
839678
|
-
const content5 = await (0,
|
|
839789
|
+
const content5 = await (0, import_promises80.readFile)(markdownFile, "utf-8");
|
|
839679
839790
|
const referencedFiles = this.extractReferences(content5, markdownFile, docsWorkspace.absoluteFilePath);
|
|
839680
839791
|
this.pageToSnippets.set(markdownFile, referencedFiles);
|
|
839681
839792
|
for (const referencedFile of referencedFiles) {
|
|
@@ -839761,7 +839872,7 @@ async function cleanFernDocsCache(bundleRoot, context3) {
|
|
|
839761
839872
|
const cacheExists = await doesPathExist(AbsoluteFilePath2.of(cachePath));
|
|
839762
839873
|
if (cacheExists) {
|
|
839763
839874
|
context3.logger.debug(`Cleaning Fern Docs cache at ${cachePath}`);
|
|
839764
|
-
await (0,
|
|
839875
|
+
await (0, import_promises80.rm)(cachePath, { recursive: true });
|
|
839765
839876
|
context3.logger.debug("Fern Docs cache cleaned successfully");
|
|
839766
839877
|
} else {
|
|
839767
839878
|
context3.logger.debug("No Fern Docs cache to clean");
|
|
@@ -839814,7 +839925,7 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
|
|
|
839814
839925
|
const appPreviewFolder = getPathToPreviewFolder({ app: true });
|
|
839815
839926
|
if (await doesPathExist(appPreviewFolder)) {
|
|
839816
839927
|
context3.logger.info("Force download requested. Deleting cached bundle...");
|
|
839817
|
-
await (0,
|
|
839928
|
+
await (0, import_promises80.rm)(appPreviewFolder, { recursive: true });
|
|
839818
839929
|
}
|
|
839819
839930
|
}
|
|
839820
839931
|
if (bundlePath != null) {
|
|
@@ -841294,7 +841405,7 @@ init_lib6();
|
|
|
841294
841405
|
|
|
841295
841406
|
// ../workspace/loader/lib/listFernFiles.js
|
|
841296
841407
|
init_lib6();
|
|
841297
|
-
var
|
|
841408
|
+
var import_promises81 = require("fs/promises");
|
|
841298
841409
|
async function listFernFiles2(root6, extensionGlob) {
|
|
841299
841410
|
const files = [];
|
|
841300
841411
|
for (const absoluteFilepath of await listFiles(root6, extensionGlob)) {
|
|
@@ -841309,7 +841420,7 @@ async function createFernFile2({ relativeFilepath, absoluteFilepath }) {
|
|
|
841309
841420
|
return {
|
|
841310
841421
|
relativeFilepath,
|
|
841311
841422
|
absoluteFilepath,
|
|
841312
|
-
fileContents: (await (0,
|
|
841423
|
+
fileContents: (await (0, import_promises81.readFile)(absoluteFilepath)).toString()
|
|
841313
841424
|
};
|
|
841314
841425
|
}
|
|
841315
841426
|
|
|
@@ -841616,7 +841727,7 @@ async function loadAPIWorkspace({ absolutePathToWorkspace, context: context3, cl
|
|
|
841616
841727
|
// ../workspace/loader/lib/loadDocsWorkspace.js
|
|
841617
841728
|
init_lib4();
|
|
841618
841729
|
init_lib6();
|
|
841619
|
-
var
|
|
841730
|
+
var import_promises82 = require("fs/promises");
|
|
841620
841731
|
|
|
841621
841732
|
// ../workspace/loader/lib/docs-yml.schema.json
|
|
841622
841733
|
var docs_yml_schema_exports = {};
|
|
@@ -847559,7 +847670,7 @@ async function loadDocsConfiguration({ absolutePathToDocsDefinition, context: co
|
|
|
847559
847670
|
});
|
|
847560
847671
|
}
|
|
847561
847672
|
async function loadRawDocsConfiguration({ absolutePathOfConfiguration, context: context3 }) {
|
|
847562
|
-
const contentsStr = await (0,
|
|
847673
|
+
const contentsStr = await (0, import_promises82.readFile)(absolutePathOfConfiguration);
|
|
847563
847674
|
const contentsJson = jsYaml.load(contentsStr.toString());
|
|
847564
847675
|
const result = validateAgainstJsonSchema(contentsJson, docs_yml_schema_exports, {
|
|
847565
847676
|
filePath: absolutePathOfConfiguration
|
|
@@ -847590,8 +847701,8 @@ ${result.error?.message ?? "Unknown error"}`);
|
|
|
847590
847701
|
// ../generation/remote-generation/remote-workspace-runner/lib/downloadSnippetsForTask.js
|
|
847591
847702
|
init_lib6();
|
|
847592
847703
|
var import_fs26 = require("fs");
|
|
847593
|
-
var
|
|
847594
|
-
var
|
|
847704
|
+
var import_promises83 = require("fs/promises");
|
|
847705
|
+
var import_promises84 = require("stream/promises");
|
|
847595
847706
|
async function downloadSnippetsForTask({ snippetsS3PreSignedReadUrl, absolutePathToLocalSnippetJSON, context: context3 }) {
|
|
847596
847707
|
try {
|
|
847597
847708
|
await downloadFileForTask({
|
|
@@ -847608,10 +847719,10 @@ async function downloadFileForTask({ s3PreSignedReadUrl, absolutePathToLocalOutp
|
|
|
847608
847719
|
responseType: "stream"
|
|
847609
847720
|
});
|
|
847610
847721
|
if (await doesPathExist(absolutePathToLocalOutput)) {
|
|
847611
|
-
await (0,
|
|
847722
|
+
await (0, import_promises83.rm)(absolutePathToLocalOutput, { recursive: true });
|
|
847612
847723
|
}
|
|
847613
|
-
await (0,
|
|
847614
|
-
await (0,
|
|
847724
|
+
await (0, import_promises83.mkdir)(dirname6(absolutePathToLocalOutput), { recursive: true });
|
|
847725
|
+
await (0, import_promises84.pipeline)(request7.data, (0, import_fs26.createWriteStream)(absolutePathToLocalOutput));
|
|
847615
847726
|
}
|
|
847616
847727
|
|
|
847617
847728
|
// ../generation/remote-generation/remote-workspace-runner/lib/resolveAutoDiscoveredFernignorePath.js
|
|
@@ -847635,7 +847746,7 @@ init_js();
|
|
|
847635
847746
|
// ../generation/remote-generation/remote-workspace-runner/lib/createAndStartJob.js
|
|
847636
847747
|
init_lib6();
|
|
847637
847748
|
var import_form_data4 = __toESM(require_form_data(), 1);
|
|
847638
|
-
var
|
|
847749
|
+
var import_promises85 = require("fs/promises");
|
|
847639
847750
|
var import_url_join23 = __toESM(require_url_join(), 1);
|
|
847640
847751
|
var import_util19 = require("util");
|
|
847641
847752
|
var import_zlib5 = require("zlib");
|
|
@@ -847688,7 +847799,7 @@ async function createAndStartJob({ projectConfig, workspace, organization, inter
|
|
|
847688
847799
|
fernignoreContents = "";
|
|
847689
847800
|
} else if (fernignorePath != null) {
|
|
847690
847801
|
try {
|
|
847691
|
-
fernignoreContents = await (0,
|
|
847802
|
+
fernignoreContents = await (0, import_promises85.readFile)(fernignorePath, "utf-8");
|
|
847692
847803
|
} catch (error50) {
|
|
847693
847804
|
context3.failAndThrow(`Failed to read fernignore file at ${fernignorePath}: ${error50}`);
|
|
847694
847805
|
}
|
|
@@ -847935,9 +848046,9 @@ function pollJobAndReportStatus({ job, taskId, taskHandler, context: context3 })
|
|
|
847935
848046
|
init_lib4();
|
|
847936
848047
|
init_lib6();
|
|
847937
848048
|
var import_fs27 = require("fs");
|
|
847938
|
-
var
|
|
848049
|
+
var import_promises86 = require("fs/promises");
|
|
847939
848050
|
var import_path57 = __toESM(require("path"), 1);
|
|
847940
|
-
var
|
|
848051
|
+
var import_promises87 = require("stream/promises");
|
|
847941
848052
|
|
|
847942
848053
|
// ../../../node_modules/.pnpm/terminal-link@3.0.0/node_modules/terminal-link/index.js
|
|
847943
848054
|
var import_supports_hyperlinks = __toESM(require_supports_hyperlinks(), 1);
|
|
@@ -848106,9 +848217,9 @@ async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutpu
|
|
|
848106
848217
|
});
|
|
848107
848218
|
const tmpDir = await import_tmp_promise9.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
848108
848219
|
const outputZipPath = import_path57.default.join(tmpDir.path, "output.zip");
|
|
848109
|
-
await (0,
|
|
848220
|
+
await (0, import_promises87.pipeline)(request7.data, (0, import_fs27.createWriteStream)(outputZipPath));
|
|
848110
848221
|
await forceRemoveDirectory(absolutePathToLocalOutput);
|
|
848111
|
-
await (0,
|
|
848222
|
+
await (0, import_promises86.mkdir)(absolutePathToLocalOutput, { recursive: true });
|
|
848112
848223
|
await extractZipToDirectory(outputZipPath, absolutePathToLocalOutput);
|
|
848113
848224
|
}
|
|
848114
848225
|
async function forceRemoveDirectory(dirPath) {
|
|
@@ -848116,22 +848227,22 @@ async function forceRemoveDirectory(dirPath) {
|
|
|
848116
848227
|
return;
|
|
848117
848228
|
}
|
|
848118
848229
|
await makeWritableRecursive(dirPath);
|
|
848119
|
-
await (0,
|
|
848230
|
+
await (0, import_promises86.rm)(dirPath, { recursive: true, force: true });
|
|
848120
848231
|
}
|
|
848121
848232
|
async function makeWritableRecursive(dirPath) {
|
|
848122
848233
|
try {
|
|
848123
|
-
const entries23 = await (0,
|
|
848234
|
+
const entries23 = await (0, import_promises86.readdir)(dirPath, { withFileTypes: true });
|
|
848124
848235
|
for (const entry of entries23) {
|
|
848125
848236
|
const fullPath = AbsoluteFilePath2.of(import_path57.default.join(dirPath, entry.name));
|
|
848126
848237
|
if (entry.isDirectory()) {
|
|
848127
848238
|
await makeWritableRecursive(fullPath);
|
|
848128
848239
|
}
|
|
848129
848240
|
try {
|
|
848130
|
-
await (0,
|
|
848241
|
+
await (0, import_promises86.chmod)(fullPath, 493);
|
|
848131
848242
|
} catch {
|
|
848132
848243
|
}
|
|
848133
848244
|
}
|
|
848134
|
-
await (0,
|
|
848245
|
+
await (0, import_promises86.chmod)(dirPath, 493);
|
|
848135
848246
|
} catch {
|
|
848136
848247
|
}
|
|
848137
848248
|
}
|
|
@@ -848177,7 +848288,7 @@ async function downloadFilesWithFernIgnoreInTempRepo({ s3PreSignedReadUrl, absol
|
|
|
848177
848288
|
const tmpOutputResolutionDir = AbsoluteFilePath2.of((await import_tmp_promise9.default.dir({})).path);
|
|
848178
848289
|
const absolutePathToFernignore = join8(absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME));
|
|
848179
848290
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
848180
|
-
await (0,
|
|
848291
|
+
await (0, import_promises86.cp)(absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
848181
848292
|
await runGitCommand(["init"], tmpOutputResolutionDir, context3);
|
|
848182
848293
|
await runGitCommand(["add", "."], tmpOutputResolutionDir, context3);
|
|
848183
848294
|
await runGitCommand([
|
|
@@ -848200,7 +848311,7 @@ async function downloadFilesWithFernIgnoreInTempRepo({ s3PreSignedReadUrl, absol
|
|
|
848200
848311
|
await runGitCommand(["restore", "."], tmpOutputResolutionDir, context3);
|
|
848201
848312
|
await forceRemoveDirectory(join8(tmpOutputResolutionDir, RelativeFilePath2.of(".git")));
|
|
848202
848313
|
await forceRemoveDirectory(absolutePathToLocalOutput);
|
|
848203
|
-
await (0,
|
|
848314
|
+
await (0, import_promises86.cp)(tmpOutputResolutionDir, absolutePathToLocalOutput, { recursive: true });
|
|
848204
848315
|
}
|
|
848205
848316
|
async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath }) {
|
|
848206
848317
|
const request7 = await axios_default.get(s3PreSignedReadUrl, {
|
|
@@ -848208,7 +848319,7 @@ async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath
|
|
|
848208
848319
|
});
|
|
848209
848320
|
const tmpDir = await import_tmp_promise9.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
848210
848321
|
const outputZipPath = import_path57.default.join(tmpDir.path, "output.zip");
|
|
848211
|
-
await (0,
|
|
848322
|
+
await (0, import_promises87.pipeline)(request7.data, (0, import_fs27.createWriteStream)(outputZipPath));
|
|
848212
848323
|
await extractZipToDirectory(outputZipPath, outputPath);
|
|
848213
848324
|
}
|
|
848214
848325
|
async function extractZipToDirectory(zipPath, outputDir) {
|
|
@@ -848223,10 +848334,10 @@ async function extractZipToDirectory(zipPath, outputDir) {
|
|
|
848223
848334
|
zipFile.on("entry", (entry) => {
|
|
848224
848335
|
const outputPath = import_path57.default.join(outputDir, entry.fileName);
|
|
848225
848336
|
if (entry.fileName.endsWith("/")) {
|
|
848226
|
-
(0,
|
|
848337
|
+
(0, import_promises86.mkdir)(outputPath, { recursive: true }).then(() => zipFile.readEntry()).catch(reject);
|
|
848227
848338
|
return;
|
|
848228
848339
|
}
|
|
848229
|
-
(0,
|
|
848340
|
+
(0, import_promises86.mkdir)(import_path57.default.dirname(outputPath), { recursive: true }).then(() => {
|
|
848230
848341
|
zipFile.openReadStream(entry, (streamErr, readStream2) => {
|
|
848231
848342
|
if (streamErr || !readStream2) {
|
|
848232
848343
|
reject(streamErr ?? new Error("Failed to open read stream"));
|
|
@@ -848243,7 +848354,7 @@ async function extractZipToDirectory(zipPath, outputDir) {
|
|
|
848243
848354
|
|
|
848244
848355
|
// ../generation/remote-generation/remote-workspace-runner/lib/SourceUploader.js
|
|
848245
848356
|
init_lib6();
|
|
848246
|
-
var
|
|
848357
|
+
var import_promises88 = require("fs/promises");
|
|
848247
848358
|
var import_tmp_promise10 = __toESM(require_tmp_promise(), 1);
|
|
848248
848359
|
var PROTOBUF_ZIP_FILENAME = "proto.zip";
|
|
848249
848360
|
var SourceUploader = class {
|
|
@@ -848264,7 +848375,7 @@ var SourceUploader = class {
|
|
|
848264
848375
|
}
|
|
848265
848376
|
async uploadSource(source2, uploadURL) {
|
|
848266
848377
|
const uploadCommand = await this.getUploadCommand(source2);
|
|
848267
|
-
const fileData = await (0,
|
|
848378
|
+
const fileData = await (0, import_promises88.readFile)(uploadCommand.absoluteFilePath);
|
|
848268
848379
|
const response = await fetch(uploadURL, {
|
|
848269
848380
|
method: "PUT",
|
|
848270
848381
|
body: fileData,
|
|
@@ -848284,7 +848395,7 @@ var SourceUploader = class {
|
|
|
848284
848395
|
absoluteFilePath,
|
|
848285
848396
|
cleanup: async () => {
|
|
848286
848397
|
this.context.logger.debug(`Removing ${absoluteFilePath}`);
|
|
848287
|
-
await (0,
|
|
848398
|
+
await (0, import_promises88.unlink)(absoluteFilePath);
|
|
848288
848399
|
}
|
|
848289
848400
|
};
|
|
848290
848401
|
}
|
|
@@ -848735,7 +848846,7 @@ init_lib4();
|
|
|
848735
848846
|
init_js();
|
|
848736
848847
|
init_lib6();
|
|
848737
848848
|
var import_crypto10 = require("crypto");
|
|
848738
|
-
var
|
|
848849
|
+
var import_promises89 = require("fs/promises");
|
|
848739
848850
|
init_lodash();
|
|
848740
848851
|
var mime = __toESM(require_mime_types(), 1);
|
|
848741
848852
|
|
|
@@ -848814,7 +848925,7 @@ async function unlockDeploy({ fdrOrigin, token, domain: domain3, basepath }) {
|
|
|
848814
848925
|
}
|
|
848815
848926
|
}
|
|
848816
848927
|
async function calculateFileHash(absoluteFilePath) {
|
|
848817
|
-
const fileBuffer = await (0,
|
|
848928
|
+
const fileBuffer = await (0, import_promises89.readFile)(absoluteFilePath);
|
|
848818
848929
|
return (0, import_crypto10.createHash)("sha256").update(new Uint8Array(fileBuffer)).digest("hex");
|
|
848819
848930
|
}
|
|
848820
848931
|
function sanitizeRelativePathForS3(relativeFilePath) {
|
|
@@ -849166,7 +849277,7 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context3, batchSize
|
|
|
849166
849277
|
const absoluteFilePath = sanitizedToAbsoluteMap.get(key2) || resolve6(docsWorkspacePath, RelativeFilePath2.of(key2));
|
|
849167
849278
|
try {
|
|
849168
849279
|
const mimeType = mime.lookup(absoluteFilePath);
|
|
849169
|
-
await axios_default.put(uploadUrl, await (0,
|
|
849280
|
+
await axios_default.put(uploadUrl, await (0, import_promises89.readFile)(absoluteFilePath), {
|
|
849170
849281
|
headers: {
|
|
849171
849282
|
"Content-Type": mimeType === false ? "application/octet-stream" : mimeType,
|
|
849172
849283
|
// Set max cache control for S3 uploads
|
|
@@ -849794,7 +849905,7 @@ var LegacyDocsPublisher = class {
|
|
|
849794
849905
|
previewId,
|
|
849795
849906
|
disableTemplates: void 0,
|
|
849796
849907
|
skipUpload,
|
|
849797
|
-
cliVersion: "4.
|
|
849908
|
+
cliVersion: "4.72.0-1-g2825b1479c3"
|
|
849798
849909
|
});
|
|
849799
849910
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
849800
849911
|
return { success: false };
|
|
@@ -850363,6 +850474,36 @@ var DocsTaskGroup = class {
|
|
|
850363
850474
|
}
|
|
850364
850475
|
};
|
|
850365
850476
|
|
|
850477
|
+
// ../cli-v2/lib/ui/promptSelect.js
|
|
850478
|
+
async function promptSelect({ isTTY, message, choices, nonInteractiveError, flagHint }) {
|
|
850479
|
+
if (choices.length === 0) {
|
|
850480
|
+
throw new CliError({
|
|
850481
|
+
message: "No options available to select from.",
|
|
850482
|
+
code: CliError.Code.InternalError
|
|
850483
|
+
});
|
|
850484
|
+
}
|
|
850485
|
+
if (!isTTY) {
|
|
850486
|
+
throw new CliError({ message: nonInteractiveError, code: CliError.Code.ConfigError });
|
|
850487
|
+
}
|
|
850488
|
+
const maxNameLen = Math.max(...choices.map((c16) => c16.name.length));
|
|
850489
|
+
const { selected } = await lib_default4.prompt([
|
|
850490
|
+
{
|
|
850491
|
+
type: "list",
|
|
850492
|
+
name: "selected",
|
|
850493
|
+
message,
|
|
850494
|
+
choices: choices.map((c16) => {
|
|
850495
|
+
if (flagHint == null) {
|
|
850496
|
+
return { name: c16.name, value: c16.value };
|
|
850497
|
+
}
|
|
850498
|
+
const hint = flagHint(c16.value);
|
|
850499
|
+
const label = hint != null ? `${c16.name.padEnd(maxNameLen)} ${source_default.dim(hint)}` : c16.name;
|
|
850500
|
+
return { name: label, value: c16.value };
|
|
850501
|
+
})
|
|
850502
|
+
}
|
|
850503
|
+
]);
|
|
850504
|
+
return selected;
|
|
850505
|
+
}
|
|
850506
|
+
|
|
850366
850507
|
// ../cli-v2/lib/commands/docs/publish/command.js
|
|
850367
850508
|
var PublishCommand = class {
|
|
850368
850509
|
async handle(context3, args) {
|
|
@@ -850391,7 +850532,8 @@ var PublishCommand = class {
|
|
|
850391
850532
|
code: CliError.Code.ConfigError
|
|
850392
850533
|
});
|
|
850393
850534
|
}
|
|
850394
|
-
const instanceUrl = this.resolveInstanceUrl({
|
|
850535
|
+
const instanceUrl = await this.resolveInstanceUrl({
|
|
850536
|
+
context: context3,
|
|
850395
850537
|
instances: workspace.docs.raw.instances,
|
|
850396
850538
|
instance: args.instance
|
|
850397
850539
|
});
|
|
@@ -850473,7 +850615,7 @@ var PublishCommand = class {
|
|
|
850473
850615
|
throw new CliError({ code: CliError.Code.ContainerError });
|
|
850474
850616
|
}
|
|
850475
850617
|
}
|
|
850476
|
-
resolveInstanceUrl({ instances: instances2, instance }) {
|
|
850618
|
+
async resolveInstanceUrl({ context: context3, instances: instances2, instance }) {
|
|
850477
850619
|
if (instances2.length === 0) {
|
|
850478
850620
|
throw new CliError({
|
|
850479
850621
|
message: "No docs instances configured.\n\n Add an instance to the 'docs:' section of your fern.yml.",
|
|
@@ -850498,14 +850640,17 @@ ${available}
|
|
|
850498
850640
|
}
|
|
850499
850641
|
if (instances2.length > 1) {
|
|
850500
850642
|
const available = instances2.map((i11) => ` - ${i11.url}`).join("\n");
|
|
850501
|
-
|
|
850502
|
-
|
|
850643
|
+
return await promptSelect({
|
|
850644
|
+
isTTY: context3.isTTY,
|
|
850645
|
+
message: "Multiple docs instances configured. Select one:",
|
|
850646
|
+
choices: instances2.map((i11) => ({ name: i11.url, value: i11.url })),
|
|
850647
|
+
nonInteractiveError: `Multiple docs instances configured. Please specify which instance to publish.
|
|
850503
850648
|
|
|
850504
850649
|
Available instances:
|
|
850505
850650
|
${available}
|
|
850506
850651
|
|
|
850507
850652
|
Use --instance <url> to select one.`,
|
|
850508
|
-
|
|
850653
|
+
flagHint: (value) => `--instance ${value}`
|
|
850509
850654
|
});
|
|
850510
850655
|
}
|
|
850511
850656
|
const first3 = instances2[0];
|
|
@@ -850719,7 +850864,7 @@ function addDocsCommand(cli) {
|
|
|
850719
850864
|
// ../cli-v2/lib/commands/init/command.js
|
|
850720
850865
|
init_lib4();
|
|
850721
850866
|
init_lib6();
|
|
850722
|
-
var
|
|
850867
|
+
var import_promises90 = require("fs/promises");
|
|
850723
850868
|
var import_path59 = __toESM(require("path"), 1);
|
|
850724
850869
|
|
|
850725
850870
|
// ../cli-v2/lib/config/fern-yml/FernYmlBuilder.js
|
|
@@ -851594,7 +851739,7 @@ var InitCommand = class {
|
|
|
851594
851739
|
apiPath,
|
|
851595
851740
|
defaultGroup: result.defaultGroup
|
|
851596
851741
|
});
|
|
851597
|
-
await (0,
|
|
851742
|
+
await (0, import_promises90.writeFile)(fernYmlPath, fernYmlContent, "utf-8");
|
|
851598
851743
|
context3.stderr.info(`
|
|
851599
851744
|
${Icons.success} Created ${FERN_YML_FILENAME}`);
|
|
851600
851745
|
}
|
|
@@ -851616,9 +851761,9 @@ var InitCommand = class {
|
|
|
851616
851761
|
}
|
|
851617
851762
|
async writeSpecFile(cwd2, filename, content5) {
|
|
851618
851763
|
const specsDir = join8(cwd2, RelativeFilePath2.of(SPECS_DIR));
|
|
851619
|
-
await (0,
|
|
851764
|
+
await (0, import_promises90.mkdir)(specsDir, { recursive: true });
|
|
851620
851765
|
const filePath = join8(specsDir, RelativeFilePath2.of(filename));
|
|
851621
|
-
await (0,
|
|
851766
|
+
await (0, import_promises90.writeFile)(filePath, content5, "utf-8");
|
|
851622
851767
|
}
|
|
851623
851768
|
resolveApiPath(apiSource) {
|
|
851624
851769
|
switch (apiSource.type) {
|
|
@@ -852568,11 +852713,11 @@ function addCheckCommand4(cli) {
|
|
|
852568
852713
|
// ../cli-v2/lib/commands/sdk/generate/command.js
|
|
852569
852714
|
init_lib4();
|
|
852570
852715
|
init_lib6();
|
|
852571
|
-
var
|
|
852716
|
+
var import_promises108 = require("fs/promises");
|
|
852572
852717
|
|
|
852573
852718
|
// ../cli-v2/lib/api/resolver/ApiSpecResolver.js
|
|
852574
852719
|
init_lib6();
|
|
852575
|
-
var
|
|
852720
|
+
var import_promises91 = require("fs/promises");
|
|
852576
852721
|
var import_os11 = require("os");
|
|
852577
852722
|
var import_path60 = __toESM(require("path"), 1);
|
|
852578
852723
|
|
|
@@ -852620,9 +852765,9 @@ var ApiSpecResolver = class {
|
|
|
852620
852765
|
async resolveUrl({ reference: reference4 }) {
|
|
852621
852766
|
const { content: content5, contentType } = await this.fetchContent({ url: reference4 });
|
|
852622
852767
|
const extension4 = this.inferExtension({ url: reference4, contentType });
|
|
852623
|
-
const tempDir2 = await (0,
|
|
852768
|
+
const tempDir2 = await (0, import_promises91.mkdtemp)(import_path60.default.join((0, import_os11.tmpdir)(), "fern-"));
|
|
852624
852769
|
const absoluteFilePath = AbsoluteFilePath2.of(import_path60.default.join(tempDir2, `spec${extension4}`));
|
|
852625
|
-
await (0,
|
|
852770
|
+
await (0, import_promises91.writeFile)(absoluteFilePath, content5, "utf-8");
|
|
852626
852771
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
852627
852772
|
return {
|
|
852628
852773
|
absoluteFilePath,
|
|
@@ -852635,7 +852780,7 @@ var ApiSpecResolver = class {
|
|
|
852635
852780
|
if (!await doesPathExist(absoluteFilePath)) {
|
|
852636
852781
|
throw new Error(`API spec file does not exist: ${reference4}`);
|
|
852637
852782
|
}
|
|
852638
|
-
const content5 = await (0,
|
|
852783
|
+
const content5 = await (0, import_promises91.readFile)(absoluteFilePath, "utf-8");
|
|
852639
852784
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
852640
852785
|
return {
|
|
852641
852786
|
absoluteFilePath,
|
|
@@ -852722,7 +852867,7 @@ var AutoVersioningCache = class {
|
|
|
852722
852867
|
|
|
852723
852868
|
// ../generation/local-generation/local-workspace-runner/lib/AutoVersioningService.js
|
|
852724
852869
|
var import_fs28 = require("fs");
|
|
852725
|
-
var
|
|
852870
|
+
var import_promises92 = require("fs/promises");
|
|
852726
852871
|
var import_path61 = require("path");
|
|
852727
852872
|
var import_semver12 = __toESM(require_semver2(), 1);
|
|
852728
852873
|
var AutoVersioningException = class extends Error {
|
|
@@ -853429,7 +853574,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
853429
853574
|
* Reads the module path from a go.mod file.
|
|
853430
853575
|
*/
|
|
853431
853576
|
async readGoModulePath(goModPath) {
|
|
853432
|
-
const content5 = await (0,
|
|
853577
|
+
const content5 = await (0, import_promises92.readFile)(goModPath, "utf-8");
|
|
853433
853578
|
for (const line of content5.split("\n")) {
|
|
853434
853579
|
const trimmed2 = line.trim();
|
|
853435
853580
|
if (trimmed2.startsWith("module ")) {
|
|
@@ -853442,7 +853587,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
853442
853587
|
* Adds a version suffix to the module line in go.mod.
|
|
853443
853588
|
*/
|
|
853444
853589
|
async addSuffixToGoMod(goModPath, modulePath, suffix) {
|
|
853445
|
-
const content5 = await (0,
|
|
853590
|
+
const content5 = await (0, import_promises92.readFile)(goModPath, "utf-8");
|
|
853446
853591
|
const lines = content5.split("\n");
|
|
853447
853592
|
let changed = false;
|
|
853448
853593
|
for (let i11 = 0; i11 < lines.length; i11++) {
|
|
@@ -853454,7 +853599,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
853454
853599
|
}
|
|
853455
853600
|
}
|
|
853456
853601
|
if (changed) {
|
|
853457
|
-
await (0,
|
|
853602
|
+
await (0, import_promises92.writeFile)(goModPath, lines.join("\n"), "utf-8");
|
|
853458
853603
|
this.logger.debug(`Updated go.mod: added ${suffix} to module path`);
|
|
853459
853604
|
}
|
|
853460
853605
|
}
|
|
@@ -853463,10 +853608,10 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
853463
853608
|
*/
|
|
853464
853609
|
async walkDirectory(dir, filter8) {
|
|
853465
853610
|
const results = [];
|
|
853466
|
-
const entries23 = await (0,
|
|
853611
|
+
const entries23 = await (0, import_promises92.readdir)(dir);
|
|
853467
853612
|
for (const entry of entries23) {
|
|
853468
853613
|
const fullPath = (0, import_path61.join)(dir, entry);
|
|
853469
|
-
const entryStat = await (0,
|
|
853614
|
+
const entryStat = await (0, import_promises92.stat)(fullPath);
|
|
853470
853615
|
if (entryStat.isDirectory()) {
|
|
853471
853616
|
if (entry === ".git" || entry === "vendor") {
|
|
853472
853617
|
continue;
|
|
@@ -853493,7 +853638,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
853493
853638
|
* Replaces occurrences of the module path with modulePath + suffix in import statements.
|
|
853494
853639
|
*/
|
|
853495
853640
|
async addSuffixToGoFile(filePath, modulePath, suffix) {
|
|
853496
|
-
const content5 = await (0,
|
|
853641
|
+
const content5 = await (0, import_promises92.readFile)(filePath, "utf-8");
|
|
853497
853642
|
const lines = content5.split("\n");
|
|
853498
853643
|
let changed = false;
|
|
853499
853644
|
let inImportBlock = false;
|
|
@@ -853522,7 +853667,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
853522
853667
|
}
|
|
853523
853668
|
}
|
|
853524
853669
|
if (changed) {
|
|
853525
|
-
await (0,
|
|
853670
|
+
await (0, import_promises92.writeFile)(filePath, lines.join("\n"), "utf-8");
|
|
853526
853671
|
this.logger.debug(`Updated Go imports in ${filePath}`);
|
|
853527
853672
|
}
|
|
853528
853673
|
}
|
|
@@ -853575,7 +853720,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
853575
853720
|
};
|
|
853576
853721
|
|
|
853577
853722
|
// ../generation/local-generation/docker-utils/lib/runDocker.js
|
|
853578
|
-
var
|
|
853723
|
+
var import_promises93 = require("fs/promises");
|
|
853579
853724
|
var import_tmp_promise11 = __toESM(require_tmp_promise(), 1);
|
|
853580
853725
|
async function runContainer({ logger: logger4, imageName, args = [], binds = [], envVars = {}, ports = {}, writeLogsToFile = true, removeAfterCompletion = false, runner, signal }) {
|
|
853581
853726
|
const tryRun = () => tryRunContainer({
|
|
@@ -853626,7 +853771,7 @@ async function tryRunContainer({ logger: logger4, imageName, args, binds, envVar
|
|
|
853626
853771
|
const logs4 = stdout + stderr;
|
|
853627
853772
|
if (writeLogsToFile) {
|
|
853628
853773
|
const tmpFile = await import_tmp_promise11.default.file();
|
|
853629
|
-
await (0,
|
|
853774
|
+
await (0, import_promises93.writeFile)(tmpFile.path, logs4);
|
|
853630
853775
|
logger4.info(`Generator logs here: ${tmpFile.path}`);
|
|
853631
853776
|
}
|
|
853632
853777
|
if (exitCode == null) {
|
|
@@ -872145,7 +872290,7 @@ var DynamicSnippetsGenerator = class extends AbstractDynamicSnippetsGenerator {
|
|
|
872145
872290
|
|
|
872146
872291
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/csharp/DynamicSnippetsCsharpTestGenerator.js
|
|
872147
872292
|
init_lib6();
|
|
872148
|
-
var
|
|
872293
|
+
var import_promises94 = require("fs/promises");
|
|
872149
872294
|
var import_path63 = __toESM(require("path"), 1);
|
|
872150
872295
|
|
|
872151
872296
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/utils/convertEndpointSnippetRequest.js
|
|
@@ -872277,8 +872422,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
872277
872422
|
endpointId
|
|
872278
872423
|
});
|
|
872279
872424
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
872280
|
-
await (0,
|
|
872281
|
-
await (0,
|
|
872425
|
+
await (0, import_promises94.mkdir)(import_path63.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
872426
|
+
await (0, import_promises94.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
872282
872427
|
} catch (error50) {
|
|
872283
872428
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
872284
872429
|
}
|
|
@@ -872287,8 +872432,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
872287
872432
|
}
|
|
872288
872433
|
async initializeProject(outputDir) {
|
|
872289
872434
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Snippets"));
|
|
872290
|
-
await (0,
|
|
872291
|
-
await (0,
|
|
872435
|
+
await (0, import_promises94.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
872436
|
+
await (0, import_promises94.writeFile)(join8(absolutePathToOutputDir, RelativeFilePath2.of("Snippets.csproj")), PROJECT_FILE_CONTENT);
|
|
872292
872437
|
return absolutePathToOutputDir;
|
|
872293
872438
|
}
|
|
872294
872439
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -875728,7 +875873,7 @@ var DynamicSnippetsGenerator2 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
875728
875873
|
};
|
|
875729
875874
|
|
|
875730
875875
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/go/DynamicSnippetsGoTestGenerator.js
|
|
875731
|
-
var
|
|
875876
|
+
var import_promises95 = require("fs/promises");
|
|
875732
875877
|
var import_path65 = __toESM(require("path"), 1);
|
|
875733
875878
|
var DynamicSnippetsGoTestGenerator = class {
|
|
875734
875879
|
context;
|
|
@@ -875757,8 +875902,8 @@ var DynamicSnippetsGoTestGenerator = class {
|
|
|
875757
875902
|
endpointId
|
|
875758
875903
|
});
|
|
875759
875904
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
875760
|
-
await (0,
|
|
875761
|
-
await (0,
|
|
875905
|
+
await (0, import_promises95.mkdir)(import_path65.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
875906
|
+
await (0, import_promises95.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
875762
875907
|
} catch (error50) {
|
|
875763
875908
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
875764
875909
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -879135,7 +879280,7 @@ var DynamicSnippetsGenerator3 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
879135
879280
|
};
|
|
879136
879281
|
|
|
879137
879282
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/java/DynamicSnippetsJavaTestGenerator.js
|
|
879138
|
-
var
|
|
879283
|
+
var import_promises96 = require("fs/promises");
|
|
879139
879284
|
var import_path66 = __toESM(require("path"), 1);
|
|
879140
879285
|
var DynamicSnippetsJavaTestGenerator = class {
|
|
879141
879286
|
context;
|
|
@@ -879170,8 +879315,8 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
879170
879315
|
endpointId
|
|
879171
879316
|
});
|
|
879172
879317
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
879173
|
-
await (0,
|
|
879174
|
-
await (0,
|
|
879318
|
+
await (0, import_promises96.mkdir)(import_path66.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
879319
|
+
await (0, import_promises96.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
879175
879320
|
} catch (error50) {
|
|
879176
879321
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
879177
879322
|
}
|
|
@@ -879198,7 +879343,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
879198
879343
|
const reportsPath = join8(outputDir, RelativeFilePath2.of("reports"));
|
|
879199
879344
|
const buildReportsExists = await doesPathExist(buildReportsPath, "directory");
|
|
879200
879345
|
if (buildReportsExists) {
|
|
879201
|
-
await (0,
|
|
879346
|
+
await (0, import_promises96.cp)(buildReportsPath, reportsPath, { recursive: true });
|
|
879202
879347
|
this.context.logger.info("Gradle profiling report copied to reports/");
|
|
879203
879348
|
} else {
|
|
879204
879349
|
this.context.logger.info("No profiling report found in build/reports/");
|
|
@@ -879212,7 +879357,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
879212
879357
|
}
|
|
879213
879358
|
async initializeProject(outputDir) {
|
|
879214
879359
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("src/main/java/com/snippets"));
|
|
879215
|
-
await (0,
|
|
879360
|
+
await (0, import_promises96.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
879216
879361
|
return absolutePathToOutputDir;
|
|
879217
879362
|
}
|
|
879218
879363
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -882600,7 +882745,7 @@ var DynamicSnippetsGenerator4 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
882600
882745
|
};
|
|
882601
882746
|
|
|
882602
882747
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/php/DynamicSnippetsPhpTestGenerator.js
|
|
882603
|
-
var
|
|
882748
|
+
var import_promises97 = require("fs/promises");
|
|
882604
882749
|
var import_path67 = __toESM(require("path"), 1);
|
|
882605
882750
|
var DynamicSnippetsPhpTestGenerator = class {
|
|
882606
882751
|
context;
|
|
@@ -882629,8 +882774,8 @@ var DynamicSnippetsPhpTestGenerator = class {
|
|
|
882629
882774
|
endpointId
|
|
882630
882775
|
});
|
|
882631
882776
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
882632
|
-
await (0,
|
|
882633
|
-
await (0,
|
|
882777
|
+
await (0, import_promises97.mkdir)(import_path67.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
882778
|
+
await (0, import_promises97.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
882634
882779
|
} catch (error50) {
|
|
882635
882780
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
882636
882781
|
}
|
|
@@ -885831,7 +885976,7 @@ var DynamicSnippetsGenerator5 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
885831
885976
|
};
|
|
885832
885977
|
|
|
885833
885978
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/python/DynamicSnippetsPythonTestGenerator.js
|
|
885834
|
-
var
|
|
885979
|
+
var import_promises98 = require("fs/promises");
|
|
885835
885980
|
var import_path68 = __toESM(require("path"), 1);
|
|
885836
885981
|
var DynamicSnippetsPythonTestGenerator = class {
|
|
885837
885982
|
context;
|
|
@@ -885860,8 +886005,8 @@ var DynamicSnippetsPythonTestGenerator = class {
|
|
|
885860
886005
|
endpointId
|
|
885861
886006
|
});
|
|
885862
886007
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
885863
|
-
await (0,
|
|
885864
|
-
await (0,
|
|
886008
|
+
await (0, import_promises98.mkdir)(import_path68.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
886009
|
+
await (0, import_promises98.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
885865
886010
|
} catch (error50) {
|
|
885866
886011
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
885867
886012
|
}
|
|
@@ -888466,7 +888611,7 @@ var DynamicSnippetsGenerator6 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
888466
888611
|
};
|
|
888467
888612
|
|
|
888468
888613
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/ruby/DynamicSnippetsRubyTestGenerator.js
|
|
888469
|
-
var
|
|
888614
|
+
var import_promises99 = require("fs/promises");
|
|
888470
888615
|
var import_path69 = __toESM(require("path"), 1);
|
|
888471
888616
|
var DynamicSnippetsRubyTestGenerator = class {
|
|
888472
888617
|
context;
|
|
@@ -888495,8 +888640,8 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
888495
888640
|
endpointId
|
|
888496
888641
|
});
|
|
888497
888642
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
888498
|
-
await (0,
|
|
888499
|
-
await (0,
|
|
888643
|
+
await (0, import_promises99.mkdir)(import_path69.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
888644
|
+
await (0, import_promises99.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
888500
888645
|
} catch (error50) {
|
|
888501
888646
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
888502
888647
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -888512,7 +888657,7 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
888512
888657
|
};
|
|
888513
888658
|
|
|
888514
888659
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/rust/DynamicSnippetsRustTestGenerator.js
|
|
888515
|
-
var
|
|
888660
|
+
var import_promises100 = require("fs/promises");
|
|
888516
888661
|
var import_node_path24 = __toESM(require("path"), 1);
|
|
888517
888662
|
init_lib6();
|
|
888518
888663
|
|
|
@@ -893746,8 +893891,8 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
893746
893891
|
absolutePathToOutputDir,
|
|
893747
893892
|
idx
|
|
893748
893893
|
});
|
|
893749
|
-
await (0,
|
|
893750
|
-
await (0,
|
|
893894
|
+
await (0, import_promises100.mkdir)(import_node_path24.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
893895
|
+
await (0, import_promises100.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
893751
893896
|
} catch (error50) {
|
|
893752
893897
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
893753
893898
|
}
|
|
@@ -893756,7 +893901,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
893756
893901
|
}
|
|
893757
893902
|
async initializeProject(outputDir) {
|
|
893758
893903
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("dynamic-snippets"));
|
|
893759
|
-
await (0,
|
|
893904
|
+
await (0, import_promises100.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
893760
893905
|
return absolutePathToOutputDir;
|
|
893761
893906
|
}
|
|
893762
893907
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -893765,7 +893910,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
893765
893910
|
};
|
|
893766
893911
|
|
|
893767
893912
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/swift/DynamicSnippetsSwiftTestGenerator.js
|
|
893768
|
-
var
|
|
893913
|
+
var import_promises101 = require("fs/promises");
|
|
893769
893914
|
var import_node_path25 = __toESM(require("path"), 1);
|
|
893770
893915
|
init_lib6();
|
|
893771
893916
|
|
|
@@ -898260,8 +898405,8 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
898260
898405
|
absolutePathToOutputDir,
|
|
898261
898406
|
idx
|
|
898262
898407
|
});
|
|
898263
|
-
await (0,
|
|
898264
|
-
await (0,
|
|
898408
|
+
await (0, import_promises101.mkdir)(import_node_path25.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
898409
|
+
await (0, import_promises101.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
898265
898410
|
} catch (error50) {
|
|
898266
898411
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
898267
898412
|
}
|
|
@@ -898270,7 +898415,7 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
898270
898415
|
}
|
|
898271
898416
|
async initializeProject(outputDir) {
|
|
898272
898417
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Snippets"));
|
|
898273
|
-
await (0,
|
|
898418
|
+
await (0, import_promises101.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
898274
898419
|
return absolutePathToOutputDir;
|
|
898275
898420
|
}
|
|
898276
898421
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -900598,7 +900743,7 @@ var DynamicSnippetsGenerator9 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
900598
900743
|
};
|
|
900599
900744
|
|
|
900600
900745
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/typescript/DynamicSnippetsTypeScriptTestGenerator.js
|
|
900601
|
-
var
|
|
900746
|
+
var import_promises102 = require("fs/promises");
|
|
900602
900747
|
var import_path70 = __toESM(require("path"), 1);
|
|
900603
900748
|
var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
900604
900749
|
context;
|
|
@@ -900627,8 +900772,8 @@ var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
|
900627
900772
|
endpointId
|
|
900628
900773
|
});
|
|
900629
900774
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
900630
|
-
await (0,
|
|
900631
|
-
await (0,
|
|
900775
|
+
await (0, import_promises102.mkdir)(import_path70.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
900776
|
+
await (0, import_promises102.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
900632
900777
|
} catch (error50) {
|
|
900633
900778
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
900634
900779
|
}
|
|
@@ -900727,7 +900872,7 @@ async function generateDynamicSnippetTests({ context: context3, ir: ir15, config
|
|
|
900727
900872
|
// ../generation/local-generation/local-workspace-runner/lib/runGenerator.js
|
|
900728
900873
|
init_lib6();
|
|
900729
900874
|
var import_serialization = __toESM(require_serialization2(), 1);
|
|
900730
|
-
var
|
|
900875
|
+
var import_promises104 = require("fs/promises");
|
|
900731
900876
|
var path70 = __toESM(require("path"), 1);
|
|
900732
900877
|
var import_path72 = require("path");
|
|
900733
900878
|
var import_tmp_promise13 = __toESM(require_tmp_promise(), 1);
|
|
@@ -901594,7 +901739,7 @@ function configureBamlClient(config5) {
|
|
|
901594
901739
|
init_lib4();
|
|
901595
901740
|
init_lib6();
|
|
901596
901741
|
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
901597
|
-
var
|
|
901742
|
+
var import_promises103 = require("fs/promises");
|
|
901598
901743
|
var import_os12 = require("os");
|
|
901599
901744
|
var import_path71 = require("path");
|
|
901600
901745
|
var import_semver13 = __toESM(require_semver2(), 1);
|
|
@@ -901774,7 +901919,7 @@ var LocalTaskHandler = class {
|
|
|
901774
901919
|
try {
|
|
901775
901920
|
this.context.logger.info("Analyzing SDK changes for automatic semantic versioning");
|
|
901776
901921
|
diffFile = await this.generateDiffFile();
|
|
901777
|
-
const diffContent = await (0,
|
|
901922
|
+
const diffContent = await (0, import_promises103.readFile)(diffFile, "utf-8");
|
|
901778
901923
|
if (diffContent.trim().length === 0) {
|
|
901779
901924
|
this.context.logger.info("No changes detected in generated SDK");
|
|
901780
901925
|
return null;
|
|
@@ -901972,7 +902117,7 @@ var LocalTaskHandler = class {
|
|
|
901972
902117
|
} finally {
|
|
901973
902118
|
if (diffFile) {
|
|
901974
902119
|
try {
|
|
901975
|
-
await (0,
|
|
902120
|
+
await (0, import_promises103.rm)(diffFile);
|
|
901976
902121
|
} catch (cleanupError) {
|
|
901977
902122
|
this.context.logger.warn(`Failed to delete temp diff file: ${diffFile}`, String(cleanupError));
|
|
901978
902123
|
}
|
|
@@ -902134,7 +902279,7 @@ var LocalTaskHandler = class {
|
|
|
902134
902279
|
const absolutePathToFernignore = AbsoluteFilePath2.of(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
|
|
902135
902280
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
902136
902281
|
const pathsToPreserve = await this.getPathsToPreserve(fernIgnorePaths);
|
|
902137
|
-
await (0,
|
|
902282
|
+
await (0, import_promises103.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
902138
902283
|
await this.runThrowawayGitCommand(["init"], tmpOutputResolutionDir);
|
|
902139
902284
|
await this.runThrowawayGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
902140
902285
|
await this.runThrowawayGitCommand([
|
|
@@ -902154,17 +902299,17 @@ var LocalTaskHandler = class {
|
|
|
902154
902299
|
await this.runThrowawayGitCommand(["reset", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
902155
902300
|
await this.runThrowawayGitCommand(["clean", "-fd", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
902156
902301
|
await this.runThrowawayGitCommand(["restore", "."], tmpOutputResolutionDir);
|
|
902157
|
-
await (0,
|
|
902158
|
-
await (0,
|
|
902159
|
-
await (0,
|
|
902302
|
+
await (0, import_promises103.rm)(join8(tmpOutputResolutionDir, RelativeFilePath2.of(".git")), { recursive: true });
|
|
902303
|
+
await (0, import_promises103.rm)(this.absolutePathToLocalOutput, { recursive: true });
|
|
902304
|
+
await (0, import_promises103.cp)(tmpOutputResolutionDir, this.absolutePathToLocalOutput, { recursive: true });
|
|
902160
902305
|
}
|
|
902161
902306
|
async copyGeneratedFilesNoFernIgnorePreservingGit() {
|
|
902162
|
-
const contents = await (0,
|
|
902307
|
+
const contents = await (0, import_promises103.readdir)(this.absolutePathToLocalOutput);
|
|
902163
902308
|
const itemsToPreserve = [".git"];
|
|
902164
902309
|
if (await this.generatedOutputMissingReadme()) {
|
|
902165
902310
|
itemsToPreserve.push("README.md");
|
|
902166
902311
|
}
|
|
902167
|
-
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0,
|
|
902312
|
+
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0, import_promises103.rm)(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(item)), {
|
|
902168
902313
|
force: true,
|
|
902169
902314
|
recursive: true
|
|
902170
902315
|
})));
|
|
@@ -902172,11 +902317,11 @@ var LocalTaskHandler = class {
|
|
|
902172
902317
|
}
|
|
902173
902318
|
async copyGeneratedFilesNoFernIgnoreDeleteAll() {
|
|
902174
902319
|
this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
|
|
902175
|
-
await (0,
|
|
902320
|
+
await (0, import_promises103.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
|
|
902176
902321
|
await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
|
|
902177
902322
|
}
|
|
902178
902323
|
async copyGeneratedFilesToDirectory(outputPath) {
|
|
902179
|
-
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0,
|
|
902324
|
+
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises103.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
902180
902325
|
if (firstLocalOutputItem == null) {
|
|
902181
902326
|
return;
|
|
902182
902327
|
}
|
|
@@ -902184,15 +902329,15 @@ var LocalTaskHandler = class {
|
|
|
902184
902329
|
if (firstLocalOutputItem.endsWith(".zip")) {
|
|
902185
902330
|
await (0, import_decompress2.default)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(firstLocalOutputItem)), outputPath);
|
|
902186
902331
|
for (const localOutputItem of remaininglocalOutputItems) {
|
|
902187
|
-
await (0,
|
|
902332
|
+
await (0, import_promises103.cp)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(localOutputItem)), join8(outputPath, RelativeFilePath2.of(localOutputItem)), { recursive: true });
|
|
902188
902333
|
}
|
|
902189
902334
|
} else {
|
|
902190
|
-
await (0,
|
|
902335
|
+
await (0, import_promises103.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true });
|
|
902191
902336
|
}
|
|
902192
902337
|
}
|
|
902193
902338
|
async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
|
|
902194
902339
|
this.context.logger.debug(`Copying generated snippets to ${absolutePathToLocalSnippetJSON}`);
|
|
902195
|
-
await (0,
|
|
902340
|
+
await (0, import_promises103.cp)(absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON);
|
|
902196
902341
|
}
|
|
902197
902342
|
/**
|
|
902198
902343
|
* Checks whether the generated output is missing README.md.
|
|
@@ -902201,7 +902346,7 @@ var LocalTaskHandler = class {
|
|
|
902201
902346
|
*/
|
|
902202
902347
|
async generatedOutputMissingReadme() {
|
|
902203
902348
|
try {
|
|
902204
|
-
const contents = await (0,
|
|
902349
|
+
const contents = await (0, import_promises103.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
902205
902350
|
if (contents.length === 1 && contents[0] != null && contents[0].endsWith(".zip")) {
|
|
902206
902351
|
return false;
|
|
902207
902352
|
}
|
|
@@ -902244,13 +902389,13 @@ var LocalTaskHandler = class {
|
|
|
902244
902389
|
async readPriorChangelog(maxEntries) {
|
|
902245
902390
|
const MAX_CHANGELOG_SIZE = 2048;
|
|
902246
902391
|
try {
|
|
902247
|
-
const files = await (0,
|
|
902392
|
+
const files = await (0, import_promises103.readdir)(this.absolutePathToLocalOutput);
|
|
902248
902393
|
const changelogFile = files.find((f10) => f10.toLowerCase() === "changelog.md");
|
|
902249
902394
|
if (!changelogFile) {
|
|
902250
902395
|
return "";
|
|
902251
902396
|
}
|
|
902252
902397
|
const changelogPath = join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(changelogFile));
|
|
902253
|
-
const content5 = await (0,
|
|
902398
|
+
const content5 = await (0, import_promises103.readFile)(changelogPath, "utf-8");
|
|
902254
902399
|
if (content5.trim().length === 0) {
|
|
902255
902400
|
return "";
|
|
902256
902401
|
}
|
|
@@ -902360,24 +902505,24 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
902360
902505
|
context3.logger.debug("Wrote IR to: " + absolutePathToIr);
|
|
902361
902506
|
const configJsonFile = (0, import_path72.join)(workspaceTempDir.path, GENERATOR_CONFIG_FILENAME);
|
|
902362
902507
|
const absolutePathToWriteConfigJson = AbsoluteFilePath2.of(configJsonFile);
|
|
902363
|
-
await (0,
|
|
902508
|
+
await (0, import_promises104.writeFile)(configJsonFile, "");
|
|
902364
902509
|
context3.logger.debug("Will write config.json to: " + absolutePathToWriteConfigJson);
|
|
902365
902510
|
const tmpOutputDirectory = (0, import_path72.join)(workspaceTempDir.path, CODEGEN_OUTPUT_DIRECTORY_NAME);
|
|
902366
902511
|
const absolutePathToTmpOutputDirectory = AbsoluteFilePath2.of(tmpOutputDirectory);
|
|
902367
|
-
await (0,
|
|
902512
|
+
await (0, import_promises104.mkdir)(tmpOutputDirectory, { recursive: true });
|
|
902368
902513
|
context3.logger.debug("Will write output to: " + absolutePathToTmpOutputDirectory);
|
|
902369
902514
|
let absolutePathToTmpSnippetJSON = void 0;
|
|
902370
902515
|
if (absolutePathToLocalSnippetJSON != null) {
|
|
902371
902516
|
const snippetJsonFile = (0, import_path72.join)(workspaceTempDir.path, "snippet.json");
|
|
902372
902517
|
absolutePathToTmpSnippetJSON = AbsoluteFilePath2.of(snippetJsonFile);
|
|
902373
|
-
await (0,
|
|
902518
|
+
await (0, import_promises104.writeFile)(snippetJsonFile, "");
|
|
902374
902519
|
context3.logger.debug("Will write snippet.json to: " + absolutePathToTmpSnippetJSON);
|
|
902375
902520
|
}
|
|
902376
902521
|
let absolutePathToTmpSnippetTemplatesJSON = void 0;
|
|
902377
902522
|
if (absolutePathToLocalSnippetTemplateJSON != null) {
|
|
902378
902523
|
const snippetTemplatesJsonFile = (0, import_path72.join)(workspaceTempDir.path, SNIPPET_TEMPLATES_JSON_FILENAME);
|
|
902379
902524
|
absolutePathToTmpSnippetTemplatesJSON = AbsoluteFilePath2.of(snippetTemplatesJsonFile);
|
|
902380
|
-
await (0,
|
|
902525
|
+
await (0, import_promises104.writeFile)(snippetTemplatesJsonFile, "");
|
|
902381
902526
|
context3.logger.debug("Will write snippet-templates.json to: " + absolutePathToTmpSnippetTemplatesJSON);
|
|
902382
902527
|
}
|
|
902383
902528
|
const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
|
|
@@ -902416,7 +902561,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
902416
902561
|
publishToRegistry,
|
|
902417
902562
|
paths
|
|
902418
902563
|
});
|
|
902419
|
-
await (0,
|
|
902564
|
+
await (0, import_promises104.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(await import_serialization.GeneratorConfig.jsonOrThrow(config5), void 0, 4));
|
|
902420
902565
|
const absolutePathToLicenseFile = extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig);
|
|
902421
902566
|
const sourceMounts = workspace.getSources().filter((source2) => source2.type === "protobuf").map((source2) => ({
|
|
902422
902567
|
hostPath: source2.absoluteFilePath,
|
|
@@ -903040,13 +903185,13 @@ var GenerationRunner = class {
|
|
|
903040
903185
|
};
|
|
903041
903186
|
|
|
903042
903187
|
// ../cli-v2/lib/sdk/generator/LegacyLocalGenerationRunner.js
|
|
903043
|
-
var
|
|
903188
|
+
var import_promises106 = require("fs/promises");
|
|
903044
903189
|
|
|
903045
903190
|
// ../cli-v2/lib/sdk/adapter/LegacyGeneratorInvocationAdapter.js
|
|
903046
903191
|
init_lib4();
|
|
903047
903192
|
init_lib6();
|
|
903048
903193
|
init_lib7();
|
|
903049
|
-
var
|
|
903194
|
+
var import_promises105 = require("fs/promises");
|
|
903050
903195
|
var LegacyGeneratorInvocationAdapter = class {
|
|
903051
903196
|
context;
|
|
903052
903197
|
constructor(config5) {
|
|
@@ -903286,7 +903431,7 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
903286
903431
|
if (!await doesPathExist(absolutePath, "file")) {
|
|
903287
903432
|
throw new Error(`Custom license file "${absolutePath}" does not exist; did you mean to use either MIT or Apache-2.0?`);
|
|
903288
903433
|
}
|
|
903289
|
-
const contents = await (0,
|
|
903434
|
+
const contents = await (0, import_promises105.readFile)(absolutePath, "utf-8");
|
|
903290
903435
|
return api_exports5.GithubLicense.custom({ contents });
|
|
903291
903436
|
}
|
|
903292
903437
|
buildReadme(target) {
|
|
@@ -903510,7 +903655,7 @@ var LegacyLocalGenerationRunner = class {
|
|
|
903510
903655
|
});
|
|
903511
903656
|
if (args.target.output.path != null && generatorInvocation.absolutePathToLocalOutput != null) {
|
|
903512
903657
|
const snippetPath = join8(generatorInvocation.absolutePathToLocalOutput, RelativeFilePath2.of(SNIPPET_JSON_FILENAME));
|
|
903513
|
-
await (0,
|
|
903658
|
+
await (0, import_promises106.rm)(snippetPath, { force: true });
|
|
903514
903659
|
}
|
|
903515
903660
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
903516
903661
|
return {
|
|
@@ -903527,7 +903672,7 @@ var LegacyLocalGenerationRunner = class {
|
|
|
903527
903672
|
// ../cli-v2/lib/sdk/generator/LegacyRemoteGenerationRunner.js
|
|
903528
903673
|
init_lib4();
|
|
903529
903674
|
init_lib6();
|
|
903530
|
-
var
|
|
903675
|
+
var import_promises107 = require("fs/promises");
|
|
903531
903676
|
var import_os14 = require("os");
|
|
903532
903677
|
var LegacyRemoteGenerationRunner = class {
|
|
903533
903678
|
context;
|
|
@@ -903582,13 +903727,13 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
903582
903727
|
const previewOutputDirectory = join8(absolutePathToPreview, RelativeFilePath2.of(generatorName));
|
|
903583
903728
|
const targetOutputDirectory = generatorInvocation.absolutePathToLocalOutput;
|
|
903584
903729
|
if (targetOutputDirectory != null) {
|
|
903585
|
-
await (0,
|
|
903586
|
-
await (0,
|
|
903730
|
+
await (0, import_promises107.cp)(previewOutputDirectory, targetOutputDirectory, { recursive: true });
|
|
903731
|
+
await (0, import_promises107.rm)(join8(targetOutputDirectory, RelativeFilePath2.of(".git")), {
|
|
903587
903732
|
recursive: true,
|
|
903588
903733
|
force: true
|
|
903589
903734
|
});
|
|
903590
903735
|
}
|
|
903591
|
-
await (0,
|
|
903736
|
+
await (0, import_promises107.rm)(absolutePathToPreview, { recursive: true, force: true });
|
|
903592
903737
|
}
|
|
903593
903738
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
903594
903739
|
return {
|
|
@@ -903617,7 +903762,7 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
903617
903762
|
}
|
|
903618
903763
|
async getAbsolutePathToPreview(args) {
|
|
903619
903764
|
if (this.isLocalGitCombo(args)) {
|
|
903620
|
-
const tmpPreviewDirectory = await (0,
|
|
903765
|
+
const tmpPreviewDirectory = await (0, import_promises107.mkdtemp)(join8(AbsoluteFilePath2.of((0, import_os14.tmpdir)()), RelativeFilePath2.of("fern-preview-")));
|
|
903621
903766
|
return AbsoluteFilePath2.of(tmpPreviewDirectory);
|
|
903622
903767
|
}
|
|
903623
903768
|
if (!args.preview) {
|
|
@@ -903966,7 +904111,8 @@ var GenerateCommand = class {
|
|
|
903966
904111
|
org: args.org
|
|
903967
904112
|
};
|
|
903968
904113
|
}
|
|
903969
|
-
const targets2 = this.getTargets({
|
|
904114
|
+
const targets2 = await this.getTargets({
|
|
904115
|
+
context: context3,
|
|
903970
904116
|
workspace: workspaceWithOverrides,
|
|
903971
904117
|
args,
|
|
903972
904118
|
groupName: args.target != null ? void 0 : args.group ?? workspaceWithOverrides.sdks?.defaultGroup
|
|
@@ -903999,10 +904145,13 @@ var GenerateCommand = class {
|
|
|
903999
904145
|
code: CliError.Code.ConfigError
|
|
904000
904146
|
});
|
|
904001
904147
|
}
|
|
904002
|
-
|
|
904003
|
-
|
|
904004
|
-
|
|
904005
|
-
|
|
904148
|
+
if (args.api == null || args.target == null || args.org == null || args.output == null) {
|
|
904149
|
+
throw new CliError({
|
|
904150
|
+
message: "Internal error: required flags missing",
|
|
904151
|
+
code: CliError.Code.InternalError
|
|
904152
|
+
});
|
|
904153
|
+
}
|
|
904154
|
+
const { api, target, org, output: output2 } = args;
|
|
904006
904155
|
const resolver2 = new ApiSpecResolver({ context: context3 });
|
|
904007
904156
|
const resolvedSpec = await resolver2.resolve({
|
|
904008
904157
|
reference: api
|
|
@@ -904251,19 +904400,70 @@ Example:
|
|
|
904251
904400
|
}
|
|
904252
904401
|
return { path: args.output };
|
|
904253
904402
|
}
|
|
904254
|
-
getTargets({ workspace, args, groupName }) {
|
|
904403
|
+
async getTargets({ context: context3, workspace, args, groupName }) {
|
|
904255
904404
|
let matched = workspace.sdks != null ? this.filterTargetsByGroup(workspace.sdks.targets, groupName) : [];
|
|
904256
904405
|
if (args.target != null) {
|
|
904257
904406
|
matched = matched.filter((t3) => t3.name === args.target);
|
|
904258
904407
|
if (matched.length === 0) {
|
|
904259
|
-
|
|
904408
|
+
const allTargets = workspace.sdks?.targets ?? [];
|
|
904409
|
+
const available = allTargets.map((t3) => t3.name);
|
|
904410
|
+
if (available.length > 0) {
|
|
904411
|
+
throw new CliError({
|
|
904412
|
+
message: `Target '${args.target}' not found. Available targets: ${available.join(", ")}`,
|
|
904413
|
+
code: CliError.Code.ConfigError
|
|
904414
|
+
});
|
|
904415
|
+
} else {
|
|
904416
|
+
throw new CliError({
|
|
904417
|
+
message: `Target '${args.target}' not found`,
|
|
904418
|
+
code: CliError.Code.ConfigError
|
|
904419
|
+
});
|
|
904420
|
+
}
|
|
904260
904421
|
}
|
|
904261
904422
|
}
|
|
904262
904423
|
if (matched.length === 0) {
|
|
904263
904424
|
if (groupName != null) {
|
|
904264
|
-
throw new
|
|
904425
|
+
throw new CliError({
|
|
904426
|
+
message: `No targets found for group '${groupName}'`,
|
|
904427
|
+
code: CliError.Code.ConfigError
|
|
904428
|
+
});
|
|
904429
|
+
}
|
|
904430
|
+
throw new CliError({
|
|
904431
|
+
message: "No targets configured in fern.yml",
|
|
904432
|
+
code: CliError.Code.ConfigError
|
|
904433
|
+
});
|
|
904434
|
+
}
|
|
904435
|
+
if (groupName == null && args.target == null && matched.length > 1) {
|
|
904436
|
+
const allGroups = this.collectGroups(matched);
|
|
904437
|
+
if (allGroups.length > 1) {
|
|
904438
|
+
const selectedGroup = await promptSelect({
|
|
904439
|
+
isTTY: context3.isTTY,
|
|
904440
|
+
message: "Multiple SDK groups found. Select one:",
|
|
904441
|
+
choices: [
|
|
904442
|
+
{ name: `all (${matched.length} targets)`, value: void 0 },
|
|
904443
|
+
...allGroups.map((g19) => ({ name: g19, value: g19 }))
|
|
904444
|
+
],
|
|
904445
|
+
nonInteractiveError: `Multiple SDK groups found: ${allGroups.join(", ")}. Use --group to select one.`,
|
|
904446
|
+
flagHint: (value) => value != null ? `--group ${value}` : void 0
|
|
904447
|
+
});
|
|
904448
|
+
if (selectedGroup != null) {
|
|
904449
|
+
matched = this.filterTargetsByGroup(matched, selectedGroup);
|
|
904450
|
+
}
|
|
904451
|
+
} else {
|
|
904452
|
+
const targetNames = matched.map((t3) => t3.name);
|
|
904453
|
+
const selectedTarget = await promptSelect({
|
|
904454
|
+
isTTY: context3.isTTY,
|
|
904455
|
+
message: "Multiple SDK targets found. Select one:",
|
|
904456
|
+
choices: [
|
|
904457
|
+
{ name: `all (${matched.length} targets)`, value: void 0 },
|
|
904458
|
+
...targetNames.map((name2) => ({ name: name2, value: name2 }))
|
|
904459
|
+
],
|
|
904460
|
+
nonInteractiveError: `Multiple SDK targets found: ${targetNames.join(", ")}. Use --target to select one.`,
|
|
904461
|
+
flagHint: (value) => value != null ? `--target ${value}` : void 0
|
|
904462
|
+
});
|
|
904463
|
+
if (selectedTarget != null) {
|
|
904464
|
+
matched = matched.filter((t3) => t3.name === selectedTarget);
|
|
904465
|
+
}
|
|
904265
904466
|
}
|
|
904266
|
-
throw new Error("No targets configured in fern.yml");
|
|
904267
904467
|
}
|
|
904268
904468
|
return matched.map((target) => ({
|
|
904269
904469
|
...target,
|
|
@@ -904271,6 +904471,17 @@ Example:
|
|
|
904271
904471
|
output: args.output != null ? this.parseTargetOutput(args) : target.output
|
|
904272
904472
|
}));
|
|
904273
904473
|
}
|
|
904474
|
+
collectGroups(targets2) {
|
|
904475
|
+
const groups2 = /* @__PURE__ */ new Set();
|
|
904476
|
+
for (const target of targets2) {
|
|
904477
|
+
if (target.groups != null) {
|
|
904478
|
+
for (const group of target.groups) {
|
|
904479
|
+
groups2.add(group);
|
|
904480
|
+
}
|
|
904481
|
+
}
|
|
904482
|
+
}
|
|
904483
|
+
return [...groups2].sort();
|
|
904484
|
+
}
|
|
904274
904485
|
async checkOutputDirectory({ context: context3, args, outputPath }) {
|
|
904275
904486
|
if (args.force || !context3.isTTY) {
|
|
904276
904487
|
return { shouldProceed: true };
|
|
@@ -904279,7 +904490,7 @@ Example:
|
|
|
904279
904490
|
if (!exists2) {
|
|
904280
904491
|
return { shouldProceed: true };
|
|
904281
904492
|
}
|
|
904282
|
-
const files = await (0,
|
|
904493
|
+
const files = await (0, import_promises108.readdir)(outputPath);
|
|
904283
904494
|
if (files.length === 0) {
|
|
904284
904495
|
return { shouldProceed: true };
|
|
904285
904496
|
}
|
|
@@ -904300,11 +904511,13 @@ Example:
|
|
|
904300
904511
|
return targets2.filter((target) => target.groups?.includes(groupName));
|
|
904301
904512
|
}
|
|
904302
904513
|
resolveLanguage(target) {
|
|
904303
|
-
|
|
904304
|
-
|
|
904305
|
-
return lang;
|
|
904514
|
+
if (isLanguage(target)) {
|
|
904515
|
+
return target;
|
|
904306
904516
|
}
|
|
904307
|
-
throw new
|
|
904517
|
+
throw new CliError({
|
|
904518
|
+
message: `"${target}" is not a supported language. Supported: ${LANGUAGES.join(", ")}`,
|
|
904519
|
+
code: CliError.Code.ConfigError
|
|
904520
|
+
});
|
|
904308
904521
|
}
|
|
904309
904522
|
parseAudiences(audiences) {
|
|
904310
904523
|
if (audiences == null || audiences.length === 0) {
|
|
@@ -904356,6 +904569,9 @@ Example:
|
|
|
904356
904569
|
return text9.trimEnd().split("\n").map((line) => line.length > 0 ? ` ${line}` : line).join("\n");
|
|
904357
904570
|
}
|
|
904358
904571
|
};
|
|
904572
|
+
function isLanguage(target) {
|
|
904573
|
+
return LANGUAGES.includes(target);
|
|
904574
|
+
}
|
|
904359
904575
|
function addGenerateCommand(cli) {
|
|
904360
904576
|
const cmd = new GenerateCommand();
|
|
904361
904577
|
command2(cli, "generate", "Generate SDKs from fern.yml or directly from an API spec", async (context3, args) => {
|
|
@@ -904505,7 +904721,7 @@ init_lib4();
|
|
|
904505
904721
|
// ../cli-v2/lib/sdk/updater/GeneratorMigrator.js
|
|
904506
904722
|
init_lib4();
|
|
904507
904723
|
var import_fs29 = require("fs");
|
|
904508
|
-
var
|
|
904724
|
+
var import_promises109 = require("fs/promises");
|
|
904509
904725
|
var import_path75 = require("path");
|
|
904510
904726
|
var import_semver14 = __toESM(require_semver2(), 1);
|
|
904511
904727
|
var import_url8 = require("url");
|
|
@@ -904615,7 +904831,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
904615
904831
|
}
|
|
904616
904832
|
this.migrationsInstallPromise = (async () => {
|
|
904617
904833
|
const cacheDir = this.cachePath;
|
|
904618
|
-
await (0,
|
|
904834
|
+
await (0, import_promises109.mkdir)(cacheDir, { recursive: true });
|
|
904619
904835
|
const npmCacheDir = (0, import_path75.join)(cacheDir, ".npm-cache");
|
|
904620
904836
|
const packageDir = (0, import_path75.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME);
|
|
904621
904837
|
const packageJsonPath = (0, import_path75.join)(packageDir, "package.json");
|
|
@@ -904632,7 +904848,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
904632
904848
|
"--no-audit",
|
|
904633
904849
|
"--no-fund"
|
|
904634
904850
|
], { doNotPipeOutput: true });
|
|
904635
|
-
const packageJsonContent = await (0,
|
|
904851
|
+
const packageJsonContent = await (0, import_promises109.readFile)(packageJsonPath, "utf-8");
|
|
904636
904852
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
904637
904853
|
if (packageJson2.main == null) {
|
|
904638
904854
|
throw new Error(`No main field found in package.json for ${MIGRATION_PACKAGE_NAME}`);
|
|
@@ -904674,7 +904890,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
904674
904890
|
const myPid = String(process.pid);
|
|
904675
904891
|
while (true) {
|
|
904676
904892
|
try {
|
|
904677
|
-
const fh = await (0,
|
|
904893
|
+
const fh = await (0, import_promises109.open)(lockPath, "wx");
|
|
904678
904894
|
await fh.writeFile(myPid);
|
|
904679
904895
|
await fh.close();
|
|
904680
904896
|
const exitHandler = () => {
|
|
@@ -904691,9 +904907,9 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
904691
904907
|
return async () => {
|
|
904692
904908
|
process.removeListener("exit", exitHandler);
|
|
904693
904909
|
try {
|
|
904694
|
-
const currentContent = await (0,
|
|
904910
|
+
const currentContent = await (0, import_promises109.readFile)(lockPath, "utf-8");
|
|
904695
904911
|
if (currentContent.trim() === myPid) {
|
|
904696
|
-
await (0,
|
|
904912
|
+
await (0, import_promises109.unlink)(lockPath);
|
|
904697
904913
|
} else {
|
|
904698
904914
|
logger4.debug(`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`);
|
|
904699
904915
|
}
|
|
@@ -904707,14 +904923,14 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
904707
904923
|
throw err;
|
|
904708
904924
|
}
|
|
904709
904925
|
try {
|
|
904710
|
-
const lockContent = await (0,
|
|
904926
|
+
const lockContent = await (0, import_promises109.readFile)(lockPath, "utf-8");
|
|
904711
904927
|
const lockPid = Number(lockContent.trim());
|
|
904712
|
-
const lockStat = await (0,
|
|
904928
|
+
const lockStat = await (0, import_promises109.stat)(lockPath);
|
|
904713
904929
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
904714
904930
|
if (lockAge > _GeneratorMigrator.LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !_GeneratorMigrator.isProcessAlive(lockPid)) {
|
|
904715
904931
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
904716
904932
|
try {
|
|
904717
|
-
await (0,
|
|
904933
|
+
await (0, import_promises109.unlink)(lockPath);
|
|
904718
904934
|
} catch (unlinkErr) {
|
|
904719
904935
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
904720
904936
|
}
|
|
@@ -905189,13 +905405,13 @@ var import_generator_cli2 = __toESM(require_api4(), 1);
|
|
|
905189
905405
|
|
|
905190
905406
|
// ../init/lib/initializeAPI.js
|
|
905191
905407
|
init_lib6();
|
|
905192
|
-
var
|
|
905408
|
+
var import_promises113 = require("fs/promises");
|
|
905193
905409
|
var import_fs_extra = __toESM(require_lib19(), 1);
|
|
905194
905410
|
var import_path76 = __toESM(require("path"), 1);
|
|
905195
905411
|
|
|
905196
905412
|
// ../init/lib/createFernDirectoryAndOrganization.js
|
|
905197
905413
|
init_lib6();
|
|
905198
|
-
var
|
|
905414
|
+
var import_promises110 = require("fs/promises");
|
|
905199
905415
|
init_lodash();
|
|
905200
905416
|
var GITIGNORE_CONTENT = "**/.preview\n**/.definition\n";
|
|
905201
905417
|
async function createFernDirectoryAndWorkspace({ organization, taskContext, versionOfCli }) {
|
|
@@ -905225,7 +905441,7 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
|
|
|
905225
905441
|
}
|
|
905226
905442
|
}
|
|
905227
905443
|
}
|
|
905228
|
-
await (0,
|
|
905444
|
+
await (0, import_promises110.mkdir)(FERN_DIRECTORY);
|
|
905229
905445
|
await writeProjectConfig({
|
|
905230
905446
|
filepath: join8(pathToFernDirectory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)),
|
|
905231
905447
|
organization,
|
|
@@ -905249,11 +905465,11 @@ async function writeProjectConfig({ organization, filepath, versionOfCli }) {
|
|
|
905249
905465
|
organization,
|
|
905250
905466
|
version: versionOfCli
|
|
905251
905467
|
};
|
|
905252
|
-
await (0,
|
|
905468
|
+
await (0, import_promises110.writeFile)(filepath, JSON.stringify(projectConfig, void 0, 4));
|
|
905253
905469
|
}
|
|
905254
905470
|
async function writeGitignore({ absolutePathToFernDirectory }) {
|
|
905255
905471
|
const gitignorePath = join8(absolutePathToFernDirectory, RelativeFilePath2.of(".gitignore"));
|
|
905256
|
-
await (0,
|
|
905472
|
+
await (0, import_promises110.writeFile)(gitignorePath, GITIGNORE_CONTENT);
|
|
905257
905473
|
}
|
|
905258
905474
|
|
|
905259
905475
|
// ../fern-definition/formatter/lib/FernDefinitionFileFormatter.js
|
|
@@ -905442,7 +905658,7 @@ async function formatDefinitionFile({ fileContents }) {
|
|
|
905442
905658
|
|
|
905443
905659
|
// ../fern-definition/formatter/lib/formatWorkspace.js
|
|
905444
905660
|
init_lib4();
|
|
905445
|
-
var
|
|
905661
|
+
var import_promises111 = require("fs/promises");
|
|
905446
905662
|
async function formatFernWorkspace({ workspace, context: context3, shouldFix }) {
|
|
905447
905663
|
for (const [relativeFilepath, file4] of entries(workspace.definition.namedDefinitionFiles)) {
|
|
905448
905664
|
const formatted = await formatDefinitionFile({
|
|
@@ -905450,7 +905666,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
905450
905666
|
});
|
|
905451
905667
|
if (formatted !== file4.rawContents) {
|
|
905452
905668
|
if (shouldFix) {
|
|
905453
|
-
await (0,
|
|
905669
|
+
await (0, import_promises111.writeFile)(file4.absoluteFilePath, formatted);
|
|
905454
905670
|
context3.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
|
|
905455
905671
|
} else {
|
|
905456
905672
|
context3.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
|
|
@@ -905462,7 +905678,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
905462
905678
|
|
|
905463
905679
|
// ../init/lib/createWorkspace.js
|
|
905464
905680
|
init_lib6();
|
|
905465
|
-
var
|
|
905681
|
+
var import_promises112 = require("fs/promises");
|
|
905466
905682
|
|
|
905467
905683
|
// ../init/lib/sampleImdbApi.js
|
|
905468
905684
|
var SAMPLE_IMDB_API = `
|
|
@@ -905662,7 +905878,7 @@ components:
|
|
|
905662
905878
|
// ../init/lib/createWorkspace.js
|
|
905663
905879
|
async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context: context3, apiName = "api" }) {
|
|
905664
905880
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
905665
|
-
await (0,
|
|
905881
|
+
await (0, import_promises112.mkdir)(directoryOfWorkspace);
|
|
905666
905882
|
}
|
|
905667
905883
|
await writeGeneratorsConfiguration({
|
|
905668
905884
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -905677,7 +905893,7 @@ async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context:
|
|
|
905677
905893
|
}
|
|
905678
905894
|
async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, cliVersion, context: context3 }) {
|
|
905679
905895
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
905680
|
-
await (0,
|
|
905896
|
+
await (0, import_promises112.mkdir)(directoryOfWorkspace);
|
|
905681
905897
|
}
|
|
905682
905898
|
await writeGeneratorsConfiguration({
|
|
905683
905899
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -905690,10 +905906,10 @@ async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, c
|
|
|
905690
905906
|
}
|
|
905691
905907
|
async function createDefaultOpenAPIWorkspace({ directoryOfWorkspace, cliVersion, context: context3 }) {
|
|
905692
905908
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
905693
|
-
await (0,
|
|
905909
|
+
await (0, import_promises112.mkdir)(directoryOfWorkspace, { recursive: true });
|
|
905694
905910
|
}
|
|
905695
905911
|
const openApiFilePath = join8(directoryOfWorkspace, RelativeFilePath2.of("openapi.yml"));
|
|
905696
|
-
await (0,
|
|
905912
|
+
await (0, import_promises112.writeFile)(openApiFilePath, SAMPLE_OPENAPI);
|
|
905697
905913
|
await writeGeneratorsConfiguration({
|
|
905698
905914
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
905699
905915
|
cliVersion,
|
|
@@ -905738,7 +905954,7 @@ async function getDefaultGeneratorsConfiguration({ cliVersion, context: context3
|
|
|
905738
905954
|
return config5;
|
|
905739
905955
|
}
|
|
905740
905956
|
async function writeGeneratorsConfiguration({ filepath, cliVersion, context: context3, apiConfiguration }) {
|
|
905741
|
-
await (0,
|
|
905957
|
+
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
905958
|
sortKeys: (a10, b19) => {
|
|
905743
905959
|
if (a10 === "api") {
|
|
905744
905960
|
return -1;
|
|
@@ -905757,10 +905973,10 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
905757
905973
|
strategy: "status-code"
|
|
905758
905974
|
}
|
|
905759
905975
|
};
|
|
905760
|
-
await (0,
|
|
905761
|
-
await (0,
|
|
905976
|
+
await (0, import_promises112.mkdir)(directoryOfDefinition);
|
|
905977
|
+
await (0, import_promises112.writeFile)(join8(directoryOfDefinition, RelativeFilePath2.of(ROOT_API_FILENAME)), jsYaml.dump(rootApi));
|
|
905762
905978
|
const absoluteFilepathToImdbYaml = join8(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
|
|
905763
|
-
await (0,
|
|
905979
|
+
await (0, import_promises112.writeFile)(absoluteFilepathToImdbYaml, await formatDefinitionFile({
|
|
905764
905980
|
fileContents: SAMPLE_IMDB_API
|
|
905765
905981
|
}));
|
|
905766
905982
|
}
|
|
@@ -905813,7 +906029,7 @@ async function getDirectoryOfNewAPIWorkspace({ absolutePathToFernDirectory, task
|
|
|
905813
906029
|
if (inlinedApiDefinition || inlinedOpenApiWorkspace) {
|
|
905814
906030
|
taskContext.logger.info("Creating workspaces to support multiple API Definitions.");
|
|
905815
906031
|
const apiWorkspaceDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api"));
|
|
905816
|
-
await (0,
|
|
906032
|
+
await (0, import_promises113.mkdir)(apiWorkspaceDirectory, { recursive: true });
|
|
905817
906033
|
if (inlinedApiDefinition) {
|
|
905818
906034
|
const inlinedDefinitionDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
905819
906035
|
const workspaceDefinitionDirectory = join8(apiWorkspaceDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
@@ -905850,7 +906066,7 @@ async function hasInlinedOpenAPIWorkspace({ absolutePathToFernDirectory }) {
|
|
|
905850
906066
|
// ../init/lib/initializeDocs.js
|
|
905851
906067
|
init_lib4();
|
|
905852
906068
|
init_lib6();
|
|
905853
|
-
var
|
|
906069
|
+
var import_promises114 = require("fs/promises");
|
|
905854
906070
|
async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
905855
906071
|
const createDirectoryResponse = await createFernDirectoryAndWorkspace({
|
|
905856
906072
|
organization,
|
|
@@ -905865,7 +906081,7 @@ async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
|
905865
906081
|
} else {
|
|
905866
906082
|
try {
|
|
905867
906083
|
const docsConfig = getDocsConfig(createDirectoryResponse.organization);
|
|
905868
|
-
await (0,
|
|
906084
|
+
await (0, import_promises114.writeFile)(docsYmlPath, jsYaml.dump(docsConfig));
|
|
905869
906085
|
taskContext.logger.info(source_default.green("Created docs configuration"));
|
|
905870
906086
|
return;
|
|
905871
906087
|
} catch (writeError) {
|
|
@@ -905920,7 +906136,7 @@ var FernDocsBuilder = class {
|
|
|
905920
906136
|
|
|
905921
906137
|
// ../docs-importers/commons/lib/FernDocsBuilderImpl.js
|
|
905922
906138
|
init_lib6();
|
|
905923
|
-
var
|
|
906139
|
+
var import_promises115 = require("fs/promises");
|
|
905924
906140
|
var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
905925
906141
|
openApiSpecs = {};
|
|
905926
906142
|
nonTabbedNavigation = new NonTabbedNavigationBuilderImpl();
|
|
@@ -905979,7 +906195,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
905979
906195
|
}
|
|
905980
906196
|
async build({ outputDirectory }) {
|
|
905981
906197
|
const absolutePathToFernDirectory = join8(outputDirectory, RelativeFilePath2.of(FERN_DIRECTORY));
|
|
905982
|
-
await (0,
|
|
906198
|
+
await (0, import_promises115.mkdir)(absolutePathToFernDirectory, { recursive: true });
|
|
905983
906199
|
if (Object.keys(this.tabbedNavigation).length > 0) {
|
|
905984
906200
|
this.docsYml.tabs = Object.fromEntries(Object.entries(this.tabbedNavigation).map(([key2, value]) => {
|
|
905985
906201
|
return [value.tabId, value.tabConfig];
|
|
@@ -906004,27 +906220,27 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
906004
906220
|
}))
|
|
906005
906221
|
};
|
|
906006
906222
|
}
|
|
906007
|
-
await (0,
|
|
906223
|
+
await (0, import_promises115.writeFile)(join8(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)), jsYaml.dump(generators_yml_exports.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml)));
|
|
906008
906224
|
await Promise.all(Object.entries(this.openApiSpecs).map(async ([relativePath, absolutePath]) => {
|
|
906009
906225
|
const absolutePathToOpenAPI = join8(absolutePathToFernDirectory, RelativeFilePath2.of(relativePath));
|
|
906010
|
-
await (0,
|
|
906011
|
-
await (0,
|
|
906226
|
+
await (0, import_promises115.mkdir)(dirname6(absolutePathToOpenAPI), { recursive: true });
|
|
906227
|
+
await (0, import_promises115.cp)(absolutePath, absolutePathToOpenAPI);
|
|
906012
906228
|
}));
|
|
906013
906229
|
}
|
|
906014
|
-
await (0,
|
|
906230
|
+
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
906231
|
await Promise.all(Object.entries(this.markdownPages).map(async ([filepath, page]) => {
|
|
906016
906232
|
const absoluteFilepathToMarkdownPage = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
906017
|
-
await (0,
|
|
906233
|
+
await (0, import_promises115.mkdir)(dirname6(absoluteFilepathToMarkdownPage), { recursive: true });
|
|
906018
906234
|
const frontmatter = Object.keys(page.frontmatter).length > 0 ? `---
|
|
906019
906235
|
${jsYaml.dump(JSON.parse(JSON.stringify(page.frontmatter)))}---
|
|
906020
906236
|
|
|
906021
906237
|
` : "";
|
|
906022
|
-
await (0,
|
|
906238
|
+
await (0, import_promises115.writeFile)(absoluteFilepathToMarkdownPage, `${frontmatter}${page.markdown}`);
|
|
906023
906239
|
}));
|
|
906024
906240
|
await Promise.all(Object.entries(this.assets).map(async ([filepath, asset]) => {
|
|
906025
906241
|
const absolutePathToAsset = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
906026
|
-
await (0,
|
|
906027
|
-
await (0,
|
|
906242
|
+
await (0, import_promises115.mkdir)(dirname6(absolutePathToAsset), { recursive: true });
|
|
906243
|
+
await (0, import_promises115.cp)(asset.absoluteFilePathToAsset, absolutePathToAsset);
|
|
906028
906244
|
}));
|
|
906029
906245
|
}
|
|
906030
906246
|
setInstance({ companyName }) {
|
|
@@ -906057,7 +906273,7 @@ var NonTabbedNavigationBuilderImpl = class {
|
|
|
906057
906273
|
|
|
906058
906274
|
// ../docs-importers/mintlify/lib/MintlifyImporter.js
|
|
906059
906275
|
init_lib6();
|
|
906060
|
-
var
|
|
906276
|
+
var import_promises117 = require("fs/promises");
|
|
906061
906277
|
|
|
906062
906278
|
// ../docs-importers/mintlify/lib/convertColors.js
|
|
906063
906279
|
function convertColors(colors19) {
|
|
@@ -906118,10 +906334,10 @@ init_lib6();
|
|
|
906118
906334
|
|
|
906119
906335
|
// ../docs-importers/mintlify/lib/convertMarkdown.js
|
|
906120
906336
|
init_lib6();
|
|
906121
|
-
var
|
|
906337
|
+
var import_promises116 = require("fs/promises");
|
|
906122
906338
|
var import_gray_matter9 = __toESM(require_gray_matter(), 1);
|
|
906123
906339
|
async function convertMarkdown({ absolutePathToMintJson, absoluteFilepathToMarkdown, relativeFilepathFromRoot, builder }) {
|
|
906124
|
-
const text9 = await (0,
|
|
906340
|
+
const text9 = await (0, import_promises116.readFile)(absoluteFilepathToMarkdown, "utf-8");
|
|
906125
906341
|
const { data: data2, content: content5 } = parseMintlifyFrontmatter(text9);
|
|
906126
906342
|
const slug = relativeFilepathFromRoot.replace(/\.(md|mdx)$/, "");
|
|
906127
906343
|
const transformedContent = markReferencedAssets({
|
|
@@ -906284,7 +906500,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
906284
906500
|
documentationTab = void 0;
|
|
906285
906501
|
tabUrlToInfo = {};
|
|
906286
906502
|
async import({ args, builder }) {
|
|
906287
|
-
const mintJsonContent = await (0,
|
|
906503
|
+
const mintJsonContent = await (0, import_promises117.readFile)(args.absolutePathToMintJson, "utf-8");
|
|
906288
906504
|
const mint = JSON.parse(mintJsonContent);
|
|
906289
906505
|
builder.setTitle({ title: mint.name });
|
|
906290
906506
|
const relativePathToFavicon = RelativeFilePath2.of(mint.favicon.substring(1));
|
|
@@ -906410,7 +906626,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
906410
906626
|
|
|
906411
906627
|
// ../docs-importers/mintlify/lib/runMintlifyMigration.js
|
|
906412
906628
|
init_lib6();
|
|
906413
|
-
var
|
|
906629
|
+
var import_promises118 = require("fs/promises");
|
|
906414
906630
|
async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskContext, versionOfCli, organization }) {
|
|
906415
906631
|
const mintlifyImporter = new MintlifyImporter({
|
|
906416
906632
|
context: taskContext
|
|
@@ -906421,7 +906637,7 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
|
|
|
906421
906637
|
builder
|
|
906422
906638
|
});
|
|
906423
906639
|
await builder.build({ outputDirectory: outputPath });
|
|
906424
|
-
await (0,
|
|
906640
|
+
await (0, import_promises118.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
906425
906641
|
version: versionOfCli,
|
|
906426
906642
|
organization
|
|
906427
906643
|
}, void 0, 4));
|
|
@@ -906475,7 +906691,7 @@ function assertIsStringArray(val) {
|
|
|
906475
906691
|
// ../docs-importers/readme/lib/ReadmeImporter.js
|
|
906476
906692
|
init_lib4();
|
|
906477
906693
|
init_lib6();
|
|
906478
|
-
var
|
|
906694
|
+
var import_promises123 = require("fs/promises");
|
|
906479
906695
|
|
|
906480
906696
|
// ../docs-importers/readme/lib/extract/favicon.js
|
|
906481
906697
|
async function getFavicon(hast) {
|
|
@@ -917893,7 +918109,7 @@ init_disposable();
|
|
|
917893
918109
|
init_incremental_id_generator();
|
|
917894
918110
|
|
|
917895
918111
|
// ../../../node_modules/.pnpm/puppeteer-core@24.40.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js
|
|
917896
|
-
var
|
|
918112
|
+
var import_promises121 = require("fs/promises");
|
|
917897
918113
|
var import_node_os11 = __toESM(require("os"), 1);
|
|
917898
918114
|
var import_node_path35 = __toESM(require("path"), 1);
|
|
917899
918115
|
init_main();
|
|
@@ -918337,7 +918553,7 @@ var ChromeLauncher = class extends BrowserLauncher {
|
|
|
918337
918553
|
});
|
|
918338
918554
|
if (userDataDirIndex < 0) {
|
|
918339
918555
|
isTempUserDataDir = true;
|
|
918340
|
-
chromeArguments.push(`--user-data-dir=${await (0,
|
|
918556
|
+
chromeArguments.push(`--user-data-dir=${await (0, import_promises121.mkdtemp)(this.getProfilePath())}`);
|
|
918341
918557
|
userDataDirIndex = chromeArguments.length - 1;
|
|
918342
918558
|
}
|
|
918343
918559
|
const userDataDir = chromeArguments[userDataDirIndex].split("=", 2)[1];
|
|
@@ -918494,7 +918710,7 @@ function removeMatchingFlags(array3, flag) {
|
|
|
918494
918710
|
|
|
918495
918711
|
// ../../../node_modules/.pnpm/puppeteer-core@24.40.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/FirefoxLauncher.js
|
|
918496
918712
|
var import_node_fs28 = __toESM(require("fs"), 1);
|
|
918497
|
-
var
|
|
918713
|
+
var import_promises122 = require("fs/promises");
|
|
918498
918714
|
var import_node_os12 = __toESM(require("os"), 1);
|
|
918499
918715
|
var import_node_path36 = __toESM(require("path"), 1);
|
|
918500
918716
|
init_main();
|
|
@@ -918548,7 +918764,7 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
918548
918764
|
}
|
|
918549
918765
|
isTempUserDataDir = false;
|
|
918550
918766
|
} else {
|
|
918551
|
-
userDataDir = await (0,
|
|
918767
|
+
userDataDir = await (0, import_promises122.mkdtemp)(this.getProfilePath());
|
|
918552
918768
|
firefoxArguments.push("--profile");
|
|
918553
918769
|
firefoxArguments.push(userDataDir);
|
|
918554
918770
|
}
|
|
@@ -918589,8 +918805,8 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
918589
918805
|
const prefsBackupPath = import_node_path36.default.join(userDataDir, file4 + backupSuffix);
|
|
918590
918806
|
if (import_node_fs28.default.existsSync(prefsBackupPath)) {
|
|
918591
918807
|
const prefsPath = import_node_path36.default.join(userDataDir, file4);
|
|
918592
|
-
await (0,
|
|
918593
|
-
await (0,
|
|
918808
|
+
await (0, import_promises122.unlink)(prefsPath);
|
|
918809
|
+
await (0, import_promises122.rename)(prefsBackupPath, prefsPath);
|
|
918594
918810
|
}
|
|
918595
918811
|
}));
|
|
918596
918812
|
for (const result of results) {
|
|
@@ -919623,7 +919839,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
919623
919839
|
if (response.ok) {
|
|
919624
919840
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
919625
919841
|
const faviconPath = join8(assetsDirectory, RelativeFilePath2.of("favicon"));
|
|
919626
|
-
await (0,
|
|
919842
|
+
await (0, import_promises123.writeFile)(faviconPath, new Uint8Array(imageBuffer));
|
|
919627
919843
|
builder.setFavicon({ favicon: relativize(this.absolutePathToFernDirectory, faviconPath) });
|
|
919628
919844
|
}
|
|
919629
919845
|
}
|
|
@@ -919640,7 +919856,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
919640
919856
|
*/
|
|
919641
919857
|
async getAndCreateAssetsDirectory() {
|
|
919642
919858
|
const assetsDirectory = join8(this.absolutePathToFernDirectory, RelativeFilePath2.of("assets"));
|
|
919643
|
-
await (0,
|
|
919859
|
+
await (0, import_promises123.mkdir)(assetsDirectory, { recursive: true });
|
|
919644
919860
|
return assetsDirectory;
|
|
919645
919861
|
}
|
|
919646
919862
|
/**
|
|
@@ -919690,7 +919906,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
919690
919906
|
absolutePathToOutputDirectory,
|
|
919691
919907
|
section
|
|
919692
919908
|
});
|
|
919693
|
-
await (0,
|
|
919909
|
+
await (0, import_promises123.mkdir)(absolutePathToOutputDirectoryForSection, { recursive: true });
|
|
919694
919910
|
await Promise.all(section.pages.filter((page) => page.type === "page").map(async (page) => {
|
|
919695
919911
|
const url3 = new URL(page.slug.toString(), this.url);
|
|
919696
919912
|
this.logger.debug(`Fetching page: ${url3.toString()}`);
|
|
@@ -919705,7 +919921,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
919705
919921
|
absolutePathToOutputDirectoryForSection,
|
|
919706
919922
|
page: page.slug
|
|
919707
919923
|
});
|
|
919708
|
-
await (0,
|
|
919924
|
+
await (0, import_promises123.writeFile)(absolutePathForPage, result.data.mdx);
|
|
919709
919925
|
if (result.data.images.imageURLs.length > 0) {
|
|
919710
919926
|
this.logger.debug(`Found ${result.data.images.imageURLs.length} images to download for ${url3.toString()}`);
|
|
919711
919927
|
await Promise.all(Object.entries(result.data.images.imageURLToFilename).map(async ([imageUrl, filename]) => {
|
|
@@ -919718,8 +919934,8 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
919718
919934
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
919719
919935
|
const imagePath = join8(absolutePathToOutputDirectoryForSection, RelativeFilePath2.of(filename));
|
|
919720
919936
|
const imageDir = dirname6(imagePath);
|
|
919721
|
-
await (0,
|
|
919722
|
-
await (0,
|
|
919937
|
+
await (0, import_promises123.mkdir)(imageDir, { recursive: true });
|
|
919938
|
+
await (0, import_promises123.writeFile)(imagePath, new Uint8Array(imageBuffer));
|
|
919723
919939
|
this.logger.debug(`Saved image to ${imagePath}`);
|
|
919724
919940
|
} catch (error50) {
|
|
919725
919941
|
this.logger.warn(`Error downloading image ${imageUrl}: ${error50}`);
|
|
@@ -919802,7 +920018,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
919802
920018
|
|
|
919803
920019
|
// ../docs-importers/readme/lib/runReadmeMigration.js
|
|
919804
920020
|
init_lib6();
|
|
919805
|
-
var
|
|
920021
|
+
var import_promises124 = require("fs/promises");
|
|
919806
920022
|
async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionOfCli, organization }) {
|
|
919807
920023
|
const builder = new FernDocsBuilderImpl();
|
|
919808
920024
|
builder.setInstance({ companyName: organization });
|
|
@@ -919817,7 +920033,7 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
|
|
|
919817
920033
|
builder
|
|
919818
920034
|
});
|
|
919819
920035
|
await builder.build({ outputDirectory: outputPath });
|
|
919820
|
-
await (0,
|
|
920036
|
+
await (0, import_promises124.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
919821
920037
|
version: versionOfCli,
|
|
919822
920038
|
organization
|
|
919823
920039
|
}, void 0, 4));
|
|
@@ -919840,7 +920056,7 @@ var initializeWithReadme = async ({ readmeUrl, organization, taskContext, versio
|
|
|
919840
920056
|
};
|
|
919841
920057
|
|
|
919842
920058
|
// ../init/lib/utils/loadOpenApiFromUrl.js
|
|
919843
|
-
var
|
|
920059
|
+
var import_promises125 = require("fs/promises");
|
|
919844
920060
|
var import_path77 = require("path");
|
|
919845
920061
|
var import_tmp_promise15 = __toESM(require_tmp_promise(), 1);
|
|
919846
920062
|
var LoadOpenAPIStatus;
|
|
@@ -919855,7 +920071,7 @@ async function loadOpenAPIFromUrl({ url: url3, logger: logger4 }) {
|
|
|
919855
920071
|
const filePath = (0, import_path77.join)(tmpDir.path, url3.endsWith(".json") ? "openapi.json" : "openapi.yaml");
|
|
919856
920072
|
logger4.debug("tmpDir", tmpDir.path);
|
|
919857
920073
|
logger4.debug("filePath", filePath);
|
|
919858
|
-
await (0,
|
|
920074
|
+
await (0, import_promises125.writeFile)(filePath, data2);
|
|
919859
920075
|
return {
|
|
919860
920076
|
status: LoadOpenAPIStatus.Success,
|
|
919861
920077
|
filePath
|
|
@@ -924147,7 +924363,7 @@ var CliContext = class _CliContext {
|
|
|
924147
924363
|
if (false) {
|
|
924148
924364
|
this.logger.error("CLI_VERSION is not defined");
|
|
924149
924365
|
}
|
|
924150
|
-
return "4.
|
|
924366
|
+
return "4.72.0-1-g2825b1479c3";
|
|
924151
924367
|
}
|
|
924152
924368
|
getCliName() {
|
|
924153
924369
|
if (false) {
|
|
@@ -924445,7 +924661,7 @@ function wrapWorkspaceNameForPrefix(workspaceName) {
|
|
|
924445
924661
|
|
|
924446
924662
|
// ../project-loader/lib/loadProject.js
|
|
924447
924663
|
init_lib6();
|
|
924448
|
-
var
|
|
924664
|
+
var import_promises126 = require("fs/promises");
|
|
924449
924665
|
async function loadProject({ context: context3, nameOverride, ...args }) {
|
|
924450
924666
|
const fernDirectory = await getFernDirectory(nameOverride);
|
|
924451
924667
|
if (fernDirectory == null) {
|
|
@@ -924508,7 +924724,7 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
924508
924724
|
const apisDirectory = join8(fernDirectory, RelativeFilePath2.of(APIS_DIRECTORY));
|
|
924509
924725
|
const apisDirectoryExists = await doesPathExist(apisDirectory);
|
|
924510
924726
|
if (apisDirectoryExists) {
|
|
924511
|
-
const apiDirectoryContents = await (0,
|
|
924727
|
+
const apiDirectoryContents = await (0, import_promises126.readdir)(apisDirectory, { withFileTypes: true });
|
|
924512
924728
|
const apiWorkspaceDirectoryNames = apiDirectoryContents.reduce((all9, item) => {
|
|
924513
924729
|
if (item.isDirectory()) {
|
|
924514
924730
|
all9.push(item.name);
|
|
@@ -924585,11 +924801,11 @@ async function loadProjectAndRegisterWorkspacesWithContext(cliContext, args, reg
|
|
|
924585
924801
|
|
|
924586
924802
|
// src/cliV2.ts
|
|
924587
924803
|
var import_generators_sdk5 = __toESM(require_generators_sdk(), 1);
|
|
924588
|
-
var
|
|
924804
|
+
var import_promises131 = require("fs/promises");
|
|
924589
924805
|
|
|
924590
924806
|
// src/commands/generator-list/getGeneratorList.ts
|
|
924591
924807
|
init_lib4();
|
|
924592
|
-
var
|
|
924808
|
+
var import_promises127 = require("fs/promises");
|
|
924593
924809
|
var GenerationModeFilter = {
|
|
924594
924810
|
GitHub: "github",
|
|
924595
924811
|
Local: "local-file-system",
|
|
@@ -924649,7 +924865,7 @@ async function getGeneratorList({
|
|
|
924649
924865
|
return;
|
|
924650
924866
|
}
|
|
924651
924867
|
try {
|
|
924652
|
-
await (0,
|
|
924868
|
+
await (0, import_promises127.writeFile)(outputLocation, generatorsListYaml);
|
|
924653
924869
|
} catch (error50) {
|
|
924654
924870
|
cliContext.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
924655
924871
|
code: CliError.Code.ConfigError
|
|
@@ -924717,7 +924933,7 @@ async function getGeneratorMetadata({
|
|
|
924717
924933
|
}
|
|
924718
924934
|
|
|
924719
924935
|
// src/commands/organization/getOrganization.ts
|
|
924720
|
-
var
|
|
924936
|
+
var import_promises128 = require("fs/promises");
|
|
924721
924937
|
async function getOrganization({
|
|
924722
924938
|
project,
|
|
924723
924939
|
outputLocation,
|
|
@@ -924729,7 +924945,7 @@ async function getOrganization({
|
|
|
924729
924945
|
return;
|
|
924730
924946
|
}
|
|
924731
924947
|
try {
|
|
924732
|
-
await (0,
|
|
924948
|
+
await (0, import_promises128.writeFile)(outputLocation, org);
|
|
924733
924949
|
} catch (error50) {
|
|
924734
924950
|
context3.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
924735
924951
|
code: CliError.Code.ConfigError
|
|
@@ -924739,7 +924955,7 @@ async function getOrganization({
|
|
|
924739
924955
|
|
|
924740
924956
|
// src/commands/upgrade/upgradeGenerator.ts
|
|
924741
924957
|
init_lib6();
|
|
924742
|
-
var
|
|
924958
|
+
var import_promises130 = require("fs/promises");
|
|
924743
924959
|
var import_path79 = __toESM(require("path"), 1);
|
|
924744
924960
|
var import_semver17 = __toESM(require_semver2(), 1);
|
|
924745
924961
|
var import_yaml6 = __toESM(require_dist9(), 1);
|
|
@@ -924747,7 +924963,7 @@ var import_yaml6 = __toESM(require_dist9(), 1);
|
|
|
924747
924963
|
// src/commands/upgrade/migrations/loader.ts
|
|
924748
924964
|
init_lib4();
|
|
924749
924965
|
var import_fs32 = require("fs");
|
|
924750
|
-
var
|
|
924966
|
+
var import_promises129 = require("fs/promises");
|
|
924751
924967
|
var import_os15 = require("os");
|
|
924752
924968
|
var import_path78 = require("path");
|
|
924753
924969
|
var import_semver16 = __toESM(require_semver2(), 1);
|
|
@@ -924775,7 +924991,7 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
924775
924991
|
const myPid = String(process.pid);
|
|
924776
924992
|
while (true) {
|
|
924777
924993
|
try {
|
|
924778
|
-
const fh = await (0,
|
|
924994
|
+
const fh = await (0, import_promises129.open)(lockPath, "wx");
|
|
924779
924995
|
await fh.writeFile(myPid);
|
|
924780
924996
|
await fh.close();
|
|
924781
924997
|
const exitHandler = () => {
|
|
@@ -924792,9 +925008,9 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
924792
925008
|
return async () => {
|
|
924793
925009
|
process.removeListener("exit", exitHandler);
|
|
924794
925010
|
try {
|
|
924795
|
-
const currentContent = await (0,
|
|
925011
|
+
const currentContent = await (0, import_promises129.readFile)(lockPath, "utf-8");
|
|
924796
925012
|
if (currentContent.trim() === myPid) {
|
|
924797
|
-
await (0,
|
|
925013
|
+
await (0, import_promises129.unlink)(lockPath);
|
|
924798
925014
|
} else {
|
|
924799
925015
|
logger4.debug(
|
|
924800
925016
|
`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`
|
|
@@ -924810,14 +925026,14 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
924810
925026
|
throw err;
|
|
924811
925027
|
}
|
|
924812
925028
|
try {
|
|
924813
|
-
const lockContent = await (0,
|
|
925029
|
+
const lockContent = await (0, import_promises129.readFile)(lockPath, "utf-8");
|
|
924814
925030
|
const lockPid = Number(lockContent.trim());
|
|
924815
|
-
const lockStat = await (0,
|
|
925031
|
+
const lockStat = await (0, import_promises129.stat)(lockPath);
|
|
924816
925032
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
924817
925033
|
if (lockAge > LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !isProcessAlive(lockPid)) {
|
|
924818
925034
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
924819
925035
|
try {
|
|
924820
|
-
await (0,
|
|
925036
|
+
await (0, import_promises129.unlink)(lockPath);
|
|
924821
925037
|
} catch (unlinkErr) {
|
|
924822
925038
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
924823
925039
|
}
|
|
@@ -924841,7 +925057,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
924841
925057
|
}
|
|
924842
925058
|
migrationsInstallPromise = (async () => {
|
|
924843
925059
|
const cacheDir = getMigrationCacheDir();
|
|
924844
|
-
await (0,
|
|
925060
|
+
await (0, import_promises129.mkdir)(cacheDir, { recursive: true });
|
|
924845
925061
|
const npmCacheDir = (0, import_path78.join)(cacheDir, ".npm-cache");
|
|
924846
925062
|
const packageDir = (0, import_path78.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME2);
|
|
924847
925063
|
const packageJsonPath = (0, import_path78.join)(packageDir, "package.json");
|
|
@@ -924858,7 +925074,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
924858
925074
|
"--no-audit",
|
|
924859
925075
|
"--no-fund"
|
|
924860
925076
|
]);
|
|
924861
|
-
const packageJsonContent = await (0,
|
|
925077
|
+
const packageJsonContent = await (0, import_promises129.readFile)(packageJsonPath, "utf-8");
|
|
924862
925078
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
924863
925079
|
if (packageJson2.main == null) {
|
|
924864
925080
|
throw new CliError({
|
|
@@ -925044,7 +925260,7 @@ async function loadAndUpdateGenerators({
|
|
|
925044
925260
|
skippedAutoreleaseDisabled: []
|
|
925045
925261
|
};
|
|
925046
925262
|
}
|
|
925047
|
-
const contents = await (0,
|
|
925263
|
+
const contents = await (0, import_promises130.readFile)(filepath);
|
|
925048
925264
|
context3.logger.debug(`Found generators: ${contents.toString()}`);
|
|
925049
925265
|
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
925050
925266
|
const generatorGroups = parsedDocument.get("groups");
|
|
@@ -925281,7 +925497,7 @@ async function upgradeGenerator({
|
|
|
925281
925497
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
925282
925498
|
});
|
|
925283
925499
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
925284
|
-
await (0,
|
|
925500
|
+
await (0, import_promises130.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
925285
925501
|
}
|
|
925286
925502
|
allSkippedMajorUpgrades.push(...result.skippedMajorUpgrades);
|
|
925287
925503
|
if (result.appliedUpgrades.length > 0) {
|
|
@@ -925681,7 +925897,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
925681
925897
|
}
|
|
925682
925898
|
if (argv.output) {
|
|
925683
925899
|
try {
|
|
925684
|
-
await (0,
|
|
925900
|
+
await (0, import_promises131.writeFile)(argv.output, JSON.stringify(generatorMetadata, null, 2));
|
|
925685
925901
|
} catch (error50) {
|
|
925686
925902
|
cliContext.failAndThrow(
|
|
925687
925903
|
`Could not write file to the specified location: ${argv.output}`,
|
|
@@ -925696,7 +925912,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
925696
925912
|
}
|
|
925697
925913
|
|
|
925698
925914
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
925699
|
-
var
|
|
925915
|
+
var import_promises132 = require("fs/promises");
|
|
925700
925916
|
async function addGeneratorToWorkspaces({
|
|
925701
925917
|
project: { apiWorkspaces },
|
|
925702
925918
|
generatorName,
|
|
@@ -925723,7 +925939,7 @@ async function addGeneratorToWorkspaces({
|
|
|
925723
925939
|
if (absolutePathToGeneratorsConfiguration == null) {
|
|
925724
925940
|
return;
|
|
925725
925941
|
}
|
|
925726
|
-
await (0,
|
|
925942
|
+
await (0, import_promises132.writeFile)(
|
|
925727
925943
|
absolutePathToGeneratorsConfiguration,
|
|
925728
925944
|
"# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(newConfiguration)
|
|
925729
925945
|
);
|
|
@@ -926092,7 +926308,7 @@ async function previewDocsWorkspace({
|
|
|
926092
926308
|
|
|
926093
926309
|
// src/commands/docs-diff/docsDiff.ts
|
|
926094
926310
|
init_lib6();
|
|
926095
|
-
var
|
|
926311
|
+
var import_promises133 = require("fs/promises");
|
|
926096
926312
|
var import_pngjs = __toESM(require_png2(), 1);
|
|
926097
926313
|
async function getSlugForFiles({
|
|
926098
926314
|
previewUrl,
|
|
@@ -926315,8 +926531,8 @@ async function generateComparisons({
|
|
|
926315
926531
|
afterPath,
|
|
926316
926532
|
comparisonBasePath
|
|
926317
926533
|
}) {
|
|
926318
|
-
const beforePng = import_pngjs.PNG.sync.read(await (0,
|
|
926319
|
-
const afterPng = import_pngjs.PNG.sync.read(await (0,
|
|
926534
|
+
const beforePng = import_pngjs.PNG.sync.read(await (0, import_promises133.readFile)(beforePath));
|
|
926535
|
+
const afterPng = import_pngjs.PNG.sync.read(await (0, import_promises133.readFile)(afterPath));
|
|
926320
926536
|
const beforeOriginalHeight = beforePng.height;
|
|
926321
926537
|
const afterOriginalHeight = afterPng.height;
|
|
926322
926538
|
const width = Math.max(beforePng.width, afterPng.width);
|
|
@@ -926354,7 +926570,7 @@ async function generateComparisons({
|
|
|
926354
926570
|
const sideBySide = createSideBySideComparison(croppedBefore, croppedAfter, 20, true);
|
|
926355
926571
|
const outPath = `${base4}-region-${i11 + 1}.png`;
|
|
926356
926572
|
const pngBuffer = import_pngjs.PNG.sync.write(sideBySide);
|
|
926357
|
-
await (0,
|
|
926573
|
+
await (0, import_promises133.writeFile)(outPath, new Uint8Array(pngBuffer));
|
|
926358
926574
|
results.push({ changePercent, boundingBox, comparisonPath: outPath });
|
|
926359
926575
|
}
|
|
926360
926576
|
return results;
|
|
@@ -926433,7 +926649,7 @@ async function docsDiff({
|
|
|
926433
926649
|
outputDir.startsWith("/") ? outputDir : join8(cwd(), RelativeFilePath2.of(outputDir))
|
|
926434
926650
|
);
|
|
926435
926651
|
if (!await doesPathExist(outputPath)) {
|
|
926436
|
-
await (0,
|
|
926652
|
+
await (0, import_promises133.mkdir)(outputPath, { recursive: true });
|
|
926437
926653
|
}
|
|
926438
926654
|
const results = [];
|
|
926439
926655
|
await cliContext.runTask(async (context3) => {
|
|
@@ -930846,7 +931062,7 @@ function renderModuleTree(module4, ctx, writer2, parentPath) {
|
|
|
930846
931062
|
}
|
|
930847
931063
|
|
|
930848
931064
|
// src/commands/docs-md-generate/generateLibraryDocs.ts
|
|
930849
|
-
var
|
|
931065
|
+
var import_promises134 = require("fs/promises");
|
|
930850
931066
|
function createLibraryDocsClient({ token }) {
|
|
930851
931067
|
const defaultOrigin = "https://registry-dev2.buildwithfern.com";
|
|
930852
931068
|
const baseUrl = process.env.FERN_FDR_ORIGIN ?? process.env.OVERRIDE_FDR_ORIGIN ?? defaultOrigin;
|
|
@@ -930972,7 +931188,7 @@ async function generateSingleLibrary({
|
|
|
930972
931188
|
if (config5.lang === "cpp" && config5.config?.doxyfile != null) {
|
|
930973
931189
|
const doxyfilePath = resolve6(docsWorkspace.absoluteFilePath, config5.config.doxyfile);
|
|
930974
931190
|
try {
|
|
930975
|
-
doxyfileContent = await (0,
|
|
931191
|
+
doxyfileContent = await (0, import_promises134.readFile)(doxyfilePath, "utf-8");
|
|
930976
931192
|
} catch {
|
|
930977
931193
|
return interactiveTaskContext.failAndThrow(
|
|
930978
931194
|
`Library '${name2}': Could not read Doxyfile at '${config5.config.doxyfile}' (resolved to ${doxyfilePath})`,
|
|
@@ -931313,7 +931529,7 @@ Found ${previewDeployments.length} preview deployment(s):
|
|
|
931313
931529
|
}
|
|
931314
931530
|
|
|
931315
931531
|
// src/commands/downgrade/downgrade.ts
|
|
931316
|
-
var
|
|
931532
|
+
var import_promises135 = require("fs/promises");
|
|
931317
931533
|
|
|
931318
931534
|
// ../../../node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.mjs
|
|
931319
931535
|
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
@@ -932064,13 +932280,13 @@ async function downgrade({
|
|
|
932064
932280
|
const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
|
|
932065
932281
|
draft.version = targetVersion;
|
|
932066
932282
|
});
|
|
932067
|
-
await (0,
|
|
932283
|
+
await (0, import_promises135.writeFile)(projectConfig._absolutePath, ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2)));
|
|
932068
932284
|
cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
|
|
932069
932285
|
}
|
|
932070
932286
|
|
|
932071
932287
|
// src/commands/export/generateOpenAPIForWorkspaces.ts
|
|
932072
932288
|
init_lib6();
|
|
932073
|
-
var
|
|
932289
|
+
var import_promises136 = require("fs/promises");
|
|
932074
932290
|
|
|
932075
932291
|
// src/commands/export/converters/servicesConverter.ts
|
|
932076
932292
|
init_lib4();
|
|
@@ -933453,8 +933669,8 @@ async function generateOpenAPIForWorkspaces({
|
|
|
933453
933669
|
ir: ir15,
|
|
933454
933670
|
mode: "openapi"
|
|
933455
933671
|
});
|
|
933456
|
-
await (0,
|
|
933457
|
-
await (0,
|
|
933672
|
+
await (0, import_promises136.mkdir)(dirname6(outputPath), { recursive: true });
|
|
933673
|
+
await (0, import_promises136.writeFile)(
|
|
933458
933674
|
outputPath,
|
|
933459
933675
|
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent4) : jsYaml.dump(openapi, { indent: indent4 })
|
|
933460
933676
|
);
|
|
@@ -933538,11 +933754,11 @@ var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
|
|
|
933538
933754
|
|
|
933539
933755
|
// src/commands/generate/checkOutputDirectory.ts
|
|
933540
933756
|
init_lib6();
|
|
933541
|
-
var
|
|
933757
|
+
var import_promises139 = require("fs/promises");
|
|
933542
933758
|
|
|
933543
933759
|
// src/persistence/output-directories/getOutputDirectories.ts
|
|
933544
933760
|
init_lib6();
|
|
933545
|
-
var
|
|
933761
|
+
var import_promises137 = require("fs/promises");
|
|
933546
933762
|
|
|
933547
933763
|
// src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
|
|
933548
933764
|
init_lib6();
|
|
@@ -933562,17 +933778,17 @@ async function getOutputDirectories() {
|
|
|
933562
933778
|
if (!doesOutputDirectoriesFileExist) {
|
|
933563
933779
|
return [];
|
|
933564
933780
|
}
|
|
933565
|
-
const outputDirectoriesFileContents = await (0,
|
|
933781
|
+
const outputDirectoriesFileContents = await (0, import_promises137.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
|
|
933566
933782
|
const outputDirectories = JSON.parse(outputDirectoriesFileContents);
|
|
933567
933783
|
return outputDirectories;
|
|
933568
933784
|
}
|
|
933569
933785
|
|
|
933570
933786
|
// src/persistence/output-directories/storeOutputDirectories.ts
|
|
933571
|
-
var
|
|
933787
|
+
var import_promises138 = require("fs/promises");
|
|
933572
933788
|
var import_path82 = __toESM(require("path"), 1);
|
|
933573
933789
|
async function storeOutputDirectories(outputDirectories) {
|
|
933574
|
-
await (0,
|
|
933575
|
-
await (0,
|
|
933790
|
+
await (0, import_promises138.mkdir)(import_path82.default.dirname(getPathToOutputDirectoriesFile()), { recursive: true });
|
|
933791
|
+
await (0, import_promises138.writeFile)(getPathToOutputDirectoriesFile(), JSON.stringify(outputDirectories, null, 2));
|
|
933576
933792
|
}
|
|
933577
933793
|
|
|
933578
933794
|
// src/commands/generate/checkOutputDirectory.ts
|
|
@@ -933594,7 +933810,7 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
|
933594
933810
|
shouldProceed: true
|
|
933595
933811
|
};
|
|
933596
933812
|
}
|
|
933597
|
-
const files = await (0,
|
|
933813
|
+
const files = await (0, import_promises139.readdir)(outputPath);
|
|
933598
933814
|
if (files.length === 0) {
|
|
933599
933815
|
return {
|
|
933600
933816
|
shouldProceed: true
|
|
@@ -934531,7 +934747,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
934531
934747
|
|
|
934532
934748
|
// src/commands/generate-overrides/compareOpenAPISpecs.ts
|
|
934533
934749
|
init_lib6();
|
|
934534
|
-
var
|
|
934750
|
+
var import_promises140 = require("fs/promises");
|
|
934535
934751
|
async function compareOpenAPISpecs({
|
|
934536
934752
|
originalPath,
|
|
934537
934753
|
modifiedPath,
|
|
@@ -934572,12 +934788,12 @@ async function compareOpenAPISpecs({
|
|
|
934572
934788
|
}
|
|
934573
934789
|
outputPath = join8(dirname6(originalPath), RelativeFilePath2.of(overridesFilename));
|
|
934574
934790
|
}
|
|
934575
|
-
await (0,
|
|
934791
|
+
await (0, import_promises140.writeFile)(outputPath, jsYaml.dump(overrides, { lineWidth: -1, noRefs: true }));
|
|
934576
934792
|
context3.logger.info(`Overrides written to ${outputPath}`);
|
|
934577
934793
|
});
|
|
934578
934794
|
}
|
|
934579
934795
|
async function loadSpec2(filepath, context3) {
|
|
934580
|
-
const contents = await (0,
|
|
934796
|
+
const contents = await (0, import_promises140.readFile)(filepath, "utf8");
|
|
934581
934797
|
try {
|
|
934582
934798
|
return JSON.parse(contents);
|
|
934583
934799
|
} catch {
|
|
@@ -934681,7 +934897,7 @@ function deepEqual(a10, b19) {
|
|
|
934681
934897
|
|
|
934682
934898
|
// src/commands/generate-overrides/writeOverridesForWorkspaces.ts
|
|
934683
934899
|
init_lib6();
|
|
934684
|
-
var
|
|
934900
|
+
var import_promises141 = require("fs/promises");
|
|
934685
934901
|
async function writeOverridesForWorkspaces({
|
|
934686
934902
|
project,
|
|
934687
934903
|
includeModels,
|
|
@@ -934706,7 +934922,7 @@ async function writeOverridesForWorkspaces({
|
|
|
934706
934922
|
async function readExistingOverrides(overridesFilepath, context3) {
|
|
934707
934923
|
let parsedOverrides = null;
|
|
934708
934924
|
try {
|
|
934709
|
-
const contents = (await (0,
|
|
934925
|
+
const contents = (await (0, import_promises141.readFile)(overridesFilepath, "utf8")).toString();
|
|
934710
934926
|
try {
|
|
934711
934927
|
parsedOverrides = JSON.parse(contents);
|
|
934712
934928
|
} catch (err) {
|
|
@@ -934771,7 +934987,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
934771
934987
|
for (const overridesPath of overridesPaths) {
|
|
934772
934988
|
const existingOverrides = await readExistingOverrides(overridesPath, context3);
|
|
934773
934989
|
const content5 = generateOverridesContent({ ir: ir15, existingOverrides, includeModels, context: context3 });
|
|
934774
|
-
await (0,
|
|
934990
|
+
await (0, import_promises141.writeFile)(overridesPath, jsYaml.dump(content5));
|
|
934775
934991
|
}
|
|
934776
934992
|
} else {
|
|
934777
934993
|
const content5 = generateOverridesContent({ ir: ir15, existingOverrides: {}, includeModels, context: context3 });
|
|
@@ -934785,7 +935001,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
934785
935001
|
overridesFilename = `${nameWithoutExt}-overrides${extension4}`;
|
|
934786
935002
|
}
|
|
934787
935003
|
}
|
|
934788
|
-
await (0,
|
|
935004
|
+
await (0, import_promises141.writeFile)(
|
|
934789
935005
|
join8(dirname6(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
|
|
934790
935006
|
jsYaml.dump(content5)
|
|
934791
935007
|
);
|
|
@@ -935201,7 +935417,7 @@ function convertIRtoJsonSchema(args) {
|
|
|
935201
935417
|
}
|
|
935202
935418
|
|
|
935203
935419
|
// src/commands/jsonschema/generateJsonschemaForWorkspace.ts
|
|
935204
|
-
var
|
|
935420
|
+
var import_promises142 = require("fs/promises");
|
|
935205
935421
|
async function generateJsonschemaForWorkspaces({
|
|
935206
935422
|
typeLocator,
|
|
935207
935423
|
project,
|
|
@@ -935249,9 +935465,9 @@ async function generateJsonschemaForWorkspaces({
|
|
|
935249
935465
|
context: context3
|
|
935250
935466
|
});
|
|
935251
935467
|
if (!await doesPathExist(dirname6(jsonschemaFilepath))) {
|
|
935252
|
-
await (0,
|
|
935468
|
+
await (0, import_promises142.mkdir)(dirname6(jsonschemaFilepath), { recursive: true });
|
|
935253
935469
|
}
|
|
935254
|
-
await (0,
|
|
935470
|
+
await (0, import_promises142.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
|
|
935255
935471
|
context3.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
|
|
935256
935472
|
});
|
|
935257
935473
|
})
|
|
@@ -935260,7 +935476,7 @@ async function generateJsonschemaForWorkspaces({
|
|
|
935260
935476
|
|
|
935261
935477
|
// src/commands/merge/mergeOpenAPIWithOverrides.ts
|
|
935262
935478
|
init_lib6();
|
|
935263
|
-
var
|
|
935479
|
+
var import_promises143 = require("fs/promises");
|
|
935264
935480
|
var HTTP_METHODS2 = /* @__PURE__ */ new Set(["get", "put", "post", "delete", "options", "head", "patch", "trace"]);
|
|
935265
935481
|
async function mergeOpenAPIWithOverrides({
|
|
935266
935482
|
openapiPath,
|
|
@@ -935285,12 +935501,12 @@ async function mergeOpenAPIWithOverrides({
|
|
|
935285
935501
|
const merged = mergeExamplesIntoSpec(openapi, overrides, context3);
|
|
935286
935502
|
const isJson = outputPath.endsWith(".json");
|
|
935287
935503
|
const output2 = isJson ? JSON.stringify(merged, null, 2) : jsYaml.dump(merged, { lineWidth: -1, noRefs: true });
|
|
935288
|
-
await (0,
|
|
935504
|
+
await (0, import_promises143.writeFile)(outputPath, output2);
|
|
935289
935505
|
context3.logger.info(`Merged output written to ${outputPath}`);
|
|
935290
935506
|
});
|
|
935291
935507
|
}
|
|
935292
935508
|
async function loadYamlOrJson(filepath, context3) {
|
|
935293
|
-
const contents = await (0,
|
|
935509
|
+
const contents = await (0, import_promises143.readFile)(filepath, "utf8");
|
|
935294
935510
|
try {
|
|
935295
935511
|
return JSON.parse(contents);
|
|
935296
935512
|
} catch {
|
|
@@ -935924,7 +936140,7 @@ async function mockServer({
|
|
|
935924
936140
|
}
|
|
935925
936141
|
|
|
935926
936142
|
// src/commands/register/registerWorkspacesV1.ts
|
|
935927
|
-
var
|
|
936143
|
+
var import_promises144 = require("fs/promises");
|
|
935928
936144
|
var import_path88 = __toESM(require("path"), 1);
|
|
935929
936145
|
var import_tmp_promise16 = __toESM(require_tmp_promise(), 1);
|
|
935930
936146
|
async function registerWorkspacesV1({
|
|
@@ -935977,7 +936193,7 @@ async function registerWorkspacesV1({
|
|
|
935977
936193
|
context3.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
935978
936194
|
await Zn3({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
|
|
935979
936195
|
context3.logger.info("Uploading definition...");
|
|
935980
|
-
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
936196
|
+
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises144.readFile)(tarPath));
|
|
935981
936197
|
context3.logger.info(
|
|
935982
936198
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
935983
936199
|
);
|
|
@@ -936219,7 +936435,7 @@ async function generateDiff({
|
|
|
936219
936435
|
|
|
936220
936436
|
// src/commands/sdk-preview/sdkPreview.ts
|
|
936221
936437
|
init_lib6();
|
|
936222
|
-
var
|
|
936438
|
+
var import_promises145 = __toESM(require("fs/promises"), 1);
|
|
936223
936439
|
|
|
936224
936440
|
// src/commands/sdk-preview/computePreviewVersion.ts
|
|
936225
936441
|
var BASE_VERSION = "0.0.1";
|
|
@@ -936435,7 +936651,7 @@ async function sdkPreview({
|
|
|
936435
936651
|
const firstPath = pathOutputs[0];
|
|
936436
936652
|
const absolutePathToOutput = firstPath != null ? AbsoluteFilePath2.of(resolve6(cwd(), firstPath)) : void 0;
|
|
936437
936653
|
if (absolutePathToOutput != null) {
|
|
936438
|
-
await
|
|
936654
|
+
await import_promises145.default.mkdir(absolutePathToOutput, { recursive: true });
|
|
936439
936655
|
}
|
|
936440
936656
|
for (const workspace of project.apiWorkspaces) {
|
|
936441
936657
|
if (workspace.generatorsConfiguration == null) {
|
|
@@ -936643,7 +936859,7 @@ async function sdkPreview({
|
|
|
936643
936859
|
}
|
|
936644
936860
|
|
|
936645
936861
|
// src/commands/self-update/selfUpdate.ts
|
|
936646
|
-
var
|
|
936862
|
+
var import_promises146 = require("fs/promises");
|
|
936647
936863
|
var import_path89 = require("path");
|
|
936648
936864
|
async function getPackageManagerBinDir(logger4, pm) {
|
|
936649
936865
|
let command3;
|
|
@@ -936689,7 +936905,7 @@ async function detectInstallationMethod(logger4) {
|
|
|
936689
936905
|
logger4.debug(`Found fern at: ${fernPath}`);
|
|
936690
936906
|
let resolvedPath;
|
|
936691
936907
|
try {
|
|
936692
|
-
resolvedPath = await (0,
|
|
936908
|
+
resolvedPath = await (0, import_promises146.realpath)(fernPath);
|
|
936693
936909
|
logger4.debug(`Resolved to: ${resolvedPath}`);
|
|
936694
936910
|
} catch (error50) {
|
|
936695
936911
|
logger4.debug(`Failed to resolve symlink: ${error50}`);
|
|
@@ -936992,21 +937208,21 @@ async function generateToken({
|
|
|
936992
937208
|
// src/commands/upgrade/updateApiSpec.ts
|
|
936993
937209
|
init_lib6();
|
|
936994
937210
|
var fs28 = __toESM(require("fs"), 1);
|
|
936995
|
-
var
|
|
937211
|
+
var import_promises147 = require("fs/promises");
|
|
936996
937212
|
init_graphql();
|
|
936997
937213
|
var import_stream16 = require("stream");
|
|
936998
|
-
var
|
|
937214
|
+
var import_promises148 = require("stream/promises");
|
|
936999
937215
|
async function fetchAndWriteFile(url3, path97, logger4, indent4) {
|
|
937000
937216
|
const resp = await fetch(url3);
|
|
937001
937217
|
if (resp.ok && resp.body) {
|
|
937002
937218
|
logger4.debug("Origin successfully fetched, writing to file");
|
|
937003
937219
|
const fileStream = fs28.createWriteStream(path97);
|
|
937004
|
-
await (0,
|
|
937005
|
-
const fileContents = await (0,
|
|
937220
|
+
await (0, import_promises148.finished)(import_stream16.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
937221
|
+
const fileContents = await (0, import_promises147.readFile)(path97, "utf8");
|
|
937006
937222
|
try {
|
|
937007
|
-
await (0,
|
|
937223
|
+
await (0, import_promises147.writeFile)(path97, JSON.stringify(JSON.parse(fileContents), void 0, indent4), "utf8");
|
|
937008
937224
|
} catch (e6) {
|
|
937009
|
-
await (0,
|
|
937225
|
+
await (0, import_promises147.writeFile)(path97, jsYaml.dump(jsYaml.load(fileContents), { indent: indent4 }), "utf8");
|
|
937010
937226
|
}
|
|
937011
937227
|
logger4.debug("File written successfully");
|
|
937012
937228
|
}
|
|
@@ -937162,14 +937378,14 @@ async function tryDirectJSONFetch(url3, logger4) {
|
|
|
937162
937378
|
async function fetchGraphQLSchemaWithAutoDetection(url3, path97, logger4) {
|
|
937163
937379
|
const postResult = await tryGraphQLIntrospection(url3, logger4);
|
|
937164
937380
|
if (postResult.success) {
|
|
937165
|
-
await (0,
|
|
937381
|
+
await (0, import_promises147.writeFile)(path97, postResult.result, "utf8");
|
|
937166
937382
|
logger4.info("Successfully fetched GraphQL schema using POST introspection");
|
|
937167
937383
|
return;
|
|
937168
937384
|
}
|
|
937169
937385
|
logger4.debug(`POST introspection failed: ${postResult.error}`);
|
|
937170
937386
|
const getResult = await tryDirectJSONFetch(url3, logger4);
|
|
937171
937387
|
if (getResult.success) {
|
|
937172
|
-
await (0,
|
|
937388
|
+
await (0, import_promises147.writeFile)(path97, getResult.result, "utf8");
|
|
937173
937389
|
logger4.info("Successfully fetched GraphQL schema using direct JSON fetch");
|
|
937174
937390
|
return;
|
|
937175
937391
|
}
|
|
@@ -937278,7 +937494,7 @@ async function processDefinitions({
|
|
|
937278
937494
|
init_lib4();
|
|
937279
937495
|
|
|
937280
937496
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
937281
|
-
var
|
|
937497
|
+
var import_promises149 = require("fs/promises");
|
|
937282
937498
|
|
|
937283
937499
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
937284
937500
|
init_lib6();
|
|
@@ -937314,7 +937530,7 @@ var migration = {
|
|
|
937314
937530
|
try {
|
|
937315
937531
|
const fileContents = await getFileContents(yamlFilepath);
|
|
937316
937532
|
const newContents = addDiscriminantToFile(fileContents);
|
|
937317
|
-
await (0,
|
|
937533
|
+
await (0, import_promises149.writeFile)(yamlFilepath, newContents);
|
|
937318
937534
|
} catch (error50) {
|
|
937319
937535
|
context3.failAndThrow("Failed to migrate " + yamlFilepath, error50);
|
|
937320
937536
|
}
|
|
@@ -937322,7 +937538,7 @@ var migration = {
|
|
|
937322
937538
|
}
|
|
937323
937539
|
};
|
|
937324
937540
|
async function getFileContents(filepath) {
|
|
937325
|
-
const buffer = await (0,
|
|
937541
|
+
const buffer = await (0, import_promises149.readFile)(filepath);
|
|
937326
937542
|
return buffer.toString();
|
|
937327
937543
|
}
|
|
937328
937544
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -937351,7 +937567,7 @@ var versionMigrations = {
|
|
|
937351
937567
|
var __default = versionMigrations;
|
|
937352
937568
|
|
|
937353
937569
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
937354
|
-
var
|
|
937570
|
+
var import_promises150 = require("fs/promises");
|
|
937355
937571
|
var import_yaml7 = __toESM(require_dist9(), 1);
|
|
937356
937572
|
|
|
937357
937573
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
@@ -937394,7 +937610,7 @@ var migration2 = {
|
|
|
937394
937610
|
}
|
|
937395
937611
|
};
|
|
937396
937612
|
async function migrateFile(filepath, context3) {
|
|
937397
|
-
const contents = await (0,
|
|
937613
|
+
const contents = await (0, import_promises150.readFile)(filepath);
|
|
937398
937614
|
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
937399
937615
|
const types4 = parsedDocument.get("types");
|
|
937400
937616
|
if (types4 == null) {
|
|
@@ -937426,7 +937642,7 @@ async function migrateFile(filepath, context3) {
|
|
|
937426
937642
|
}
|
|
937427
937643
|
}
|
|
937428
937644
|
}
|
|
937429
|
-
await (0,
|
|
937645
|
+
await (0, import_promises150.writeFile)(filepath, parsedDocument.toString());
|
|
937430
937646
|
}
|
|
937431
937647
|
|
|
937432
937648
|
// ../cli-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -937437,7 +937653,7 @@ var versionMigrations2 = {
|
|
|
937437
937653
|
var __default2 = versionMigrations2;
|
|
937438
937654
|
|
|
937439
937655
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
937440
|
-
var
|
|
937656
|
+
var import_promises151 = require("fs/promises");
|
|
937441
937657
|
var import_yaml8 = __toESM(require_dist9(), 1);
|
|
937442
937658
|
|
|
937443
937659
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
@@ -937480,7 +937696,7 @@ var migration3 = {
|
|
|
937480
937696
|
}
|
|
937481
937697
|
};
|
|
937482
937698
|
async function migrateGeneratorsYml(filepath, context3) {
|
|
937483
|
-
const contents = await (0,
|
|
937699
|
+
const contents = await (0, import_promises151.readFile)(filepath);
|
|
937484
937700
|
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
937485
937701
|
const draftGenerators = parsedDocument.get("draft");
|
|
937486
937702
|
if (draftGenerators == null) {
|
|
@@ -937507,7 +937723,7 @@ async function migrateGeneratorsYml(filepath, context3) {
|
|
|
937507
937723
|
draftGenerator.set("output-path", name2.value.includes("openapi") ? "./generated-openapi" : name2.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
937508
937724
|
}
|
|
937509
937725
|
});
|
|
937510
|
-
await (0,
|
|
937726
|
+
await (0, import_promises151.writeFile)(filepath, parsedDocument.toString());
|
|
937511
937727
|
}
|
|
937512
937728
|
|
|
937513
937729
|
// ../cli-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -937518,7 +937734,7 @@ var versionMigrations3 = {
|
|
|
937518
937734
|
var __default3 = versionMigrations3;
|
|
937519
937735
|
|
|
937520
937736
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
937521
|
-
var
|
|
937737
|
+
var import_promises152 = require("fs/promises");
|
|
937522
937738
|
var import_yaml9 = __toESM(require_dist9(), 1);
|
|
937523
937739
|
|
|
937524
937740
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
@@ -937561,7 +937777,7 @@ var migration4 = {
|
|
|
937561
937777
|
}
|
|
937562
937778
|
};
|
|
937563
937779
|
async function migrateFile2(filepath, context3) {
|
|
937564
|
-
const contents = await (0,
|
|
937780
|
+
const contents = await (0, import_promises152.readFile)(filepath);
|
|
937565
937781
|
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
937566
937782
|
const addType = (typeName, typeDeclaration2) => {
|
|
937567
937783
|
const types4 = parsedDocument.get("types");
|
|
@@ -937605,7 +937821,7 @@ async function migrateFile2(filepath, context3) {
|
|
|
937605
937821
|
}
|
|
937606
937822
|
}
|
|
937607
937823
|
}
|
|
937608
|
-
await (0,
|
|
937824
|
+
await (0, import_promises152.writeFile)(filepath, parsedDocument.toString());
|
|
937609
937825
|
}
|
|
937610
937826
|
|
|
937611
937827
|
// ../cli-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -937616,7 +937832,7 @@ var versionMigrations4 = {
|
|
|
937616
937832
|
var __default4 = versionMigrations4;
|
|
937617
937833
|
|
|
937618
937834
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
937619
|
-
var
|
|
937835
|
+
var import_promises153 = require("fs/promises");
|
|
937620
937836
|
var import_yaml10 = __toESM(require_dist9(), 1);
|
|
937621
937837
|
|
|
937622
937838
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
@@ -937659,7 +937875,7 @@ var migration5 = {
|
|
|
937659
937875
|
}
|
|
937660
937876
|
};
|
|
937661
937877
|
async function migrateGeneratorsYml2(filepath, context3) {
|
|
937662
|
-
const contents = await (0,
|
|
937878
|
+
const contents = await (0, import_promises153.readFile)(filepath);
|
|
937663
937879
|
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
937664
937880
|
const releaseGenerators = parsedDocument.get("release");
|
|
937665
937881
|
if (releaseGenerators == null) {
|
|
@@ -937697,7 +937913,7 @@ async function migrateGeneratorsYml2(filepath, context3) {
|
|
|
937697
937913
|
}
|
|
937698
937914
|
releaseGenerator.delete("outputs");
|
|
937699
937915
|
});
|
|
937700
|
-
await (0,
|
|
937916
|
+
await (0, import_promises153.writeFile)(filepath, parsedDocument.toString());
|
|
937701
937917
|
}
|
|
937702
937918
|
|
|
937703
937919
|
// ../cli-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -937708,7 +937924,7 @@ var versionMigrations5 = {
|
|
|
937708
937924
|
var __default5 = versionMigrations5;
|
|
937709
937925
|
|
|
937710
937926
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
937711
|
-
var
|
|
937927
|
+
var import_promises154 = require("fs/promises");
|
|
937712
937928
|
|
|
937713
937929
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
937714
937930
|
init_lib6();
|
|
@@ -937741,9 +937957,9 @@ var migration6 = {
|
|
|
937741
937957
|
run: async ({ context: context3 }) => {
|
|
937742
937958
|
const yamlFiles = await getAllYamlFiles4(context3);
|
|
937743
937959
|
for (const filepath of yamlFiles) {
|
|
937744
|
-
const contents = await (0,
|
|
937960
|
+
const contents = await (0, import_promises154.readFile)(filepath);
|
|
937745
937961
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
937746
|
-
await (0,
|
|
937962
|
+
await (0, import_promises154.writeFile)(filepath, newContents);
|
|
937747
937963
|
}
|
|
937748
937964
|
}
|
|
937749
937965
|
};
|
|
@@ -937756,7 +937972,7 @@ var versionMigrations6 = {
|
|
|
937756
937972
|
var __default6 = versionMigrations6;
|
|
937757
937973
|
|
|
937758
937974
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
937759
|
-
var
|
|
937975
|
+
var import_promises155 = require("fs/promises");
|
|
937760
937976
|
|
|
937761
937977
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
937762
937978
|
init_lib6();
|
|
@@ -937789,9 +938005,9 @@ var migration7 = {
|
|
|
937789
938005
|
run: async ({ context: context3 }) => {
|
|
937790
938006
|
const yamlFiles = await getAllRootApiYamlFiles(context3);
|
|
937791
938007
|
for (const filepath of yamlFiles) {
|
|
937792
|
-
const contents = await (0,
|
|
938008
|
+
const contents = await (0, import_promises155.readFile)(filepath);
|
|
937793
938009
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
937794
|
-
await (0,
|
|
938010
|
+
await (0, import_promises155.writeFile)(filepath, newContents);
|
|
937795
938011
|
}
|
|
937796
938012
|
}
|
|
937797
938013
|
};
|
|
@@ -937805,7 +938021,7 @@ var __default7 = versionMigrations7;
|
|
|
937805
938021
|
|
|
937806
938022
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
937807
938023
|
init_lib4();
|
|
937808
|
-
var
|
|
938024
|
+
var import_promises156 = require("fs/promises");
|
|
937809
938025
|
|
|
937810
938026
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
937811
938027
|
init_lib6();
|
|
@@ -937914,7 +938130,7 @@ var migration8 = {
|
|
|
937914
938130
|
}
|
|
937915
938131
|
};
|
|
937916
938132
|
async function migrateGeneratorsYml3(filepath) {
|
|
937917
|
-
const contentsStr = await (0,
|
|
938133
|
+
const contentsStr = await (0, import_promises156.readFile)(filepath);
|
|
937918
938134
|
const contents = jsYaml.load(contentsStr.toString());
|
|
937919
938135
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
937920
938136
|
let newGeneratorsConfiguration = {};
|
|
@@ -937932,7 +938148,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
937932
938148
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
937933
938149
|
};
|
|
937934
938150
|
}
|
|
937935
|
-
await (0,
|
|
938151
|
+
await (0, import_promises156.writeFile)(filepath, jsYaml.dump(newGeneratorsConfiguration));
|
|
937936
938152
|
}
|
|
937937
938153
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
937938
938154
|
const newSchema = {
|
|
@@ -938007,7 +938223,7 @@ var versionMigrations8 = {
|
|
|
938007
938223
|
var __default8 = versionMigrations8;
|
|
938008
938224
|
|
|
938009
938225
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
938010
|
-
var
|
|
938226
|
+
var import_promises157 = require("fs/promises");
|
|
938011
938227
|
var import_yaml11 = __toESM(require_dist9(), 1);
|
|
938012
938228
|
|
|
938013
938229
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
@@ -938050,7 +938266,7 @@ var migration9 = {
|
|
|
938050
938266
|
}
|
|
938051
938267
|
};
|
|
938052
938268
|
async function migrateRootApiFile(filepath) {
|
|
938053
|
-
const contents = await (0,
|
|
938269
|
+
const contents = await (0, import_promises157.readFile)(filepath);
|
|
938054
938270
|
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
938055
938271
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
938056
938272
|
if (errorDiscriminant == null || !import_yaml11.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
@@ -938061,7 +938277,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
938061
938277
|
"property-name": errorDiscriminant.value
|
|
938062
938278
|
});
|
|
938063
938279
|
parsedDocument.delete("error-discriminant");
|
|
938064
|
-
await (0,
|
|
938280
|
+
await (0, import_promises157.writeFile)(filepath, parsedDocument.toString());
|
|
938065
938281
|
}
|
|
938066
938282
|
|
|
938067
938283
|
// ../cli-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -938072,7 +938288,7 @@ var versionMigrations9 = {
|
|
|
938072
938288
|
var __default9 = versionMigrations9;
|
|
938073
938289
|
|
|
938074
938290
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
938075
|
-
var
|
|
938291
|
+
var import_promises158 = require("fs/promises");
|
|
938076
938292
|
var import_yaml12 = __toESM(require_dist9(), 1);
|
|
938077
938293
|
|
|
938078
938294
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
@@ -938115,7 +938331,7 @@ var migration10 = {
|
|
|
938115
938331
|
}
|
|
938116
938332
|
};
|
|
938117
938333
|
async function migrateYamlFile(filepath, context3) {
|
|
938118
|
-
const contents = await (0,
|
|
938334
|
+
const contents = await (0, import_promises158.readFile)(filepath);
|
|
938119
938335
|
const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
|
|
938120
938336
|
const services = parsedDocument.get("services");
|
|
938121
938337
|
if (services == null) {
|
|
@@ -938155,7 +938371,7 @@ async function migrateYamlFile(filepath, context3) {
|
|
|
938155
938371
|
context3.failWithoutThrowing("Failed to convert endpoint", e6);
|
|
938156
938372
|
}
|
|
938157
938373
|
}
|
|
938158
|
-
await (0,
|
|
938374
|
+
await (0, import_promises158.writeFile)(filepath, parsedDocument.toString());
|
|
938159
938375
|
}
|
|
938160
938376
|
}
|
|
938161
938377
|
function convertEndpoint4({ document: document4, endpoint: endpoint3 }) {
|
|
@@ -938234,7 +938450,7 @@ var versionMigrations10 = {
|
|
|
938234
938450
|
var __default10 = versionMigrations10;
|
|
938235
938451
|
|
|
938236
938452
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
938237
|
-
var
|
|
938453
|
+
var import_promises159 = require("fs/promises");
|
|
938238
938454
|
var import_yaml13 = __toESM(require_dist9(), 1);
|
|
938239
938455
|
|
|
938240
938456
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
@@ -938277,7 +938493,7 @@ var migration11 = {
|
|
|
938277
938493
|
}
|
|
938278
938494
|
};
|
|
938279
938495
|
async function migrateYamlFile2(filepath, context3) {
|
|
938280
|
-
const contents = await (0,
|
|
938496
|
+
const contents = await (0, import_promises159.readFile)(filepath);
|
|
938281
938497
|
const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
|
|
938282
938498
|
const types4 = parsedDocument.get("types");
|
|
938283
938499
|
if (types4 == null) {
|
|
@@ -938303,7 +938519,7 @@ async function migrateYamlFile2(filepath, context3) {
|
|
|
938303
938519
|
examples.set(i11, { value });
|
|
938304
938520
|
}
|
|
938305
938521
|
}
|
|
938306
|
-
await (0,
|
|
938522
|
+
await (0, import_promises159.writeFile)(filepath, parsedDocument.toString());
|
|
938307
938523
|
}
|
|
938308
938524
|
|
|
938309
938525
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -938314,7 +938530,7 @@ var versionMigrations11 = {
|
|
|
938314
938530
|
var __default11 = versionMigrations11;
|
|
938315
938531
|
|
|
938316
938532
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
938317
|
-
var
|
|
938533
|
+
var import_promises160 = require("fs/promises");
|
|
938318
938534
|
var import_yaml14 = __toESM(require_dist9(), 1);
|
|
938319
938535
|
|
|
938320
938536
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
@@ -938357,7 +938573,7 @@ var migration12 = {
|
|
|
938357
938573
|
}
|
|
938358
938574
|
};
|
|
938359
938575
|
async function migrateYamlFile3(filepath, context3) {
|
|
938360
|
-
const contents = await (0,
|
|
938576
|
+
const contents = await (0, import_promises160.readFile)(filepath);
|
|
938361
938577
|
const parsedDocument = import_yaml14.default.parseDocument(contents.toString());
|
|
938362
938578
|
if (!import_yaml14.default.isMap(parsedDocument.contents)) {
|
|
938363
938579
|
return context3.failAndThrow("File is not a map");
|
|
@@ -938387,7 +938603,7 @@ async function migrateYamlFile3(filepath, context3) {
|
|
|
938387
938603
|
pair.value = firstService.value;
|
|
938388
938604
|
}
|
|
938389
938605
|
}
|
|
938390
|
-
await (0,
|
|
938606
|
+
await (0, import_promises160.writeFile)(filepath, parsedDocument.toString());
|
|
938391
938607
|
}
|
|
938392
938608
|
|
|
938393
938609
|
// ../cli-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -938398,7 +938614,7 @@ var versionMigrations12 = {
|
|
|
938398
938614
|
var __default12 = versionMigrations12;
|
|
938399
938615
|
|
|
938400
938616
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
938401
|
-
var
|
|
938617
|
+
var import_promises161 = require("fs/promises");
|
|
938402
938618
|
var import_yaml15 = __toESM(require_dist9(), 1);
|
|
938403
938619
|
|
|
938404
938620
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
@@ -938441,7 +938657,7 @@ var migration13 = {
|
|
|
938441
938657
|
}
|
|
938442
938658
|
};
|
|
938443
938659
|
async function migrateYamlFile4(filepath, context3) {
|
|
938444
|
-
const contents = await (0,
|
|
938660
|
+
const contents = await (0, import_promises161.readFile)(filepath);
|
|
938445
938661
|
const parsedDocument = import_yaml15.default.parseDocument(contents.toString());
|
|
938446
938662
|
if (!import_yaml15.default.isMap(parsedDocument.contents)) {
|
|
938447
938663
|
return context3.failAndThrow("File is not a map");
|
|
@@ -938460,7 +938676,7 @@ async function migrateYamlFile4(filepath, context3) {
|
|
|
938460
938676
|
}
|
|
938461
938677
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
938462
938678
|
parsedDocument.contents.items.unshift(docsPair);
|
|
938463
|
-
await (0,
|
|
938679
|
+
await (0, import_promises161.writeFile)(filepath, parsedDocument.toString());
|
|
938464
938680
|
}
|
|
938465
938681
|
|
|
938466
938682
|
// ../cli-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -938471,7 +938687,7 @@ var versionMigrations13 = {
|
|
|
938471
938687
|
var __default13 = versionMigrations13;
|
|
938472
938688
|
|
|
938473
938689
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
938474
|
-
var
|
|
938690
|
+
var import_promises162 = require("fs/promises");
|
|
938475
938691
|
|
|
938476
938692
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
938477
938693
|
init_lib6();
|
|
@@ -938513,14 +938729,14 @@ var migration14 = {
|
|
|
938513
938729
|
}
|
|
938514
938730
|
};
|
|
938515
938731
|
async function migrateYamlFile5(filepath) {
|
|
938516
|
-
const contents = await (0,
|
|
938732
|
+
const contents = await (0, import_promises162.readFile)(filepath);
|
|
938517
938733
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
938518
938734
|
const regex5 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
938519
938735
|
const updatedSnapshot = contents.toString().replace(regex5, (_match, _prefix, domain3) => {
|
|
938520
938736
|
return `docs:
|
|
938521
938737
|
domain: "${domain3}.${domainSuffix}"`;
|
|
938522
938738
|
});
|
|
938523
|
-
await (0,
|
|
938739
|
+
await (0, import_promises162.writeFile)(filepath, updatedSnapshot.toString());
|
|
938524
938740
|
}
|
|
938525
938741
|
|
|
938526
938742
|
// ../cli-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -938540,10 +938756,10 @@ var LegacyDocsSerializers = __toESM(require_serialization4(), 1);
|
|
|
938540
938756
|
|
|
938541
938757
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
938542
938758
|
init_lib6();
|
|
938543
|
-
var
|
|
938759
|
+
var import_promises163 = require("fs/promises");
|
|
938544
938760
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
938545
938761
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
938546
|
-
const contentsStr = await (0,
|
|
938762
|
+
const contentsStr = await (0, import_promises163.readFile)(filepath);
|
|
938547
938763
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
938548
938764
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
938549
938765
|
if (result.ok) {
|
|
@@ -938562,7 +938778,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
938562
938778
|
|
|
938563
938779
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
938564
938780
|
init_lib6();
|
|
938565
|
-
var
|
|
938781
|
+
var import_promises165 = require("fs/promises");
|
|
938566
938782
|
|
|
938567
938783
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
938568
938784
|
function convertLegacyDocsConfig({ docsConfiguration, docsURLs, apiName }) {
|
|
@@ -938745,10 +938961,10 @@ __export(legacy_exports, {
|
|
|
938745
938961
|
|
|
938746
938962
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
938747
938963
|
init_lib6();
|
|
938748
|
-
var
|
|
938964
|
+
var import_promises164 = require("fs/promises");
|
|
938749
938965
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
938750
938966
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
938751
|
-
const contentsStr = await (0,
|
|
938967
|
+
const contentsStr = await (0, import_promises164.readFile)(filepath);
|
|
938752
938968
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
938753
938969
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
938754
938970
|
if (result.success) {
|
|
@@ -938778,7 +938994,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
938778
938994
|
var APIS_DIRECTORY2 = "apis";
|
|
938779
938995
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
938780
938996
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY2));
|
|
938781
|
-
await (0,
|
|
938997
|
+
await (0, import_promises165.mkdir)(absolutePathToApisDirectory);
|
|
938782
938998
|
for (const workspace of workspaces) {
|
|
938783
938999
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
938784
939000
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -938786,11 +939002,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
938786
939002
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
938787
939003
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
938788
939004
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
938789
|
-
await (0,
|
|
939005
|
+
await (0, import_promises165.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
938790
939006
|
}
|
|
938791
939007
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
938792
939008
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
938793
|
-
await (0,
|
|
939009
|
+
await (0, import_promises165.rm)(absolutePathToWorkspace, { recursive: true });
|
|
938794
939010
|
}
|
|
938795
939011
|
}
|
|
938796
939012
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -938803,7 +939019,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
938803
939019
|
generatorsConfiguration,
|
|
938804
939020
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
938805
939021
|
});
|
|
938806
|
-
await (0,
|
|
939022
|
+
await (0, import_promises165.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
938807
939023
|
return convertedResponse.docsURLs;
|
|
938808
939024
|
}
|
|
938809
939025
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -938817,20 +939033,20 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
938817
939033
|
apiName
|
|
938818
939034
|
});
|
|
938819
939035
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
938820
|
-
await (0,
|
|
939036
|
+
await (0, import_promises165.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
938821
939037
|
}
|
|
938822
939038
|
|
|
938823
939039
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
938824
939040
|
init_lib6();
|
|
938825
|
-
var
|
|
939041
|
+
var import_promises166 = require("fs/promises");
|
|
938826
939042
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
938827
939043
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
938828
939044
|
await migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs });
|
|
938829
939045
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
938830
939046
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
938831
939047
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
938832
|
-
await (0,
|
|
938833
|
-
await (0,
|
|
939048
|
+
await (0, import_promises166.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
939049
|
+
await (0, import_promises166.rm)(absolutePathToWorkspace, { recursive: true });
|
|
938834
939050
|
}
|
|
938835
939051
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
938836
939052
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -938843,7 +939059,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
938843
939059
|
apiName: void 0
|
|
938844
939060
|
});
|
|
938845
939061
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
938846
|
-
await (0,
|
|
939062
|
+
await (0, import_promises166.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
938847
939063
|
}
|
|
938848
939064
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
938849
939065
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -938855,23 +939071,23 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
938855
939071
|
generatorsConfiguration,
|
|
938856
939072
|
pathModificationStrategy: "MoveUp"
|
|
938857
939073
|
});
|
|
938858
|
-
await (0,
|
|
939074
|
+
await (0, import_promises166.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
938859
939075
|
return convertedResponse.docsURLs;
|
|
938860
939076
|
}
|
|
938861
939077
|
|
|
938862
939078
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
938863
939079
|
init_lib6();
|
|
938864
|
-
var
|
|
939080
|
+
var import_promises167 = require("fs/promises");
|
|
938865
939081
|
var APIS_DIRECTORY3 = "apis";
|
|
938866
939082
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
938867
939083
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY3));
|
|
938868
|
-
await (0,
|
|
939084
|
+
await (0, import_promises167.mkdir)(absolutePathToApisDirectory);
|
|
938869
939085
|
for (const workspace of workspaces) {
|
|
938870
939086
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
938871
939087
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
938872
939088
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
938873
939089
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
938874
|
-
await (0,
|
|
939090
|
+
await (0, import_promises167.rm)(absolutePathToWorkspace, { recursive: true });
|
|
938875
939091
|
}
|
|
938876
939092
|
}
|
|
938877
939093
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -938884,16 +939100,16 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
938884
939100
|
generatorsConfiguration,
|
|
938885
939101
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
938886
939102
|
});
|
|
938887
|
-
await (0,
|
|
939103
|
+
await (0, import_promises167.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
938888
939104
|
}
|
|
938889
939105
|
|
|
938890
939106
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
938891
939107
|
init_lib6();
|
|
938892
|
-
var
|
|
939108
|
+
var import_promises168 = require("fs/promises");
|
|
938893
939109
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
938894
939110
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
938895
939111
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
938896
|
-
await (0,
|
|
939112
|
+
await (0, import_promises168.rm)(absolutePathToWorkspace, { recursive: true });
|
|
938897
939113
|
}
|
|
938898
939114
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
938899
939115
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -938905,7 +939121,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
938905
939121
|
generatorsConfiguration,
|
|
938906
939122
|
pathModificationStrategy: "MoveUp"
|
|
938907
939123
|
});
|
|
938908
|
-
await (0,
|
|
939124
|
+
await (0, import_promises168.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
938909
939125
|
}
|
|
938910
939126
|
|
|
938911
939127
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -938983,7 +939199,7 @@ var __default15 = versionMigrations15;
|
|
|
938983
939199
|
|
|
938984
939200
|
// ../cli-migrations/lib/migrations/0.41.0-rc0/require-generators-yml/migration.js
|
|
938985
939201
|
init_lib6();
|
|
938986
|
-
var
|
|
939202
|
+
var import_promises169 = require("fs/promises");
|
|
938987
939203
|
var import_yaml16 = __toESM(require_dist9(), 1);
|
|
938988
939204
|
var migration16 = {
|
|
938989
939205
|
name: "require-generators-yml",
|
|
@@ -939026,7 +939242,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
939026
939242
|
if (existingGeneratorsYml == null) {
|
|
939027
939243
|
if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
939028
939244
|
const absolutePathToGeneratorsYml = join8(absoluteFilepathToWorkspace, RelativeFilePath2.of("generators.yml"));
|
|
939029
|
-
await (0,
|
|
939245
|
+
await (0, import_promises169.writeFile)(absolutePathToGeneratorsYml, jsYaml.dump({
|
|
939030
939246
|
api: {
|
|
939031
939247
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
939032
939248
|
}
|
|
@@ -939041,7 +939257,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
939041
939257
|
parsedDocument.set("api", {
|
|
939042
939258
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
939043
939259
|
});
|
|
939044
|
-
await (0,
|
|
939260
|
+
await (0, import_promises169.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
|
|
939045
939261
|
context3.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
|
|
939046
939262
|
}
|
|
939047
939263
|
}
|
|
@@ -939069,7 +939285,7 @@ var __default16 = versionMigrations16;
|
|
|
939069
939285
|
|
|
939070
939286
|
// ../cli-migrations/lib/migrations/0.54.0-rc0/use-generators-yml-specs/migration.js
|
|
939071
939287
|
init_lib6();
|
|
939072
|
-
var
|
|
939288
|
+
var import_promises170 = require("fs/promises");
|
|
939073
939289
|
var import_yaml17 = __toESM(require_dist9(), 1);
|
|
939074
939290
|
var migration17 = {
|
|
939075
939291
|
name: "generators-yml-use-api-specs",
|
|
@@ -939249,7 +939465,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
|
|
|
939249
939465
|
if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
|
|
939250
939466
|
documentToWrite = `${schemaComment}${documentToWrite}`;
|
|
939251
939467
|
}
|
|
939252
|
-
await (0,
|
|
939468
|
+
await (0, import_promises170.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
939253
939469
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
939254
939470
|
}
|
|
939255
939471
|
async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, directories, context: context3, namespace }) {
|
|
@@ -939296,7 +939512,7 @@ async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, direc
|
|
|
939296
939512
|
}
|
|
939297
939513
|
let specContent;
|
|
939298
939514
|
try {
|
|
939299
|
-
const fileContents = await (0,
|
|
939515
|
+
const fileContents = await (0, import_promises170.readFile)(absoluteSpecPath, { encoding: "utf-8" });
|
|
939300
939516
|
specContent = jsYaml.load(fileContents);
|
|
939301
939517
|
} catch (e6) {
|
|
939302
939518
|
context3.logger.warn(`Failed to read API spec file ${spec.path}. Error: ${e6}. Skipping...`);
|
|
@@ -939400,7 +939616,7 @@ var __default17 = versionMigrations17;
|
|
|
939400
939616
|
|
|
939401
939617
|
// ../cli-migrations/lib/migrations/0.82.1/add-path-parameter-order-setting/migration.js
|
|
939402
939618
|
init_lib6();
|
|
939403
|
-
var
|
|
939619
|
+
var import_promises171 = require("fs/promises");
|
|
939404
939620
|
var migration18 = {
|
|
939405
939621
|
name: "add-path-parameter-order-setting",
|
|
939406
939622
|
summary: `Adds the 'path-parameter-order' setting to existing API configurations to maintain backwards compatibility.
|
|
@@ -939488,7 +939704,7 @@ async function updateGeneratorsYml({ context: context3, files }) {
|
|
|
939488
939704
|
documentToWrite = `${schemaComment}
|
|
939489
939705
|
${documentToWrite}`;
|
|
939490
939706
|
}
|
|
939491
|
-
await (0,
|
|
939707
|
+
await (0, import_promises171.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
939492
939708
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
939493
939709
|
}
|
|
939494
939710
|
async function getFilesAndDirectories3(absoluteFilepath) {
|
|
@@ -939525,7 +939741,7 @@ var __default18 = versionMigrations18;
|
|
|
939525
939741
|
|
|
939526
939742
|
// ../cli-migrations/lib/migrations/1.0.0/update-settings-defaults/migration.js
|
|
939527
939743
|
init_lib6();
|
|
939528
|
-
var
|
|
939744
|
+
var import_promises172 = require("fs/promises");
|
|
939529
939745
|
var migration19 = {
|
|
939530
939746
|
name: "update-1_0_0-defaults",
|
|
939531
939747
|
summary: `The defaults of the API spec settings have changed.
|
|
@@ -939700,7 +939916,7 @@ async function updateGeneratorsYml2({ context: context3, files }) {
|
|
|
939700
939916
|
documentToWrite = `${schemaComment}
|
|
939701
939917
|
${documentToWrite}`;
|
|
939702
939918
|
}
|
|
939703
|
-
await (0,
|
|
939919
|
+
await (0, import_promises172.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
939704
939920
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
939705
939921
|
}
|
|
939706
939922
|
async function getFilesAndDirectories4(absoluteFilepath) {
|
|
@@ -939770,7 +939986,7 @@ var __default19 = versionMigrations19;
|
|
|
939770
939986
|
|
|
939771
939987
|
// ../cli-migrations/lib/migrations/2.0.0-rc0/update-settings-defaults/migration.js
|
|
939772
939988
|
init_lib6();
|
|
939773
|
-
var
|
|
939989
|
+
var import_promises173 = require("fs/promises");
|
|
939774
939990
|
var migration20 = {
|
|
939775
939991
|
name: "update-2_0_0-defaults",
|
|
939776
939992
|
summary: `The default of 'coerce-enums-to-literals' has changed from true to false.
|
|
@@ -939945,7 +940161,7 @@ async function updateGeneratorsYml3({ context: context3, files }) {
|
|
|
939945
940161
|
documentToWrite = `${schemaComment}
|
|
939946
940162
|
${documentToWrite}`;
|
|
939947
940163
|
}
|
|
939948
|
-
await (0,
|
|
940164
|
+
await (0, import_promises173.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
939949
940165
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
939950
940166
|
}
|
|
939951
940167
|
async function getFilesAndDirectories5(absoluteFilepath) {
|
|
@@ -939992,7 +940208,7 @@ var __default20 = versionMigrations20;
|
|
|
939992
940208
|
|
|
939993
940209
|
// ../cli-migrations/lib/migrations/2.13.0/migrate-deprecated-generator-api-settings/migration.js
|
|
939994
940210
|
init_lib6();
|
|
939995
|
-
var
|
|
940211
|
+
var import_promises174 = require("fs/promises");
|
|
939996
940212
|
var migration21 = {
|
|
939997
940213
|
name: "migrate-deprecated-generator-api-settings",
|
|
939998
940214
|
summary: `Migrates deprecated generator-level API settings keys to their new equivalents:
|
|
@@ -940083,7 +940299,7 @@ async function updateGeneratorsYml4({ context: context3, files }) {
|
|
|
940083
940299
|
documentToWrite = `${schemaComment}
|
|
940084
940300
|
${documentToWrite}`;
|
|
940085
940301
|
}
|
|
940086
|
-
await (0,
|
|
940302
|
+
await (0, import_promises174.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
940087
940303
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
940088
940304
|
}
|
|
940089
940305
|
function migrateDeprecatedSettings(settings, context3) {
|
|
@@ -940130,7 +940346,7 @@ var __default21 = versionMigrations21;
|
|
|
940130
940346
|
|
|
940131
940347
|
// ../cli-migrations/lib/migrations/3.0.0/enable-smart-casing/migration.js
|
|
940132
940348
|
init_lib6();
|
|
940133
|
-
var
|
|
940349
|
+
var import_promises175 = require("fs/promises");
|
|
940134
940350
|
var migration22 = {
|
|
940135
940351
|
name: "enable-smart-casing",
|
|
940136
940352
|
summary: `Sets 'smart-casing: false' for existing generators to preserve backwards compatibility.
|
|
@@ -940214,7 +940430,7 @@ async function updateGeneratorsYml5({ context: context3, files }) {
|
|
|
940214
940430
|
documentToWrite = `${schemaComment}
|
|
940215
940431
|
${documentToWrite}`;
|
|
940216
940432
|
}
|
|
940217
|
-
await (0,
|
|
940433
|
+
await (0, import_promises175.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
940218
940434
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
940219
940435
|
}
|
|
940220
940436
|
function setSmartCasingFalseIfNotConfigured(generator, context3) {
|
|
@@ -940355,7 +940571,7 @@ ${source_default.dim(migration23.summary)}`
|
|
|
940355
940571
|
}
|
|
940356
940572
|
|
|
940357
940573
|
// src/commands/upgrade/upgrade.ts
|
|
940358
|
-
var
|
|
940574
|
+
var import_promises176 = require("fs/promises");
|
|
940359
940575
|
|
|
940360
940576
|
// src/cwd.ts
|
|
940361
940577
|
var FERN_CWD_ENV_VAR = "FERN_CWD";
|
|
@@ -940682,7 +940898,7 @@ async function upgrade({
|
|
|
940682
940898
|
const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
|
|
940683
940899
|
draft.version = resolvedTargetVersion;
|
|
940684
940900
|
});
|
|
940685
|
-
await (0,
|
|
940901
|
+
await (0, import_promises176.writeFile)(
|
|
940686
940902
|
projectConfig2._absolutePath,
|
|
940687
940903
|
ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2))
|
|
940688
940904
|
);
|
|
@@ -941307,7 +941523,7 @@ async function validateWorkspaces({
|
|
|
941307
941523
|
|
|
941308
941524
|
// src/commands/write-definition/writeDefinitionForWorkspaces.ts
|
|
941309
941525
|
init_lib6();
|
|
941310
|
-
var
|
|
941526
|
+
var import_promises177 = require("fs/promises");
|
|
941311
941527
|
var import_path91 = __toESM(require("path"), 1);
|
|
941312
941528
|
async function writeDefinitionForWorkspaces({
|
|
941313
941529
|
project,
|
|
@@ -941388,28 +941604,28 @@ async function writeFernDefinition({
|
|
|
941388
941604
|
return a10.localeCompare(b19);
|
|
941389
941605
|
};
|
|
941390
941606
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
941391
|
-
await (0,
|
|
941607
|
+
await (0, import_promises177.rm)(absolutePathToOutputDirectory, { recursive: true });
|
|
941392
941608
|
}
|
|
941393
|
-
await (0,
|
|
941394
|
-
await (0,
|
|
941609
|
+
await (0, import_promises177.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
941610
|
+
await (0, import_promises177.writeFile)(
|
|
941395
941611
|
join8(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
|
|
941396
941612
|
jsYaml.dump(definition3.rootApiFile.contents, { sortKeys })
|
|
941397
941613
|
);
|
|
941398
941614
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
941399
941615
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
941400
|
-
await (0,
|
|
941401
|
-
await (0,
|
|
941616
|
+
await (0, import_promises177.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
941617
|
+
await (0, import_promises177.writeFile)(absoluteFilepath, jsYaml.dump(packageMarker.contents, { sortKeys }));
|
|
941402
941618
|
}
|
|
941403
941619
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
941404
941620
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
941405
|
-
await (0,
|
|
941406
|
-
await (0,
|
|
941621
|
+
await (0, import_promises177.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
941622
|
+
await (0, import_promises177.writeFile)(absoluteFilepath, jsYaml.dump(definitionFile.contents, { sortKeys }));
|
|
941407
941623
|
}
|
|
941408
941624
|
}
|
|
941409
941625
|
|
|
941410
941626
|
// src/commands/write-docs-definition/writeDocsDefinitionForProject.ts
|
|
941411
941627
|
init_lib6();
|
|
941412
|
-
var
|
|
941628
|
+
var import_promises178 = require("fs/promises");
|
|
941413
941629
|
async function writeDocsDefinitionForProject({
|
|
941414
941630
|
project,
|
|
941415
941631
|
outputPath,
|
|
@@ -941441,7 +941657,7 @@ async function writeDocsDefinitionForProject({
|
|
|
941441
941657
|
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
941658
|
});
|
|
941443
941659
|
const docsDefinition = await docsResolver.resolve();
|
|
941444
|
-
await (0,
|
|
941660
|
+
await (0, import_promises178.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
|
|
941445
941661
|
context3.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
|
|
941446
941662
|
});
|
|
941447
941663
|
}
|
|
@@ -941450,7 +941666,7 @@ async function writeDocsDefinitionForProject({
|
|
|
941450
941666
|
init_lib6();
|
|
941451
941667
|
var import_cli_progress2 = __toESM(require_cli_progress(), 1);
|
|
941452
941668
|
var import_fs38 = require("fs");
|
|
941453
|
-
var
|
|
941669
|
+
var import_promises182 = require("fs/promises");
|
|
941454
941670
|
var import_is_ci3 = __toESM(require_is_ci(), 1);
|
|
941455
941671
|
var import_path94 = __toESM(require("path"), 1);
|
|
941456
941672
|
|
|
@@ -941943,7 +942159,7 @@ function shouldProcessFile(filePath, stub) {
|
|
|
941943
942159
|
|
|
941944
942160
|
// src/commands/write-translation/docs-config-utils.ts
|
|
941945
942161
|
init_lib6();
|
|
941946
|
-
var
|
|
942162
|
+
var import_promises179 = require("fs/promises");
|
|
941947
942163
|
|
|
941948
942164
|
// src/commands/write-translation/url-utils.ts
|
|
941949
942165
|
function addLanguageSuffixToUrl(url3, language) {
|
|
@@ -942100,7 +942316,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
942100
942316
|
stub = false
|
|
942101
942317
|
}) {
|
|
942102
942318
|
try {
|
|
942103
|
-
const originalConfigContent = await (0,
|
|
942319
|
+
const originalConfigContent = await (0, import_promises179.readFile)(originalDocsConfigPath, "utf-8");
|
|
942104
942320
|
const transformation = {
|
|
942105
942321
|
filePath: DOCS_CONFIGURATION_FILENAME,
|
|
942106
942322
|
language,
|
|
@@ -942114,7 +942330,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
942114
942330
|
const modifiedConfigContent = jsYaml.dump(modifiedConfig, {
|
|
942115
942331
|
sortKeys: false
|
|
942116
942332
|
});
|
|
942117
|
-
await (0,
|
|
942333
|
+
await (0, import_promises179.writeFile)(modifiedConfigPath, modifiedConfigContent, "utf-8");
|
|
942118
942334
|
context3.logger.debug(`Created language-specific docs config: ${modifiedConfigPath}`);
|
|
942119
942335
|
} catch (error50) {
|
|
942120
942336
|
if (error50 instanceof Error && error50.message.includes("403")) {
|
|
@@ -942127,11 +942343,11 @@ async function createLanguageSpecificDocsConfig({
|
|
|
942127
942343
|
// src/commands/write-translation/file-collection-utils.ts
|
|
942128
942344
|
init_lib6();
|
|
942129
942345
|
var import_fs36 = require("fs");
|
|
942130
|
-
var
|
|
942346
|
+
var import_promises180 = require("fs/promises");
|
|
942131
942347
|
var import_path92 = __toESM(require("path"), 1);
|
|
942132
942348
|
async function collectFiles(baseDirectory, relativeBase) {
|
|
942133
942349
|
const discoveredFiles = {};
|
|
942134
|
-
const entries23 = await (0,
|
|
942350
|
+
const entries23 = await (0, import_promises180.readdir)(baseDirectory);
|
|
942135
942351
|
for (const entry of entries23) {
|
|
942136
942352
|
if (entry === "translations") {
|
|
942137
942353
|
continue;
|
|
@@ -942154,7 +942370,7 @@ async function collectFiles(baseDirectory, relativeBase) {
|
|
|
942154
942370
|
// src/commands/write-translation/hash-utils.ts
|
|
942155
942371
|
var import_crypto13 = require("crypto");
|
|
942156
942372
|
var import_fs37 = require("fs");
|
|
942157
|
-
var
|
|
942373
|
+
var import_promises181 = require("fs/promises");
|
|
942158
942374
|
var import_path93 = __toESM(require("path"), 1);
|
|
942159
942375
|
function calculateContentHash(content5) {
|
|
942160
942376
|
return (0, import_crypto13.createHash)("sha256").update(content5, "utf-8").digest("hex");
|
|
@@ -942165,7 +942381,7 @@ async function loadHashMappings(translationsDirectory) {
|
|
|
942165
942381
|
return {};
|
|
942166
942382
|
}
|
|
942167
942383
|
try {
|
|
942168
|
-
const hashesContent = await (0,
|
|
942384
|
+
const hashesContent = await (0, import_promises181.readFile)(hashesFilePath, "utf-8");
|
|
942169
942385
|
const parsed = JSON.parse(hashesContent);
|
|
942170
942386
|
const { _comment, ...hashMappings } = parsed;
|
|
942171
942387
|
return hashMappings;
|
|
@@ -942186,11 +942402,11 @@ async function saveHashMappings(translationsDirectory, hashMappings) {
|
|
|
942186
942402
|
_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
942403
|
...sortedMappings
|
|
942188
942404
|
};
|
|
942189
|
-
await (0,
|
|
942405
|
+
await (0, import_promises181.writeFile)(hashesFilePath, JSON.stringify(fileContent, null, 2), "utf-8");
|
|
942190
942406
|
}
|
|
942191
942407
|
async function hasFileChanged(filePath, relativePath, previousHashes) {
|
|
942192
942408
|
try {
|
|
942193
|
-
const content5 = await (0,
|
|
942409
|
+
const content5 = await (0, import_promises181.readFile)(filePath, "utf-8");
|
|
942194
942410
|
const currentHash = calculateContentHash(content5);
|
|
942195
942411
|
const previousHash = previousHashes[relativePath];
|
|
942196
942412
|
return currentHash !== previousHash;
|
|
@@ -942246,7 +942462,7 @@ async function writeTranslationForProject({
|
|
|
942246
942462
|
}
|
|
942247
942463
|
if (!(0, import_fs38.existsSync)(translationsDirectory)) {
|
|
942248
942464
|
context3.logger.debug(`Creating translations directory at: ${translationsDirectory}`);
|
|
942249
|
-
await (0,
|
|
942465
|
+
await (0, import_promises182.mkdir)(translationsDirectory, { recursive: true });
|
|
942250
942466
|
}
|
|
942251
942467
|
const languageStats = {};
|
|
942252
942468
|
const targetLanguages = languages.filter((lang) => lang !== sourceLanguage);
|
|
@@ -942259,7 +942475,7 @@ async function writeTranslationForProject({
|
|
|
942259
942475
|
RelativeFilePath2.of("fern")
|
|
942260
942476
|
);
|
|
942261
942477
|
if (!(0, import_fs38.existsSync)(languageDirectory)) {
|
|
942262
|
-
await (0,
|
|
942478
|
+
await (0, import_promises182.mkdir)(languageDirectory, { recursive: true });
|
|
942263
942479
|
}
|
|
942264
942480
|
languageStats[language] = {
|
|
942265
942481
|
filesProcessed: 0,
|
|
@@ -942361,7 +942577,7 @@ async function writeTranslationForProject({
|
|
|
942361
942577
|
`[COMPLETED] ${DOCS_CONFIGURATION_FILENAME} -> ${language}/${DOCS_CONFIGURATION_FILENAME}`
|
|
942362
942578
|
);
|
|
942363
942579
|
}
|
|
942364
|
-
const originalConfigContent = await (0,
|
|
942580
|
+
const originalConfigContent = await (0, import_promises182.readFile)(originalDocsConfigPath, "utf-8");
|
|
942365
942581
|
await updateAndSaveHashForFile(
|
|
942366
942582
|
translationsDirectory,
|
|
942367
942583
|
hashMappings,
|
|
@@ -942406,7 +942622,7 @@ async function writeTranslationForProject({
|
|
|
942406
942622
|
continue;
|
|
942407
942623
|
}
|
|
942408
942624
|
cliContext.logger.debug(`[PROCESSING] ${relativePath} (detected changes)`);
|
|
942409
|
-
const originalContent = await (0,
|
|
942625
|
+
const originalContent = await (0, import_promises182.readFile)(filePath, "utf-8");
|
|
942410
942626
|
await updateAndSaveHashForFile(translationsDirectory, hashMappings, relativePath, originalContent);
|
|
942411
942627
|
const sourceStats = languageStats[sourceLanguage];
|
|
942412
942628
|
if (sourceStats) {
|
|
@@ -942431,7 +942647,7 @@ async function writeTranslationForProject({
|
|
|
942431
942647
|
const destPath = join8(languageDirectory, relativePath);
|
|
942432
942648
|
const destDir = import_path94.default.dirname(destPath);
|
|
942433
942649
|
if (!(0, import_fs38.existsSync)(destDir)) {
|
|
942434
|
-
await (0,
|
|
942650
|
+
await (0, import_promises182.mkdir)(destDir, { recursive: true });
|
|
942435
942651
|
}
|
|
942436
942652
|
const transformation = {
|
|
942437
942653
|
filePath: relativePath,
|
|
@@ -942444,7 +942660,7 @@ async function writeTranslationForProject({
|
|
|
942444
942660
|
cliContext,
|
|
942445
942661
|
stub
|
|
942446
942662
|
});
|
|
942447
|
-
await (0,
|
|
942663
|
+
await (0, import_promises182.writeFile)(destPath, transformedContent, "utf-8");
|
|
942448
942664
|
const languageStatsForLang = languageStats[language];
|
|
942449
942665
|
if (languageStatsForLang) {
|
|
942450
942666
|
languageStatsForLang.filesProcessed++;
|
|
@@ -942475,9 +942691,9 @@ async function writeTranslationForProject({
|
|
|
942475
942691
|
const destPath = join8(languageDirectory, relativePath);
|
|
942476
942692
|
const destDir = import_path94.default.dirname(destPath);
|
|
942477
942693
|
if (!(0, import_fs38.existsSync)(destDir)) {
|
|
942478
|
-
await (0,
|
|
942694
|
+
await (0, import_promises182.mkdir)(destDir, { recursive: true });
|
|
942479
942695
|
}
|
|
942480
|
-
await (0,
|
|
942696
|
+
await (0, import_promises182.copyFile)(filePath, destPath);
|
|
942481
942697
|
assetsCopied++;
|
|
942482
942698
|
cliContext.logger.debug(`[ASSET COPIED] ${relativePath} -> ${language}/${relativePath}`);
|
|
942483
942699
|
}
|