@fern-api/fern-api-dev 4.50.2 → 4.50.4-1-g8a6fed15293
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 +634 -607
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -48657,8 +48657,8 @@ var require_graceful_fs = __commonJS({
|
|
|
48657
48657
|
fs28.createReadStream = createReadStream5;
|
|
48658
48658
|
fs28.createWriteStream = createWriteStream7;
|
|
48659
48659
|
var fs$readFile = fs28.readFile;
|
|
48660
|
-
fs28.readFile =
|
|
48661
|
-
function
|
|
48660
|
+
fs28.readFile = readFile102;
|
|
48661
|
+
function readFile102(path97, options2, cb2) {
|
|
48662
48662
|
if (typeof options2 === "function")
|
|
48663
48663
|
cb2 = options2, options2 = null;
|
|
48664
48664
|
return go$readFile(path97, options2, cb2);
|
|
@@ -307062,8 +307062,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
307062
307062
|
fs28.createReadStream = createReadStream5;
|
|
307063
307063
|
fs28.createWriteStream = createWriteStream7;
|
|
307064
307064
|
var fs$readFile = fs28.readFile;
|
|
307065
|
-
fs28.readFile =
|
|
307066
|
-
function
|
|
307065
|
+
fs28.readFile = readFile102;
|
|
307066
|
+
function readFile102(path97, options2, cb2) {
|
|
307067
307067
|
if (typeof options2 === "function")
|
|
307068
307068
|
cb2 = options2, options2 = null;
|
|
307069
307069
|
return go$readFile(path97, options2, cb2);
|
|
@@ -363995,7 +363995,7 @@ var require_dist11 = __commonJS({
|
|
|
363995
363995
|
conflicts: conflicts2
|
|
363996
363996
|
};
|
|
363997
363997
|
}
|
|
363998
|
-
var
|
|
363998
|
+
var import_promises181 = require("fs/promises");
|
|
363999
363999
|
var import_node_os15 = require("os");
|
|
364000
364000
|
var import_node_path210 = require("path");
|
|
364001
364001
|
var import_minimatch8 = require_commonjs3();
|
|
@@ -364087,7 +364087,7 @@ var require_dist11 = __commonJS({
|
|
|
364087
364087
|
/** Populate accumulator after git apply succeeds. */
|
|
364088
364088
|
async populateAccumulatorForPatch(patch5, baseGen, currentTreeHash) {
|
|
364089
364089
|
if (!baseGen) return;
|
|
364090
|
-
const tempDir2 = await (0,
|
|
364090
|
+
const tempDir2 = await (0, import_promises181.mkdtemp)((0, import_node_path210.join)((0, import_node_os15.tmpdir)(), "replay-acc-"));
|
|
364091
364091
|
const { GitClient: GitClient22 } = await Promise.resolve().then(() => (init_GitClient(), GitClient_exports));
|
|
364092
364092
|
const tempGit = new GitClient22(tempDir2);
|
|
364093
364093
|
await tempGit.exec(["init"]);
|
|
@@ -364107,7 +364107,7 @@ var require_dist11 = __commonJS({
|
|
|
364107
364107
|
}
|
|
364108
364108
|
}
|
|
364109
364109
|
} finally {
|
|
364110
|
-
await (0,
|
|
364110
|
+
await (0, import_promises181.rm)(tempDir2, { recursive: true }).catch(() => {
|
|
364111
364111
|
});
|
|
364112
364112
|
}
|
|
364113
364113
|
}
|
|
@@ -364132,7 +364132,7 @@ var require_dist11 = __commonJS({
|
|
|
364132
364132
|
resolvedFiles[filePath] = resolvedPath;
|
|
364133
364133
|
}
|
|
364134
364134
|
const fullPath = (0, import_node_path210.join)(this.outputDir, resolvedPath);
|
|
364135
|
-
snapshots.set(resolvedPath, await (0,
|
|
364135
|
+
snapshots.set(resolvedPath, await (0, import_promises181.readFile)(fullPath, "utf-8").catch(() => null));
|
|
364136
364136
|
}
|
|
364137
364137
|
try {
|
|
364138
364138
|
await this.git.execWithInput(["apply", "--3way"], patch5.patch_content);
|
|
@@ -364146,7 +364146,7 @@ var require_dist11 = __commonJS({
|
|
|
364146
364146
|
} catch {
|
|
364147
364147
|
for (const [resolvedPath, content5] of snapshots) {
|
|
364148
364148
|
if (content5 != null) {
|
|
364149
|
-
await (0,
|
|
364149
|
+
await (0, import_promises181.writeFile)((0, import_node_path210.join)(this.outputDir, resolvedPath), content5);
|
|
364150
364150
|
}
|
|
364151
364151
|
}
|
|
364152
364152
|
}
|
|
@@ -364156,7 +364156,7 @@ var require_dist11 = __commonJS({
|
|
|
364156
364156
|
async applyWithThreeWayMerge(patch5) {
|
|
364157
364157
|
const fileResults = [];
|
|
364158
364158
|
const resolvedFiles = {};
|
|
364159
|
-
const tempDir2 = await (0,
|
|
364159
|
+
const tempDir2 = await (0, import_promises181.mkdtemp)((0, import_node_path210.join)((0, import_node_os15.tmpdir)(), "replay-"));
|
|
364160
364160
|
const { GitClient: GitClient22 } = await Promise.resolve().then(() => (init_GitClient(), GitClient_exports));
|
|
364161
364161
|
const tempGit = new GitClient22(tempDir2);
|
|
364162
364162
|
await tempGit.exec(["init"]);
|
|
@@ -364179,7 +364179,7 @@ var require_dist11 = __commonJS({
|
|
|
364179
364179
|
fileResults.push(result);
|
|
364180
364180
|
}
|
|
364181
364181
|
} finally {
|
|
364182
|
-
await (0,
|
|
364182
|
+
await (0, import_promises181.rm)(tempDir2, { recursive: true }).catch(() => {
|
|
364183
364183
|
});
|
|
364184
364184
|
}
|
|
364185
364185
|
const conflictFiles = fileResults.filter((r23) => r23.status === "conflict");
|
|
@@ -364220,7 +364220,7 @@ var require_dist11 = __commonJS({
|
|
|
364220
364220
|
}
|
|
364221
364221
|
}
|
|
364222
364222
|
const oursPath = (0, import_node_path210.join)(this.outputDir, resolvedPath);
|
|
364223
|
-
const ours = await (0,
|
|
364223
|
+
const ours = await (0, import_promises181.readFile)(oursPath, "utf-8").catch(() => null);
|
|
364224
364224
|
let theirs = await this.applyPatchToContent(
|
|
364225
364225
|
base4,
|
|
364226
364226
|
patch5.patch_content,
|
|
@@ -364263,15 +364263,15 @@ var require_dist11 = __commonJS({
|
|
|
364263
364263
|
}
|
|
364264
364264
|
if (!base4 && !ours && effective_theirs) {
|
|
364265
364265
|
const outDir2 = (0, import_node_path210.dirname)(oursPath);
|
|
364266
|
-
await (0,
|
|
364267
|
-
await (0,
|
|
364266
|
+
await (0, import_promises181.mkdir)(outDir2, { recursive: true });
|
|
364267
|
+
await (0, import_promises181.writeFile)(oursPath, effective_theirs);
|
|
364268
364268
|
return { file: resolvedPath, status: "merged", reason: "new-file" };
|
|
364269
364269
|
}
|
|
364270
364270
|
if (!base4 && ours && effective_theirs) {
|
|
364271
364271
|
const merged2 = threeWayMerge("", ours, effective_theirs);
|
|
364272
364272
|
const outDir2 = (0, import_node_path210.dirname)(oursPath);
|
|
364273
|
-
await (0,
|
|
364274
|
-
await (0,
|
|
364273
|
+
await (0, import_promises181.mkdir)(outDir2, { recursive: true });
|
|
364274
|
+
await (0, import_promises181.writeFile)(oursPath, merged2.content);
|
|
364275
364275
|
if (merged2.hasConflicts) {
|
|
364276
364276
|
return {
|
|
364277
364277
|
file: resolvedPath,
|
|
@@ -364300,8 +364300,8 @@ var require_dist11 = __commonJS({
|
|
|
364300
364300
|
const mergeBase = useAccumulatorAsMergeBase && accumulatorEntry ? accumulatorEntry.content : base4;
|
|
364301
364301
|
const merged = threeWayMerge(mergeBase, ours, effective_theirs);
|
|
364302
364302
|
const outDir = (0, import_node_path210.dirname)(oursPath);
|
|
364303
|
-
await (0,
|
|
364304
|
-
await (0,
|
|
364303
|
+
await (0, import_promises181.mkdir)(outDir, { recursive: true });
|
|
364304
|
+
await (0, import_promises181.writeFile)(oursPath, merged.content);
|
|
364305
364305
|
if (effective_theirs && base4) {
|
|
364306
364306
|
this.fileTheirsAccumulator.set(resolvedPath, {
|
|
364307
364307
|
content: effective_theirs,
|
|
@@ -364368,8 +364368,8 @@ var require_dist11 = __commonJS({
|
|
|
364368
364368
|
try {
|
|
364369
364369
|
if (sourceFilePath) {
|
|
364370
364370
|
const tempSourcePath = (0, import_node_path210.join)(tempDir2, sourceFilePath);
|
|
364371
|
-
await (0,
|
|
364372
|
-
await (0,
|
|
364371
|
+
await (0, import_promises181.mkdir)((0, import_node_path210.dirname)(tempSourcePath), { recursive: true });
|
|
364372
|
+
await (0, import_promises181.writeFile)(tempSourcePath, base4);
|
|
364373
364373
|
await tempGit.exec(["add", sourceFilePath]);
|
|
364374
364374
|
await tempGit.exec([
|
|
364375
364375
|
"commit",
|
|
@@ -364379,15 +364379,15 @@ var require_dist11 = __commonJS({
|
|
|
364379
364379
|
]);
|
|
364380
364380
|
await tempGit.execWithInput(["apply", "--allow-empty"], fileDiff);
|
|
364381
364381
|
const tempTargetPath = (0, import_node_path210.join)(tempDir2, filePath);
|
|
364382
|
-
return await (0,
|
|
364382
|
+
return await (0, import_promises181.readFile)(tempTargetPath, "utf-8");
|
|
364383
364383
|
}
|
|
364384
364384
|
const tempFilePath = (0, import_node_path210.join)(tempDir2, filePath);
|
|
364385
|
-
await (0,
|
|
364386
|
-
await (0,
|
|
364385
|
+
await (0, import_promises181.mkdir)((0, import_node_path210.dirname)(tempFilePath), { recursive: true });
|
|
364386
|
+
await (0, import_promises181.writeFile)(tempFilePath, base4);
|
|
364387
364387
|
await tempGit.exec(["add", filePath]);
|
|
364388
364388
|
await tempGit.exec(["commit", "-m", `base for ${filePath}`, "--allow-empty"]);
|
|
364389
364389
|
await tempGit.execWithInput(["apply", "--allow-empty"], fileDiff);
|
|
364390
|
-
return await (0,
|
|
364390
|
+
return await (0, import_promises181.readFile)(tempFilePath, "utf-8");
|
|
364391
364391
|
} catch {
|
|
364392
364392
|
return null;
|
|
364393
364393
|
}
|
|
@@ -367404,7 +367404,7 @@ var require_jsonfile = __commonJS({
|
|
|
367404
367404
|
}
|
|
367405
367405
|
return obj;
|
|
367406
367406
|
}
|
|
367407
|
-
var
|
|
367407
|
+
var readFile102 = universalify.fromPromise(_readFile);
|
|
367408
367408
|
function readFileSync19(file4, options2 = {}) {
|
|
367409
367409
|
if (typeof options2 === "string") {
|
|
367410
367410
|
options2 = { encoding: options2 };
|
|
@@ -367436,7 +367436,7 @@ var require_jsonfile = __commonJS({
|
|
|
367436
367436
|
return fs27.writeFileSync(file4, str3, options2);
|
|
367437
367437
|
}
|
|
367438
367438
|
module4.exports = {
|
|
367439
|
-
readFile:
|
|
367439
|
+
readFile: readFile102,
|
|
367440
367440
|
readFileSync: readFileSync19,
|
|
367441
367441
|
writeFile: writeFile89,
|
|
367442
367442
|
writeFileSync: writeFileSync7
|
|
@@ -430422,7 +430422,7 @@ async function unpackArchive(archivePath, folderPath) {
|
|
|
430422
430422
|
} else if (archivePath.endsWith(".tar.bz2")) {
|
|
430423
430423
|
await extractTar(archivePath, folderPath, "bzip2");
|
|
430424
430424
|
} else if (archivePath.endsWith(".dmg")) {
|
|
430425
|
-
await (0,
|
|
430425
|
+
await (0, import_promises118.mkdir)(folderPath);
|
|
430426
430426
|
await installDMG(archivePath, folderPath);
|
|
430427
430427
|
} else if (archivePath.endsWith(".exe")) {
|
|
430428
430428
|
const result = (0, import_node_child_process4.spawnSync)(archivePath, [`/ExtractDir=${folderPath}`], {
|
|
@@ -430511,7 +430511,7 @@ async function installDMG(dmgPath, folderPath) {
|
|
|
430511
430511
|
}
|
|
430512
430512
|
const mountPath = volumes[0];
|
|
430513
430513
|
try {
|
|
430514
|
-
const fileNames = await (0,
|
|
430514
|
+
const fileNames = await (0, import_promises118.readdir)(mountPath);
|
|
430515
430515
|
const appName = fileNames.find((item) => {
|
|
430516
430516
|
return typeof item === "string" && item.endsWith(".app");
|
|
430517
430517
|
});
|
|
@@ -430524,13 +430524,13 @@ async function installDMG(dmgPath, folderPath) {
|
|
|
430524
430524
|
(0, import_node_child_process4.spawnSync)("hdiutil", ["detach", mountPath, "-quiet"]);
|
|
430525
430525
|
}
|
|
430526
430526
|
}
|
|
430527
|
-
var import_node_child_process4, import_node_fs24,
|
|
430527
|
+
var import_node_child_process4, import_node_fs24, import_promises118, path79, import_node_stream6, import_debug8, debugFileUtil, internalConstantsForTesting;
|
|
430528
430528
|
var init_fileUtil = __esm({
|
|
430529
430529
|
"../../../node_modules/.pnpm/@puppeteer+browsers@2.13.0/node_modules/@puppeteer/browsers/lib/esm/fileUtil.js"() {
|
|
430530
430530
|
"use strict";
|
|
430531
430531
|
import_node_child_process4 = require("child_process");
|
|
430532
430532
|
import_node_fs24 = require("fs");
|
|
430533
|
-
|
|
430533
|
+
import_promises118 = require("fs/promises");
|
|
430534
430534
|
path79 = __toESM(require("path"), 1);
|
|
430535
430535
|
import_node_stream6 = require("stream");
|
|
430536
430536
|
import_debug8 = __toESM(require_src(), 1);
|
|
@@ -430593,7 +430593,7 @@ async function installWithProviders(options2) {
|
|
|
430593
430593
|
}
|
|
430594
430594
|
debugInstall(`Successfully got URL from ${provider.getName()}: ${url3}`);
|
|
430595
430595
|
if (!(0, import_node_fs25.existsSync)(browserRoot)) {
|
|
430596
|
-
await (0,
|
|
430596
|
+
await (0, import_promises119.mkdir)(browserRoot, { recursive: true });
|
|
430597
430597
|
}
|
|
430598
430598
|
return await installUrl(url3, options2, provider);
|
|
430599
430599
|
} catch (err) {
|
|
@@ -430666,7 +430666,7 @@ async function installUrl(url3, options2, provider) {
|
|
|
430666
430666
|
const browserRoot = cache3.browserRoot(options2.browser);
|
|
430667
430667
|
const archivePath = import_node_path33.default.join(browserRoot, `${options2.buildId}-${fileName}`);
|
|
430668
430668
|
if (!(0, import_node_fs25.existsSync)(browserRoot)) {
|
|
430669
|
-
await (0,
|
|
430669
|
+
await (0, import_promises119.mkdir)(browserRoot, { recursive: true });
|
|
430670
430670
|
}
|
|
430671
430671
|
if (!options2.unpack) {
|
|
430672
430672
|
if ((0, import_node_fs25.existsSync)(archivePath)) {
|
|
@@ -430730,7 +430730,7 @@ async function installUrl(url3, options2, provider) {
|
|
|
430730
430730
|
return installedBrowser;
|
|
430731
430731
|
} finally {
|
|
430732
430732
|
if ((0, import_node_fs25.existsSync)(archivePath)) {
|
|
430733
|
-
await (0,
|
|
430733
|
+
await (0, import_promises119.unlink)(archivePath);
|
|
430734
430734
|
}
|
|
430735
430735
|
}
|
|
430736
430736
|
}
|
|
@@ -430810,14 +430810,14 @@ function toMegabytes(bytes) {
|
|
|
430810
430810
|
const mb2 = bytes / 1e3 / 1e3;
|
|
430811
430811
|
return `${Math.round(mb2 * 10) / 10} MB`;
|
|
430812
430812
|
}
|
|
430813
|
-
var import_node_assert3, import_node_child_process5, import_node_fs25,
|
|
430813
|
+
var import_node_assert3, import_node_child_process5, import_node_fs25, import_promises119, import_node_os9, import_node_path33, import_progress, debugInstall, times;
|
|
430814
430814
|
var init_install = __esm({
|
|
430815
430815
|
"../../../node_modules/.pnpm/@puppeteer+browsers@2.13.0/node_modules/@puppeteer/browsers/lib/esm/install.js"() {
|
|
430816
430816
|
"use strict";
|
|
430817
430817
|
import_node_assert3 = __toESM(require("assert"), 1);
|
|
430818
430818
|
import_node_child_process5 = require("child_process");
|
|
430819
430819
|
import_node_fs25 = require("fs");
|
|
430820
|
-
|
|
430820
|
+
import_promises119 = require("fs/promises");
|
|
430821
430821
|
import_node_os9 = __toESM(require("os"), 1);
|
|
430822
430822
|
import_node_path33 = __toESM(require("path"), 1);
|
|
430823
430823
|
import_progress = __toESM(require_progress(), 1);
|
|
@@ -580500,7 +580500,7 @@ async function applyOverlays({ absoluteFilePathToOverlay, absoluteFilePathToOpen
|
|
|
580500
580500
|
const outputFileName = `${import_path31.default.parse(originalFileName).name}.overlaid.json`;
|
|
580501
580501
|
const outputPath = import_path31.default.join(dir, outputFileName);
|
|
580502
580502
|
await (0, import_promises26.writeFile)(outputPath, JSON.stringify(result, null, 2), "utf8");
|
|
580503
|
-
context3.logger.
|
|
580503
|
+
context3.logger.debug(`Wrote overlaid OpenAPI spec to: ${outputPath}`);
|
|
580504
580504
|
return result;
|
|
580505
580505
|
}
|
|
580506
580506
|
async function parseOverlayFile(absoluteFilePathToOverlay, context3) {
|
|
@@ -593565,12 +593565,14 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
|
|
|
593565
593565
|
}
|
|
593566
593566
|
};
|
|
593567
593567
|
|
|
593568
|
+
// ../workspace/oss-validator/lib/validateOSSWorkspace.js
|
|
593569
|
+
var import_promises38 = require("fs/promises");
|
|
593570
|
+
|
|
593568
593571
|
// ../workspace/oss-validator/lib/rules/no-component-schema-collisions/no-component-schema-collisions.js
|
|
593569
593572
|
init_lib6();
|
|
593570
|
-
var import_promises38 = require("fs/promises");
|
|
593571
593573
|
var NoComponentSchemaCollisionsRule = {
|
|
593572
593574
|
name: "no-component-schema-collisions",
|
|
593573
|
-
run: async ({ workspace, specs,
|
|
593575
|
+
run: async ({ workspace, specs, loadedDocuments }) => {
|
|
593574
593576
|
const violations = [];
|
|
593575
593577
|
const openapiSpecs = specs.filter((spec) => spec.type === "openapi");
|
|
593576
593578
|
if (openapiSpecs.length < 2) {
|
|
@@ -593582,19 +593584,11 @@ var NoComponentSchemaCollisionsRule = {
|
|
|
593582
593584
|
}
|
|
593583
593585
|
const schemaIdRegistry = /* @__PURE__ */ new Map();
|
|
593584
593586
|
for (const spec of openapiSpecs) {
|
|
593585
|
-
const
|
|
593586
|
-
|
|
593587
|
-
const isOpenAPI = contents.includes("openapi") || contents.includes("swagger");
|
|
593588
|
-
if (!isOpenAPI && !isAsyncAPI) {
|
|
593587
|
+
const document4 = loadedDocuments.get(spec.absoluteFilepath);
|
|
593588
|
+
if (document4 == null) {
|
|
593589
593589
|
continue;
|
|
593590
593590
|
}
|
|
593591
593591
|
const relativeFilepath = relative3(workspace.absoluteFilePath, spec.source.file);
|
|
593592
|
-
const document4 = await loadOpenAPI({
|
|
593593
|
-
absolutePathToOpenAPI: spec.absoluteFilepath,
|
|
593594
|
-
context: context3,
|
|
593595
|
-
absolutePathToOpenAPIOverrides: spec.absoluteFilepathToOverrides,
|
|
593596
|
-
absolutePathToOpenAPIOverlays: spec.absoluteFilepathToOverlays
|
|
593597
|
-
});
|
|
593598
593592
|
const apiToValidate = isOpenAPIV2(document4) ? await convertOpenAPIV2ToV3(document4) : document4;
|
|
593599
593593
|
const schemas = apiToValidate.components?.schemas ?? {};
|
|
593600
593594
|
for (const schemaId of Object.keys(schemas)) {
|
|
@@ -593618,25 +593612,18 @@ var NoComponentSchemaCollisionsRule = {
|
|
|
593618
593612
|
|
|
593619
593613
|
// ../workspace/oss-validator/lib/rules/no-duplicate-auth-header-parameters/no-duplicate-auth-header-parameters.js
|
|
593620
593614
|
init_lib6();
|
|
593621
|
-
var import_promises39 = require("fs/promises");
|
|
593622
593615
|
var NoDuplicateAuthHeaderParametersRule = {
|
|
593623
593616
|
name: "no-duplicate-auth-header-parameters",
|
|
593624
|
-
run: async ({ workspace, specs,
|
|
593617
|
+
run: async ({ workspace, specs, loadedDocuments }) => {
|
|
593625
593618
|
const violations = [];
|
|
593626
593619
|
for (const spec of specs) {
|
|
593627
593620
|
if (spec.type !== "openapi") {
|
|
593628
593621
|
continue;
|
|
593629
593622
|
}
|
|
593630
|
-
const
|
|
593631
|
-
if (
|
|
593623
|
+
const openAPI = loadedDocuments.get(spec.absoluteFilepath);
|
|
593624
|
+
if (openAPI == null) {
|
|
593632
593625
|
continue;
|
|
593633
593626
|
}
|
|
593634
|
-
const openAPI = await loadOpenAPI({
|
|
593635
|
-
absolutePathToOpenAPI: spec.absoluteFilepath,
|
|
593636
|
-
context: context3,
|
|
593637
|
-
absolutePathToOpenAPIOverrides: spec.absoluteFilepathToOverrides,
|
|
593638
|
-
absolutePathToOpenAPIOverlays: spec.absoluteFilepathToOverlays
|
|
593639
|
-
});
|
|
593640
593627
|
const apiToValidate = isOpenAPIV2(openAPI) ? await convertOpenAPIV2ToV3(openAPI) : openAPI;
|
|
593641
593628
|
const authHeaderNames = getAuthHeaderNames(apiToValidate);
|
|
593642
593629
|
if (authHeaderNames.size === 0) {
|
|
@@ -593745,21 +593732,14 @@ function isDuplicateAuthHeader(param, authHeaderNames) {
|
|
|
593745
593732
|
|
|
593746
593733
|
// ../workspace/oss-validator/lib/rules/no-duplicate-overrides/no-duplicate-overrides.js
|
|
593747
593734
|
init_lib6();
|
|
593748
|
-
var import_promises40 = require("fs/promises");
|
|
593749
593735
|
var NoDuplicateOverridesRule = {
|
|
593750
593736
|
name: "no-duplicate-overrides",
|
|
593751
|
-
run: async ({ workspace, specs,
|
|
593737
|
+
run: async ({ workspace, specs, loadedDocuments }) => {
|
|
593752
593738
|
const violations = [];
|
|
593753
593739
|
const seenMethodsByAudience = /* @__PURE__ */ new Map();
|
|
593754
593740
|
for (const spec of specs) {
|
|
593755
|
-
const
|
|
593756
|
-
if (
|
|
593757
|
-
const openAPI = await loadOpenAPI({
|
|
593758
|
-
absolutePathToOpenAPI: spec.absoluteFilepath,
|
|
593759
|
-
context: context3,
|
|
593760
|
-
absolutePathToOpenAPIOverrides: spec.absoluteFilepathToOverrides,
|
|
593761
|
-
absolutePathToOpenAPIOverlays: spec.absoluteFilepathToOverlays
|
|
593762
|
-
});
|
|
593741
|
+
const openAPI = loadedDocuments.get(spec.absoluteFilepath);
|
|
593742
|
+
if (openAPI != null) {
|
|
593763
593743
|
const apiToValidate = isOpenAPIV2(openAPI) ? await convertOpenAPIV2ToV3(openAPI) : openAPI;
|
|
593764
593744
|
for (const [path97, pathItem] of Object.entries(apiToValidate.paths ?? {})) {
|
|
593765
593745
|
for (const [method8, operation] of Object.entries(pathItem ?? {})) {
|
|
@@ -593808,28 +593788,21 @@ function audiencesIntersect(a10, b19) {
|
|
|
593808
593788
|
|
|
593809
593789
|
// ../workspace/oss-validator/lib/rules/no-invalid-tag-names-or-frontmatter/no-invalid-tag-names-or-frontmatter.js
|
|
593810
593790
|
init_lib6();
|
|
593811
|
-
var import_promises41 = require("fs/promises");
|
|
593812
593791
|
var NON_ASCII_REGEX3 = new RegExp("[^\\x00-\\x7F]");
|
|
593813
593792
|
var FRONTMATTER_REGEX = /(?:^|\n)\s*---\s*(?:\n|$)/;
|
|
593814
593793
|
var HTTP_METHODS = ["get", "post", "put", "delete", "patch", "options", "head", "trace"];
|
|
593815
593794
|
var NoInvalidTagNamesOrFrontmatterRule = {
|
|
593816
593795
|
name: "no-invalid-tag-names-or-frontmatter",
|
|
593817
|
-
run: async ({ workspace, specs,
|
|
593796
|
+
run: async ({ workspace, specs, loadedDocuments }) => {
|
|
593818
593797
|
const violations = [];
|
|
593819
593798
|
for (const spec of specs) {
|
|
593820
593799
|
if (spec.type !== "openapi") {
|
|
593821
593800
|
continue;
|
|
593822
593801
|
}
|
|
593823
|
-
const
|
|
593824
|
-
if (
|
|
593802
|
+
const openAPI = loadedDocuments.get(spec.absoluteFilepath);
|
|
593803
|
+
if (openAPI == null) {
|
|
593825
593804
|
continue;
|
|
593826
593805
|
}
|
|
593827
|
-
const openAPI = await loadOpenAPI({
|
|
593828
|
-
absolutePathToOpenAPI: spec.absoluteFilepath,
|
|
593829
|
-
context: context3,
|
|
593830
|
-
absolutePathToOpenAPIOverrides: spec.absoluteFilepathToOverrides,
|
|
593831
|
-
absolutePathToOpenAPIOverlays: spec.absoluteFilepathToOverlays
|
|
593832
|
-
});
|
|
593833
593806
|
const apiToValidate = isOpenAPIV2(openAPI) ? await convertOpenAPIV2ToV3(openAPI) : openAPI;
|
|
593834
593807
|
const relativeFilepath = relative3(workspace.absoluteFilePath, spec.source.file);
|
|
593835
593808
|
const apiDoc = apiToValidate;
|
|
@@ -593896,10 +593869,9 @@ var NoInvalidTagNamesOrFrontmatterRule = {
|
|
|
593896
593869
|
|
|
593897
593870
|
// ../workspace/oss-validator/lib/rules/no-schema-title-collisions/no-schema-title-collisions.js
|
|
593898
593871
|
init_lib6();
|
|
593899
|
-
var import_promises42 = require("fs/promises");
|
|
593900
593872
|
var NoSchemaTitleCollisionsRule = {
|
|
593901
593873
|
name: "no-schema-title-collisions",
|
|
593902
|
-
run: async ({ workspace, specs,
|
|
593874
|
+
run: async ({ workspace, specs, loadedDocuments }) => {
|
|
593903
593875
|
const violations = [];
|
|
593904
593876
|
const titleRegistry = /* @__PURE__ */ new Map();
|
|
593905
593877
|
for (const spec of specs) {
|
|
@@ -593910,19 +593882,11 @@ var NoSchemaTitleCollisionsRule = {
|
|
|
593910
593882
|
if (settings?.useTitlesAsName !== true || settings?.resolveSchemaCollisions === true) {
|
|
593911
593883
|
continue;
|
|
593912
593884
|
}
|
|
593913
|
-
const
|
|
593914
|
-
|
|
593915
|
-
const isOpenAPI = contents.includes("openapi") || contents.includes("swagger");
|
|
593916
|
-
if (!isOpenAPI && !isAsyncAPI) {
|
|
593885
|
+
const document4 = loadedDocuments.get(spec.absoluteFilepath);
|
|
593886
|
+
if (document4 == null) {
|
|
593917
593887
|
continue;
|
|
593918
593888
|
}
|
|
593919
593889
|
const relativeFilepath = relative3(workspace.absoluteFilePath, spec.source.file);
|
|
593920
|
-
const document4 = await loadOpenAPI({
|
|
593921
|
-
absolutePathToOpenAPI: spec.absoluteFilepath,
|
|
593922
|
-
context: context3,
|
|
593923
|
-
absolutePathToOpenAPIOverrides: spec.absoluteFilepathToOverrides,
|
|
593924
|
-
absolutePathToOpenAPIOverlays: spec.absoluteFilepathToOverlays
|
|
593925
|
-
});
|
|
593926
593890
|
const apiToValidate = isOpenAPIV2(document4) ? await convertOpenAPIV2ToV3(document4) : document4;
|
|
593927
593891
|
const schemas = apiToValidate.components?.schemas ?? {};
|
|
593928
593892
|
for (const [schemaId, schema2] of Object.entries(schemas)) {
|
|
@@ -593966,10 +593930,28 @@ function getAllRules2() {
|
|
|
593966
593930
|
async function validateOSSWorkspace(workspace, context3) {
|
|
593967
593931
|
return await runRulesOnOSSWorkspace({ workspace, context: context3, rules: getAllRules2() });
|
|
593968
593932
|
}
|
|
593933
|
+
async function preloadOpenAPIDocuments({ specs, context: context3 }) {
|
|
593934
|
+
const loadedDocuments = /* @__PURE__ */ new Map();
|
|
593935
|
+
for (const spec of specs) {
|
|
593936
|
+
const contents = (await (0, import_promises38.readFile)(spec.absoluteFilepath)).toString();
|
|
593937
|
+
if (!contents.includes("openapi") && !contents.includes("swagger")) {
|
|
593938
|
+
continue;
|
|
593939
|
+
}
|
|
593940
|
+
const document4 = await loadOpenAPI({
|
|
593941
|
+
absolutePathToOpenAPI: spec.absoluteFilepath,
|
|
593942
|
+
context: context3,
|
|
593943
|
+
absolutePathToOpenAPIOverrides: spec.absoluteFilepathToOverrides,
|
|
593944
|
+
absolutePathToOpenAPIOverlays: spec.absoluteFilepathToOverlays
|
|
593945
|
+
});
|
|
593946
|
+
loadedDocuments.set(spec.absoluteFilepath, document4);
|
|
593947
|
+
}
|
|
593948
|
+
return loadedDocuments;
|
|
593949
|
+
}
|
|
593969
593950
|
async function runRulesOnOSSWorkspace({ workspace, context: context3, rules }) {
|
|
593970
593951
|
const openApiSpecs = await workspace.getOpenAPISpecsCached({ context: context3 });
|
|
593952
|
+
const loadedDocuments = await preloadOpenAPIDocuments({ specs: openApiSpecs, context: context3 });
|
|
593971
593953
|
const ruleResults = await Promise.all(rules.map(async (rule) => {
|
|
593972
|
-
const violations = await rule.run({ workspace, specs: openApiSpecs, context: context3 });
|
|
593954
|
+
const violations = await rule.run({ workspace, specs: openApiSpecs, context: context3, loadedDocuments });
|
|
593973
593955
|
return violations.map((violation) => ({ ...violation, name: violation.name ?? rule.name }));
|
|
593974
593956
|
}));
|
|
593975
593957
|
return ruleResults.flat();
|
|
@@ -594959,7 +594941,7 @@ function getPathToTokenFile() {
|
|
|
594959
594941
|
|
|
594960
594942
|
// ../auth/lib/persistence/getToken.js
|
|
594961
594943
|
init_lib6();
|
|
594962
|
-
var
|
|
594944
|
+
var import_promises39 = require("fs/promises");
|
|
594963
594945
|
var FERN_TOKEN_ENV_VAR = "FERN_TOKEN";
|
|
594964
594946
|
async function getToken2() {
|
|
594965
594947
|
return await getAccessToken() ?? await getUserToken();
|
|
@@ -594980,7 +594962,7 @@ async function getUserToken() {
|
|
|
594980
594962
|
if (!doesTokenFileExist) {
|
|
594981
594963
|
return void 0;
|
|
594982
594964
|
}
|
|
594983
|
-
const tokenFileContents = await (0,
|
|
594965
|
+
const tokenFileContents = await (0, import_promises39.readFile)(pathToTokenFile);
|
|
594984
594966
|
const tokenString = tokenFileContents.toString().trim();
|
|
594985
594967
|
if (tokenString.length === 0) {
|
|
594986
594968
|
return void 0;
|
|
@@ -594992,11 +594974,11 @@ async function getUserToken() {
|
|
|
594992
594974
|
}
|
|
594993
594975
|
|
|
594994
594976
|
// ../auth/lib/persistence/removeToken.js
|
|
594995
|
-
var
|
|
594977
|
+
var import_promises40 = require("fs/promises");
|
|
594996
594978
|
async function removeToken() {
|
|
594997
594979
|
const pathToTokenFile = getPathToTokenFile();
|
|
594998
594980
|
try {
|
|
594999
|
-
await (0,
|
|
594981
|
+
await (0, import_promises40.unlink)(pathToTokenFile);
|
|
595000
594982
|
} catch (error50) {
|
|
595001
594983
|
if (error50.code !== "ENOENT") {
|
|
595002
594984
|
throw error50;
|
|
@@ -595005,12 +594987,12 @@ async function removeToken() {
|
|
|
595005
594987
|
}
|
|
595006
594988
|
|
|
595007
594989
|
// ../auth/lib/persistence/storeToken.js
|
|
595008
|
-
var
|
|
594990
|
+
var import_promises41 = require("fs/promises");
|
|
595009
594991
|
var import_path39 = __toESM(require("path"), 1);
|
|
595010
594992
|
async function storeToken(token) {
|
|
595011
594993
|
const pathToTokenFile = getPathToTokenFile();
|
|
595012
|
-
await (0,
|
|
595013
|
-
await (0,
|
|
594994
|
+
await (0, import_promises41.mkdir)(import_path39.default.dirname(pathToTokenFile), { recursive: true });
|
|
594995
|
+
await (0, import_promises41.writeFile)(pathToTokenFile, token);
|
|
595014
594996
|
}
|
|
595015
594997
|
|
|
595016
594998
|
// ../auth/lib/users/getCurrentUser.js
|
|
@@ -602302,7 +602284,7 @@ var AccessTokenPosthogManager = class {
|
|
|
602302
602284
|
properties: {
|
|
602303
602285
|
...event,
|
|
602304
602286
|
...event.properties,
|
|
602305
|
-
version: "4.50.
|
|
602287
|
+
version: "4.50.4-1-g8a6fed15293",
|
|
602306
602288
|
usingAccessToken: true
|
|
602307
602289
|
}
|
|
602308
602290
|
});
|
|
@@ -602325,7 +602307,7 @@ var NoopPosthogManager = class {
|
|
|
602325
602307
|
|
|
602326
602308
|
// ../posthog-manager/lib/UserPosthogManager.js
|
|
602327
602309
|
init_lib6();
|
|
602328
|
-
var
|
|
602310
|
+
var import_promises42 = require("fs/promises");
|
|
602329
602311
|
var import_os5 = require("os");
|
|
602330
602312
|
var import_path41 = require("path");
|
|
602331
602313
|
var DISTINCT_ID_FILENAME = "id";
|
|
@@ -602353,7 +602335,7 @@ var UserPosthogManager = class {
|
|
|
602353
602335
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
602354
602336
|
event: "CLI",
|
|
602355
602337
|
properties: {
|
|
602356
|
-
version: "4.50.
|
|
602338
|
+
version: "4.50.4-1-g8a6fed15293",
|
|
602357
602339
|
...event,
|
|
602358
602340
|
...event.properties,
|
|
602359
602341
|
usingAccessToken: false,
|
|
@@ -602392,10 +602374,10 @@ var UserPosthogManager = class {
|
|
|
602392
602374
|
if (this.persistedDistinctId == null) {
|
|
602393
602375
|
const pathToFile = join2(AbsoluteFilePath2.of((0, import_os5.homedir)()), RelativeFilePath2.of(LOCAL_STORAGE_FOLDER3), RelativeFilePath2.of(DISTINCT_ID_FILENAME));
|
|
602394
602376
|
if (!await doesPathExist(pathToFile)) {
|
|
602395
|
-
await (0,
|
|
602396
|
-
await (0,
|
|
602377
|
+
await (0, import_promises42.mkdir)((0, import_path41.dirname)(pathToFile), { recursive: true });
|
|
602378
|
+
await (0, import_promises42.writeFile)(pathToFile, v4_default());
|
|
602397
602379
|
}
|
|
602398
|
-
this.persistedDistinctId = (await (0,
|
|
602380
|
+
this.persistedDistinctId = (await (0, import_promises42.readFile)(pathToFile)).toString();
|
|
602399
602381
|
}
|
|
602400
602382
|
return this.persistedDistinctId;
|
|
602401
602383
|
}
|
|
@@ -603927,7 +603909,7 @@ var FernRcAccountManager = class {
|
|
|
603927
603909
|
// ../cli-v2/lib/config/fern-rc/FernRcSchemaLoader.js
|
|
603928
603910
|
init_lib6();
|
|
603929
603911
|
var import_fs18 = require("fs");
|
|
603930
|
-
var
|
|
603912
|
+
var import_promises43 = require("fs/promises");
|
|
603931
603913
|
var import_os6 = require("os");
|
|
603932
603914
|
var FILENAME = ".fernrc";
|
|
603933
603915
|
var FernRcSchemaLoader = class {
|
|
@@ -603945,7 +603927,7 @@ var FernRcSchemaLoader = class {
|
|
|
603945
603927
|
absoluteFilePath: this.absoluteFilePath
|
|
603946
603928
|
};
|
|
603947
603929
|
}
|
|
603948
|
-
const contents = await (0,
|
|
603930
|
+
const contents = await (0, import_promises43.readFile)(this.absoluteFilePath, "utf-8");
|
|
603949
603931
|
if (contents.trim().length === 0) {
|
|
603950
603932
|
return {
|
|
603951
603933
|
data: createEmptyFernRcSchema(),
|
|
@@ -604037,7 +604019,7 @@ var FernRcSchemaLoader = class {
|
|
|
604037
604019
|
lineWidth: 120,
|
|
604038
604020
|
noRefs: true
|
|
604039
604021
|
});
|
|
604040
|
-
await (0,
|
|
604022
|
+
await (0, import_promises43.writeFile)(this.absoluteFilePath, yamlContent, "utf-8");
|
|
604041
604023
|
}
|
|
604042
604024
|
};
|
|
604043
604025
|
|
|
@@ -604071,7 +604053,7 @@ var FernRcTelemetryManager = class {
|
|
|
604071
604053
|
|
|
604072
604054
|
// ../cli-v2/lib/config/fern-rc/LegacyTokenMigrator.js
|
|
604073
604055
|
init_lib6();
|
|
604074
|
-
var
|
|
604056
|
+
var import_promises44 = require("fs/promises");
|
|
604075
604057
|
var DEFAULT_USER = "default";
|
|
604076
604058
|
var LegacyTokenMigrator = class {
|
|
604077
604059
|
loader;
|
|
@@ -604090,7 +604072,7 @@ var LegacyTokenMigrator = class {
|
|
|
604090
604072
|
if (config5.auth.accounts.length > 0) {
|
|
604091
604073
|
return { migrated: false };
|
|
604092
604074
|
}
|
|
604093
|
-
const tokenContent = (await (0,
|
|
604075
|
+
const tokenContent = (await (0, import_promises44.readFile)(legacyPath, "utf-8")).trim();
|
|
604094
604076
|
if (tokenContent.length === 0) {
|
|
604095
604077
|
return { migrated: false };
|
|
604096
604078
|
}
|
|
@@ -604334,7 +604316,7 @@ var import_os7 = __toESM(require("os"), 1);
|
|
|
604334
604316
|
// ../cli-v2/lib/cache/ir/IrCache.js
|
|
604335
604317
|
init_lib6();
|
|
604336
604318
|
var import_crypto7 = __toESM(require("crypto"), 1);
|
|
604337
|
-
var
|
|
604319
|
+
var import_promises45 = __toESM(require("fs/promises"), 1);
|
|
604338
604320
|
var IrCache = class {
|
|
604339
604321
|
/** Absolute file path to the IR cache directory (e.g. ~/.cache/fern/v1/ir) */
|
|
604340
604322
|
absoluteFilePath;
|
|
@@ -604364,7 +604346,7 @@ var IrCache = class {
|
|
|
604364
604346
|
async lookup({ hash: hash5, irVersion }) {
|
|
604365
604347
|
const entryPath = this.getEntryPath({ irVersion, hash: hash5 });
|
|
604366
604348
|
try {
|
|
604367
|
-
const stats = await
|
|
604349
|
+
const stats = await import_promises45.default.stat(entryPath);
|
|
604368
604350
|
if (!stats.isFile()) {
|
|
604369
604351
|
return void 0;
|
|
604370
604352
|
}
|
|
@@ -604385,7 +604367,7 @@ var IrCache = class {
|
|
|
604385
604367
|
* Read the content of a cached IR entry.
|
|
604386
604368
|
*/
|
|
604387
604369
|
async read(entry) {
|
|
604388
|
-
return await
|
|
604370
|
+
return await import_promises45.default.readFile(entry.absoluteFilePath, "utf-8");
|
|
604389
604371
|
}
|
|
604390
604372
|
/**
|
|
604391
604373
|
* Store IR content in the cache with an atomic write.
|
|
@@ -604397,19 +604379,19 @@ var IrCache = class {
|
|
|
604397
604379
|
const entryPath = this.getEntryPath({ irVersion, hash: hash5 });
|
|
604398
604380
|
const entryDir = dirname4(entryPath);
|
|
604399
604381
|
const tempFile = join2(this.tempPath, RelativeFilePath2.of(`${import_crypto7.default.randomUUID()}.json`));
|
|
604400
|
-
await
|
|
604401
|
-
await
|
|
604382
|
+
await import_promises45.default.mkdir(entryDir, { recursive: true });
|
|
604383
|
+
await import_promises45.default.mkdir(this.tempPath, { recursive: true });
|
|
604402
604384
|
try {
|
|
604403
604385
|
await streamObjectToFile(tempFile, content5, { pretty: true });
|
|
604404
|
-
await
|
|
604386
|
+
await import_promises45.default.rename(tempFile, entryPath);
|
|
604405
604387
|
} catch (error50) {
|
|
604406
604388
|
try {
|
|
604407
|
-
await
|
|
604389
|
+
await import_promises45.default.unlink(tempFile);
|
|
604408
604390
|
} catch {
|
|
604409
604391
|
}
|
|
604410
604392
|
throw error50;
|
|
604411
604393
|
}
|
|
604412
|
-
const stats = await
|
|
604394
|
+
const stats = await import_promises45.default.stat(entryPath);
|
|
604413
604395
|
return {
|
|
604414
604396
|
hash: hash5,
|
|
604415
604397
|
irVersion,
|
|
@@ -604462,7 +604444,7 @@ var IrCache = class {
|
|
|
604462
604444
|
*/
|
|
604463
604445
|
async listVersionDirectories() {
|
|
604464
604446
|
try {
|
|
604465
|
-
const entries21 = await
|
|
604447
|
+
const entries21 = await import_promises45.default.readdir(this.absoluteFilePath, { withFileTypes: true });
|
|
604466
604448
|
return entries21.filter((e6) => e6.isDirectory()).map((e6) => e6.name);
|
|
604467
604449
|
} catch {
|
|
604468
604450
|
return [];
|
|
@@ -604476,7 +604458,7 @@ var IrCache = class {
|
|
|
604476
604458
|
let totalSize = 0;
|
|
604477
604459
|
const walk4 = async (dir) => {
|
|
604478
604460
|
try {
|
|
604479
|
-
const entries21 = await
|
|
604461
|
+
const entries21 = await import_promises45.default.readdir(dir, { withFileTypes: true });
|
|
604480
604462
|
for (const entry of entries21) {
|
|
604481
604463
|
const fullPath = `${dir}/${entry.name}`;
|
|
604482
604464
|
if (entry.isDirectory()) {
|
|
@@ -604486,7 +604468,7 @@ var IrCache = class {
|
|
|
604486
604468
|
if (entry.isFile() && entry.name.endsWith(".json")) {
|
|
604487
604469
|
entryCount++;
|
|
604488
604470
|
try {
|
|
604489
|
-
const stats = await
|
|
604471
|
+
const stats = await import_promises45.default.stat(fullPath);
|
|
604490
604472
|
totalSize += stats.size;
|
|
604491
604473
|
} catch {
|
|
604492
604474
|
}
|
|
@@ -604509,14 +604491,14 @@ var IrCache = class {
|
|
|
604509
604491
|
let freedSize = 0;
|
|
604510
604492
|
const walk4 = async (dir) => {
|
|
604511
604493
|
try {
|
|
604512
|
-
const entries21 = await
|
|
604494
|
+
const entries21 = await import_promises45.default.readdir(dir, { withFileTypes: true });
|
|
604513
604495
|
for (const entry of entries21) {
|
|
604514
604496
|
const fullPath = `${dir}/${entry.name}`;
|
|
604515
604497
|
if (entry.isDirectory()) {
|
|
604516
604498
|
await walk4(fullPath);
|
|
604517
604499
|
if (!dryRun) {
|
|
604518
604500
|
try {
|
|
604519
|
-
await
|
|
604501
|
+
await import_promises45.default.rmdir(fullPath);
|
|
604520
604502
|
} catch {
|
|
604521
604503
|
}
|
|
604522
604504
|
}
|
|
@@ -604524,11 +604506,11 @@ var IrCache = class {
|
|
|
604524
604506
|
}
|
|
604525
604507
|
if (entry.isFile() && entry.name.endsWith(".json")) {
|
|
604526
604508
|
try {
|
|
604527
|
-
const stats = await
|
|
604509
|
+
const stats = await import_promises45.default.stat(fullPath);
|
|
604528
604510
|
deletedCount++;
|
|
604529
604511
|
freedSize += stats.size;
|
|
604530
604512
|
if (!dryRun) {
|
|
604531
|
-
await
|
|
604513
|
+
await import_promises45.default.unlink(fullPath);
|
|
604532
604514
|
}
|
|
604533
604515
|
} catch {
|
|
604534
604516
|
}
|
|
@@ -604540,7 +604522,7 @@ var IrCache = class {
|
|
|
604540
604522
|
await walk4(dirPath);
|
|
604541
604523
|
if (!dryRun) {
|
|
604542
604524
|
try {
|
|
604543
|
-
await
|
|
604525
|
+
await import_promises45.default.rmdir(dirPath);
|
|
604544
604526
|
} catch {
|
|
604545
604527
|
}
|
|
604546
604528
|
}
|
|
@@ -604549,7 +604531,7 @@ var IrCache = class {
|
|
|
604549
604531
|
};
|
|
604550
604532
|
|
|
604551
604533
|
// ../cli-v2/lib/cache/logs/LogsCache.js
|
|
604552
|
-
var
|
|
604534
|
+
var import_promises46 = __toESM(require("fs/promises"), 1);
|
|
604553
604535
|
var LogsCache = class {
|
|
604554
604536
|
/** Absolute file path to the log cache directory (e.g. ~/.cache/fern/v1/logs) */
|
|
604555
604537
|
absoluteFilePath;
|
|
@@ -604563,12 +604545,12 @@ var LogsCache = class {
|
|
|
604563
604545
|
let fileCount = 0;
|
|
604564
604546
|
let totalSize = 0;
|
|
604565
604547
|
try {
|
|
604566
|
-
const entries21 = await
|
|
604548
|
+
const entries21 = await import_promises46.default.readdir(this.absoluteFilePath, { withFileTypes: true });
|
|
604567
604549
|
for (const entry of entries21) {
|
|
604568
604550
|
if (entry.isFile() && entry.name.endsWith(".log")) {
|
|
604569
604551
|
fileCount++;
|
|
604570
604552
|
try {
|
|
604571
|
-
const stats = await
|
|
604553
|
+
const stats = await import_promises46.default.stat(`${this.absoluteFilePath}/${entry.name}`);
|
|
604572
604554
|
totalSize += stats.size;
|
|
604573
604555
|
} catch {
|
|
604574
604556
|
}
|
|
@@ -604585,16 +604567,16 @@ var LogsCache = class {
|
|
|
604585
604567
|
let deletedCount = 0;
|
|
604586
604568
|
let freedSize = 0;
|
|
604587
604569
|
try {
|
|
604588
|
-
const entries21 = await
|
|
604570
|
+
const entries21 = await import_promises46.default.readdir(this.absoluteFilePath, { withFileTypes: true });
|
|
604589
604571
|
for (const entry of entries21) {
|
|
604590
604572
|
if (entry.isFile() && entry.name.endsWith(".log")) {
|
|
604591
604573
|
const fullPath = `${this.absoluteFilePath}/${entry.name}`;
|
|
604592
604574
|
try {
|
|
604593
|
-
const stats = await
|
|
604575
|
+
const stats = await import_promises46.default.stat(fullPath);
|
|
604594
604576
|
deletedCount++;
|
|
604595
604577
|
freedSize += stats.size;
|
|
604596
604578
|
if (!dryRun) {
|
|
604597
|
-
await
|
|
604579
|
+
await import_promises46.default.unlink(fullPath);
|
|
604598
604580
|
}
|
|
604599
604581
|
} catch {
|
|
604600
604582
|
}
|
|
@@ -604938,7 +604920,7 @@ var SourceLocation = class _SourceLocation {
|
|
|
604938
604920
|
};
|
|
604939
604921
|
|
|
604940
604922
|
// ../yaml/loader/lib/ReferenceResolver.js
|
|
604941
|
-
var
|
|
604923
|
+
var import_promises47 = require("fs/promises");
|
|
604942
604924
|
var import_yaml2 = __toESM(require_dist8(), 1);
|
|
604943
604925
|
|
|
604944
604926
|
// ../yaml/loader/lib/ValidationIssue.js
|
|
@@ -605243,7 +605225,7 @@ var ReferenceResolver = class {
|
|
|
605243
605225
|
}));
|
|
605244
605226
|
return void 0;
|
|
605245
605227
|
}
|
|
605246
|
-
const content5 = await (0,
|
|
605228
|
+
const content5 = await (0, import_promises47.readFile)(referencedFilePath, "utf-8");
|
|
605247
605229
|
const parsedDocument = (0, import_yaml2.parseDocument)(content5);
|
|
605248
605230
|
if (parsedDocument.errors.length > 0) {
|
|
605249
605231
|
const errorMessages = parsedDocument.errors.map((e6) => e6.message).join("; ");
|
|
@@ -605394,7 +605376,7 @@ function deepStrictImpl(schema2, cache3) {
|
|
|
605394
605376
|
|
|
605395
605377
|
// ../yaml/loader/lib/YamlParser.js
|
|
605396
605378
|
init_lib5();
|
|
605397
|
-
var
|
|
605379
|
+
var import_promises48 = require("fs/promises");
|
|
605398
605380
|
var import_yaml3 = __toESM(require_dist8(), 1);
|
|
605399
605381
|
var YamlParser = class {
|
|
605400
605382
|
/**
|
|
@@ -605405,7 +605387,7 @@ var YamlParser = class {
|
|
|
605405
605387
|
* @throws Error if the file cannot be read or contains invalid YAML.
|
|
605406
605388
|
*/
|
|
605407
605389
|
async parse(absoluteFilePath) {
|
|
605408
|
-
const source2 = await (0,
|
|
605390
|
+
const source2 = await (0, import_promises48.readFile)(absoluteFilePath, "utf-8");
|
|
605409
605391
|
return (0, import_yaml3.parse)(source2);
|
|
605410
605392
|
}
|
|
605411
605393
|
/**
|
|
@@ -605419,7 +605401,7 @@ var YamlParser = class {
|
|
|
605419
605401
|
* @throws Error if the file cannot be read or contains invalid YAML.
|
|
605420
605402
|
*/
|
|
605421
605403
|
async parseDocument({ absoluteFilePath, cwd: cwd2 }) {
|
|
605422
|
-
const source2 = await (0,
|
|
605404
|
+
const source2 = await (0, import_promises48.readFile)(absoluteFilePath, "utf-8");
|
|
605423
605405
|
const document4 = (0, import_yaml3.parseDocument)(source2);
|
|
605424
605406
|
const relativeFilePath = RelativeFilePath.of(relative2(cwd2, absoluteFilePath));
|
|
605425
605407
|
return new YamlDocument({
|
|
@@ -626266,7 +626248,7 @@ function _init2(options2 = {}, getDefaultIntegrationsImpl) {
|
|
|
626266
626248
|
}
|
|
626267
626249
|
|
|
626268
626250
|
// ../cli-v2/lib/telemetry/TelemetryClient.js
|
|
626269
|
-
var
|
|
626251
|
+
var import_promises49 = require("fs/promises");
|
|
626270
626252
|
var import_is_ci2 = __toESM(require_is_ci(), 1);
|
|
626271
626253
|
var os13 = __toESM(require("os"), 1);
|
|
626272
626254
|
var import_os8 = require("os");
|
|
@@ -626386,14 +626368,14 @@ var TelemetryClient = class {
|
|
|
626386
626368
|
const distinctIdFilepath = this.getDistinctIdFilepath();
|
|
626387
626369
|
try {
|
|
626388
626370
|
if (!await doesPathExist(distinctIdFilepath)) {
|
|
626389
|
-
await (0,
|
|
626390
|
-
await (0,
|
|
626371
|
+
await (0, import_promises49.mkdir)((0, import_path46.dirname)(distinctIdFilepath), { recursive: true });
|
|
626372
|
+
await (0, import_promises49.writeFile)(distinctIdFilepath, v4_default(), { flag: "wx" });
|
|
626391
626373
|
}
|
|
626392
|
-
const content5 = (await (0,
|
|
626374
|
+
const content5 = (await (0, import_promises49.readFile)(distinctIdFilepath)).toString().trim();
|
|
626393
626375
|
this.cachedDistinctId = content5;
|
|
626394
626376
|
if (!validate_default(content5)) {
|
|
626395
626377
|
const newId = v4_default();
|
|
626396
|
-
await (0,
|
|
626378
|
+
await (0, import_promises49.writeFile)(distinctIdFilepath, newId);
|
|
626397
626379
|
this.cachedDistinctId = newId;
|
|
626398
626380
|
}
|
|
626399
626381
|
} catch {
|
|
@@ -741334,7 +741316,7 @@ function addCompileCommand(cli) {
|
|
|
741334
741316
|
|
|
741335
741317
|
// ../cli-v2/lib/commands/api/merge/command.js
|
|
741336
741318
|
init_lib4();
|
|
741337
|
-
var
|
|
741319
|
+
var import_promises52 = require("fs/promises");
|
|
741338
741320
|
var import_path48 = __toESM(require("path"), 1);
|
|
741339
741321
|
|
|
741340
741322
|
// ../cli-v2/lib/config/fern-yml/constants.js
|
|
@@ -741343,7 +741325,7 @@ var REF_KEY2 = "$ref";
|
|
|
741343
741325
|
|
|
741344
741326
|
// ../cli-v2/lib/config/fern-yml/FernYmlEditor.js
|
|
741345
741327
|
init_lib6();
|
|
741346
|
-
var
|
|
741328
|
+
var import_promises50 = require("fs/promises");
|
|
741347
741329
|
var import_path47 = __toESM(require("path"), 1);
|
|
741348
741330
|
var import_yaml4 = __toESM(require_dist8(), 1);
|
|
741349
741331
|
var FernYmlEditor = class _FernYmlEditor {
|
|
@@ -741366,7 +741348,7 @@ var FernYmlEditor = class _FernYmlEditor {
|
|
|
741366
741348
|
* Sections (`sdks`, `api`) are resolved lazily on first method call.
|
|
741367
741349
|
*/
|
|
741368
741350
|
static async load(config5) {
|
|
741369
|
-
const content5 = await (0,
|
|
741351
|
+
const content5 = await (0, import_promises50.readFile)(config5.fernYmlPath, "utf-8");
|
|
741370
741352
|
const document4 = (0, import_yaml4.parseDocument)(content5);
|
|
741371
741353
|
const doc = document4.toJS();
|
|
741372
741354
|
if (doc == null || typeof doc !== "object") {
|
|
@@ -741547,7 +741529,7 @@ var FernYmlEditor = class _FernYmlEditor {
|
|
|
741547
741529
|
for (const section of this.sections.values()) {
|
|
741548
741530
|
if (this.dirtyFiles.has(section.filePath) && !written.has(section.filePath)) {
|
|
741549
741531
|
written.add(section.filePath);
|
|
741550
|
-
writes.push((0,
|
|
741532
|
+
writes.push((0, import_promises50.writeFile)(section.filePath, section.document.toString(), "utf-8"));
|
|
741551
741533
|
}
|
|
741552
741534
|
}
|
|
741553
741535
|
await Promise.all(writes);
|
|
@@ -741576,7 +741558,7 @@ var FernYmlEditor = class _FernYmlEditor {
|
|
|
741576
741558
|
message: `Referenced file '${refPath}' in ${FERN_YML_FILENAME} does not exist.`
|
|
741577
741559
|
});
|
|
741578
741560
|
}
|
|
741579
|
-
const refContent = await (0,
|
|
741561
|
+
const refContent = await (0, import_promises50.readFile)(resolvedPath, "utf-8");
|
|
741580
741562
|
const refDocument = (0, import_yaml4.parseDocument)(refContent);
|
|
741581
741563
|
const section2 = {
|
|
741582
741564
|
document: refDocument,
|
|
@@ -741921,11 +741903,11 @@ function isEnoentError(error50) {
|
|
|
741921
741903
|
}
|
|
741922
741904
|
|
|
741923
741905
|
// ../cli-v2/lib/commands/api/utils/loadSpec.js
|
|
741924
|
-
var
|
|
741906
|
+
var import_promises51 = require("fs/promises");
|
|
741925
741907
|
async function loadSpec(filepath) {
|
|
741926
741908
|
let contents;
|
|
741927
741909
|
try {
|
|
741928
|
-
contents = await (0,
|
|
741910
|
+
contents = await (0, import_promises51.readFile)(filepath, "utf8");
|
|
741929
741911
|
} catch (error50) {
|
|
741930
741912
|
if (isEnoentError(error50)) {
|
|
741931
741913
|
throw new CliError({ message: `File does not exist: ${filepath}` });
|
|
@@ -741999,7 +741981,7 @@ var MergeCommand = class {
|
|
|
741999
741981
|
}
|
|
742000
741982
|
context3.stderr.info(`${Icons.success} Merged ${source_default.bold(String(overridePaths.length))} override(s) ${source_default.dim("\u2192")} ${source_default.cyan(entry.specFilePath)}`);
|
|
742001
741983
|
}
|
|
742002
|
-
await (0,
|
|
741984
|
+
await (0, import_promises52.writeFile)(entry.specFilePath, serializeSpec(merged, entry.specFilePath));
|
|
742003
741985
|
mergedCount++;
|
|
742004
741986
|
if (editor != null) {
|
|
742005
741987
|
if (overridePaths != null) {
|
|
@@ -742039,7 +742021,7 @@ var MergeCommand = class {
|
|
|
742039
742021
|
async cleanupFiles(context3, filePaths) {
|
|
742040
742022
|
await Promise.all(filePaths.map(async (filePath) => {
|
|
742041
742023
|
try {
|
|
742042
|
-
await (0,
|
|
742024
|
+
await (0, import_promises52.unlink)(filePath);
|
|
742043
742025
|
context3.stderr.info(source_default.dim(`Deleted ${filePath}`));
|
|
742044
742026
|
} catch (error50) {
|
|
742045
742027
|
if (!isEnoentError(error50)) {
|
|
@@ -742064,7 +742046,7 @@ function addMergeCommand(cli) {
|
|
|
742064
742046
|
// ../cli-v2/lib/commands/api/split/command.js
|
|
742065
742047
|
init_lib4();
|
|
742066
742048
|
var import_child_process5 = require("child_process");
|
|
742067
|
-
var
|
|
742049
|
+
var import_promises53 = require("fs/promises");
|
|
742068
742050
|
var import_path49 = __toESM(require("path"), 1);
|
|
742069
742051
|
var import_util17 = require("util");
|
|
742070
742052
|
|
|
@@ -742139,7 +742121,7 @@ var SplitCommand = class {
|
|
|
742139
742121
|
} else {
|
|
742140
742122
|
await this.splitAsOverrides(context3, editor, entry, originalContent, currentContent, args.output);
|
|
742141
742123
|
}
|
|
742142
|
-
await (0,
|
|
742124
|
+
await (0, import_promises53.writeFile)(entry.specFilePath, originalRaw);
|
|
742143
742125
|
context3.stderr.debug(source_default.dim(`Restored ${entry.specFilePath} to git HEAD`));
|
|
742144
742126
|
splitCount++;
|
|
742145
742127
|
}
|
|
@@ -742163,7 +742145,7 @@ var SplitCommand = class {
|
|
|
742163
742145
|
if (await this.tryMergeOverlayIntoExistingFile(outputPath, overlay.actions)) {
|
|
742164
742146
|
context3.stderr.info(`${Icons.success} Merged ${source_default.bold(String(overlay.actions.length))} action(s) into existing ${source_default.cyan(outputPath)}`);
|
|
742165
742147
|
} else {
|
|
742166
|
-
await (0,
|
|
742148
|
+
await (0, import_promises53.writeFile)(outputPath, serializeSpec(overlay, outputPath));
|
|
742167
742149
|
context3.stderr.info(`${Icons.success} Overlay written (${source_default.bold(String(overlay.actions.length))} action(s)) ${source_default.dim("\u2192")} ${source_default.cyan(outputPath)}`);
|
|
742168
742150
|
}
|
|
742169
742151
|
const edit = await editor.addOverlay(entry.specFilePath, outputPath);
|
|
@@ -742178,7 +742160,7 @@ var SplitCommand = class {
|
|
|
742178
742160
|
if (await this.tryMergeIntoExistingFile(outputPath, overrides)) {
|
|
742179
742161
|
context3.stderr.info(`${Icons.success} Merged diff into existing ${source_default.cyan(outputPath)}`);
|
|
742180
742162
|
} else {
|
|
742181
|
-
await (0,
|
|
742163
|
+
await (0, import_promises53.writeFile)(outputPath, serializeSpec(overrides, outputPath));
|
|
742182
742164
|
context3.stderr.info(`${Icons.success} Overrides written ${source_default.dim("\u2192")} ${source_default.cyan(outputPath)}`);
|
|
742183
742165
|
}
|
|
742184
742166
|
const edit = await editor.addOverride(entry.specFilePath, outputPath);
|
|
@@ -742194,7 +742176,7 @@ var SplitCommand = class {
|
|
|
742194
742176
|
async tryMergeOverlayIntoExistingFile(outputPath, newActions) {
|
|
742195
742177
|
let raw;
|
|
742196
742178
|
try {
|
|
742197
|
-
raw = await (0,
|
|
742179
|
+
raw = await (0, import_promises53.readFile)(outputPath, "utf8");
|
|
742198
742180
|
} catch (error50) {
|
|
742199
742181
|
if (isEnoentError(error50)) {
|
|
742200
742182
|
return false;
|
|
@@ -742204,7 +742186,7 @@ var SplitCommand = class {
|
|
|
742204
742186
|
const existing = parseSpec(raw, outputPath);
|
|
742205
742187
|
const existingActions = Array.isArray(existing.actions) ? existing.actions : [];
|
|
742206
742188
|
existing.actions = [...existingActions, ...newActions];
|
|
742207
|
-
await (0,
|
|
742189
|
+
await (0, import_promises53.writeFile)(outputPath, serializeSpec(existing, outputPath));
|
|
742208
742190
|
return true;
|
|
742209
742191
|
}
|
|
742210
742192
|
/**
|
|
@@ -742214,7 +742196,7 @@ var SplitCommand = class {
|
|
|
742214
742196
|
async tryMergeIntoExistingFile(outputPath, overrides) {
|
|
742215
742197
|
let raw;
|
|
742216
742198
|
try {
|
|
742217
|
-
raw = await (0,
|
|
742199
|
+
raw = await (0, import_promises53.readFile)(outputPath, "utf8");
|
|
742218
742200
|
} catch (error50) {
|
|
742219
742201
|
if (isEnoentError(error50)) {
|
|
742220
742202
|
return false;
|
|
@@ -742223,7 +742205,7 @@ var SplitCommand = class {
|
|
|
742223
742205
|
}
|
|
742224
742206
|
const existing = parseSpec(raw, outputPath);
|
|
742225
742207
|
const merged = mergeWithOverrides({ data: existing, overrides });
|
|
742226
|
-
await (0,
|
|
742208
|
+
await (0, import_promises53.writeFile)(outputPath, serializeSpec(merged, outputPath));
|
|
742227
742209
|
return true;
|
|
742228
742210
|
}
|
|
742229
742211
|
async getFileFromGitHead(repoRoot, absolutePath) {
|
|
@@ -777585,9 +777567,9 @@ function replaceFrontmatterImagesforLogo(data2, mapImage) {
|
|
|
777585
777567
|
|
|
777586
777568
|
// ../docs-markdown-utils/lib/replaceReferencedCode.js
|
|
777587
777569
|
init_lib6();
|
|
777588
|
-
var
|
|
777570
|
+
var import_promises54 = require("fs/promises");
|
|
777589
777571
|
async function defaultFileLoader(filepath) {
|
|
777590
|
-
const file4 = await (0,
|
|
777572
|
+
const file4 = await (0, import_promises54.readFile)(filepath);
|
|
777591
777573
|
return file4.toString();
|
|
777592
777574
|
}
|
|
777593
777575
|
function isUrl(src) {
|
|
@@ -777755,10 +777737,10 @@ ${replacement}
|
|
|
777755
777737
|
|
|
777756
777738
|
// ../docs-markdown-utils/lib/replaceReferencedMarkdown.js
|
|
777757
777739
|
init_lib6();
|
|
777758
|
-
var
|
|
777740
|
+
var import_promises55 = require("fs/promises");
|
|
777759
777741
|
var import_gray_matter4 = __toESM(require_gray_matter(), 1);
|
|
777760
777742
|
async function defaultMarkdownLoader(filepath) {
|
|
777761
|
-
const { content: content5 } = (0, import_gray_matter4.default)(await (0,
|
|
777743
|
+
const { content: content5 } = (0, import_gray_matter4.default)(await (0, import_promises55.readFile)(filepath));
|
|
777762
777744
|
return content5;
|
|
777763
777745
|
}
|
|
777764
777746
|
function extractAttributes(markdownTag) {
|
|
@@ -777955,7 +777937,7 @@ init_lib10();
|
|
|
777955
777937
|
var import_dayjs3 = __toESM(require_dayjs_min2(), 1);
|
|
777956
777938
|
var import_utc3 = __toESM(require_utc2(), 1);
|
|
777957
777939
|
var import_fs24 = require("fs");
|
|
777958
|
-
var
|
|
777940
|
+
var import_promises59 = require("fs/promises");
|
|
777959
777941
|
var import_gray_matter5 = __toESM(require_gray_matter(), 1);
|
|
777960
777942
|
init_lodash();
|
|
777961
777943
|
|
|
@@ -782414,7 +782396,7 @@ var OpenAPIPruner = class {
|
|
|
782414
782396
|
};
|
|
782415
782397
|
|
|
782416
782398
|
// ../register/lib/ai-example-enhancer/enhanceExamplesWithAI.js
|
|
782417
|
-
var
|
|
782399
|
+
var import_promises58 = require("fs/promises");
|
|
782418
782400
|
|
|
782419
782401
|
// ../register/lib/ai-example-enhancer/filterHelpers.js
|
|
782420
782402
|
function isFdrTypedValueWrapper(value) {
|
|
@@ -782768,12 +782750,12 @@ var SpinnerStatusCoordinator = class _SpinnerStatusCoordinator {
|
|
|
782768
782750
|
|
|
782769
782751
|
// ../register/lib/ai-example-enhancer/validateAiExamples.js
|
|
782770
782752
|
init_lib6();
|
|
782771
|
-
var
|
|
782753
|
+
var import_promises56 = require("fs/promises");
|
|
782772
782754
|
async function parseAiExamplesOverride(sourceFilePath, context3) {
|
|
782773
782755
|
const overrideFilePath = AbsoluteFilePath2.of(`${dirname4(sourceFilePath)}/ai_examples_override.yml`);
|
|
782774
782756
|
const aiExamples = [];
|
|
782775
782757
|
try {
|
|
782776
|
-
const existingContent = await (0,
|
|
782758
|
+
const existingContent = await (0, import_promises56.readFile)(overrideFilePath, "utf-8");
|
|
782777
782759
|
const parsed = jsYaml.load(existingContent);
|
|
782778
782760
|
if (parsed && typeof parsed === "object" && "paths" in parsed) {
|
|
782779
782761
|
const paths = parsed.paths;
|
|
@@ -782822,7 +782804,7 @@ async function validateAiExamplesFromFile({ sourceFilePath, context: context3 })
|
|
|
782822
782804
|
}
|
|
782823
782805
|
let spec;
|
|
782824
782806
|
try {
|
|
782825
|
-
const specContent = await (0,
|
|
782807
|
+
const specContent = await (0, import_promises56.readFile)(sourceFilePath, "utf-8");
|
|
782826
782808
|
try {
|
|
782827
782809
|
spec = JSON.parse(specContent);
|
|
782828
782810
|
} catch {
|
|
@@ -782881,7 +782863,7 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context3 }) {
|
|
|
782881
782863
|
}
|
|
782882
782864
|
const overrideFilePath = AbsoluteFilePath2.of(`${dirname4(sourceFilePath)}/ai_examples_override.yml`);
|
|
782883
782865
|
try {
|
|
782884
|
-
const existingContent = await (0,
|
|
782866
|
+
const existingContent = await (0, import_promises56.readFile)(overrideFilePath, "utf-8");
|
|
782885
782867
|
const parsed = jsYaml.load(existingContent);
|
|
782886
782868
|
if (!parsed || !parsed.paths) {
|
|
782887
782869
|
return {
|
|
@@ -782926,12 +782908,12 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context3 }) {
|
|
|
782926
782908
|
|
|
782927
782909
|
// ../register/lib/ai-example-enhancer/writeAiExamplesOverride.js
|
|
782928
782910
|
init_lib6();
|
|
782929
|
-
var
|
|
782911
|
+
var import_promises57 = require("fs/promises");
|
|
782930
782912
|
async function loadExistingOverrideCoverage(sourceFilePath, context3) {
|
|
782931
782913
|
const overrideFilePath = AbsoluteFilePath2.of(`${dirname4(sourceFilePath)}/ai_examples_override.yml`);
|
|
782932
782914
|
const coveredEndpoints = /* @__PURE__ */ new Set();
|
|
782933
782915
|
try {
|
|
782934
|
-
const existingContent = await (0,
|
|
782916
|
+
const existingContent = await (0, import_promises57.readFile)(overrideFilePath, "utf-8");
|
|
782935
782917
|
const parsed = jsYaml.load(existingContent);
|
|
782936
782918
|
if (parsed && typeof parsed === "object" && "paths" in parsed) {
|
|
782937
782919
|
const paths = parsed.paths;
|
|
@@ -783057,7 +783039,7 @@ async function writeAiExamplesOverride({ enhancedExamples, sourceFilePath, conte
|
|
|
783057
783039
|
try {
|
|
783058
783040
|
let existingOverride = {};
|
|
783059
783041
|
try {
|
|
783060
|
-
const existingContent = await (0,
|
|
783042
|
+
const existingContent = await (0, import_promises57.readFile)(overrideFilePath, "utf-8");
|
|
783061
783043
|
const parsed = jsYaml.load(existingContent);
|
|
783062
783044
|
if (parsed && typeof parsed === "object") {
|
|
783063
783045
|
existingOverride = parsed;
|
|
@@ -783100,7 +783082,7 @@ async function writeAiExamplesOverride({ enhancedExamples, sourceFilePath, conte
|
|
|
783100
783082
|
lineWidth: -1,
|
|
783101
783083
|
noRefs: true
|
|
783102
783084
|
});
|
|
783103
|
-
await (0,
|
|
783085
|
+
await (0, import_promises57.writeFile)(overrideFilePath, yamlContent, "utf-8");
|
|
783104
783086
|
context3.logger.debug(`AI enhanced examples written to: ${overrideFilePath}`);
|
|
783105
783087
|
} catch (error50) {
|
|
783106
783088
|
context3.logger.warn(`Failed to write AI examples override file: ${error50}`);
|
|
@@ -783390,7 +783372,7 @@ async function performAIEnhancement(apiDefinition, config5, context3, token, org
|
|
|
783390
783372
|
const parsedSpecs = [];
|
|
783391
783373
|
for (const sourceSpec of sourceSpecs) {
|
|
783392
783374
|
try {
|
|
783393
|
-
let specContent = await (0,
|
|
783375
|
+
let specContent = await (0, import_promises58.readFile)(sourceSpec.absoluteFilePath, "utf-8");
|
|
783394
783376
|
if (sourceSpec.absoluteFilePathToOverrides != null) {
|
|
783395
783377
|
const overridesPaths = Array.isArray(sourceSpec.absoluteFilePathToOverrides) ? sourceSpec.absoluteFilePathToOverrides : [sourceSpec.absoluteFilePathToOverrides];
|
|
783396
783378
|
try {
|
|
@@ -783401,7 +783383,7 @@ async function performAIEnhancement(apiDefinition, config5, context3, token, org
|
|
|
783401
783383
|
parsedSpec = load(specContent, { json: true });
|
|
783402
783384
|
}
|
|
783403
783385
|
for (const overridesPath of overridesPaths) {
|
|
783404
|
-
const overridesContent = await (0,
|
|
783386
|
+
const overridesContent = await (0, import_promises58.readFile)(overridesPath, "utf-8");
|
|
783405
783387
|
let parsedOverrides;
|
|
783406
783388
|
try {
|
|
783407
783389
|
parsedOverrides = JSON.parse(overridesContent);
|
|
@@ -786528,7 +786510,7 @@ var DocsDefinitionResolver = class {
|
|
|
786528
786510
|
const jsFilePaths = /* @__PURE__ */ new Set();
|
|
786529
786511
|
await Promise.all(this._parsedDocsConfig.experimental.mdxComponents.map(async (filepath) => {
|
|
786530
786512
|
const absoluteFilePath = resolve5(this.docsWorkspace.absoluteFilePath, filepath);
|
|
786531
|
-
const stats = await (0,
|
|
786513
|
+
const stats = await (0, import_promises59.stat)(absoluteFilePath);
|
|
786532
786514
|
if (stats.isDirectory()) {
|
|
786533
786515
|
const files = await listFiles(absoluteFilePath, "{js,ts,jsx,tsx,md,mdx}");
|
|
786534
786516
|
files.forEach((file4) => {
|
|
@@ -786540,7 +786522,7 @@ var DocsDefinitionResolver = class {
|
|
|
786540
786522
|
}));
|
|
786541
786523
|
jsFiles = Object.fromEntries(await Promise.all([...jsFilePaths].map(async (filePath) => {
|
|
786542
786524
|
const relativeFilePath = this.toRelativeFilepath(filePath);
|
|
786543
|
-
const contents = (await (0,
|
|
786525
|
+
const contents = (await (0, import_promises59.readFile)(filePath)).toString();
|
|
786544
786526
|
return [relativeFilePath, contents];
|
|
786545
786527
|
})));
|
|
786546
786528
|
const mdxTime = performance.now() - mdxStart;
|
|
@@ -786554,13 +786536,13 @@ var DocsDefinitionResolver = class {
|
|
|
786554
786536
|
}
|
|
786555
786537
|
if (this._parsedDocsConfig.header != null) {
|
|
786556
786538
|
const relativeFilePath = this.toRelativeFilepath(this._parsedDocsConfig.header);
|
|
786557
|
-
const contents = (await (0,
|
|
786539
|
+
const contents = (await (0, import_promises59.readFile)(this._parsedDocsConfig.header)).toString();
|
|
786558
786540
|
jsFiles[relativeFilePath] = contents;
|
|
786559
786541
|
this.taskContext.logger.debug(`Added custom header component: ${relativeFilePath}`);
|
|
786560
786542
|
}
|
|
786561
786543
|
if (this._parsedDocsConfig.footer != null) {
|
|
786562
786544
|
const relativeFilePath = this.toRelativeFilepath(this._parsedDocsConfig.footer);
|
|
786563
|
-
const contents = (await (0,
|
|
786545
|
+
const contents = (await (0, import_promises59.readFile)(this._parsedDocsConfig.footer)).toString();
|
|
786564
786546
|
jsFiles[relativeFilePath] = contents;
|
|
786565
786547
|
this.taskContext.logger.debug(`Added custom footer component: ${relativeFilePath}`);
|
|
786566
786548
|
}
|
|
@@ -787345,7 +787327,7 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
787345
787327
|
this.taskContext.logger.warn(`No _navigation.yml found for library '${libraryName}' at ${navFilePath}. Run 'fern docs md generate' first.`);
|
|
787346
787328
|
return null;
|
|
787347
787329
|
}
|
|
787348
|
-
const navContent = await (0,
|
|
787330
|
+
const navContent = await (0, import_promises59.readFile)(navFilePath, "utf-8");
|
|
787349
787331
|
const yamlBody = navContent.split("\n").filter((line) => !line.startsWith("#")).join("\n");
|
|
787350
787332
|
try {
|
|
787351
787333
|
return jsYaml.load(yamlBody) ?? [];
|
|
@@ -787365,7 +787347,7 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
787365
787347
|
return void 0;
|
|
787366
787348
|
}
|
|
787367
787349
|
const relPath = relative3(this.docsWorkspace.absoluteFilePath, absolutePath);
|
|
787368
|
-
const content5 = await (0,
|
|
787350
|
+
const content5 = await (0, import_promises59.readFile)(absolutePath, "utf-8");
|
|
787369
787351
|
this.parsedDocsConfig.pages[relPath] = content5;
|
|
787370
787352
|
return navigation_exports2.PageId(relPath);
|
|
787371
787353
|
}
|
|
@@ -796229,7 +796211,7 @@ async function validateVersionConfigFileSchema({ value }) {
|
|
|
796229
796211
|
// ../yaml/docs-validator/lib/docsAst/visitDocsConfigFileYamlAst.js
|
|
796230
796212
|
init_lib4();
|
|
796231
796213
|
init_lib6();
|
|
796232
|
-
var
|
|
796214
|
+
var import_promises61 = require("fs/promises");
|
|
796233
796215
|
|
|
796234
796216
|
// ../yaml/docs-validator/lib/docsAst/validateProductConfig.js
|
|
796235
796217
|
init_lib4();
|
|
@@ -798307,7 +798289,7 @@ async function visitFilepath({ absoluteFilepathToConfiguration, rawUnresolvedFil
|
|
|
798307
798289
|
// ../yaml/docs-validator/lib/docsAst/visitNavigationAst.js
|
|
798308
798290
|
init_lib4();
|
|
798309
798291
|
init_lib6();
|
|
798310
|
-
var
|
|
798292
|
+
var import_promises60 = require("fs/promises");
|
|
798311
798293
|
|
|
798312
798294
|
// ../yaml/docs-validator/lib/utils/asyncPool.js
|
|
798313
798295
|
async function asyncPool(limit, items, fn5) {
|
|
@@ -798459,13 +798441,13 @@ async function visitNavigationItem2({ absolutePathToFernFolder, navigationItem,
|
|
|
798459
798441
|
if (markdownPath != null) {
|
|
798460
798442
|
const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), markdownPath);
|
|
798461
798443
|
if (await doesPathExist(absoluteFilepath)) {
|
|
798462
|
-
const fileStats = await (0,
|
|
798444
|
+
const fileStats = await (0, import_promises60.stat)(absoluteFilepath);
|
|
798463
798445
|
const fileSizeMB = fileStats.size / (1024 * 1024);
|
|
798464
798446
|
if (fileSizeMB > 1) {
|
|
798465
798447
|
context3.logger.trace(`Processing large markdown file: ${markdownPath} (${fileSizeMB.toFixed(2)} MB)`);
|
|
798466
798448
|
}
|
|
798467
798449
|
const startTime = performance.now();
|
|
798468
|
-
const content5 = (await (0,
|
|
798450
|
+
const content5 = (await (0, import_promises60.readFile)(absoluteFilepath, "utf8")).toString();
|
|
798469
798451
|
const readTime = performance.now() - startTime;
|
|
798470
798452
|
if (readTime > 2e3) {
|
|
798471
798453
|
context3.logger.debug(`Slow file read: ${markdownPath} took ${readTime.toFixed(0)}ms`);
|
|
@@ -798513,12 +798495,12 @@ async function visitNavigationItem2({ absolutePathToFernFolder, navigationItem,
|
|
|
798513
798495
|
context3.logger.trace(`Starting changelog processing for directory: ${changelogDir}`);
|
|
798514
798496
|
if (await doesPathExist(changelogDir)) {
|
|
798515
798497
|
const startTime = performance.now();
|
|
798516
|
-
const files = await (0,
|
|
798498
|
+
const files = await (0, import_promises60.readdir)(changelogDir);
|
|
798517
798499
|
const markdownFiles = files.filter((file4) => file4.endsWith(".md") || file4.endsWith(".mdx"));
|
|
798518
798500
|
context3.logger.debug(`Processing ${markdownFiles.length} changelog files in ${changelogDir}`);
|
|
798519
798501
|
await asyncPool(VALIDATION_CONCURRENCY, markdownFiles, async (file4) => {
|
|
798520
798502
|
const absoluteFilepath = resolve5(changelogDir, file4);
|
|
798521
|
-
const content5 = (await (0,
|
|
798503
|
+
const content5 = (await (0, import_promises60.readFile)(absoluteFilepath, "utf8")).toString();
|
|
798522
798504
|
context3.logger.trace(`Validating changelog file: ${file4}`);
|
|
798523
798505
|
await visitor.markdownPage?.({
|
|
798524
798506
|
title: file4,
|
|
@@ -798753,7 +798735,7 @@ async function visitDocsConfigFileYamlAst({ contents, visitor, absoluteFilepathT
|
|
|
798753
798735
|
willBeUploaded: false
|
|
798754
798736
|
});
|
|
798755
798737
|
const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), product.path);
|
|
798756
|
-
const content5 = jsYaml.load((await (0,
|
|
798738
|
+
const content5 = jsYaml.load((await (0, import_promises61.readFile)(absoluteFilepath)).toString());
|
|
798757
798739
|
if (await doesPathExist(absoluteFilepath)) {
|
|
798758
798740
|
await visitor.productFile?.({
|
|
798759
798741
|
path: product.path,
|
|
@@ -798832,7 +798814,7 @@ async function visitDocsConfigFileYamlAst({ contents, visitor, absoluteFilepathT
|
|
|
798832
798814
|
willBeUploaded: false
|
|
798833
798815
|
});
|
|
798834
798816
|
const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), version7.path);
|
|
798835
|
-
const content5 = jsYaml.load((await (0,
|
|
798817
|
+
const content5 = jsYaml.load((await (0, import_promises61.readFile)(absoluteFilepath)).toString());
|
|
798836
798818
|
if (await doesPathExist(absoluteFilepath)) {
|
|
798837
798819
|
await visitor.versionFile?.({
|
|
798838
798820
|
path: version7.path,
|
|
@@ -799268,11 +799250,11 @@ var import_chardet2 = __toESM(require_lib9(), 1);
|
|
|
799268
799250
|
// ../../../node_modules/.pnpm/file-type@21.3.4/node_modules/file-type/index.js
|
|
799269
799251
|
var import_web = require("stream/web");
|
|
799270
799252
|
var import_node_stream5 = require("stream");
|
|
799271
|
-
var
|
|
799253
|
+
var import_promises64 = __toESM(require("fs/promises"), 1);
|
|
799272
799254
|
var import_node_fs13 = require("fs");
|
|
799273
799255
|
|
|
799274
799256
|
// ../../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/index.js
|
|
799275
|
-
var
|
|
799257
|
+
var import_promises63 = require("fs/promises");
|
|
799276
799258
|
|
|
799277
799259
|
// ../../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/stream/Errors.js
|
|
799278
799260
|
var defaultMessages = "End-Of-Stream";
|
|
@@ -799795,14 +799777,14 @@ function fromBlob(blob, options2) {
|
|
|
799795
799777
|
}
|
|
799796
799778
|
|
|
799797
799779
|
// ../../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/FileTokenizer.js
|
|
799798
|
-
var
|
|
799780
|
+
var import_promises62 = require("fs/promises");
|
|
799799
799781
|
var FileTokenizer = class _FileTokenizer extends AbstractTokenizer {
|
|
799800
799782
|
/**
|
|
799801
799783
|
* Create tokenizer from provided file path
|
|
799802
799784
|
* @param sourceFilePath File path
|
|
799803
799785
|
*/
|
|
799804
799786
|
static async fromFile(sourceFilePath) {
|
|
799805
|
-
const fileHandle = await (0,
|
|
799787
|
+
const fileHandle = await (0, import_promises62.open)(sourceFilePath, "r");
|
|
799806
799788
|
const stat6 = await fileHandle.stat();
|
|
799807
799789
|
return new _FileTokenizer(fileHandle, { fileInfo: { path: sourceFilePath, size: stat6.size } });
|
|
799808
799790
|
}
|
|
@@ -803043,7 +803025,7 @@ var supportedExtensions = new Set(extensions);
|
|
|
803043
803025
|
var supportedMimeTypes = new Set(mimeTypes);
|
|
803044
803026
|
|
|
803045
803027
|
// ../yaml/docs-validator/lib/rules/valid-file-types/valid-file-types.js
|
|
803046
|
-
var
|
|
803028
|
+
var import_promises65 = require("fs/promises");
|
|
803047
803029
|
var import_path52 = __toESM(require("path"), 1);
|
|
803048
803030
|
var ALLOWED_FILE_TYPES = /* @__PURE__ */ new Set([
|
|
803049
803031
|
// image files
|
|
@@ -803172,7 +803154,7 @@ var ValidFileTypes = {
|
|
|
803172
803154
|
}
|
|
803173
803155
|
};
|
|
803174
803156
|
var getViolationsForFile = async (absoluteFilepath) => {
|
|
803175
|
-
const file4 = new Uint8Array(await (0,
|
|
803157
|
+
const file4 = new Uint8Array(await (0, import_promises65.readFile)(absoluteFilepath));
|
|
803176
803158
|
const fileType = await fileTypeFromBuffer(file4);
|
|
803177
803159
|
if (fileType != null) {
|
|
803178
803160
|
if (ALLOWED_FILE_TYPES.has(fileType.mime)) {
|
|
@@ -803211,7 +803193,7 @@ var getViolationsForFile = async (absoluteFilepath) => {
|
|
|
803211
803193
|
};
|
|
803212
803194
|
|
|
803213
803195
|
// ../yaml/docs-validator/lib/rules/valid-frontmatter/valid-frontmatter.js
|
|
803214
|
-
var
|
|
803196
|
+
var import_promises66 = require("fs/promises");
|
|
803215
803197
|
var import_gray_matter6 = __toESM(require_gray_matter(), 1);
|
|
803216
803198
|
var ValidFrontmatter = {
|
|
803217
803199
|
name: "valid-frontmatter",
|
|
@@ -803222,7 +803204,7 @@ var ValidFrontmatter = {
|
|
|
803222
803204
|
return [];
|
|
803223
803205
|
}
|
|
803224
803206
|
try {
|
|
803225
|
-
const fileContents = await (0,
|
|
803207
|
+
const fileContents = await (0, import_promises66.readFile)(absoluteFilepath, "utf-8");
|
|
803226
803208
|
(0, import_gray_matter6.default)(fileContents);
|
|
803227
803209
|
return [];
|
|
803228
803210
|
} catch (error50) {
|
|
@@ -820664,7 +820646,7 @@ async function parseMarkdown({ markdown, absoluteFilepath, absolutePathToFernFol
|
|
|
820664
820646
|
|
|
820665
820647
|
// ../yaml/docs-validator/lib/rules/valid-markdown-file-reference/valid-markdown-file-reference.js
|
|
820666
820648
|
init_lib6();
|
|
820667
|
-
var
|
|
820649
|
+
var import_promises67 = require("fs/promises");
|
|
820668
820650
|
var import_gray_matter7 = __toESM(require_gray_matter(), 1);
|
|
820669
820651
|
var ValidMarkdownFileReferences = {
|
|
820670
820652
|
name: "valid-markdown-file-references",
|
|
@@ -820675,7 +820657,7 @@ var ValidMarkdownFileReferences = {
|
|
|
820675
820657
|
return [];
|
|
820676
820658
|
}
|
|
820677
820659
|
try {
|
|
820678
|
-
const fileContents = await (0,
|
|
820660
|
+
const fileContents = await (0, import_promises67.readFile)(absoluteFilepath, "utf-8");
|
|
820679
820661
|
const { content: content5 } = (0, import_gray_matter7.default)(fileContents, {});
|
|
820680
820662
|
const tree = parseMarkdownToTree(content5);
|
|
820681
820663
|
const errors4 = [];
|
|
@@ -821276,7 +821258,7 @@ var MDX_NODE_TYPES = [
|
|
|
821276
821258
|
"mdxTextExpression",
|
|
821277
821259
|
"mdxjsEsm"
|
|
821278
821260
|
];
|
|
821279
|
-
function collectLinksAndSources({ readFile:
|
|
821261
|
+
function collectLinksAndSources({ readFile: readFile102 = (path97) => (0, import_node_fs14.readFileSync)(path97, "utf-8"), ...opts }) {
|
|
821280
821262
|
const visitedAbsoluteFilepaths = /* @__PURE__ */ new Set();
|
|
821281
821263
|
const contentQueue = [opts];
|
|
821282
821264
|
const links = [];
|
|
@@ -821314,7 +821296,7 @@ function collectLinksAndSources({ readFile: readFile106 = (path97) => (0, import
|
|
|
821314
821296
|
const resolvedImportPath = resolve5(dirname4(absoluteFilepath), importPath);
|
|
821315
821297
|
if (resolvedImportPath.endsWith(".mdx") || resolvedImportPath.endsWith(".md")) {
|
|
821316
821298
|
contentQueue.push({
|
|
821317
|
-
content:
|
|
821299
|
+
content: readFile102(resolvedImportPath),
|
|
821318
821300
|
absoluteFilepath: resolvedImportPath
|
|
821319
821301
|
});
|
|
821320
821302
|
}
|
|
@@ -821357,7 +821339,7 @@ function collectLinksAndSources({ readFile: readFile106 = (path97) => (0, import
|
|
|
821357
821339
|
if (absoluteFilepath && typeof src === "string") {
|
|
821358
821340
|
const resolvedImportPath = resolve5(dirname4(absoluteFilepath), src);
|
|
821359
821341
|
contentQueue.push({
|
|
821360
|
-
content:
|
|
821342
|
+
content: readFile102(resolvedImportPath),
|
|
821361
821343
|
absoluteFilepath: resolvedImportPath
|
|
821362
821344
|
});
|
|
821363
821345
|
}
|
|
@@ -821754,7 +821736,7 @@ function createDocsConfigFileAstVisitorForRules({ relativeFilepath, allRulesWith
|
|
|
821754
821736
|
|
|
821755
821737
|
// ../yaml/docs-validator/lib/rules/no-non-component-refs/no-non-component-refs.js
|
|
821756
821738
|
init_lib6();
|
|
821757
|
-
var
|
|
821739
|
+
var import_promises68 = require("fs/promises");
|
|
821758
821740
|
var NoNonComponentRefsRule = {
|
|
821759
821741
|
name: "no-non-component-refs",
|
|
821760
821742
|
create: ({ ossWorkspaces, logger: logger4, workspace: docsWorkspace }) => {
|
|
@@ -821768,7 +821750,7 @@ var NoNonComponentRefsRule = {
|
|
|
821768
821750
|
if (!processedFiles.has(spec.absoluteFilepath)) {
|
|
821769
821751
|
processedFiles.add(spec.absoluteFilepath);
|
|
821770
821752
|
try {
|
|
821771
|
-
const contents = (await (0,
|
|
821753
|
+
const contents = (await (0, import_promises68.readFile)(spec.absoluteFilepath)).toString();
|
|
821772
821754
|
const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
|
|
821773
821755
|
const isOpenApiV2Yaml = contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"));
|
|
821774
821756
|
const isOpenApiV2Json = contents.includes('"swagger":') && (contents.includes('"swagger":"2.0"') || contents.includes('"swagger": "2.0"'));
|
|
@@ -821810,7 +821792,7 @@ var NoNonComponentRefsRule = {
|
|
|
821810
821792
|
|
|
821811
821793
|
// ../yaml/docs-validator/lib/rules/no-openapi-v2-in-docs/no-openapi-v2-in-docs.js
|
|
821812
821794
|
init_lib6();
|
|
821813
|
-
var
|
|
821795
|
+
var import_promises69 = require("fs/promises");
|
|
821814
821796
|
var NoOpenApiV2InDocsRule = {
|
|
821815
821797
|
name: "no-openapi-v2-in-docs",
|
|
821816
821798
|
create: ({ ossWorkspaces, logger: logger4, workspace: docsWorkspace }) => {
|
|
@@ -821823,7 +821805,7 @@ var NoOpenApiV2InDocsRule = {
|
|
|
821823
821805
|
if (spec.type === "openapi" && !processedFiles.has(spec.absoluteFilepath)) {
|
|
821824
821806
|
processedFiles.add(spec.absoluteFilepath);
|
|
821825
821807
|
try {
|
|
821826
|
-
const contents = (await (0,
|
|
821808
|
+
const contents = (await (0, import_promises69.readFile)(spec.absoluteFilepath)).toString();
|
|
821827
821809
|
const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
|
|
821828
821810
|
const isOpenApiV2Yaml = contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"));
|
|
821829
821811
|
const isOpenApiV2Json = contents.includes('"swagger":') && (contents.includes('"swagger":"2.0"') || contents.includes('"swagger": "2.0"'));
|
|
@@ -821949,7 +821931,7 @@ var ValidInstanceUrlRule = {
|
|
|
821949
821931
|
|
|
821950
821932
|
// ../yaml/docs-validator/lib/rules/valid-local-references/valid-local-references.js
|
|
821951
821933
|
init_lib6();
|
|
821952
|
-
var
|
|
821934
|
+
var import_promises70 = require("fs/promises");
|
|
821953
821935
|
function validateReference(ref2, spec) {
|
|
821954
821936
|
const pathParts = ref2.replace(/^#\//, "").split("/").map((part) => (
|
|
821955
821937
|
// Decode JSON Pointer escapes: ~1 -> /, ~0 -> ~
|
|
@@ -822016,7 +821998,7 @@ var ValidLocalReferencesRule = {
|
|
|
822016
821998
|
if (spec.type === "openapi" && !processedFiles.has(spec.absoluteFilepath)) {
|
|
822017
821999
|
processedFiles.add(spec.absoluteFilepath);
|
|
822018
822000
|
try {
|
|
822019
|
-
const contents = (await (0,
|
|
822001
|
+
const contents = (await (0, import_promises70.readFile)(spec.absoluteFilepath)).toString();
|
|
822020
822002
|
const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
|
|
822021
822003
|
const isOpenApiV2Yaml = contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"));
|
|
822022
822004
|
const isOpenApiV2Json = contents.includes('"swagger":') && (contents.includes('"swagger":"2.0"') || contents.includes('"swagger": "2.0"'));
|
|
@@ -822071,7 +822053,7 @@ var ValidLocalReferencesRule = {
|
|
|
822071
822053
|
|
|
822072
822054
|
// ../yaml/docs-validator/lib/rules/valid-openapi-examples/valid-openapi-examples.js
|
|
822073
822055
|
init_lib6();
|
|
822074
|
-
var
|
|
822056
|
+
var import_promises71 = require("fs/promises");
|
|
822075
822057
|
var ValidOpenApiExamples = {
|
|
822076
822058
|
name: "valid-openapi-examples",
|
|
822077
822059
|
create: ({ ossWorkspaces, logger: logger4, workspace: docsWorkspace }) => {
|
|
@@ -822169,7 +822151,7 @@ var ValidOpenApiExamples = {
|
|
|
822169
822151
|
};
|
|
822170
822152
|
async function validateOpenApiExamples({ specPath, logger: logger4 }) {
|
|
822171
822153
|
try {
|
|
822172
|
-
const specContent = await (0,
|
|
822154
|
+
const specContent = await (0, import_promises71.readFile)(specPath, "utf-8");
|
|
822173
822155
|
let spec;
|
|
822174
822156
|
try {
|
|
822175
822157
|
spec = JSON.parse(specContent);
|
|
@@ -822899,11 +822881,11 @@ function addCheckCommand2(cli) {
|
|
|
822899
822881
|
|
|
822900
822882
|
// ../cli-v2/lib/migrator/Migrator.js
|
|
822901
822883
|
init_lib6();
|
|
822902
|
-
var
|
|
822884
|
+
var import_promises75 = require("fs/promises");
|
|
822903
822885
|
|
|
822904
822886
|
// ../cli-v2/lib/migrator/converters/convertApiSpecs.js
|
|
822905
822887
|
init_lib6();
|
|
822906
|
-
var
|
|
822888
|
+
var import_promises72 = require("fs/promises");
|
|
822907
822889
|
|
|
822908
822890
|
// ../cli-v2/lib/migrator/converters/convertSettings.js
|
|
822909
822891
|
var SETTINGS_KEY_MAP = {
|
|
@@ -823037,7 +823019,7 @@ async function convertMultiApi(options2) {
|
|
|
823037
823019
|
const { apisDir, generatorsYmlApis } = options2;
|
|
823038
823020
|
const warnings = [];
|
|
823039
823021
|
const apis = {};
|
|
823040
|
-
const apiDirs = await (0,
|
|
823022
|
+
const apiDirs = await (0, import_promises72.readdir)(apisDir, { withFileTypes: true });
|
|
823041
823023
|
const apiNames = apiDirs.filter((d14) => d14.isDirectory()).map((d14) => d14.name);
|
|
823042
823024
|
for (const apiName of apiNames) {
|
|
823043
823025
|
const apiDir = join2(apisDir, RelativeFilePath2.of(apiName));
|
|
@@ -823788,7 +823770,7 @@ function convertRawReadme(readme) {
|
|
|
823788
823770
|
// ../cli-v2/lib/migrator/fern-config-json/FernConfigJsonMigrator.js
|
|
823789
823771
|
init_lib4();
|
|
823790
823772
|
init_lib6();
|
|
823791
|
-
var
|
|
823773
|
+
var import_promises73 = require("fs/promises");
|
|
823792
823774
|
var FernConfigJsonMigrator = class {
|
|
823793
823775
|
cwd;
|
|
823794
823776
|
constructor({ cwd: cwd2 }) {
|
|
@@ -823821,7 +823803,7 @@ var FernConfigJsonMigrator = class {
|
|
|
823821
823803
|
};
|
|
823822
823804
|
}
|
|
823823
823805
|
try {
|
|
823824
|
-
const content5 = await (0,
|
|
823806
|
+
const content5 = await (0, import_promises73.readFile)(absoluteFilePath, "utf-8");
|
|
823825
823807
|
const config5 = JSON.parse(content5);
|
|
823826
823808
|
const org = typeof config5.organization === "string" ? config5.organization : void 0;
|
|
823827
823809
|
const cliVersion = typeof config5.version === "string" ? config5.version : void 0;
|
|
@@ -823860,7 +823842,7 @@ var FernConfigJsonMigrator = class {
|
|
|
823860
823842
|
// ../cli-v2/lib/migrator/generators-yml/GeneratorsYmlMigrator.js
|
|
823861
823843
|
init_lib4();
|
|
823862
823844
|
init_lib6();
|
|
823863
|
-
var
|
|
823845
|
+
var import_promises74 = require("fs/promises");
|
|
823864
823846
|
var GeneratorsYmlMigrator = class {
|
|
823865
823847
|
cwd;
|
|
823866
823848
|
apiName;
|
|
@@ -823894,7 +823876,7 @@ var GeneratorsYmlMigrator = class {
|
|
|
823894
823876
|
}
|
|
823895
823877
|
let content5;
|
|
823896
823878
|
try {
|
|
823897
|
-
content5 = await (0,
|
|
823879
|
+
content5 = await (0, import_promises74.readFile)(absoluteFilePath, "utf-8");
|
|
823898
823880
|
const config5 = jsYaml.load(content5);
|
|
823899
823881
|
if (config5 == null || typeof config5 !== "object") {
|
|
823900
823882
|
return {
|
|
@@ -824121,11 +824103,11 @@ var Migrator = class {
|
|
|
824121
824103
|
}
|
|
824122
824104
|
const fernYmlPath = join2(this.cwd, RelativeFilePath2.of(FERN_YML_FILENAME));
|
|
824123
824105
|
const yamlContent = this.serializeFernYml(fernYml);
|
|
824124
|
-
await (0,
|
|
824106
|
+
await (0, import_promises75.writeFile)(fernYmlPath, yamlContent, "utf-8");
|
|
824125
824107
|
if (this.deleteOriginals) {
|
|
824126
824108
|
for (const absoluteFilePath of migratedFiles) {
|
|
824127
824109
|
try {
|
|
824128
|
-
await (0,
|
|
824110
|
+
await (0, import_promises75.rm)(absoluteFilePath);
|
|
824129
824111
|
this.logger.debug(`Deleted ${absoluteFilePath}`);
|
|
824130
824112
|
} catch {
|
|
824131
824113
|
warnings.push({
|
|
@@ -824169,7 +824151,7 @@ var Migrator = class {
|
|
|
824169
824151
|
}
|
|
824170
824152
|
async migrateMultiApi(options2) {
|
|
824171
824153
|
const { fernDir, apisDir, org, warnings, migratedFiles } = options2;
|
|
824172
|
-
const apiDirs = await (0,
|
|
824154
|
+
const apiDirs = await (0, import_promises75.readdir)(apisDir, { withFileTypes: true });
|
|
824173
824155
|
const apiNames = apiDirs.filter((d14) => d14.isDirectory()).map((d14) => d14.name);
|
|
824174
824156
|
if (apiNames.length === 0) {
|
|
824175
824157
|
warnings.push({
|
|
@@ -824529,7 +824511,7 @@ init_js();
|
|
|
824529
824511
|
init_lib6();
|
|
824530
824512
|
var import_cors = __toESM(require_lib14(), 1);
|
|
824531
824513
|
var import_express2 = __toESM(require_express3(), 1);
|
|
824532
|
-
var
|
|
824514
|
+
var import_promises79 = require("fs/promises");
|
|
824533
824515
|
var import_http9 = __toESM(require("http"), 1);
|
|
824534
824516
|
var import_path55 = __toESM(require("path"), 1);
|
|
824535
824517
|
|
|
@@ -826202,13 +826184,13 @@ init_wrapper();
|
|
|
826202
826184
|
|
|
826203
826185
|
// ../docs-preview/lib/DebugLogger.js
|
|
826204
826186
|
init_lib6();
|
|
826205
|
-
var
|
|
826187
|
+
var import_promises76 = require("fs/promises");
|
|
826206
826188
|
var import_os9 = require("os");
|
|
826207
826189
|
var import_path54 = __toESM(require("path"), 1);
|
|
826208
826190
|
var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
826209
826191
|
var LOGS_FOLDER_NAME = "logs";
|
|
826210
826192
|
function getCliSource() {
|
|
826211
|
-
const version7 = "4.50.
|
|
826193
|
+
const version7 = "4.50.4-1-g8a6fed15293";
|
|
826212
826194
|
return `cli@${version7}`;
|
|
826213
826195
|
}
|
|
826214
826196
|
var DebugLogger = class {
|
|
@@ -826228,7 +826210,7 @@ var DebugLogger = class {
|
|
|
826228
826210
|
const localStorageFolder = join2(AbsoluteFilePath2.of((0, import_os9.homedir)()), RelativeFilePath2.of(LOCAL_STORAGE_FOLDER4));
|
|
826229
826211
|
const logsDir = join2(localStorageFolder, RelativeFilePath2.of(LOGS_FOLDER_NAME));
|
|
826230
826212
|
if (!await doesPathExist(logsDir)) {
|
|
826231
|
-
await (0,
|
|
826213
|
+
await (0, import_promises76.mkdir)(logsDir, { recursive: true });
|
|
826232
826214
|
}
|
|
826233
826215
|
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
826234
826216
|
const logFileName = `${timestamp2}.debug.log`;
|
|
@@ -826241,7 +826223,7 @@ var DebugLogger = class {
|
|
|
826241
826223
|
"================================================================================",
|
|
826242
826224
|
""
|
|
826243
826225
|
].join("\n");
|
|
826244
|
-
await (0,
|
|
826226
|
+
await (0, import_promises76.writeFile)(this.logFilePath, header, "utf-8");
|
|
826245
826227
|
this.initialized = true;
|
|
826246
826228
|
}
|
|
826247
826229
|
/**
|
|
@@ -826259,7 +826241,7 @@ var DebugLogger = class {
|
|
|
826259
826241
|
}
|
|
826260
826242
|
const line = JSON.stringify(entry) + "\n";
|
|
826261
826243
|
try {
|
|
826262
|
-
await (0,
|
|
826244
|
+
await (0, import_promises76.appendFile)(this.logFilePath, line, "utf-8");
|
|
826263
826245
|
} catch (error50) {
|
|
826264
826246
|
}
|
|
826265
826247
|
}
|
|
@@ -826494,7 +826476,7 @@ function getBun() {
|
|
|
826494
826476
|
init_lib6();
|
|
826495
826477
|
var import_cli_progress = __toESM(require_cli_progress(), 1);
|
|
826496
826478
|
var import_decompress = __toESM(require_decompress(), 1);
|
|
826497
|
-
var
|
|
826479
|
+
var import_promises77 = require("fs/promises");
|
|
826498
826480
|
var import_os10 = require("os");
|
|
826499
826481
|
var import_tmp_promise8 = __toESM(require_tmp_promise(), 1);
|
|
826500
826482
|
var import_xml2js = __toESM(require_xml2js(), 1);
|
|
@@ -826582,7 +826564,7 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
826582
826564
|
let currentETag = void 0;
|
|
826583
826565
|
if (currentETagExists) {
|
|
826584
826566
|
logger4.debug("Reading existing ETag");
|
|
826585
|
-
currentETag = (await (0,
|
|
826567
|
+
currentETag = (await (0, import_promises77.readFile)(eTagFilepath)).toString();
|
|
826586
826568
|
}
|
|
826587
826569
|
if (currentETag != null && currentETag === eTag) {
|
|
826588
826570
|
logger4.debug("ETag matches. Using already downloaded bundle");
|
|
@@ -826646,16 +826628,16 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
826646
826628
|
}
|
|
826647
826629
|
}
|
|
826648
826630
|
const nodeBuffer = Buffer.concat(chunks);
|
|
826649
|
-
await (0,
|
|
826631
|
+
await (0, import_promises77.writeFile)(outputZipPath, new Uint8Array(nodeBuffer));
|
|
826650
826632
|
logger4.debug(`Wrote ${tryTar ? "output.tar.gz" : "output.zip"} to ${outputZipPath}`);
|
|
826651
826633
|
const absolutePathToPreviewFolder = getPathToPreviewFolder({ app });
|
|
826652
826634
|
if (await doesPathExist(absolutePathToPreviewFolder)) {
|
|
826653
826635
|
logger4.debug(`Removing previously cached bundle at: ${absolutePathToPreviewFolder}`);
|
|
826654
|
-
await (0,
|
|
826636
|
+
await (0, import_promises77.rm)(absolutePathToPreviewFolder, { recursive: true });
|
|
826655
826637
|
}
|
|
826656
|
-
await (0,
|
|
826638
|
+
await (0, import_promises77.mkdir)(absolutePathToPreviewFolder, { recursive: true });
|
|
826657
826639
|
const absolutePathToBundleFolder = getPathToBundleFolder({ app });
|
|
826658
|
-
await (0,
|
|
826640
|
+
await (0, import_promises77.mkdir)(absolutePathToBundleFolder, { recursive: true });
|
|
826659
826641
|
logger4.debug(`Decompressing bundle from ${outputZipPath} to ${absolutePathToBundleFolder}`);
|
|
826660
826642
|
let unzipProgressBar;
|
|
826661
826643
|
let unzipInterval;
|
|
@@ -826690,7 +826672,7 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
826690
826672
|
unzipProgressBar.stop();
|
|
826691
826673
|
}
|
|
826692
826674
|
}
|
|
826693
|
-
await (0,
|
|
826675
|
+
await (0, import_promises77.writeFile)(eTagFilepath, eTag);
|
|
826694
826676
|
logger4.debug(`Downloaded bundle to ${absolutePathToBundleFolder}`);
|
|
826695
826677
|
if (app) {
|
|
826696
826678
|
logger4.debug("Checking if pnpm is installed");
|
|
@@ -826772,15 +826754,15 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
826772
826754
|
}
|
|
826773
826755
|
if (!pnpmfileExists) {
|
|
826774
826756
|
logger4.debug(`Writing pnpmfile.cjs at ${pnpmfilePath}`);
|
|
826775
|
-
await (0,
|
|
826757
|
+
await (0, import_promises77.writeFile)(pnpmfilePath, PNPMFILE_CJS_CONTENTS);
|
|
826776
826758
|
}
|
|
826777
826759
|
if (!npmrcExists) {
|
|
826778
826760
|
logger4.debug(`Writing .npmrc at ${npmrcPath}`);
|
|
826779
|
-
await (0,
|
|
826761
|
+
await (0, import_promises77.writeFile)(npmrcPath, NPMRC_CONTENTS);
|
|
826780
826762
|
}
|
|
826781
826763
|
if (instrumentationJsExists) {
|
|
826782
826764
|
logger4.debug(`Removing instrumentation.js at ${absPathToInstrumentationJs}`);
|
|
826783
|
-
await (0,
|
|
826765
|
+
await (0, import_promises77.rm)(absPathToInstrumentationJs);
|
|
826784
826766
|
}
|
|
826785
826767
|
try {
|
|
826786
826768
|
logger4.debug("Running pnpm install within standalone");
|
|
@@ -826800,7 +826782,7 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
826800
826782
|
logger4.error(`Error: ${error50}`);
|
|
826801
826783
|
const absolutePathToPreviewFolder = getPathToPreviewFolder({ app });
|
|
826802
826784
|
if (await doesPathExist(absolutePathToPreviewFolder)) {
|
|
826803
|
-
await (0,
|
|
826785
|
+
await (0, import_promises77.rm)(absolutePathToPreviewFolder, { recursive: true });
|
|
826804
826786
|
}
|
|
826805
826787
|
logger4.debug(`Removing incomplete bundle: rm -rf ${absolutePathToPreviewFolder}`);
|
|
826806
826788
|
return {
|
|
@@ -826813,7 +826795,7 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
826813
826795
|
init_lib4();
|
|
826814
826796
|
init_js();
|
|
826815
826797
|
init_lib6();
|
|
826816
|
-
var
|
|
826798
|
+
var import_promises78 = require("fs/promises");
|
|
826817
826799
|
var import_gray_matter8 = __toESM(require_gray_matter(), 1);
|
|
826818
826800
|
var frontmatterPositionCache = /* @__PURE__ */ new Map();
|
|
826819
826801
|
var frontmatterSidebarTitleCache = /* @__PURE__ */ new Map();
|
|
@@ -826883,7 +826865,7 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
|
|
|
826883
826865
|
navAffectingChange = true;
|
|
826884
826866
|
continue;
|
|
826885
826867
|
}
|
|
826886
|
-
const markdown = (await (0,
|
|
826868
|
+
const markdown = (await (0, import_promises78.readFile)(absoluteFilePath)).toString();
|
|
826887
826869
|
const isNewFile = previousValue == null;
|
|
826888
826870
|
if (isNewFile) {
|
|
826889
826871
|
navAffectingChange = true;
|
|
@@ -827287,7 +827269,7 @@ var SnippetDependencyTracker = class {
|
|
|
827287
827269
|
const markdownFiles = await this.findMarkdownFiles(docsWorkspace.absoluteFilePath);
|
|
827288
827270
|
for (const markdownFile of markdownFiles) {
|
|
827289
827271
|
try {
|
|
827290
|
-
const content5 = await (0,
|
|
827272
|
+
const content5 = await (0, import_promises79.readFile)(markdownFile, "utf-8");
|
|
827291
827273
|
const referencedFiles = this.extractReferences(content5, markdownFile, docsWorkspace.absoluteFilePath);
|
|
827292
827274
|
this.pageToSnippets.set(markdownFile, referencedFiles);
|
|
827293
827275
|
for (const referencedFile of referencedFiles) {
|
|
@@ -827369,7 +827351,7 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
|
|
|
827369
827351
|
const appPreviewFolder = getPathToPreviewFolder({ app: true });
|
|
827370
827352
|
if (await doesPathExist(appPreviewFolder)) {
|
|
827371
827353
|
context3.logger.info("Force download requested. Deleting cached bundle...");
|
|
827372
|
-
await (0,
|
|
827354
|
+
await (0, import_promises79.rm)(appPreviewFolder, { recursive: true });
|
|
827373
827355
|
}
|
|
827374
827356
|
}
|
|
827375
827357
|
if (bundlePath != null) {
|
|
@@ -828864,7 +828846,7 @@ init_lib6();
|
|
|
828864
828846
|
|
|
828865
828847
|
// ../workspace/loader/lib/listFernFiles.js
|
|
828866
828848
|
init_lib6();
|
|
828867
|
-
var
|
|
828849
|
+
var import_promises80 = require("fs/promises");
|
|
828868
828850
|
async function listFernFiles2(root6, extensionGlob) {
|
|
828869
828851
|
const files = [];
|
|
828870
828852
|
for (const absoluteFilepath of await listFiles(root6, extensionGlob)) {
|
|
@@ -828879,7 +828861,7 @@ async function createFernFile2({ relativeFilepath, absoluteFilepath }) {
|
|
|
828879
828861
|
return {
|
|
828880
828862
|
relativeFilepath,
|
|
828881
828863
|
absoluteFilepath,
|
|
828882
|
-
fileContents: (await (0,
|
|
828864
|
+
fileContents: (await (0, import_promises80.readFile)(absoluteFilepath)).toString()
|
|
828883
828865
|
};
|
|
828884
828866
|
}
|
|
828885
828867
|
|
|
@@ -829186,7 +829168,7 @@ async function loadAPIWorkspace({ absolutePathToWorkspace, context: context3, cl
|
|
|
829186
829168
|
// ../workspace/loader/lib/loadDocsWorkspace.js
|
|
829187
829169
|
init_lib4();
|
|
829188
829170
|
init_lib6();
|
|
829189
|
-
var
|
|
829171
|
+
var import_promises81 = require("fs/promises");
|
|
829190
829172
|
|
|
829191
829173
|
// ../workspace/loader/lib/docs-yml.schema.json
|
|
829192
829174
|
var docs_yml_schema_exports = {};
|
|
@@ -835056,7 +835038,7 @@ async function loadDocsConfiguration({ absolutePathToDocsDefinition, context: co
|
|
|
835056
835038
|
});
|
|
835057
835039
|
}
|
|
835058
835040
|
async function loadRawDocsConfiguration({ absolutePathOfConfiguration, context: context3 }) {
|
|
835059
|
-
const contentsStr = await (0,
|
|
835041
|
+
const contentsStr = await (0, import_promises81.readFile)(absolutePathOfConfiguration);
|
|
835060
835042
|
const contentsJson = jsYaml.load(contentsStr.toString());
|
|
835061
835043
|
const result = validateAgainstJsonSchema(contentsJson, docs_yml_schema_exports, {
|
|
835062
835044
|
filePath: absolutePathOfConfiguration
|
|
@@ -835090,8 +835072,8 @@ var import_fiddle_sdk5 = __toESM(require_fiddle_sdk(), 1);
|
|
|
835090
835072
|
// ../generation/remote-generation/remote-workspace-runner/lib/downloadSnippetsForTask.js
|
|
835091
835073
|
init_lib6();
|
|
835092
835074
|
var import_fs25 = require("fs");
|
|
835093
|
-
var
|
|
835094
|
-
var
|
|
835075
|
+
var import_promises82 = require("fs/promises");
|
|
835076
|
+
var import_promises83 = require("stream/promises");
|
|
835095
835077
|
async function downloadSnippetsForTask({ snippetsS3PreSignedReadUrl, absolutePathToLocalSnippetJSON, context: context3 }) {
|
|
835096
835078
|
try {
|
|
835097
835079
|
await downloadFileForTask({
|
|
@@ -835108,10 +835090,10 @@ async function downloadFileForTask({ s3PreSignedReadUrl, absolutePathToLocalOutp
|
|
|
835108
835090
|
responseType: "stream"
|
|
835109
835091
|
});
|
|
835110
835092
|
if (await doesPathExist(absolutePathToLocalOutput)) {
|
|
835111
|
-
await (0,
|
|
835093
|
+
await (0, import_promises82.rm)(absolutePathToLocalOutput, { recursive: true });
|
|
835112
835094
|
}
|
|
835113
|
-
await (0,
|
|
835114
|
-
await (0,
|
|
835095
|
+
await (0, import_promises82.mkdir)(dirname4(absolutePathToLocalOutput), { recursive: true });
|
|
835096
|
+
await (0, import_promises83.pipeline)(request7.data, (0, import_fs25.createWriteStream)(absolutePathToLocalOutput));
|
|
835115
835097
|
}
|
|
835116
835098
|
|
|
835117
835099
|
// ../generation/remote-generation/remote-workspace-runner/lib/resolveAutoDiscoveredFernignorePath.js
|
|
@@ -835136,7 +835118,7 @@ init_js();
|
|
|
835136
835118
|
init_lib6();
|
|
835137
835119
|
var import_fiddle_sdk4 = __toESM(require_fiddle_sdk(), 1);
|
|
835138
835120
|
var import_form_data4 = __toESM(require_form_data(), 1);
|
|
835139
|
-
var
|
|
835121
|
+
var import_promises84 = require("fs/promises");
|
|
835140
835122
|
var import_url_join23 = __toESM(require_url_join(), 1);
|
|
835141
835123
|
var import_util19 = require("util");
|
|
835142
835124
|
var import_zlib5 = require("zlib");
|
|
@@ -835189,7 +835171,7 @@ async function createAndStartJob({ projectConfig, workspace, organization, inter
|
|
|
835189
835171
|
fernignoreContents = "";
|
|
835190
835172
|
} else if (fernignorePath != null) {
|
|
835191
835173
|
try {
|
|
835192
|
-
fernignoreContents = await (0,
|
|
835174
|
+
fernignoreContents = await (0, import_promises84.readFile)(fernignorePath, "utf-8");
|
|
835193
835175
|
} catch (error50) {
|
|
835194
835176
|
context3.failAndThrow(`Failed to read fernignore file at ${fernignorePath}: ${error50}`);
|
|
835195
835177
|
}
|
|
@@ -835415,9 +835397,9 @@ function pollJobAndReportStatus({ job, taskId, taskHandler, context: context3 })
|
|
|
835415
835397
|
init_lib4();
|
|
835416
835398
|
init_lib6();
|
|
835417
835399
|
var import_fs26 = require("fs");
|
|
835418
|
-
var
|
|
835400
|
+
var import_promises85 = require("fs/promises");
|
|
835419
835401
|
var import_path57 = __toESM(require("path"), 1);
|
|
835420
|
-
var
|
|
835402
|
+
var import_promises86 = require("stream/promises");
|
|
835421
835403
|
|
|
835422
835404
|
// ../../../node_modules/.pnpm/terminal-link@3.0.0/node_modules/terminal-link/index.js
|
|
835423
835405
|
var import_supports_hyperlinks = __toESM(require_supports_hyperlinks(), 1);
|
|
@@ -835586,9 +835568,9 @@ async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutpu
|
|
|
835586
835568
|
});
|
|
835587
835569
|
const tmpDir = await import_tmp_promise9.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
835588
835570
|
const outputZipPath = import_path57.default.join(tmpDir.path, "output.zip");
|
|
835589
|
-
await (0,
|
|
835571
|
+
await (0, import_promises86.pipeline)(request7.data, (0, import_fs26.createWriteStream)(outputZipPath));
|
|
835590
835572
|
await forceRemoveDirectory(absolutePathToLocalOutput);
|
|
835591
|
-
await (0,
|
|
835573
|
+
await (0, import_promises85.mkdir)(absolutePathToLocalOutput, { recursive: true });
|
|
835592
835574
|
await extractZipToDirectory(outputZipPath, absolutePathToLocalOutput);
|
|
835593
835575
|
}
|
|
835594
835576
|
async function forceRemoveDirectory(dirPath) {
|
|
@@ -835596,22 +835578,22 @@ async function forceRemoveDirectory(dirPath) {
|
|
|
835596
835578
|
return;
|
|
835597
835579
|
}
|
|
835598
835580
|
await makeWritableRecursive(dirPath);
|
|
835599
|
-
await (0,
|
|
835581
|
+
await (0, import_promises85.rm)(dirPath, { recursive: true, force: true });
|
|
835600
835582
|
}
|
|
835601
835583
|
async function makeWritableRecursive(dirPath) {
|
|
835602
835584
|
try {
|
|
835603
|
-
const entries21 = await (0,
|
|
835585
|
+
const entries21 = await (0, import_promises85.readdir)(dirPath, { withFileTypes: true });
|
|
835604
835586
|
for (const entry of entries21) {
|
|
835605
835587
|
const fullPath = AbsoluteFilePath2.of(import_path57.default.join(dirPath, entry.name));
|
|
835606
835588
|
if (entry.isDirectory()) {
|
|
835607
835589
|
await makeWritableRecursive(fullPath);
|
|
835608
835590
|
}
|
|
835609
835591
|
try {
|
|
835610
|
-
await (0,
|
|
835592
|
+
await (0, import_promises85.chmod)(fullPath, 493);
|
|
835611
835593
|
} catch {
|
|
835612
835594
|
}
|
|
835613
835595
|
}
|
|
835614
|
-
await (0,
|
|
835596
|
+
await (0, import_promises85.chmod)(dirPath, 493);
|
|
835615
835597
|
} catch {
|
|
835616
835598
|
}
|
|
835617
835599
|
}
|
|
@@ -835657,7 +835639,7 @@ async function downloadFilesWithFernIgnoreInTempRepo({ s3PreSignedReadUrl, absol
|
|
|
835657
835639
|
const tmpOutputResolutionDir = AbsoluteFilePath2.of((await import_tmp_promise9.default.dir({})).path);
|
|
835658
835640
|
const absolutePathToFernignore = join2(absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME));
|
|
835659
835641
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
835660
|
-
await (0,
|
|
835642
|
+
await (0, import_promises85.cp)(absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
835661
835643
|
await runGitCommand(["init"], tmpOutputResolutionDir, context3);
|
|
835662
835644
|
await runGitCommand(["add", "."], tmpOutputResolutionDir, context3);
|
|
835663
835645
|
await runGitCommand([
|
|
@@ -835680,7 +835662,7 @@ async function downloadFilesWithFernIgnoreInTempRepo({ s3PreSignedReadUrl, absol
|
|
|
835680
835662
|
await runGitCommand(["restore", "."], tmpOutputResolutionDir, context3);
|
|
835681
835663
|
await forceRemoveDirectory(join2(tmpOutputResolutionDir, RelativeFilePath2.of(".git")));
|
|
835682
835664
|
await forceRemoveDirectory(absolutePathToLocalOutput);
|
|
835683
|
-
await (0,
|
|
835665
|
+
await (0, import_promises85.cp)(tmpOutputResolutionDir, absolutePathToLocalOutput, { recursive: true });
|
|
835684
835666
|
}
|
|
835685
835667
|
async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath }) {
|
|
835686
835668
|
const request7 = await axios_default.get(s3PreSignedReadUrl, {
|
|
@@ -835688,7 +835670,7 @@ async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath
|
|
|
835688
835670
|
});
|
|
835689
835671
|
const tmpDir = await import_tmp_promise9.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
835690
835672
|
const outputZipPath = import_path57.default.join(tmpDir.path, "output.zip");
|
|
835691
|
-
await (0,
|
|
835673
|
+
await (0, import_promises86.pipeline)(request7.data, (0, import_fs26.createWriteStream)(outputZipPath));
|
|
835692
835674
|
await extractZipToDirectory(outputZipPath, outputPath);
|
|
835693
835675
|
}
|
|
835694
835676
|
async function extractZipToDirectory(zipPath, outputDir) {
|
|
@@ -835703,10 +835685,10 @@ async function extractZipToDirectory(zipPath, outputDir) {
|
|
|
835703
835685
|
zipFile.on("entry", (entry) => {
|
|
835704
835686
|
const outputPath = import_path57.default.join(outputDir, entry.fileName);
|
|
835705
835687
|
if (entry.fileName.endsWith("/")) {
|
|
835706
|
-
(0,
|
|
835688
|
+
(0, import_promises85.mkdir)(outputPath, { recursive: true }).then(() => zipFile.readEntry()).catch(reject);
|
|
835707
835689
|
return;
|
|
835708
835690
|
}
|
|
835709
|
-
(0,
|
|
835691
|
+
(0, import_promises85.mkdir)(import_path57.default.dirname(outputPath), { recursive: true }).then(() => {
|
|
835710
835692
|
zipFile.openReadStream(entry, (streamErr, readStream2) => {
|
|
835711
835693
|
if (streamErr || !readStream2) {
|
|
835712
835694
|
reject(streamErr ?? new Error("Failed to open read stream"));
|
|
@@ -835723,7 +835705,7 @@ async function extractZipToDirectory(zipPath, outputDir) {
|
|
|
835723
835705
|
|
|
835724
835706
|
// ../generation/remote-generation/remote-workspace-runner/lib/SourceUploader.js
|
|
835725
835707
|
init_lib6();
|
|
835726
|
-
var
|
|
835708
|
+
var import_promises87 = require("fs/promises");
|
|
835727
835709
|
var import_tmp_promise10 = __toESM(require_tmp_promise(), 1);
|
|
835728
835710
|
var PROTOBUF_ZIP_FILENAME = "proto.zip";
|
|
835729
835711
|
var SourceUploader = class {
|
|
@@ -835744,7 +835726,7 @@ var SourceUploader = class {
|
|
|
835744
835726
|
}
|
|
835745
835727
|
async uploadSource(source2, uploadURL) {
|
|
835746
835728
|
const uploadCommand = await this.getUploadCommand(source2);
|
|
835747
|
-
const fileData = await (0,
|
|
835729
|
+
const fileData = await (0, import_promises87.readFile)(uploadCommand.absoluteFilePath);
|
|
835748
835730
|
const response = await fetch(uploadURL, {
|
|
835749
835731
|
method: "PUT",
|
|
835750
835732
|
body: fileData,
|
|
@@ -835764,7 +835746,7 @@ var SourceUploader = class {
|
|
|
835764
835746
|
absoluteFilePath,
|
|
835765
835747
|
cleanup: async () => {
|
|
835766
835748
|
this.context.logger.debug(`Removing ${absoluteFilePath}`);
|
|
835767
|
-
await (0,
|
|
835749
|
+
await (0, import_promises87.unlink)(absoluteFilePath);
|
|
835768
835750
|
}
|
|
835769
835751
|
};
|
|
835770
835752
|
}
|
|
@@ -836206,7 +836188,7 @@ init_lib4();
|
|
|
836206
836188
|
init_js();
|
|
836207
836189
|
init_lib6();
|
|
836208
836190
|
var import_crypto10 = require("crypto");
|
|
836209
|
-
var
|
|
836191
|
+
var import_promises88 = require("fs/promises");
|
|
836210
836192
|
init_lodash();
|
|
836211
836193
|
var mime = __toESM(require_mime_types(), 1);
|
|
836212
836194
|
|
|
@@ -836285,7 +836267,7 @@ async function unlockDeploy({ fdrOrigin, token, domain: domain3, basepath }) {
|
|
|
836285
836267
|
}
|
|
836286
836268
|
}
|
|
836287
836269
|
async function calculateFileHash(absoluteFilePath) {
|
|
836288
|
-
const fileBuffer = await (0,
|
|
836270
|
+
const fileBuffer = await (0, import_promises88.readFile)(absoluteFilePath);
|
|
836289
836271
|
return (0, import_crypto10.createHash)("sha256").update(new Uint8Array(fileBuffer)).digest("hex");
|
|
836290
836272
|
}
|
|
836291
836273
|
function sanitizeRelativePathForS3(relativeFilePath) {
|
|
@@ -836631,7 +836613,7 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context3, batchSize
|
|
|
836631
836613
|
const absoluteFilePath = sanitizedToAbsoluteMap.get(key2) || resolve5(docsWorkspacePath, RelativeFilePath2.of(key2));
|
|
836632
836614
|
try {
|
|
836633
836615
|
const mimeType = mime.lookup(absoluteFilePath);
|
|
836634
|
-
await axios_default.put(uploadUrl, await (0,
|
|
836616
|
+
await axios_default.put(uploadUrl, await (0, import_promises88.readFile)(absoluteFilePath), {
|
|
836635
836617
|
headers: {
|
|
836636
836618
|
"Content-Type": mimeType === false ? "application/octet-stream" : mimeType,
|
|
836637
836619
|
// Set max cache control for S3 uploads
|
|
@@ -837210,7 +837192,7 @@ var LegacyDocsPublisher = class {
|
|
|
837210
837192
|
previewId: void 0,
|
|
837211
837193
|
disableTemplates: void 0,
|
|
837212
837194
|
skipUpload,
|
|
837213
|
-
cliVersion: "4.50.
|
|
837195
|
+
cliVersion: "4.50.4-1-g8a6fed15293"
|
|
837214
837196
|
});
|
|
837215
837197
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
837216
837198
|
return { success: false };
|
|
@@ -838086,7 +838068,7 @@ function addDocsCommand(cli) {
|
|
|
838086
838068
|
// ../cli-v2/lib/commands/init/command.js
|
|
838087
838069
|
init_lib4();
|
|
838088
838070
|
init_lib6();
|
|
838089
|
-
var
|
|
838071
|
+
var import_promises89 = require("fs/promises");
|
|
838090
838072
|
var import_path59 = __toESM(require("path"), 1);
|
|
838091
838073
|
|
|
838092
838074
|
// ../cli-v2/lib/config/fern-yml/FernYmlBuilder.js
|
|
@@ -838961,7 +838943,7 @@ var InitCommand = class {
|
|
|
838961
838943
|
apiPath,
|
|
838962
838944
|
defaultGroup: result.defaultGroup
|
|
838963
838945
|
});
|
|
838964
|
-
await (0,
|
|
838946
|
+
await (0, import_promises89.writeFile)(fernYmlPath, fernYmlContent, "utf-8");
|
|
838965
838947
|
context3.stderr.info(`
|
|
838966
838948
|
${Icons.success} Created ${FERN_YML_FILENAME}`);
|
|
838967
838949
|
}
|
|
@@ -838983,9 +838965,9 @@ var InitCommand = class {
|
|
|
838983
838965
|
}
|
|
838984
838966
|
async writeSpecFile(cwd2, filename, content5) {
|
|
838985
838967
|
const specsDir = join2(cwd2, RelativeFilePath2.of(SPECS_DIR));
|
|
838986
|
-
await (0,
|
|
838968
|
+
await (0, import_promises89.mkdir)(specsDir, { recursive: true });
|
|
838987
838969
|
const filePath = join2(specsDir, RelativeFilePath2.of(filename));
|
|
838988
|
-
await (0,
|
|
838970
|
+
await (0, import_promises89.writeFile)(filePath, content5, "utf-8");
|
|
838989
838971
|
}
|
|
838990
838972
|
resolveApiPath(apiSource) {
|
|
838991
838973
|
switch (apiSource.type) {
|
|
@@ -839465,11 +839447,11 @@ function addCheckCommand4(cli) {
|
|
|
839465
839447
|
// ../cli-v2/lib/commands/sdk/generate/command.js
|
|
839466
839448
|
init_lib4();
|
|
839467
839449
|
init_lib6();
|
|
839468
|
-
var
|
|
839450
|
+
var import_promises107 = require("fs/promises");
|
|
839469
839451
|
|
|
839470
839452
|
// ../cli-v2/lib/api/resolver/ApiSpecResolver.js
|
|
839471
839453
|
init_lib6();
|
|
839472
|
-
var
|
|
839454
|
+
var import_promises90 = require("fs/promises");
|
|
839473
839455
|
var import_os11 = require("os");
|
|
839474
839456
|
var import_path60 = __toESM(require("path"), 1);
|
|
839475
839457
|
|
|
@@ -839517,9 +839499,9 @@ var ApiSpecResolver = class {
|
|
|
839517
839499
|
async resolveUrl({ reference: reference4 }) {
|
|
839518
839500
|
const { content: content5, contentType } = await this.fetchContent({ url: reference4 });
|
|
839519
839501
|
const extension5 = this.inferExtension({ url: reference4, contentType });
|
|
839520
|
-
const tempDir2 = await (0,
|
|
839502
|
+
const tempDir2 = await (0, import_promises90.mkdtemp)(import_path60.default.join((0, import_os11.tmpdir)(), "fern-"));
|
|
839521
839503
|
const absoluteFilePath = AbsoluteFilePath2.of(import_path60.default.join(tempDir2, `spec${extension5}`));
|
|
839522
|
-
await (0,
|
|
839504
|
+
await (0, import_promises90.writeFile)(absoluteFilePath, content5, "utf-8");
|
|
839523
839505
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
839524
839506
|
return {
|
|
839525
839507
|
absoluteFilePath,
|
|
@@ -839532,7 +839514,7 @@ var ApiSpecResolver = class {
|
|
|
839532
839514
|
if (!await doesPathExist(absoluteFilePath)) {
|
|
839533
839515
|
throw new Error(`API spec file does not exist: ${reference4}`);
|
|
839534
839516
|
}
|
|
839535
|
-
const content5 = await (0,
|
|
839517
|
+
const content5 = await (0, import_promises90.readFile)(absoluteFilePath, "utf-8");
|
|
839536
839518
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
839537
839519
|
return {
|
|
839538
839520
|
absoluteFilePath,
|
|
@@ -839619,7 +839601,7 @@ var AutoVersioningCache = class {
|
|
|
839619
839601
|
|
|
839620
839602
|
// ../generation/local-generation/local-workspace-runner/lib/AutoVersioningService.js
|
|
839621
839603
|
var import_fs27 = require("fs");
|
|
839622
|
-
var
|
|
839604
|
+
var import_promises91 = require("fs/promises");
|
|
839623
839605
|
var import_path61 = require("path");
|
|
839624
839606
|
var AutoVersioningException = class extends Error {
|
|
839625
839607
|
constructor(message, cause) {
|
|
@@ -840274,7 +840256,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
840274
840256
|
* Reads the module path from a go.mod file.
|
|
840275
840257
|
*/
|
|
840276
840258
|
async readGoModulePath(goModPath) {
|
|
840277
|
-
const content5 = await (0,
|
|
840259
|
+
const content5 = await (0, import_promises91.readFile)(goModPath, "utf-8");
|
|
840278
840260
|
for (const line of content5.split("\n")) {
|
|
840279
840261
|
const trimmed2 = line.trim();
|
|
840280
840262
|
if (trimmed2.startsWith("module ")) {
|
|
@@ -840287,7 +840269,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
840287
840269
|
* Adds a version suffix to the module line in go.mod.
|
|
840288
840270
|
*/
|
|
840289
840271
|
async addSuffixToGoMod(goModPath, modulePath, suffix) {
|
|
840290
|
-
const content5 = await (0,
|
|
840272
|
+
const content5 = await (0, import_promises91.readFile)(goModPath, "utf-8");
|
|
840291
840273
|
const lines = content5.split("\n");
|
|
840292
840274
|
let changed = false;
|
|
840293
840275
|
for (let i11 = 0; i11 < lines.length; i11++) {
|
|
@@ -840299,7 +840281,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
840299
840281
|
}
|
|
840300
840282
|
}
|
|
840301
840283
|
if (changed) {
|
|
840302
|
-
await (0,
|
|
840284
|
+
await (0, import_promises91.writeFile)(goModPath, lines.join("\n"), "utf-8");
|
|
840303
840285
|
this.logger.debug(`Updated go.mod: added ${suffix} to module path`);
|
|
840304
840286
|
}
|
|
840305
840287
|
}
|
|
@@ -840308,10 +840290,10 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
840308
840290
|
*/
|
|
840309
840291
|
async walkDirectory(dir, filter8) {
|
|
840310
840292
|
const results = [];
|
|
840311
|
-
const entries21 = await (0,
|
|
840293
|
+
const entries21 = await (0, import_promises91.readdir)(dir);
|
|
840312
840294
|
for (const entry of entries21) {
|
|
840313
840295
|
const fullPath = (0, import_path61.join)(dir, entry);
|
|
840314
|
-
const entryStat = await (0,
|
|
840296
|
+
const entryStat = await (0, import_promises91.stat)(fullPath);
|
|
840315
840297
|
if (entryStat.isDirectory()) {
|
|
840316
840298
|
if (entry === ".git" || entry === "vendor") {
|
|
840317
840299
|
continue;
|
|
@@ -840338,7 +840320,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
840338
840320
|
* Replaces occurrences of the module path with modulePath + suffix in import statements.
|
|
840339
840321
|
*/
|
|
840340
840322
|
async addSuffixToGoFile(filePath, modulePath, suffix) {
|
|
840341
|
-
const content5 = await (0,
|
|
840323
|
+
const content5 = await (0, import_promises91.readFile)(filePath, "utf-8");
|
|
840342
840324
|
const lines = content5.split("\n");
|
|
840343
840325
|
let changed = false;
|
|
840344
840326
|
let inImportBlock = false;
|
|
@@ -840367,7 +840349,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
840367
840349
|
}
|
|
840368
840350
|
}
|
|
840369
840351
|
if (changed) {
|
|
840370
|
-
await (0,
|
|
840352
|
+
await (0, import_promises91.writeFile)(filePath, lines.join("\n"), "utf-8");
|
|
840371
840353
|
this.logger.debug(`Updated Go imports in ${filePath}`);
|
|
840372
840354
|
}
|
|
840373
840355
|
}
|
|
@@ -840420,7 +840402,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
840420
840402
|
};
|
|
840421
840403
|
|
|
840422
840404
|
// ../generation/local-generation/docker-utils/lib/runDocker.js
|
|
840423
|
-
var
|
|
840405
|
+
var import_promises92 = require("fs/promises");
|
|
840424
840406
|
var import_tmp_promise11 = __toESM(require_tmp_promise(), 1);
|
|
840425
840407
|
async function runContainer({ logger: logger4, imageName, args = [], binds = [], envVars = {}, ports = {}, writeLogsToFile = true, removeAfterCompletion = false, runner, signal }) {
|
|
840426
840408
|
const tryRun = () => tryRunContainer({
|
|
@@ -840471,7 +840453,7 @@ async function tryRunContainer({ logger: logger4, imageName, args, binds, envVar
|
|
|
840471
840453
|
const logs4 = stdout + stderr;
|
|
840472
840454
|
if (writeLogsToFile) {
|
|
840473
840455
|
const tmpFile = await import_tmp_promise11.default.file();
|
|
840474
|
-
await (0,
|
|
840456
|
+
await (0, import_promises92.writeFile)(tmpFile.path, logs4);
|
|
840475
840457
|
logger4.info(`Generator logs here: ${tmpFile.path}`);
|
|
840476
840458
|
}
|
|
840477
840459
|
if (exitCode == null) {
|
|
@@ -858696,7 +858678,7 @@ var DynamicSnippetsGenerator = class extends AbstractDynamicSnippetsGenerator {
|
|
|
858696
858678
|
|
|
858697
858679
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/csharp/DynamicSnippetsCsharpTestGenerator.js
|
|
858698
858680
|
init_lib6();
|
|
858699
|
-
var
|
|
858681
|
+
var import_promises93 = require("fs/promises");
|
|
858700
858682
|
var import_path63 = __toESM(require("path"), 1);
|
|
858701
858683
|
|
|
858702
858684
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/utils/convertEndpointSnippetRequest.js
|
|
@@ -858830,8 +858812,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
858830
858812
|
endpointId
|
|
858831
858813
|
});
|
|
858832
858814
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
858833
|
-
await (0,
|
|
858834
|
-
await (0,
|
|
858815
|
+
await (0, import_promises93.mkdir)(import_path63.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
858816
|
+
await (0, import_promises93.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
858835
858817
|
} catch (error50) {
|
|
858836
858818
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
858837
858819
|
}
|
|
@@ -858840,8 +858822,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
858840
858822
|
}
|
|
858841
858823
|
async initializeProject(outputDir) {
|
|
858842
858824
|
const absolutePathToOutputDir = join2(outputDir, RelativeFilePath2.of("src/SeedApi.DynamicSnippets"));
|
|
858843
|
-
await (0,
|
|
858844
|
-
await (0,
|
|
858825
|
+
await (0, import_promises93.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
858826
|
+
await (0, import_promises93.writeFile)(join2(absolutePathToOutputDir, RelativeFilePath2.of("SeedApi.DynamicSnippets.csproj")), PROJECT_FILE_CONTENT);
|
|
858845
858827
|
return absolutePathToOutputDir;
|
|
858846
858828
|
}
|
|
858847
858829
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -862237,7 +862219,7 @@ var DynamicSnippetsGenerator2 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
862237
862219
|
};
|
|
862238
862220
|
|
|
862239
862221
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/go/DynamicSnippetsGoTestGenerator.js
|
|
862240
|
-
var
|
|
862222
|
+
var import_promises94 = require("fs/promises");
|
|
862241
862223
|
var import_path65 = __toESM(require("path"), 1);
|
|
862242
862224
|
var DynamicSnippetsGoTestGenerator = class {
|
|
862243
862225
|
context;
|
|
@@ -862266,8 +862248,8 @@ var DynamicSnippetsGoTestGenerator = class {
|
|
|
862266
862248
|
endpointId
|
|
862267
862249
|
});
|
|
862268
862250
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
862269
|
-
await (0,
|
|
862270
|
-
await (0,
|
|
862251
|
+
await (0, import_promises94.mkdir)(import_path65.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
862252
|
+
await (0, import_promises94.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
862271
862253
|
} catch (error50) {
|
|
862272
862254
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
862273
862255
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -865635,7 +865617,7 @@ var DynamicSnippetsGenerator3 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
865635
865617
|
};
|
|
865636
865618
|
|
|
865637
865619
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/java/DynamicSnippetsJavaTestGenerator.js
|
|
865638
|
-
var
|
|
865620
|
+
var import_promises95 = require("fs/promises");
|
|
865639
865621
|
var import_path66 = __toESM(require("path"), 1);
|
|
865640
865622
|
var DynamicSnippetsJavaTestGenerator = class {
|
|
865641
865623
|
context;
|
|
@@ -865670,8 +865652,8 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
865670
865652
|
endpointId
|
|
865671
865653
|
});
|
|
865672
865654
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
865673
|
-
await (0,
|
|
865674
|
-
await (0,
|
|
865655
|
+
await (0, import_promises95.mkdir)(import_path66.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
865656
|
+
await (0, import_promises95.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
865675
865657
|
} catch (error50) {
|
|
865676
865658
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
865677
865659
|
}
|
|
@@ -865698,7 +865680,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
865698
865680
|
const reportsPath = join2(outputDir, RelativeFilePath2.of("reports"));
|
|
865699
865681
|
const buildReportsExists = await doesPathExist(buildReportsPath, "directory");
|
|
865700
865682
|
if (buildReportsExists) {
|
|
865701
|
-
await (0,
|
|
865683
|
+
await (0, import_promises95.cp)(buildReportsPath, reportsPath, { recursive: true });
|
|
865702
865684
|
this.context.logger.info("Gradle profiling report copied to reports/");
|
|
865703
865685
|
} else {
|
|
865704
865686
|
this.context.logger.info("No profiling report found in build/reports/");
|
|
@@ -865712,7 +865694,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
865712
865694
|
}
|
|
865713
865695
|
async initializeProject(outputDir) {
|
|
865714
865696
|
const absolutePathToOutputDir = join2(outputDir, RelativeFilePath2.of("src/main/java/com/snippets"));
|
|
865715
|
-
await (0,
|
|
865697
|
+
await (0, import_promises95.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
865716
865698
|
return absolutePathToOutputDir;
|
|
865717
865699
|
}
|
|
865718
865700
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -869091,7 +869073,7 @@ var DynamicSnippetsGenerator4 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
869091
869073
|
};
|
|
869092
869074
|
|
|
869093
869075
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/php/DynamicSnippetsPhpTestGenerator.js
|
|
869094
|
-
var
|
|
869076
|
+
var import_promises96 = require("fs/promises");
|
|
869095
869077
|
var import_path67 = __toESM(require("path"), 1);
|
|
869096
869078
|
var DynamicSnippetsPhpTestGenerator = class {
|
|
869097
869079
|
context;
|
|
@@ -869120,8 +869102,8 @@ var DynamicSnippetsPhpTestGenerator = class {
|
|
|
869120
869102
|
endpointId
|
|
869121
869103
|
});
|
|
869122
869104
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
869123
|
-
await (0,
|
|
869124
|
-
await (0,
|
|
869105
|
+
await (0, import_promises96.mkdir)(import_path67.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
869106
|
+
await (0, import_promises96.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
869125
869107
|
} catch (error50) {
|
|
869126
869108
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
869127
869109
|
}
|
|
@@ -872289,7 +872271,7 @@ var DynamicSnippetsGenerator5 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
872289
872271
|
};
|
|
872290
872272
|
|
|
872291
872273
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/python/DynamicSnippetsPythonTestGenerator.js
|
|
872292
|
-
var
|
|
872274
|
+
var import_promises97 = require("fs/promises");
|
|
872293
872275
|
var import_path68 = __toESM(require("path"), 1);
|
|
872294
872276
|
var DynamicSnippetsPythonTestGenerator = class {
|
|
872295
872277
|
context;
|
|
@@ -872318,8 +872300,8 @@ var DynamicSnippetsPythonTestGenerator = class {
|
|
|
872318
872300
|
endpointId
|
|
872319
872301
|
});
|
|
872320
872302
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
872321
|
-
await (0,
|
|
872322
|
-
await (0,
|
|
872303
|
+
await (0, import_promises97.mkdir)(import_path68.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
872304
|
+
await (0, import_promises97.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
872323
872305
|
} catch (error50) {
|
|
872324
872306
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
872325
872307
|
}
|
|
@@ -874916,7 +874898,7 @@ var DynamicSnippetsGenerator6 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
874916
874898
|
};
|
|
874917
874899
|
|
|
874918
874900
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/ruby/DynamicSnippetsRubyTestGenerator.js
|
|
874919
|
-
var
|
|
874901
|
+
var import_promises98 = require("fs/promises");
|
|
874920
874902
|
var import_path69 = __toESM(require("path"), 1);
|
|
874921
874903
|
var DynamicSnippetsRubyTestGenerator = class {
|
|
874922
874904
|
context;
|
|
@@ -874945,8 +874927,8 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
874945
874927
|
endpointId
|
|
874946
874928
|
});
|
|
874947
874929
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
874948
|
-
await (0,
|
|
874949
|
-
await (0,
|
|
874930
|
+
await (0, import_promises98.mkdir)(import_path69.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
874931
|
+
await (0, import_promises98.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
874950
874932
|
} catch (error50) {
|
|
874951
874933
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
874952
874934
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -874962,7 +874944,7 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
874962
874944
|
};
|
|
874963
874945
|
|
|
874964
874946
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/rust/DynamicSnippetsRustTestGenerator.js
|
|
874965
|
-
var
|
|
874947
|
+
var import_promises99 = require("fs/promises");
|
|
874966
874948
|
var import_node_path24 = __toESM(require("path"), 1);
|
|
874967
874949
|
init_lib6();
|
|
874968
874950
|
|
|
@@ -875571,6 +875553,10 @@ var Attribute2 = class _Attribute extends AstNode7 {
|
|
|
875571
875553
|
name: "serde",
|
|
875572
875554
|
args: ["skip"]
|
|
875573
875555
|
}),
|
|
875556
|
+
skipSerializing: () => new _Attribute({
|
|
875557
|
+
name: "serde",
|
|
875558
|
+
args: ["skip_serializing"]
|
|
875559
|
+
}),
|
|
875574
875560
|
skipSerializingIf: (condition) => new _Attribute({
|
|
875575
875561
|
name: "serde",
|
|
875576
875562
|
args: [`skip_serializing_if = ${condition}`]
|
|
@@ -880166,8 +880152,8 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
880166
880152
|
absolutePathToOutputDir,
|
|
880167
880153
|
idx
|
|
880168
880154
|
});
|
|
880169
|
-
await (0,
|
|
880170
|
-
await (0,
|
|
880155
|
+
await (0, import_promises99.mkdir)(import_node_path24.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
880156
|
+
await (0, import_promises99.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
880171
880157
|
} catch (error50) {
|
|
880172
880158
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
880173
880159
|
}
|
|
@@ -880176,7 +880162,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
880176
880162
|
}
|
|
880177
880163
|
async initializeProject(outputDir) {
|
|
880178
880164
|
const absolutePathToOutputDir = join2(outputDir, RelativeFilePath2.of("dynamic-snippets"));
|
|
880179
|
-
await (0,
|
|
880165
|
+
await (0, import_promises99.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
880180
880166
|
return absolutePathToOutputDir;
|
|
880181
880167
|
}
|
|
880182
880168
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -880185,7 +880171,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
880185
880171
|
};
|
|
880186
880172
|
|
|
880187
880173
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/swift/DynamicSnippetsSwiftTestGenerator.js
|
|
880188
|
-
var
|
|
880174
|
+
var import_promises100 = require("fs/promises");
|
|
880189
880175
|
var import_node_path25 = __toESM(require("path"), 1);
|
|
880190
880176
|
init_lib6();
|
|
880191
880177
|
|
|
@@ -884670,8 +884656,8 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
884670
884656
|
absolutePathToOutputDir,
|
|
884671
884657
|
idx
|
|
884672
884658
|
});
|
|
884673
|
-
await (0,
|
|
884674
|
-
await (0,
|
|
884659
|
+
await (0, import_promises100.mkdir)(import_node_path25.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
884660
|
+
await (0, import_promises100.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
884675
884661
|
} catch (error50) {
|
|
884676
884662
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
884677
884663
|
}
|
|
@@ -884680,7 +884666,7 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
884680
884666
|
}
|
|
884681
884667
|
async initializeProject(outputDir) {
|
|
884682
884668
|
const absolutePathToOutputDir = join2(outputDir, RelativeFilePath2.of("Snippets"));
|
|
884683
|
-
await (0,
|
|
884669
|
+
await (0, import_promises100.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
884684
884670
|
return absolutePathToOutputDir;
|
|
884685
884671
|
}
|
|
884686
884672
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -887005,7 +886991,7 @@ var DynamicSnippetsGenerator9 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
887005
886991
|
};
|
|
887006
886992
|
|
|
887007
886993
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/typescript/DynamicSnippetsTypeScriptTestGenerator.js
|
|
887008
|
-
var
|
|
886994
|
+
var import_promises101 = require("fs/promises");
|
|
887009
886995
|
var import_path70 = __toESM(require("path"), 1);
|
|
887010
886996
|
var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
887011
886997
|
context;
|
|
@@ -887034,8 +887020,8 @@ var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
|
887034
887020
|
endpointId
|
|
887035
887021
|
});
|
|
887036
887022
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
887037
|
-
await (0,
|
|
887038
|
-
await (0,
|
|
887023
|
+
await (0, import_promises101.mkdir)(import_path70.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
887024
|
+
await (0, import_promises101.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
887039
887025
|
} catch (error50) {
|
|
887040
887026
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
887041
887027
|
}
|
|
@@ -887134,7 +887120,7 @@ async function generateDynamicSnippetTests({ context: context3, ir: ir15, config
|
|
|
887134
887120
|
// ../generation/local-generation/local-workspace-runner/lib/runGenerator.js
|
|
887135
887121
|
init_lib6();
|
|
887136
887122
|
var import_serialization = __toESM(require_serialization3(), 1);
|
|
887137
|
-
var
|
|
887123
|
+
var import_promises103 = require("fs/promises");
|
|
887138
887124
|
var path70 = __toESM(require("path"), 1);
|
|
887139
887125
|
var import_path72 = require("path");
|
|
887140
887126
|
var import_tmp_promise13 = __toESM(require_tmp_promise(), 1);
|
|
@@ -887994,7 +887980,7 @@ function configureBamlClient(config5) {
|
|
|
887994
887980
|
init_lib4();
|
|
887995
887981
|
init_lib6();
|
|
887996
887982
|
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
887997
|
-
var
|
|
887983
|
+
var import_promises102 = require("fs/promises");
|
|
887998
887984
|
var import_os12 = require("os");
|
|
887999
887985
|
var import_path71 = require("path");
|
|
888000
887986
|
var import_semver12 = __toESM(require_semver2(), 1);
|
|
@@ -888171,7 +888157,7 @@ var LocalTaskHandler = class {
|
|
|
888171
888157
|
try {
|
|
888172
888158
|
this.context.logger.info("Analyzing SDK changes for automatic semantic versioning");
|
|
888173
888159
|
diffFile = await this.generateDiffFile();
|
|
888174
|
-
const diffContent = await (0,
|
|
888160
|
+
const diffContent = await (0, import_promises102.readFile)(diffFile, "utf-8");
|
|
888175
888161
|
if (diffContent.trim().length === 0) {
|
|
888176
888162
|
this.context.logger.info("No changes detected in generated SDK");
|
|
888177
888163
|
return null;
|
|
@@ -888332,7 +888318,7 @@ var LocalTaskHandler = class {
|
|
|
888332
888318
|
} finally {
|
|
888333
888319
|
if (diffFile) {
|
|
888334
888320
|
try {
|
|
888335
|
-
await (0,
|
|
888321
|
+
await (0, import_promises102.rm)(diffFile);
|
|
888336
888322
|
} catch (cleanupError) {
|
|
888337
888323
|
this.context.logger.warn(`Failed to delete temp diff file: ${diffFile}`, String(cleanupError));
|
|
888338
888324
|
}
|
|
@@ -888444,7 +888430,7 @@ var LocalTaskHandler = class {
|
|
|
888444
888430
|
const absolutePathToFernignore = AbsoluteFilePath2.of(join2(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
|
|
888445
888431
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
888446
888432
|
const pathsToPreserve = await this.getPathsToPreserve(fernIgnorePaths);
|
|
888447
|
-
await (0,
|
|
888433
|
+
await (0, import_promises102.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
888448
888434
|
await this.runGitCommand(["init"], tmpOutputResolutionDir);
|
|
888449
888435
|
await this.runGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
888450
888436
|
await this.runGitCommand([
|
|
@@ -888466,17 +888452,17 @@ var LocalTaskHandler = class {
|
|
|
888466
888452
|
await this.runGitCommand(["reset", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
888467
888453
|
await this.runGitCommand(["clean", "-fd", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
888468
888454
|
await this.runGitCommand(["restore", "."], tmpOutputResolutionDir);
|
|
888469
|
-
await (0,
|
|
888470
|
-
await (0,
|
|
888471
|
-
await (0,
|
|
888455
|
+
await (0, import_promises102.rm)(join2(tmpOutputResolutionDir, RelativeFilePath2.of(".git")), { recursive: true });
|
|
888456
|
+
await (0, import_promises102.rm)(this.absolutePathToLocalOutput, { recursive: true });
|
|
888457
|
+
await (0, import_promises102.cp)(tmpOutputResolutionDir, this.absolutePathToLocalOutput, { recursive: true });
|
|
888472
888458
|
}
|
|
888473
888459
|
async copyGeneratedFilesNoFernIgnorePreservingGit() {
|
|
888474
|
-
const contents = await (0,
|
|
888460
|
+
const contents = await (0, import_promises102.readdir)(this.absolutePathToLocalOutput);
|
|
888475
888461
|
const itemsToPreserve = [".git"];
|
|
888476
888462
|
if (await this.generatedOutputMissingReadme()) {
|
|
888477
888463
|
itemsToPreserve.push("README.md");
|
|
888478
888464
|
}
|
|
888479
|
-
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0,
|
|
888465
|
+
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0, import_promises102.rm)(join2(this.absolutePathToLocalOutput, RelativeFilePath2.of(item)), {
|
|
888480
888466
|
force: true,
|
|
888481
888467
|
recursive: true
|
|
888482
888468
|
})));
|
|
@@ -888484,11 +888470,11 @@ var LocalTaskHandler = class {
|
|
|
888484
888470
|
}
|
|
888485
888471
|
async copyGeneratedFilesNoFernIgnoreDeleteAll() {
|
|
888486
888472
|
this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
|
|
888487
|
-
await (0,
|
|
888473
|
+
await (0, import_promises102.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
|
|
888488
888474
|
await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
|
|
888489
888475
|
}
|
|
888490
888476
|
async copyGeneratedFilesToDirectory(outputPath) {
|
|
888491
|
-
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0,
|
|
888477
|
+
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises102.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
888492
888478
|
if (firstLocalOutputItem == null) {
|
|
888493
888479
|
return;
|
|
888494
888480
|
}
|
|
@@ -888496,15 +888482,15 @@ var LocalTaskHandler = class {
|
|
|
888496
888482
|
if (firstLocalOutputItem.endsWith(".zip")) {
|
|
888497
888483
|
await (0, import_decompress2.default)(join2(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(firstLocalOutputItem)), outputPath);
|
|
888498
888484
|
for (const localOutputItem of remaininglocalOutputItems) {
|
|
888499
|
-
await (0,
|
|
888485
|
+
await (0, import_promises102.cp)(join2(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(localOutputItem)), join2(outputPath, RelativeFilePath2.of(localOutputItem)), { recursive: true });
|
|
888500
888486
|
}
|
|
888501
888487
|
} else {
|
|
888502
|
-
await (0,
|
|
888488
|
+
await (0, import_promises102.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true });
|
|
888503
888489
|
}
|
|
888504
888490
|
}
|
|
888505
888491
|
async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
|
|
888506
888492
|
this.context.logger.debug(`Copying generated snippets to ${absolutePathToLocalSnippetJSON}`);
|
|
888507
|
-
await (0,
|
|
888493
|
+
await (0, import_promises102.cp)(absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON);
|
|
888508
888494
|
}
|
|
888509
888495
|
/**
|
|
888510
888496
|
* Checks whether the generated output is missing README.md.
|
|
@@ -888513,7 +888499,7 @@ var LocalTaskHandler = class {
|
|
|
888513
888499
|
*/
|
|
888514
888500
|
async generatedOutputMissingReadme() {
|
|
888515
888501
|
try {
|
|
888516
|
-
const contents = await (0,
|
|
888502
|
+
const contents = await (0, import_promises102.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
888517
888503
|
if (contents.length === 1 && contents[0] != null && contents[0].endsWith(".zip")) {
|
|
888518
888504
|
return false;
|
|
888519
888505
|
}
|
|
@@ -888549,13 +888535,13 @@ var LocalTaskHandler = class {
|
|
|
888549
888535
|
async readPriorChangelog(maxEntries) {
|
|
888550
888536
|
const MAX_CHANGELOG_SIZE = 2048;
|
|
888551
888537
|
try {
|
|
888552
|
-
const files = await (0,
|
|
888538
|
+
const files = await (0, import_promises102.readdir)(this.absolutePathToLocalOutput);
|
|
888553
888539
|
const changelogFile = files.find((f10) => f10.toLowerCase() === "changelog.md");
|
|
888554
888540
|
if (!changelogFile) {
|
|
888555
888541
|
return "";
|
|
888556
888542
|
}
|
|
888557
888543
|
const changelogPath = join2(this.absolutePathToLocalOutput, RelativeFilePath2.of(changelogFile));
|
|
888558
|
-
const content5 = await (0,
|
|
888544
|
+
const content5 = await (0, import_promises102.readFile)(changelogPath, "utf-8");
|
|
888559
888545
|
if (content5.trim().length === 0) {
|
|
888560
888546
|
return "";
|
|
888561
888547
|
}
|
|
@@ -888665,24 +888651,24 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
888665
888651
|
context3.logger.debug("Wrote IR to: " + absolutePathToIr);
|
|
888666
888652
|
const configJsonFile = (0, import_path72.join)(workspaceTempDir.path, GENERATOR_CONFIG_FILENAME);
|
|
888667
888653
|
const absolutePathToWriteConfigJson = AbsoluteFilePath2.of(configJsonFile);
|
|
888668
|
-
await (0,
|
|
888654
|
+
await (0, import_promises103.writeFile)(configJsonFile, "");
|
|
888669
888655
|
context3.logger.debug("Will write config.json to: " + absolutePathToWriteConfigJson);
|
|
888670
888656
|
const tmpOutputDirectory = (0, import_path72.join)(workspaceTempDir.path, CODEGEN_OUTPUT_DIRECTORY_NAME);
|
|
888671
888657
|
const absolutePathToTmpOutputDirectory = AbsoluteFilePath2.of(tmpOutputDirectory);
|
|
888672
|
-
await (0,
|
|
888658
|
+
await (0, import_promises103.mkdir)(tmpOutputDirectory, { recursive: true });
|
|
888673
888659
|
context3.logger.debug("Will write output to: " + absolutePathToTmpOutputDirectory);
|
|
888674
888660
|
let absolutePathToTmpSnippetJSON = void 0;
|
|
888675
888661
|
if (absolutePathToLocalSnippetJSON != null) {
|
|
888676
888662
|
const snippetJsonFile = (0, import_path72.join)(workspaceTempDir.path, "snippet.json");
|
|
888677
888663
|
absolutePathToTmpSnippetJSON = AbsoluteFilePath2.of(snippetJsonFile);
|
|
888678
|
-
await (0,
|
|
888664
|
+
await (0, import_promises103.writeFile)(snippetJsonFile, "");
|
|
888679
888665
|
context3.logger.debug("Will write snippet.json to: " + absolutePathToTmpSnippetJSON);
|
|
888680
888666
|
}
|
|
888681
888667
|
let absolutePathToTmpSnippetTemplatesJSON = void 0;
|
|
888682
888668
|
if (absolutePathToLocalSnippetTemplateJSON != null) {
|
|
888683
888669
|
const snippetTemplatesJsonFile = (0, import_path72.join)(workspaceTempDir.path, SNIPPET_TEMPLATES_JSON_FILENAME);
|
|
888684
888670
|
absolutePathToTmpSnippetTemplatesJSON = AbsoluteFilePath2.of(snippetTemplatesJsonFile);
|
|
888685
|
-
await (0,
|
|
888671
|
+
await (0, import_promises103.writeFile)(snippetTemplatesJsonFile, "");
|
|
888686
888672
|
context3.logger.debug("Will write snippet-templates.json to: " + absolutePathToTmpSnippetTemplatesJSON);
|
|
888687
888673
|
}
|
|
888688
888674
|
const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
|
|
@@ -888721,7 +888707,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
888721
888707
|
publishToRegistry,
|
|
888722
888708
|
paths
|
|
888723
888709
|
});
|
|
888724
|
-
await (0,
|
|
888710
|
+
await (0, import_promises103.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(await import_serialization.GeneratorConfig.jsonOrThrow(config5), void 0, 4));
|
|
888725
888711
|
const absolutePathToLicenseFile = extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig);
|
|
888726
888712
|
const sourceMounts = workspace.getSources().filter((source2) => source2.type === "protobuf").map((source2) => ({
|
|
888727
888713
|
hostPath: source2.absoluteFilePath,
|
|
@@ -889322,14 +889308,14 @@ var GenerationRunner = class {
|
|
|
889322
889308
|
};
|
|
889323
889309
|
|
|
889324
889310
|
// ../cli-v2/lib/sdk/generator/LegacyLocalGenerationRunner.js
|
|
889325
|
-
var
|
|
889311
|
+
var import_promises105 = require("fs/promises");
|
|
889326
889312
|
|
|
889327
889313
|
// ../cli-v2/lib/sdk/adapter/LegacyGeneratorInvocationAdapter.js
|
|
889328
889314
|
init_lib4();
|
|
889329
889315
|
init_lib6();
|
|
889330
889316
|
init_lib7();
|
|
889331
889317
|
var import_fiddle_sdk6 = __toESM(require_fiddle_sdk(), 1);
|
|
889332
|
-
var
|
|
889318
|
+
var import_promises104 = require("fs/promises");
|
|
889333
889319
|
var LegacyGeneratorInvocationAdapter = class {
|
|
889334
889320
|
context;
|
|
889335
889321
|
constructor(config5) {
|
|
@@ -889562,7 +889548,7 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
889562
889548
|
if (!await doesPathExist(absolutePath, "file")) {
|
|
889563
889549
|
throw new Error(`Custom license file "${absolutePath}" does not exist; did you mean to use either MIT or Apache-2.0?`);
|
|
889564
889550
|
}
|
|
889565
|
-
const contents = await (0,
|
|
889551
|
+
const contents = await (0, import_promises104.readFile)(absolutePath, "utf-8");
|
|
889566
889552
|
return import_fiddle_sdk6.FernFiddle.GithubLicense.custom({ contents });
|
|
889567
889553
|
}
|
|
889568
889554
|
buildReadme(target) {
|
|
@@ -889784,7 +889770,7 @@ var LegacyLocalGenerationRunner = class {
|
|
|
889784
889770
|
});
|
|
889785
889771
|
if (args.target.output.path != null && generatorInvocation.absolutePathToLocalOutput != null) {
|
|
889786
889772
|
const snippetPath = join2(generatorInvocation.absolutePathToLocalOutput, RelativeFilePath2.of(SNIPPET_JSON_FILENAME));
|
|
889787
|
-
await (0,
|
|
889773
|
+
await (0, import_promises105.rm)(snippetPath, { force: true });
|
|
889788
889774
|
}
|
|
889789
889775
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
889790
889776
|
return {
|
|
@@ -889801,7 +889787,7 @@ var LegacyLocalGenerationRunner = class {
|
|
|
889801
889787
|
// ../cli-v2/lib/sdk/generator/LegacyRemoteGenerationRunner.js
|
|
889802
889788
|
init_lib4();
|
|
889803
889789
|
init_lib6();
|
|
889804
|
-
var
|
|
889790
|
+
var import_promises106 = require("fs/promises");
|
|
889805
889791
|
var import_os14 = require("os");
|
|
889806
889792
|
var LegacyRemoteGenerationRunner = class {
|
|
889807
889793
|
context;
|
|
@@ -889856,13 +889842,13 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
889856
889842
|
const previewOutputDirectory = join2(absolutePathToPreview, RelativeFilePath2.of(generatorName));
|
|
889857
889843
|
const targetOutputDirectory = generatorInvocation.absolutePathToLocalOutput;
|
|
889858
889844
|
if (targetOutputDirectory != null) {
|
|
889859
|
-
await (0,
|
|
889860
|
-
await (0,
|
|
889845
|
+
await (0, import_promises106.cp)(previewOutputDirectory, targetOutputDirectory, { recursive: true });
|
|
889846
|
+
await (0, import_promises106.rm)(join2(targetOutputDirectory, RelativeFilePath2.of(".git")), {
|
|
889861
889847
|
recursive: true,
|
|
889862
889848
|
force: true
|
|
889863
889849
|
});
|
|
889864
889850
|
}
|
|
889865
|
-
await (0,
|
|
889851
|
+
await (0, import_promises106.rm)(absolutePathToPreview, { recursive: true, force: true });
|
|
889866
889852
|
}
|
|
889867
889853
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
889868
889854
|
return {
|
|
@@ -889891,7 +889877,7 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
889891
889877
|
}
|
|
889892
889878
|
async getAbsolutePathToPreview(args) {
|
|
889893
889879
|
if (this.isLocalGitCombo(args)) {
|
|
889894
|
-
const tmpPreviewDirectory = await (0,
|
|
889880
|
+
const tmpPreviewDirectory = await (0, import_promises106.mkdtemp)(join2(AbsoluteFilePath2.of((0, import_os14.tmpdir)()), RelativeFilePath2.of("fern-preview-")));
|
|
889895
889881
|
return AbsoluteFilePath2.of(tmpPreviewDirectory);
|
|
889896
889882
|
}
|
|
889897
889883
|
if (!args.preview) {
|
|
@@ -890527,7 +890513,7 @@ Example:
|
|
|
890527
890513
|
if (!exists2) {
|
|
890528
890514
|
return { shouldProceed: true };
|
|
890529
890515
|
}
|
|
890530
|
-
const files = await (0,
|
|
890516
|
+
const files = await (0, import_promises107.readdir)(outputPath);
|
|
890531
890517
|
if (files.length === 0) {
|
|
890532
890518
|
return { shouldProceed: true };
|
|
890533
890519
|
}
|
|
@@ -890739,7 +890725,7 @@ init_lib4();
|
|
|
890739
890725
|
// ../cli-v2/lib/sdk/updater/GeneratorMigrator.js
|
|
890740
890726
|
init_lib4();
|
|
890741
890727
|
var import_fs28 = require("fs");
|
|
890742
|
-
var
|
|
890728
|
+
var import_promises108 = require("fs/promises");
|
|
890743
890729
|
var import_path75 = require("path");
|
|
890744
890730
|
var import_semver13 = __toESM(require_semver2(), 1);
|
|
890745
890731
|
var import_url8 = require("url");
|
|
@@ -890848,7 +890834,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
890848
890834
|
}
|
|
890849
890835
|
this.migrationsInstallPromise = (async () => {
|
|
890850
890836
|
const cacheDir = this.cachePath;
|
|
890851
|
-
await (0,
|
|
890837
|
+
await (0, import_promises108.mkdir)(cacheDir, { recursive: true });
|
|
890852
890838
|
const npmCacheDir = (0, import_path75.join)(cacheDir, ".npm-cache");
|
|
890853
890839
|
const packageDir = (0, import_path75.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME);
|
|
890854
890840
|
const packageJsonPath = (0, import_path75.join)(packageDir, "package.json");
|
|
@@ -890865,7 +890851,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
890865
890851
|
"--no-audit",
|
|
890866
890852
|
"--no-fund"
|
|
890867
890853
|
], { doNotPipeOutput: true });
|
|
890868
|
-
const packageJsonContent = await (0,
|
|
890854
|
+
const packageJsonContent = await (0, import_promises108.readFile)(packageJsonPath, "utf-8");
|
|
890869
890855
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
890870
890856
|
if (packageJson2.main == null) {
|
|
890871
890857
|
throw new Error(`No main field found in package.json for ${MIGRATION_PACKAGE_NAME}`);
|
|
@@ -890907,7 +890893,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
890907
890893
|
const myPid = String(process.pid);
|
|
890908
890894
|
while (true) {
|
|
890909
890895
|
try {
|
|
890910
|
-
const fh = await (0,
|
|
890896
|
+
const fh = await (0, import_promises108.open)(lockPath, "wx");
|
|
890911
890897
|
await fh.writeFile(myPid);
|
|
890912
890898
|
await fh.close();
|
|
890913
890899
|
const exitHandler = () => {
|
|
@@ -890924,9 +890910,9 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
890924
890910
|
return async () => {
|
|
890925
890911
|
process.removeListener("exit", exitHandler);
|
|
890926
890912
|
try {
|
|
890927
|
-
const currentContent = await (0,
|
|
890913
|
+
const currentContent = await (0, import_promises108.readFile)(lockPath, "utf-8");
|
|
890928
890914
|
if (currentContent.trim() === myPid) {
|
|
890929
|
-
await (0,
|
|
890915
|
+
await (0, import_promises108.unlink)(lockPath);
|
|
890930
890916
|
} else {
|
|
890931
890917
|
logger4.debug(`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`);
|
|
890932
890918
|
}
|
|
@@ -890940,14 +890926,14 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
890940
890926
|
throw err;
|
|
890941
890927
|
}
|
|
890942
890928
|
try {
|
|
890943
|
-
const lockContent = await (0,
|
|
890929
|
+
const lockContent = await (0, import_promises108.readFile)(lockPath, "utf-8");
|
|
890944
890930
|
const lockPid = Number(lockContent.trim());
|
|
890945
|
-
const lockStat = await (0,
|
|
890931
|
+
const lockStat = await (0, import_promises108.stat)(lockPath);
|
|
890946
890932
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
890947
890933
|
if (lockAge > _GeneratorMigrator.LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !_GeneratorMigrator.isProcessAlive(lockPid)) {
|
|
890948
890934
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
890949
890935
|
try {
|
|
890950
|
-
await (0,
|
|
890936
|
+
await (0, import_promises108.unlink)(lockPath);
|
|
890951
890937
|
} catch (unlinkErr) {
|
|
890952
890938
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
890953
890939
|
}
|
|
@@ -891419,13 +891405,13 @@ var import_generator_cli2 = __toESM(require_api5(), 1);
|
|
|
891419
891405
|
|
|
891420
891406
|
// ../init/lib/initializeAPI.js
|
|
891421
891407
|
init_lib6();
|
|
891422
|
-
var
|
|
891408
|
+
var import_promises112 = require("fs/promises");
|
|
891423
891409
|
var import_fs_extra = __toESM(require_lib19(), 1);
|
|
891424
891410
|
var import_path76 = __toESM(require("path"), 1);
|
|
891425
891411
|
|
|
891426
891412
|
// ../init/lib/createFernDirectoryAndOrganization.js
|
|
891427
891413
|
init_lib6();
|
|
891428
|
-
var
|
|
891414
|
+
var import_promises109 = require("fs/promises");
|
|
891429
891415
|
init_lodash();
|
|
891430
891416
|
var GITIGNORE_CONTENT = "**/.preview\n**/.definition\n";
|
|
891431
891417
|
async function createFernDirectoryAndWorkspace({ organization, taskContext, versionOfCli }) {
|
|
@@ -891455,7 +891441,7 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
|
|
|
891455
891441
|
}
|
|
891456
891442
|
}
|
|
891457
891443
|
}
|
|
891458
|
-
await (0,
|
|
891444
|
+
await (0, import_promises109.mkdir)(FERN_DIRECTORY);
|
|
891459
891445
|
await writeProjectConfig({
|
|
891460
891446
|
filepath: join2(pathToFernDirectory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)),
|
|
891461
891447
|
organization,
|
|
@@ -891479,11 +891465,11 @@ async function writeProjectConfig({ organization, filepath, versionOfCli }) {
|
|
|
891479
891465
|
organization,
|
|
891480
891466
|
version: versionOfCli
|
|
891481
891467
|
};
|
|
891482
|
-
await (0,
|
|
891468
|
+
await (0, import_promises109.writeFile)(filepath, JSON.stringify(projectConfig, void 0, 4));
|
|
891483
891469
|
}
|
|
891484
891470
|
async function writeGitignore({ absolutePathToFernDirectory }) {
|
|
891485
891471
|
const gitignorePath = join2(absolutePathToFernDirectory, RelativeFilePath2.of(".gitignore"));
|
|
891486
|
-
await (0,
|
|
891472
|
+
await (0, import_promises109.writeFile)(gitignorePath, GITIGNORE_CONTENT);
|
|
891487
891473
|
}
|
|
891488
891474
|
|
|
891489
891475
|
// ../fern-definition/formatter/lib/FernDefinitionFileFormatter.js
|
|
@@ -891672,7 +891658,7 @@ async function formatDefinitionFile({ fileContents }) {
|
|
|
891672
891658
|
|
|
891673
891659
|
// ../fern-definition/formatter/lib/formatWorkspace.js
|
|
891674
891660
|
init_lib4();
|
|
891675
|
-
var
|
|
891661
|
+
var import_promises110 = require("fs/promises");
|
|
891676
891662
|
async function formatFernWorkspace({ workspace, context: context3, shouldFix }) {
|
|
891677
891663
|
for (const [relativeFilepath, file4] of entries(workspace.definition.namedDefinitionFiles)) {
|
|
891678
891664
|
const formatted = await formatDefinitionFile({
|
|
@@ -891680,7 +891666,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
891680
891666
|
});
|
|
891681
891667
|
if (formatted !== file4.rawContents) {
|
|
891682
891668
|
if (shouldFix) {
|
|
891683
|
-
await (0,
|
|
891669
|
+
await (0, import_promises110.writeFile)(file4.absoluteFilePath, formatted);
|
|
891684
891670
|
context3.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
|
|
891685
891671
|
} else {
|
|
891686
891672
|
context3.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
|
|
@@ -891692,7 +891678,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
891692
891678
|
|
|
891693
891679
|
// ../init/lib/createWorkspace.js
|
|
891694
891680
|
init_lib6();
|
|
891695
|
-
var
|
|
891681
|
+
var import_promises111 = require("fs/promises");
|
|
891696
891682
|
|
|
891697
891683
|
// ../init/lib/sampleImdbApi.js
|
|
891698
891684
|
var SAMPLE_IMDB_API = `
|
|
@@ -891892,7 +891878,7 @@ components:
|
|
|
891892
891878
|
// ../init/lib/createWorkspace.js
|
|
891893
891879
|
async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context: context3, apiName = "api" }) {
|
|
891894
891880
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
891895
|
-
await (0,
|
|
891881
|
+
await (0, import_promises111.mkdir)(directoryOfWorkspace);
|
|
891896
891882
|
}
|
|
891897
891883
|
await writeGeneratorsConfiguration({
|
|
891898
891884
|
filepath: join2(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -891907,7 +891893,7 @@ async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context:
|
|
|
891907
891893
|
}
|
|
891908
891894
|
async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, cliVersion, context: context3 }) {
|
|
891909
891895
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
891910
|
-
await (0,
|
|
891896
|
+
await (0, import_promises111.mkdir)(directoryOfWorkspace);
|
|
891911
891897
|
}
|
|
891912
891898
|
await writeGeneratorsConfiguration({
|
|
891913
891899
|
filepath: join2(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -891920,10 +891906,10 @@ async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, c
|
|
|
891920
891906
|
}
|
|
891921
891907
|
async function createDefaultOpenAPIWorkspace({ directoryOfWorkspace, cliVersion, context: context3 }) {
|
|
891922
891908
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
891923
|
-
await (0,
|
|
891909
|
+
await (0, import_promises111.mkdir)(directoryOfWorkspace, { recursive: true });
|
|
891924
891910
|
}
|
|
891925
891911
|
const openApiFilePath = join2(directoryOfWorkspace, RelativeFilePath2.of("openapi.yml"));
|
|
891926
|
-
await (0,
|
|
891912
|
+
await (0, import_promises111.writeFile)(openApiFilePath, SAMPLE_OPENAPI);
|
|
891927
891913
|
await writeGeneratorsConfiguration({
|
|
891928
891914
|
filepath: join2(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
891929
891915
|
cliVersion,
|
|
@@ -891968,7 +891954,7 @@ async function getDefaultGeneratorsConfiguration({ cliVersion, context: context3
|
|
|
891968
891954
|
return config5;
|
|
891969
891955
|
}
|
|
891970
891956
|
async function writeGeneratorsConfiguration({ filepath, cliVersion, context: context3, apiConfiguration }) {
|
|
891971
|
-
await (0,
|
|
891957
|
+
await (0, import_promises111.writeFile)(filepath, "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(await getDefaultGeneratorsConfiguration({ cliVersion, context: context3, apiConfiguration }), {
|
|
891972
891958
|
sortKeys: (a10, b19) => {
|
|
891973
891959
|
if (a10 === "api") {
|
|
891974
891960
|
return -1;
|
|
@@ -891987,10 +891973,10 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
891987
891973
|
strategy: "status-code"
|
|
891988
891974
|
}
|
|
891989
891975
|
};
|
|
891990
|
-
await (0,
|
|
891991
|
-
await (0,
|
|
891976
|
+
await (0, import_promises111.mkdir)(directoryOfDefinition);
|
|
891977
|
+
await (0, import_promises111.writeFile)(join2(directoryOfDefinition, RelativeFilePath2.of(ROOT_API_FILENAME)), jsYaml.dump(rootApi));
|
|
891992
891978
|
const absoluteFilepathToImdbYaml = join2(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
|
|
891993
|
-
await (0,
|
|
891979
|
+
await (0, import_promises111.writeFile)(absoluteFilepathToImdbYaml, await formatDefinitionFile({
|
|
891994
891980
|
fileContents: SAMPLE_IMDB_API
|
|
891995
891981
|
}));
|
|
891996
891982
|
}
|
|
@@ -892043,7 +892029,7 @@ async function getDirectoryOfNewAPIWorkspace({ absolutePathToFernDirectory, task
|
|
|
892043
892029
|
if (inlinedApiDefinition || inlinedOpenApiWorkspace) {
|
|
892044
892030
|
taskContext.logger.info("Creating workspaces to support multiple API Definitions.");
|
|
892045
892031
|
const apiWorkspaceDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api"));
|
|
892046
|
-
await (0,
|
|
892032
|
+
await (0, import_promises112.mkdir)(apiWorkspaceDirectory, { recursive: true });
|
|
892047
892033
|
if (inlinedApiDefinition) {
|
|
892048
892034
|
const inlinedDefinitionDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
892049
892035
|
const workspaceDefinitionDirectory = join2(apiWorkspaceDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
@@ -892080,7 +892066,7 @@ async function hasInlinedOpenAPIWorkspace({ absolutePathToFernDirectory }) {
|
|
|
892080
892066
|
// ../init/lib/initializeDocs.js
|
|
892081
892067
|
init_lib4();
|
|
892082
892068
|
init_lib6();
|
|
892083
|
-
var
|
|
892069
|
+
var import_promises113 = require("fs/promises");
|
|
892084
892070
|
async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
892085
892071
|
const createDirectoryResponse = await createFernDirectoryAndWorkspace({
|
|
892086
892072
|
organization,
|
|
@@ -892095,7 +892081,7 @@ async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
|
892095
892081
|
} else {
|
|
892096
892082
|
try {
|
|
892097
892083
|
const docsConfig = getDocsConfig(createDirectoryResponse.organization);
|
|
892098
|
-
await (0,
|
|
892084
|
+
await (0, import_promises113.writeFile)(docsYmlPath, jsYaml.dump(docsConfig));
|
|
892099
892085
|
taskContext.logger.info(source_default.green("Created docs configuration"));
|
|
892100
892086
|
return;
|
|
892101
892087
|
} catch (writeError) {
|
|
@@ -892150,7 +892136,7 @@ var FernDocsBuilder = class {
|
|
|
892150
892136
|
|
|
892151
892137
|
// ../docs-importers/commons/lib/FernDocsBuilderImpl.js
|
|
892152
892138
|
init_lib6();
|
|
892153
|
-
var
|
|
892139
|
+
var import_promises114 = require("fs/promises");
|
|
892154
892140
|
var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
892155
892141
|
openApiSpecs = {};
|
|
892156
892142
|
nonTabbedNavigation = new NonTabbedNavigationBuilderImpl();
|
|
@@ -892209,7 +892195,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
892209
892195
|
}
|
|
892210
892196
|
async build({ outputDirectory }) {
|
|
892211
892197
|
const absolutePathToFernDirectory = join2(outputDirectory, RelativeFilePath2.of(FERN_DIRECTORY));
|
|
892212
|
-
await (0,
|
|
892198
|
+
await (0, import_promises114.mkdir)(absolutePathToFernDirectory, { recursive: true });
|
|
892213
892199
|
if (Object.keys(this.tabbedNavigation).length > 0) {
|
|
892214
892200
|
this.docsYml.tabs = Object.fromEntries(Object.entries(this.tabbedNavigation).map(([key2, value]) => {
|
|
892215
892201
|
return [value.tabId, value.tabConfig];
|
|
@@ -892234,27 +892220,27 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
892234
892220
|
}))
|
|
892235
892221
|
};
|
|
892236
892222
|
}
|
|
892237
|
-
await (0,
|
|
892223
|
+
await (0, import_promises114.writeFile)(join2(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)), jsYaml.dump(generators_yml_exports.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml)));
|
|
892238
892224
|
await Promise.all(Object.entries(this.openApiSpecs).map(async ([relativePath, absolutePath]) => {
|
|
892239
892225
|
const absolutePathToOpenAPI = join2(absolutePathToFernDirectory, RelativeFilePath2.of(relativePath));
|
|
892240
|
-
await (0,
|
|
892241
|
-
await (0,
|
|
892226
|
+
await (0, import_promises114.mkdir)(dirname4(absolutePathToOpenAPI), { recursive: true });
|
|
892227
|
+
await (0, import_promises114.cp)(absolutePath, absolutePathToOpenAPI);
|
|
892242
892228
|
}));
|
|
892243
892229
|
}
|
|
892244
|
-
await (0,
|
|
892230
|
+
await (0, import_promises114.writeFile)(join2(absolutePathToFernDirectory, RelativeFilePath2.of(DOCS_CONFIGURATION_FILENAME)), jsYaml.dump(docs_yml_exports.RawSchemas.Serializer.DocsConfiguration.jsonOrThrow(this.docsYml, { omitUndefined: true })));
|
|
892245
892231
|
await Promise.all(Object.entries(this.markdownPages).map(async ([filepath, page]) => {
|
|
892246
892232
|
const absoluteFilepathToMarkdownPage = join2(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
892247
|
-
await (0,
|
|
892233
|
+
await (0, import_promises114.mkdir)(dirname4(absoluteFilepathToMarkdownPage), { recursive: true });
|
|
892248
892234
|
const frontmatter = Object.keys(page.frontmatter).length > 0 ? `---
|
|
892249
892235
|
${jsYaml.dump(JSON.parse(JSON.stringify(page.frontmatter)))}---
|
|
892250
892236
|
|
|
892251
892237
|
` : "";
|
|
892252
|
-
await (0,
|
|
892238
|
+
await (0, import_promises114.writeFile)(absoluteFilepathToMarkdownPage, `${frontmatter}${page.markdown}`);
|
|
892253
892239
|
}));
|
|
892254
892240
|
await Promise.all(Object.entries(this.assets).map(async ([filepath, asset]) => {
|
|
892255
892241
|
const absolutePathToAsset = join2(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
892256
|
-
await (0,
|
|
892257
|
-
await (0,
|
|
892242
|
+
await (0, import_promises114.mkdir)(dirname4(absolutePathToAsset), { recursive: true });
|
|
892243
|
+
await (0, import_promises114.cp)(asset.absoluteFilePathToAsset, absolutePathToAsset);
|
|
892258
892244
|
}));
|
|
892259
892245
|
}
|
|
892260
892246
|
setInstance({ companyName }) {
|
|
@@ -892287,7 +892273,7 @@ var NonTabbedNavigationBuilderImpl = class {
|
|
|
892287
892273
|
|
|
892288
892274
|
// ../docs-importers/mintlify/lib/MintlifyImporter.js
|
|
892289
892275
|
init_lib6();
|
|
892290
|
-
var
|
|
892276
|
+
var import_promises116 = require("fs/promises");
|
|
892291
892277
|
|
|
892292
892278
|
// ../docs-importers/mintlify/lib/convertColors.js
|
|
892293
892279
|
function convertColors(colors19) {
|
|
@@ -892348,10 +892334,10 @@ init_lib6();
|
|
|
892348
892334
|
|
|
892349
892335
|
// ../docs-importers/mintlify/lib/convertMarkdown.js
|
|
892350
892336
|
init_lib6();
|
|
892351
|
-
var
|
|
892337
|
+
var import_promises115 = require("fs/promises");
|
|
892352
892338
|
var import_gray_matter9 = __toESM(require_gray_matter(), 1);
|
|
892353
892339
|
async function convertMarkdown({ absolutePathToMintJson, absoluteFilepathToMarkdown, relativeFilepathFromRoot, builder }) {
|
|
892354
|
-
const text9 = await (0,
|
|
892340
|
+
const text9 = await (0, import_promises115.readFile)(absoluteFilepathToMarkdown, "utf-8");
|
|
892355
892341
|
const { data: data2, content: content5 } = parseMintlifyFrontmatter(text9);
|
|
892356
892342
|
const slug = relativeFilepathFromRoot.replace(/\.(md|mdx)$/, "");
|
|
892357
892343
|
const transformedContent = markReferencedAssets({
|
|
@@ -892514,7 +892500,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
892514
892500
|
documentationTab = void 0;
|
|
892515
892501
|
tabUrlToInfo = {};
|
|
892516
892502
|
async import({ args, builder }) {
|
|
892517
|
-
const mintJsonContent = await (0,
|
|
892503
|
+
const mintJsonContent = await (0, import_promises116.readFile)(args.absolutePathToMintJson, "utf-8");
|
|
892518
892504
|
const mint = JSON.parse(mintJsonContent);
|
|
892519
892505
|
builder.setTitle({ title: mint.name });
|
|
892520
892506
|
const relativePathToFavicon = RelativeFilePath2.of(mint.favicon.substring(1));
|
|
@@ -892640,7 +892626,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
892640
892626
|
|
|
892641
892627
|
// ../docs-importers/mintlify/lib/runMintlifyMigration.js
|
|
892642
892628
|
init_lib6();
|
|
892643
|
-
var
|
|
892629
|
+
var import_promises117 = require("fs/promises");
|
|
892644
892630
|
async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskContext, versionOfCli, organization }) {
|
|
892645
892631
|
const mintlifyImporter = new MintlifyImporter({
|
|
892646
892632
|
context: taskContext
|
|
@@ -892651,7 +892637,7 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
|
|
|
892651
892637
|
builder
|
|
892652
892638
|
});
|
|
892653
892639
|
await builder.build({ outputDirectory: outputPath });
|
|
892654
|
-
await (0,
|
|
892640
|
+
await (0, import_promises117.writeFile)(join2(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
892655
892641
|
version: versionOfCli,
|
|
892656
892642
|
organization
|
|
892657
892643
|
}, void 0, 4));
|
|
@@ -892705,7 +892691,7 @@ function assertIsStringArray(val) {
|
|
|
892705
892691
|
// ../docs-importers/readme/lib/ReadmeImporter.js
|
|
892706
892692
|
init_lib4();
|
|
892707
892693
|
init_lib6();
|
|
892708
|
-
var
|
|
892694
|
+
var import_promises122 = require("fs/promises");
|
|
892709
892695
|
|
|
892710
892696
|
// ../docs-importers/readme/lib/extract/favicon.js
|
|
892711
892697
|
async function getFavicon(hast) {
|
|
@@ -904123,7 +904109,7 @@ init_disposable();
|
|
|
904123
904109
|
init_incremental_id_generator();
|
|
904124
904110
|
|
|
904125
904111
|
// ../../../node_modules/.pnpm/puppeteer-core@24.40.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js
|
|
904126
|
-
var
|
|
904112
|
+
var import_promises120 = require("fs/promises");
|
|
904127
904113
|
var import_node_os11 = __toESM(require("os"), 1);
|
|
904128
904114
|
var import_node_path35 = __toESM(require("path"), 1);
|
|
904129
904115
|
init_main();
|
|
@@ -904567,7 +904553,7 @@ var ChromeLauncher = class extends BrowserLauncher {
|
|
|
904567
904553
|
});
|
|
904568
904554
|
if (userDataDirIndex < 0) {
|
|
904569
904555
|
isTempUserDataDir = true;
|
|
904570
|
-
chromeArguments.push(`--user-data-dir=${await (0,
|
|
904556
|
+
chromeArguments.push(`--user-data-dir=${await (0, import_promises120.mkdtemp)(this.getProfilePath())}`);
|
|
904571
904557
|
userDataDirIndex = chromeArguments.length - 1;
|
|
904572
904558
|
}
|
|
904573
904559
|
const userDataDir = chromeArguments[userDataDirIndex].split("=", 2)[1];
|
|
@@ -904724,7 +904710,7 @@ function removeMatchingFlags(array3, flag) {
|
|
|
904724
904710
|
|
|
904725
904711
|
// ../../../node_modules/.pnpm/puppeteer-core@24.40.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/FirefoxLauncher.js
|
|
904726
904712
|
var import_node_fs28 = __toESM(require("fs"), 1);
|
|
904727
|
-
var
|
|
904713
|
+
var import_promises121 = require("fs/promises");
|
|
904728
904714
|
var import_node_os12 = __toESM(require("os"), 1);
|
|
904729
904715
|
var import_node_path36 = __toESM(require("path"), 1);
|
|
904730
904716
|
init_main();
|
|
@@ -904778,7 +904764,7 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
904778
904764
|
}
|
|
904779
904765
|
isTempUserDataDir = false;
|
|
904780
904766
|
} else {
|
|
904781
|
-
userDataDir = await (0,
|
|
904767
|
+
userDataDir = await (0, import_promises121.mkdtemp)(this.getProfilePath());
|
|
904782
904768
|
firefoxArguments.push("--profile");
|
|
904783
904769
|
firefoxArguments.push(userDataDir);
|
|
904784
904770
|
}
|
|
@@ -904819,8 +904805,8 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
904819
904805
|
const prefsBackupPath = import_node_path36.default.join(userDataDir, file4 + backupSuffix);
|
|
904820
904806
|
if (import_node_fs28.default.existsSync(prefsBackupPath)) {
|
|
904821
904807
|
const prefsPath = import_node_path36.default.join(userDataDir, file4);
|
|
904822
|
-
await (0,
|
|
904823
|
-
await (0,
|
|
904808
|
+
await (0, import_promises121.unlink)(prefsPath);
|
|
904809
|
+
await (0, import_promises121.rename)(prefsBackupPath, prefsPath);
|
|
904824
904810
|
}
|
|
904825
904811
|
}));
|
|
904826
904812
|
for (const result of results) {
|
|
@@ -905853,7 +905839,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
905853
905839
|
if (response.ok) {
|
|
905854
905840
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
905855
905841
|
const faviconPath = join2(assetsDirectory, RelativeFilePath2.of("favicon"));
|
|
905856
|
-
await (0,
|
|
905842
|
+
await (0, import_promises122.writeFile)(faviconPath, new Uint8Array(imageBuffer));
|
|
905857
905843
|
builder.setFavicon({ favicon: relativize(this.absolutePathToFernDirectory, faviconPath) });
|
|
905858
905844
|
}
|
|
905859
905845
|
}
|
|
@@ -905870,7 +905856,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
905870
905856
|
*/
|
|
905871
905857
|
async getAndCreateAssetsDirectory() {
|
|
905872
905858
|
const assetsDirectory = join2(this.absolutePathToFernDirectory, RelativeFilePath2.of("assets"));
|
|
905873
|
-
await (0,
|
|
905859
|
+
await (0, import_promises122.mkdir)(assetsDirectory, { recursive: true });
|
|
905874
905860
|
return assetsDirectory;
|
|
905875
905861
|
}
|
|
905876
905862
|
/**
|
|
@@ -905920,7 +905906,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
905920
905906
|
absolutePathToOutputDirectory,
|
|
905921
905907
|
section
|
|
905922
905908
|
});
|
|
905923
|
-
await (0,
|
|
905909
|
+
await (0, import_promises122.mkdir)(absolutePathToOutputDirectoryForSection, { recursive: true });
|
|
905924
905910
|
await Promise.all(section.pages.filter((page) => page.type === "page").map(async (page) => {
|
|
905925
905911
|
const url3 = new URL(page.slug.toString(), this.url);
|
|
905926
905912
|
this.logger.debug(`Fetching page: ${url3.toString()}`);
|
|
@@ -905935,7 +905921,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
905935
905921
|
absolutePathToOutputDirectoryForSection,
|
|
905936
905922
|
page: page.slug
|
|
905937
905923
|
});
|
|
905938
|
-
await (0,
|
|
905924
|
+
await (0, import_promises122.writeFile)(absolutePathForPage, result.data.mdx);
|
|
905939
905925
|
if (result.data.images.imageURLs.length > 0) {
|
|
905940
905926
|
this.logger.debug(`Found ${result.data.images.imageURLs.length} images to download for ${url3.toString()}`);
|
|
905941
905927
|
await Promise.all(Object.entries(result.data.images.imageURLToFilename).map(async ([imageUrl, filename]) => {
|
|
@@ -905948,8 +905934,8 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
905948
905934
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
905949
905935
|
const imagePath = join2(absolutePathToOutputDirectoryForSection, RelativeFilePath2.of(filename));
|
|
905950
905936
|
const imageDir = dirname4(imagePath);
|
|
905951
|
-
await (0,
|
|
905952
|
-
await (0,
|
|
905937
|
+
await (0, import_promises122.mkdir)(imageDir, { recursive: true });
|
|
905938
|
+
await (0, import_promises122.writeFile)(imagePath, new Uint8Array(imageBuffer));
|
|
905953
905939
|
this.logger.debug(`Saved image to ${imagePath}`);
|
|
905954
905940
|
} catch (error50) {
|
|
905955
905941
|
this.logger.warn(`Error downloading image ${imageUrl}: ${error50}`);
|
|
@@ -906032,7 +906018,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
906032
906018
|
|
|
906033
906019
|
// ../docs-importers/readme/lib/runReadmeMigration.js
|
|
906034
906020
|
init_lib6();
|
|
906035
|
-
var
|
|
906021
|
+
var import_promises123 = require("fs/promises");
|
|
906036
906022
|
async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionOfCli, organization }) {
|
|
906037
906023
|
const builder = new FernDocsBuilderImpl();
|
|
906038
906024
|
builder.setInstance({ companyName: organization });
|
|
@@ -906047,7 +906033,7 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
|
|
|
906047
906033
|
builder
|
|
906048
906034
|
});
|
|
906049
906035
|
await builder.build({ outputDirectory: outputPath });
|
|
906050
|
-
await (0,
|
|
906036
|
+
await (0, import_promises123.writeFile)(join2(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
906051
906037
|
version: versionOfCli,
|
|
906052
906038
|
organization
|
|
906053
906039
|
}, void 0, 4));
|
|
@@ -906070,7 +906056,7 @@ var initializeWithReadme = async ({ readmeUrl, organization, taskContext, versio
|
|
|
906070
906056
|
};
|
|
906071
906057
|
|
|
906072
906058
|
// ../init/lib/utils/loadOpenApiFromUrl.js
|
|
906073
|
-
var
|
|
906059
|
+
var import_promises124 = require("fs/promises");
|
|
906074
906060
|
var import_path77 = require("path");
|
|
906075
906061
|
var import_tmp_promise15 = __toESM(require_tmp_promise(), 1);
|
|
906076
906062
|
var LoadOpenAPIStatus;
|
|
@@ -906085,7 +906071,7 @@ async function loadOpenAPIFromUrl({ url: url3, logger: logger4 }) {
|
|
|
906085
906071
|
const filePath = (0, import_path77.join)(tmpDir.path, url3.endsWith(".json") ? "openapi.json" : "openapi.yaml");
|
|
906086
906072
|
logger4.debug("tmpDir", tmpDir.path);
|
|
906087
906073
|
logger4.debug("filePath", filePath);
|
|
906088
|
-
await (0,
|
|
906074
|
+
await (0, import_promises124.writeFile)(filePath, data2);
|
|
906089
906075
|
return {
|
|
906090
906076
|
status: LoadOpenAPIStatus.Success,
|
|
906091
906077
|
filePath
|
|
@@ -910325,7 +910311,7 @@ var CliContext = class {
|
|
|
910325
910311
|
if (false) {
|
|
910326
910312
|
this.logger.error("CLI_VERSION is not defined");
|
|
910327
910313
|
}
|
|
910328
|
-
return "4.50.
|
|
910314
|
+
return "4.50.4-1-g8a6fed15293";
|
|
910329
910315
|
}
|
|
910330
910316
|
getCliName() {
|
|
910331
910317
|
if (false) {
|
|
@@ -910611,7 +910597,7 @@ function wrapWorkspaceNameForPrefix(workspaceName) {
|
|
|
910611
910597
|
|
|
910612
910598
|
// ../project-loader/lib/loadProject.js
|
|
910613
910599
|
init_lib6();
|
|
910614
|
-
var
|
|
910600
|
+
var import_promises125 = require("fs/promises");
|
|
910615
910601
|
async function loadProject({ context: context3, nameOverride, ...args }) {
|
|
910616
910602
|
const fernDirectory = await getFernDirectory(nameOverride);
|
|
910617
910603
|
if (fernDirectory == null) {
|
|
@@ -910674,7 +910660,7 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
910674
910660
|
const apisDirectory = join2(fernDirectory, RelativeFilePath2.of(APIS_DIRECTORY));
|
|
910675
910661
|
const apisDirectoryExists = await doesPathExist(apisDirectory);
|
|
910676
910662
|
if (apisDirectoryExists) {
|
|
910677
|
-
const apiDirectoryContents = await (0,
|
|
910663
|
+
const apiDirectoryContents = await (0, import_promises125.readdir)(apisDirectory, { withFileTypes: true });
|
|
910678
910664
|
const apiWorkspaceDirectoryNames = apiDirectoryContents.reduce((all9, item) => {
|
|
910679
910665
|
if (item.isDirectory()) {
|
|
910680
910666
|
all9.push(item.name);
|
|
@@ -910751,11 +910737,11 @@ async function loadProjectAndRegisterWorkspacesWithContext(cliContext, args, reg
|
|
|
910751
910737
|
|
|
910752
910738
|
// src/cliV2.ts
|
|
910753
910739
|
var import_generators_sdk5 = __toESM(require_generators_sdk(), 1);
|
|
910754
|
-
var
|
|
910740
|
+
var import_promises130 = require("fs/promises");
|
|
910755
910741
|
|
|
910756
910742
|
// src/commands/generator-list/getGeneratorList.ts
|
|
910757
910743
|
init_lib4();
|
|
910758
|
-
var
|
|
910744
|
+
var import_promises126 = require("fs/promises");
|
|
910759
910745
|
var GenerationModeFilter = {
|
|
910760
910746
|
GitHub: "github",
|
|
910761
910747
|
Local: "local-file-system",
|
|
@@ -910815,7 +910801,7 @@ async function getGeneratorList({
|
|
|
910815
910801
|
return;
|
|
910816
910802
|
}
|
|
910817
910803
|
try {
|
|
910818
|
-
await (0,
|
|
910804
|
+
await (0, import_promises126.writeFile)(outputLocation, generatorsListYaml);
|
|
910819
910805
|
} catch (error50) {
|
|
910820
910806
|
cliContext.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50);
|
|
910821
910807
|
}
|
|
@@ -910881,7 +910867,7 @@ async function getGeneratorMetadata({
|
|
|
910881
910867
|
}
|
|
910882
910868
|
|
|
910883
910869
|
// src/commands/organization/getOrganization.ts
|
|
910884
|
-
var
|
|
910870
|
+
var import_promises127 = require("fs/promises");
|
|
910885
910871
|
async function getOrganization({
|
|
910886
910872
|
project,
|
|
910887
910873
|
outputLocation,
|
|
@@ -910893,7 +910879,7 @@ async function getOrganization({
|
|
|
910893
910879
|
return;
|
|
910894
910880
|
}
|
|
910895
910881
|
try {
|
|
910896
|
-
await (0,
|
|
910882
|
+
await (0, import_promises127.writeFile)(outputLocation, org);
|
|
910897
910883
|
} catch (error50) {
|
|
910898
910884
|
context3.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50);
|
|
910899
910885
|
}
|
|
@@ -910901,7 +910887,7 @@ async function getOrganization({
|
|
|
910901
910887
|
|
|
910902
910888
|
// src/commands/upgrade/upgradeGenerator.ts
|
|
910903
910889
|
init_lib6();
|
|
910904
|
-
var
|
|
910890
|
+
var import_promises129 = require("fs/promises");
|
|
910905
910891
|
var import_path79 = __toESM(require("path"), 1);
|
|
910906
910892
|
var import_semver16 = __toESM(require_semver2(), 1);
|
|
910907
910893
|
var import_yaml6 = __toESM(require_dist8(), 1);
|
|
@@ -910909,7 +910895,7 @@ var import_yaml6 = __toESM(require_dist8(), 1);
|
|
|
910909
910895
|
// src/commands/upgrade/migrations/loader.ts
|
|
910910
910896
|
init_lib4();
|
|
910911
910897
|
var import_fs31 = require("fs");
|
|
910912
|
-
var
|
|
910898
|
+
var import_promises128 = require("fs/promises");
|
|
910913
910899
|
var import_os15 = require("os");
|
|
910914
910900
|
var import_path78 = require("path");
|
|
910915
910901
|
var import_semver15 = __toESM(require_semver2(), 1);
|
|
@@ -910937,7 +910923,7 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
910937
910923
|
const myPid = String(process.pid);
|
|
910938
910924
|
while (true) {
|
|
910939
910925
|
try {
|
|
910940
|
-
const fh = await (0,
|
|
910926
|
+
const fh = await (0, import_promises128.open)(lockPath, "wx");
|
|
910941
910927
|
await fh.writeFile(myPid);
|
|
910942
910928
|
await fh.close();
|
|
910943
910929
|
const exitHandler = () => {
|
|
@@ -910954,9 +910940,9 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
910954
910940
|
return async () => {
|
|
910955
910941
|
process.removeListener("exit", exitHandler);
|
|
910956
910942
|
try {
|
|
910957
|
-
const currentContent = await (0,
|
|
910943
|
+
const currentContent = await (0, import_promises128.readFile)(lockPath, "utf-8");
|
|
910958
910944
|
if (currentContent.trim() === myPid) {
|
|
910959
|
-
await (0,
|
|
910945
|
+
await (0, import_promises128.unlink)(lockPath);
|
|
910960
910946
|
} else {
|
|
910961
910947
|
logger4.debug(
|
|
910962
910948
|
`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`
|
|
@@ -910972,14 +910958,14 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
910972
910958
|
throw err;
|
|
910973
910959
|
}
|
|
910974
910960
|
try {
|
|
910975
|
-
const lockContent = await (0,
|
|
910961
|
+
const lockContent = await (0, import_promises128.readFile)(lockPath, "utf-8");
|
|
910976
910962
|
const lockPid = Number(lockContent.trim());
|
|
910977
|
-
const lockStat = await (0,
|
|
910963
|
+
const lockStat = await (0, import_promises128.stat)(lockPath);
|
|
910978
910964
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
910979
910965
|
if (lockAge > LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !isProcessAlive(lockPid)) {
|
|
910980
910966
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
910981
910967
|
try {
|
|
910982
|
-
await (0,
|
|
910968
|
+
await (0, import_promises128.unlink)(lockPath);
|
|
910983
910969
|
} catch (unlinkErr) {
|
|
910984
910970
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
910985
910971
|
}
|
|
@@ -911003,7 +910989,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
911003
910989
|
}
|
|
911004
910990
|
migrationsInstallPromise = (async () => {
|
|
911005
910991
|
const cacheDir = getMigrationCacheDir();
|
|
911006
|
-
await (0,
|
|
910992
|
+
await (0, import_promises128.mkdir)(cacheDir, { recursive: true });
|
|
911007
910993
|
const npmCacheDir = (0, import_path78.join)(cacheDir, ".npm-cache");
|
|
911008
910994
|
const packageDir = (0, import_path78.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME2);
|
|
911009
910995
|
const packageJsonPath = (0, import_path78.join)(packageDir, "package.json");
|
|
@@ -911020,7 +911006,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
911020
911006
|
"--no-audit",
|
|
911021
911007
|
"--no-fund"
|
|
911022
911008
|
]);
|
|
911023
|
-
const packageJsonContent = await (0,
|
|
911009
|
+
const packageJsonContent = await (0, import_promises128.readFile)(packageJsonPath, "utf-8");
|
|
911024
911010
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
911025
911011
|
if (packageJson2.main == null) {
|
|
911026
911012
|
throw new Error(`No main field found in package.json for ${MIGRATION_PACKAGE_NAME2}`);
|
|
@@ -911195,7 +911181,7 @@ async function loadAndUpdateGenerators({
|
|
|
911195
911181
|
skippedAutoreleaseDisabled: []
|
|
911196
911182
|
};
|
|
911197
911183
|
}
|
|
911198
|
-
const contents = await (0,
|
|
911184
|
+
const contents = await (0, import_promises129.readFile)(filepath);
|
|
911199
911185
|
context3.logger.debug(`Found generators: ${contents.toString()}`);
|
|
911200
911186
|
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
911201
911187
|
const generatorGroups = parsedDocument.get("groups");
|
|
@@ -911416,7 +911402,7 @@ async function upgradeGenerator({
|
|
|
911416
911402
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
911417
911403
|
});
|
|
911418
911404
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
911419
|
-
await (0,
|
|
911405
|
+
await (0, import_promises129.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
911420
911406
|
}
|
|
911421
911407
|
allSkippedMajorUpgrades.push(...result.skippedMajorUpgrades);
|
|
911422
911408
|
if (result.appliedUpgrades.length > 0) {
|
|
@@ -911814,7 +911800,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
911814
911800
|
}
|
|
911815
911801
|
if (argv.output) {
|
|
911816
911802
|
try {
|
|
911817
|
-
await (0,
|
|
911803
|
+
await (0, import_promises130.writeFile)(argv.output, JSON.stringify(generatorMetadata, null, 2));
|
|
911818
911804
|
} catch (error50) {
|
|
911819
911805
|
cliContext.failAndThrow(
|
|
911820
911806
|
`Could not write file to the specified location: ${argv.output}`,
|
|
@@ -911828,7 +911814,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
911828
911814
|
}
|
|
911829
911815
|
|
|
911830
911816
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
911831
|
-
var
|
|
911817
|
+
var import_promises131 = require("fs/promises");
|
|
911832
911818
|
async function addGeneratorToWorkspaces({
|
|
911833
911819
|
project: { apiWorkspaces },
|
|
911834
911820
|
generatorName,
|
|
@@ -911855,7 +911841,7 @@ async function addGeneratorToWorkspaces({
|
|
|
911855
911841
|
if (absolutePathToGeneratorsConfiguration == null) {
|
|
911856
911842
|
return;
|
|
911857
911843
|
}
|
|
911858
|
-
await (0,
|
|
911844
|
+
await (0, import_promises131.writeFile)(
|
|
911859
911845
|
absolutePathToGeneratorsConfiguration,
|
|
911860
911846
|
"# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(newConfiguration)
|
|
911861
911847
|
);
|
|
@@ -912206,7 +912192,7 @@ async function previewDocsWorkspace({
|
|
|
912206
912192
|
|
|
912207
912193
|
// src/commands/docs-diff/docsDiff.ts
|
|
912208
912194
|
init_lib6();
|
|
912209
|
-
var
|
|
912195
|
+
var import_promises132 = require("fs/promises");
|
|
912210
912196
|
var import_pngjs = __toESM(require_png2(), 1);
|
|
912211
912197
|
async function getSlugForFiles({
|
|
912212
912198
|
previewUrl,
|
|
@@ -912426,8 +912412,8 @@ async function generateComparisons({
|
|
|
912426
912412
|
afterPath,
|
|
912427
912413
|
comparisonBasePath
|
|
912428
912414
|
}) {
|
|
912429
|
-
const beforePng = import_pngjs.PNG.sync.read(await (0,
|
|
912430
|
-
const afterPng = import_pngjs.PNG.sync.read(await (0,
|
|
912415
|
+
const beforePng = import_pngjs.PNG.sync.read(await (0, import_promises132.readFile)(beforePath));
|
|
912416
|
+
const afterPng = import_pngjs.PNG.sync.read(await (0, import_promises132.readFile)(afterPath));
|
|
912431
912417
|
const beforeOriginalHeight = beforePng.height;
|
|
912432
912418
|
const afterOriginalHeight = afterPng.height;
|
|
912433
912419
|
const width = Math.max(beforePng.width, afterPng.width);
|
|
@@ -912465,7 +912451,7 @@ async function generateComparisons({
|
|
|
912465
912451
|
const sideBySide = createSideBySideComparison(croppedBefore, croppedAfter, 20, true);
|
|
912466
912452
|
const outPath = `${base4}-region-${i11 + 1}.png`;
|
|
912467
912453
|
const pngBuffer = import_pngjs.PNG.sync.write(sideBySide);
|
|
912468
|
-
await (0,
|
|
912454
|
+
await (0, import_promises132.writeFile)(outPath, new Uint8Array(pngBuffer));
|
|
912469
912455
|
results.push({ changePercent, boundingBox, comparisonPath: outPath });
|
|
912470
912456
|
}
|
|
912471
912457
|
return results;
|
|
@@ -912540,7 +912526,7 @@ async function docsDiff({
|
|
|
912540
912526
|
outputDir.startsWith("/") ? outputDir : join2(cwd(), RelativeFilePath2.of(outputDir))
|
|
912541
912527
|
);
|
|
912542
912528
|
if (!await doesPathExist(outputPath)) {
|
|
912543
|
-
await (0,
|
|
912529
|
+
await (0, import_promises132.mkdir)(outputPath, { recursive: true });
|
|
912544
912530
|
}
|
|
912545
912531
|
const results = [];
|
|
912546
912532
|
await cliContext.runTask(async (context3) => {
|
|
@@ -916937,7 +916923,7 @@ function renderModuleTree(module4, ctx, writer2, parentPath) {
|
|
|
916937
916923
|
}
|
|
916938
916924
|
|
|
916939
916925
|
// src/commands/docs-md-generate/generateLibraryDocs.ts
|
|
916940
|
-
var
|
|
916926
|
+
var import_promises133 = require("fs/promises");
|
|
916941
916927
|
function createLibraryDocsClient({ token }) {
|
|
916942
916928
|
const defaultOrigin = "https://registry-dev2.buildwithfern.com";
|
|
916943
916929
|
const baseUrl = process.env.FERN_FDR_ORIGIN ?? process.env.OVERRIDE_FDR_ORIGIN ?? defaultOrigin;
|
|
@@ -917051,7 +917037,7 @@ async function generateSingleLibrary({
|
|
|
917051
917037
|
if (config5.lang === "cpp" && config5.config?.doxyfile != null) {
|
|
917052
917038
|
const doxyfilePath = resolve5(docsWorkspace.absoluteFilePath, config5.config.doxyfile);
|
|
917053
917039
|
try {
|
|
917054
|
-
doxyfileContent = await (0,
|
|
917040
|
+
doxyfileContent = await (0, import_promises133.readFile)(doxyfilePath, "utf-8");
|
|
917055
917041
|
} catch {
|
|
917056
917042
|
return interactiveTaskContext.failAndThrow(
|
|
917057
917043
|
`Library '${name2}': Could not read Doxyfile at '${config5.config.doxyfile}' (resolved to ${doxyfilePath})`
|
|
@@ -917312,7 +917298,7 @@ Found ${previewDeployments.length} preview deployment(s):
|
|
|
917312
917298
|
}
|
|
917313
917299
|
|
|
917314
917300
|
// src/commands/downgrade/downgrade.ts
|
|
917315
|
-
var
|
|
917301
|
+
var import_promises134 = require("fs/promises");
|
|
917316
917302
|
|
|
917317
917303
|
// ../../../node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.mjs
|
|
917318
917304
|
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
@@ -918059,13 +918045,13 @@ async function downgrade({
|
|
|
918059
918045
|
const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
|
|
918060
918046
|
draft.version = targetVersion;
|
|
918061
918047
|
});
|
|
918062
|
-
await (0,
|
|
918048
|
+
await (0, import_promises134.writeFile)(projectConfig._absolutePath, ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2)));
|
|
918063
918049
|
cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
|
|
918064
918050
|
}
|
|
918065
918051
|
|
|
918066
918052
|
// src/commands/export/generateOpenAPIForWorkspaces.ts
|
|
918067
918053
|
init_lib6();
|
|
918068
|
-
var
|
|
918054
|
+
var import_promises135 = require("fs/promises");
|
|
918069
918055
|
|
|
918070
918056
|
// src/commands/export/converters/servicesConverter.ts
|
|
918071
918057
|
init_lib4();
|
|
@@ -919396,8 +919382,8 @@ async function generateOpenAPIForWorkspaces({
|
|
|
919396
919382
|
ir: ir15,
|
|
919397
919383
|
mode: "openapi"
|
|
919398
919384
|
});
|
|
919399
|
-
await (0,
|
|
919400
|
-
await (0,
|
|
919385
|
+
await (0, import_promises135.mkdir)(dirname4(outputPath), { recursive: true });
|
|
919386
|
+
await (0, import_promises135.writeFile)(
|
|
919401
919387
|
outputPath,
|
|
919402
919388
|
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent4) : jsYaml.dump(openapi, { indent: indent4 })
|
|
919403
919389
|
);
|
|
@@ -919440,11 +919426,11 @@ var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
|
|
|
919440
919426
|
|
|
919441
919427
|
// src/commands/generate/checkOutputDirectory.ts
|
|
919442
919428
|
init_lib6();
|
|
919443
|
-
var
|
|
919429
|
+
var import_promises138 = require("fs/promises");
|
|
919444
919430
|
|
|
919445
919431
|
// src/persistence/output-directories/getOutputDirectories.ts
|
|
919446
919432
|
init_lib6();
|
|
919447
|
-
var
|
|
919433
|
+
var import_promises136 = require("fs/promises");
|
|
919448
919434
|
|
|
919449
919435
|
// src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
|
|
919450
919436
|
init_lib6();
|
|
@@ -919464,17 +919450,17 @@ async function getOutputDirectories() {
|
|
|
919464
919450
|
if (!doesOutputDirectoriesFileExist) {
|
|
919465
919451
|
return [];
|
|
919466
919452
|
}
|
|
919467
|
-
const outputDirectoriesFileContents = await (0,
|
|
919453
|
+
const outputDirectoriesFileContents = await (0, import_promises136.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
|
|
919468
919454
|
const outputDirectories = JSON.parse(outputDirectoriesFileContents);
|
|
919469
919455
|
return outputDirectories;
|
|
919470
919456
|
}
|
|
919471
919457
|
|
|
919472
919458
|
// src/persistence/output-directories/storeOutputDirectories.ts
|
|
919473
|
-
var
|
|
919459
|
+
var import_promises137 = require("fs/promises");
|
|
919474
919460
|
var import_path82 = __toESM(require("path"), 1);
|
|
919475
919461
|
async function storeOutputDirectories(outputDirectories) {
|
|
919476
|
-
await (0,
|
|
919477
|
-
await (0,
|
|
919462
|
+
await (0, import_promises137.mkdir)(import_path82.default.dirname(getPathToOutputDirectoriesFile()), { recursive: true });
|
|
919463
|
+
await (0, import_promises137.writeFile)(getPathToOutputDirectoriesFile(), JSON.stringify(outputDirectories, null, 2));
|
|
919478
919464
|
}
|
|
919479
919465
|
|
|
919480
919466
|
// src/commands/generate/checkOutputDirectory.ts
|
|
@@ -919496,7 +919482,7 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
|
919496
919482
|
shouldProceed: true
|
|
919497
919483
|
};
|
|
919498
919484
|
}
|
|
919499
|
-
const files = await (0,
|
|
919485
|
+
const files = await (0, import_promises138.readdir)(outputPath);
|
|
919500
919486
|
if (files.length === 0) {
|
|
919501
919487
|
return {
|
|
919502
919488
|
shouldProceed: true
|
|
@@ -919980,15 +919966,14 @@ ${source_default.yellow("?")} Are you sure you want to continue?`,
|
|
|
919980
919966
|
}
|
|
919981
919967
|
let token = null;
|
|
919982
919968
|
if (hasFdrOriginOverride) {
|
|
919983
|
-
const fernToken =
|
|
919969
|
+
const fernToken = await getToken2();
|
|
919984
919970
|
if (!fernToken) {
|
|
919985
|
-
cliContext.failAndThrow(
|
|
919971
|
+
cliContext.failAndThrow(
|
|
919972
|
+
"No token found. Please set the FERN_TOKEN environment variable or run `fern login`."
|
|
919973
|
+
);
|
|
919986
919974
|
return;
|
|
919987
919975
|
}
|
|
919988
|
-
token =
|
|
919989
|
-
type: "organization",
|
|
919990
|
-
value: fernToken
|
|
919991
|
-
};
|
|
919976
|
+
token = fernToken;
|
|
919992
919977
|
} else {
|
|
919993
919978
|
token = await cliContext.runTask(async (context3) => {
|
|
919994
919979
|
return askToLogin(context3);
|
|
@@ -920345,7 +920330,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
920345
920330
|
|
|
920346
920331
|
// src/commands/generate-overrides/compareOpenAPISpecs.ts
|
|
920347
920332
|
init_lib6();
|
|
920348
|
-
var
|
|
920333
|
+
var import_promises139 = require("fs/promises");
|
|
920349
920334
|
async function compareOpenAPISpecs({
|
|
920350
920335
|
originalPath,
|
|
920351
920336
|
modifiedPath,
|
|
@@ -920382,12 +920367,12 @@ async function compareOpenAPISpecs({
|
|
|
920382
920367
|
}
|
|
920383
920368
|
outputPath = join2(dirname4(originalPath), RelativeFilePath2.of(overridesFilename));
|
|
920384
920369
|
}
|
|
920385
|
-
await (0,
|
|
920370
|
+
await (0, import_promises139.writeFile)(outputPath, jsYaml.dump(overrides, { lineWidth: -1, noRefs: true }));
|
|
920386
920371
|
context3.logger.info(`Overrides written to ${outputPath}`);
|
|
920387
920372
|
});
|
|
920388
920373
|
}
|
|
920389
920374
|
async function loadSpec2(filepath, context3) {
|
|
920390
|
-
const contents = await (0,
|
|
920375
|
+
const contents = await (0, import_promises139.readFile)(filepath, "utf8");
|
|
920391
920376
|
try {
|
|
920392
920377
|
return JSON.parse(contents);
|
|
920393
920378
|
} catch {
|
|
@@ -920489,7 +920474,7 @@ function deepEqual(a10, b19) {
|
|
|
920489
920474
|
|
|
920490
920475
|
// src/commands/generate-overrides/writeOverridesForWorkspaces.ts
|
|
920491
920476
|
init_lib6();
|
|
920492
|
-
var
|
|
920477
|
+
var import_promises140 = require("fs/promises");
|
|
920493
920478
|
async function writeOverridesForWorkspaces({
|
|
920494
920479
|
project,
|
|
920495
920480
|
includeModels,
|
|
@@ -920514,7 +920499,7 @@ async function writeOverridesForWorkspaces({
|
|
|
920514
920499
|
async function readExistingOverrides(overridesFilepath, context3) {
|
|
920515
920500
|
let parsedOverrides = null;
|
|
920516
920501
|
try {
|
|
920517
|
-
const contents = (await (0,
|
|
920502
|
+
const contents = (await (0, import_promises140.readFile)(overridesFilepath, "utf8")).toString();
|
|
920518
920503
|
try {
|
|
920519
920504
|
parsedOverrides = JSON.parse(contents);
|
|
920520
920505
|
} catch (err) {
|
|
@@ -920577,7 +920562,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
920577
920562
|
for (const overridesPath of overridesPaths) {
|
|
920578
920563
|
const existingOverrides = await readExistingOverrides(overridesPath, context3);
|
|
920579
920564
|
const content5 = generateOverridesContent({ ir: ir15, existingOverrides, includeModels, context: context3 });
|
|
920580
|
-
await (0,
|
|
920565
|
+
await (0, import_promises140.writeFile)(overridesPath, jsYaml.dump(content5));
|
|
920581
920566
|
}
|
|
920582
920567
|
} else {
|
|
920583
920568
|
const content5 = generateOverridesContent({ ir: ir15, existingOverrides: {}, includeModels, context: context3 });
|
|
@@ -920591,7 +920576,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
920591
920576
|
overridesFilename = `${nameWithoutExt}-overrides${extension5}`;
|
|
920592
920577
|
}
|
|
920593
920578
|
}
|
|
920594
|
-
await (0,
|
|
920579
|
+
await (0, import_promises140.writeFile)(
|
|
920595
920580
|
join2(dirname4(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
|
|
920596
920581
|
jsYaml.dump(content5)
|
|
920597
920582
|
);
|
|
@@ -921005,7 +920990,7 @@ function convertIRtoJsonSchema(args) {
|
|
|
921005
920990
|
}
|
|
921006
920991
|
|
|
921007
920992
|
// src/commands/jsonschema/generateJsonschemaForWorkspace.ts
|
|
921008
|
-
var
|
|
920993
|
+
var import_promises141 = require("fs/promises");
|
|
921009
920994
|
async function generateJsonschemaForWorkspaces({
|
|
921010
920995
|
typeLocator,
|
|
921011
920996
|
project,
|
|
@@ -921053,9 +921038,9 @@ async function generateJsonschemaForWorkspaces({
|
|
|
921053
921038
|
context: context3
|
|
921054
921039
|
});
|
|
921055
921040
|
if (!await doesPathExist(dirname4(jsonschemaFilepath))) {
|
|
921056
|
-
await (0,
|
|
921041
|
+
await (0, import_promises141.mkdir)(dirname4(jsonschemaFilepath), { recursive: true });
|
|
921057
921042
|
}
|
|
921058
|
-
await (0,
|
|
921043
|
+
await (0, import_promises141.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
|
|
921059
921044
|
context3.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
|
|
921060
921045
|
});
|
|
921061
921046
|
})
|
|
@@ -921064,7 +921049,7 @@ async function generateJsonschemaForWorkspaces({
|
|
|
921064
921049
|
|
|
921065
921050
|
// src/commands/merge/mergeOpenAPIWithOverrides.ts
|
|
921066
921051
|
init_lib6();
|
|
921067
|
-
var
|
|
921052
|
+
var import_promises142 = require("fs/promises");
|
|
921068
921053
|
var HTTP_METHODS2 = /* @__PURE__ */ new Set(["get", "put", "post", "delete", "options", "head", "patch", "trace"]);
|
|
921069
921054
|
async function mergeOpenAPIWithOverrides({
|
|
921070
921055
|
openapiPath,
|
|
@@ -921085,12 +921070,12 @@ async function mergeOpenAPIWithOverrides({
|
|
|
921085
921070
|
const merged = mergeExamplesIntoSpec(openapi, overrides, context3);
|
|
921086
921071
|
const isJson = outputPath.endsWith(".json");
|
|
921087
921072
|
const output2 = isJson ? JSON.stringify(merged, null, 2) : jsYaml.dump(merged, { lineWidth: -1, noRefs: true });
|
|
921088
|
-
await (0,
|
|
921073
|
+
await (0, import_promises142.writeFile)(outputPath, output2);
|
|
921089
921074
|
context3.logger.info(`Merged output written to ${outputPath}`);
|
|
921090
921075
|
});
|
|
921091
921076
|
}
|
|
921092
921077
|
async function loadYamlOrJson(filepath, context3) {
|
|
921093
|
-
const contents = await (0,
|
|
921078
|
+
const contents = await (0, import_promises142.readFile)(filepath, "utf8");
|
|
921094
921079
|
try {
|
|
921095
921080
|
return JSON.parse(contents);
|
|
921096
921081
|
} catch {
|
|
@@ -921718,7 +921703,7 @@ async function mockServer({
|
|
|
921718
921703
|
|
|
921719
921704
|
// src/commands/register/registerWorkspacesV1.ts
|
|
921720
921705
|
var import_fiddle_sdk8 = __toESM(require_fiddle_sdk(), 1);
|
|
921721
|
-
var
|
|
921706
|
+
var import_promises143 = require("fs/promises");
|
|
921722
921707
|
var import_path88 = __toESM(require("path"), 1);
|
|
921723
921708
|
var import_tmp_promise16 = __toESM(require_tmp_promise(), 1);
|
|
921724
921709
|
async function registerWorkspacesV1({
|
|
@@ -921767,7 +921752,7 @@ async function registerWorkspacesV1({
|
|
|
921767
921752
|
context3.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
921768
921753
|
await Zn3({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
|
|
921769
921754
|
context3.logger.info("Uploading definition...");
|
|
921770
|
-
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
921755
|
+
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises143.readFile)(tarPath));
|
|
921771
921756
|
context3.logger.info(
|
|
921772
921757
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
921773
921758
|
);
|
|
@@ -922224,7 +922209,7 @@ async function sdkPreview({
|
|
|
922224
922209
|
}
|
|
922225
922210
|
|
|
922226
922211
|
// src/commands/self-update/selfUpdate.ts
|
|
922227
|
-
var
|
|
922212
|
+
var import_promises144 = require("fs/promises");
|
|
922228
922213
|
var import_path89 = require("path");
|
|
922229
922214
|
async function getPackageManagerBinDir(logger4, pm) {
|
|
922230
922215
|
let command3;
|
|
@@ -922270,7 +922255,7 @@ async function detectInstallationMethod(logger4) {
|
|
|
922270
922255
|
logger4.debug(`Found fern at: ${fernPath}`);
|
|
922271
922256
|
let resolvedPath;
|
|
922272
922257
|
try {
|
|
922273
|
-
resolvedPath = await (0,
|
|
922258
|
+
resolvedPath = await (0, import_promises144.realpath)(fernPath);
|
|
922274
922259
|
logger4.debug(`Resolved to: ${resolvedPath}`);
|
|
922275
922260
|
} catch (error50) {
|
|
922276
922261
|
logger4.debug(`Failed to resolve symlink: ${error50}`);
|
|
@@ -922552,21 +922537,21 @@ async function generateToken({
|
|
|
922552
922537
|
// src/commands/upgrade/updateApiSpec.ts
|
|
922553
922538
|
init_lib6();
|
|
922554
922539
|
var fs26 = __toESM(require("fs"), 1);
|
|
922555
|
-
var
|
|
922540
|
+
var import_promises145 = require("fs/promises");
|
|
922556
922541
|
init_graphql();
|
|
922557
922542
|
var import_stream16 = require("stream");
|
|
922558
|
-
var
|
|
922543
|
+
var import_promises146 = require("stream/promises");
|
|
922559
922544
|
async function fetchAndWriteFile(url3, path97, logger4, indent4) {
|
|
922560
922545
|
const resp = await fetch(url3);
|
|
922561
922546
|
if (resp.ok && resp.body) {
|
|
922562
922547
|
logger4.debug("Origin successfully fetched, writing to file");
|
|
922563
922548
|
const fileStream = fs26.createWriteStream(path97);
|
|
922564
|
-
await (0,
|
|
922565
|
-
const fileContents = await (0,
|
|
922549
|
+
await (0, import_promises146.finished)(import_stream16.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
922550
|
+
const fileContents = await (0, import_promises145.readFile)(path97, "utf8");
|
|
922566
922551
|
try {
|
|
922567
|
-
await (0,
|
|
922552
|
+
await (0, import_promises145.writeFile)(path97, JSON.stringify(JSON.parse(fileContents), void 0, indent4), "utf8");
|
|
922568
922553
|
} catch (e6) {
|
|
922569
|
-
await (0,
|
|
922554
|
+
await (0, import_promises145.writeFile)(path97, jsYaml.dump(jsYaml.load(fileContents), { indent: indent4 }), "utf8");
|
|
922570
922555
|
}
|
|
922571
922556
|
logger4.debug("File written successfully");
|
|
922572
922557
|
}
|
|
@@ -922716,14 +922701,14 @@ async function tryDirectJSONFetch(url3, logger4) {
|
|
|
922716
922701
|
async function fetchGraphQLSchemaWithAutoDetection(url3, path97, logger4) {
|
|
922717
922702
|
const postResult = await tryGraphQLIntrospection(url3, logger4);
|
|
922718
922703
|
if (postResult.success) {
|
|
922719
|
-
await (0,
|
|
922704
|
+
await (0, import_promises145.writeFile)(path97, postResult.result, "utf8");
|
|
922720
922705
|
logger4.info("Successfully fetched GraphQL schema using POST introspection");
|
|
922721
922706
|
return;
|
|
922722
922707
|
}
|
|
922723
922708
|
logger4.debug(`POST introspection failed: ${postResult.error}`);
|
|
922724
922709
|
const getResult = await tryDirectJSONFetch(url3, logger4);
|
|
922725
922710
|
if (getResult.success) {
|
|
922726
|
-
await (0,
|
|
922711
|
+
await (0, import_promises145.writeFile)(path97, getResult.result, "utf8");
|
|
922727
922712
|
logger4.info("Successfully fetched GraphQL schema using direct JSON fetch");
|
|
922728
922713
|
return;
|
|
922729
922714
|
}
|
|
@@ -922832,7 +922817,7 @@ async function processDefinitions({
|
|
|
922832
922817
|
init_lib4();
|
|
922833
922818
|
|
|
922834
922819
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
922835
|
-
var
|
|
922820
|
+
var import_promises147 = require("fs/promises");
|
|
922836
922821
|
|
|
922837
922822
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
922838
922823
|
init_lib6();
|
|
@@ -922868,7 +922853,7 @@ var migration = {
|
|
|
922868
922853
|
try {
|
|
922869
922854
|
const fileContents = await getFileContents(yamlFilepath);
|
|
922870
922855
|
const newContents = addDiscriminantToFile(fileContents);
|
|
922871
|
-
await (0,
|
|
922856
|
+
await (0, import_promises147.writeFile)(yamlFilepath, newContents);
|
|
922872
922857
|
} catch (error50) {
|
|
922873
922858
|
context3.failAndThrow("Failed to migrate " + yamlFilepath, error50);
|
|
922874
922859
|
}
|
|
@@ -922876,7 +922861,7 @@ var migration = {
|
|
|
922876
922861
|
}
|
|
922877
922862
|
};
|
|
922878
922863
|
async function getFileContents(filepath) {
|
|
922879
|
-
const buffer = await (0,
|
|
922864
|
+
const buffer = await (0, import_promises147.readFile)(filepath);
|
|
922880
922865
|
return buffer.toString();
|
|
922881
922866
|
}
|
|
922882
922867
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -922905,7 +922890,7 @@ var versionMigrations = {
|
|
|
922905
922890
|
var __default = versionMigrations;
|
|
922906
922891
|
|
|
922907
922892
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
922908
|
-
var
|
|
922893
|
+
var import_promises148 = require("fs/promises");
|
|
922909
922894
|
var import_yaml7 = __toESM(require_dist8(), 1);
|
|
922910
922895
|
|
|
922911
922896
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
@@ -922948,7 +922933,7 @@ var migration2 = {
|
|
|
922948
922933
|
}
|
|
922949
922934
|
};
|
|
922950
922935
|
async function migrateFile(filepath, context3) {
|
|
922951
|
-
const contents = await (0,
|
|
922936
|
+
const contents = await (0, import_promises148.readFile)(filepath);
|
|
922952
922937
|
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
922953
922938
|
const types4 = parsedDocument.get("types");
|
|
922954
922939
|
if (types4 == null) {
|
|
@@ -922980,7 +922965,7 @@ async function migrateFile(filepath, context3) {
|
|
|
922980
922965
|
}
|
|
922981
922966
|
}
|
|
922982
922967
|
}
|
|
922983
|
-
await (0,
|
|
922968
|
+
await (0, import_promises148.writeFile)(filepath, parsedDocument.toString());
|
|
922984
922969
|
}
|
|
922985
922970
|
|
|
922986
922971
|
// ../cli-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -922991,7 +922976,7 @@ var versionMigrations2 = {
|
|
|
922991
922976
|
var __default2 = versionMigrations2;
|
|
922992
922977
|
|
|
922993
922978
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
922994
|
-
var
|
|
922979
|
+
var import_promises149 = require("fs/promises");
|
|
922995
922980
|
var import_yaml8 = __toESM(require_dist8(), 1);
|
|
922996
922981
|
|
|
922997
922982
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
@@ -923034,7 +923019,7 @@ var migration3 = {
|
|
|
923034
923019
|
}
|
|
923035
923020
|
};
|
|
923036
923021
|
async function migrateGeneratorsYml(filepath, context3) {
|
|
923037
|
-
const contents = await (0,
|
|
923022
|
+
const contents = await (0, import_promises149.readFile)(filepath);
|
|
923038
923023
|
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
923039
923024
|
const draftGenerators = parsedDocument.get("draft");
|
|
923040
923025
|
if (draftGenerators == null) {
|
|
@@ -923061,7 +923046,7 @@ async function migrateGeneratorsYml(filepath, context3) {
|
|
|
923061
923046
|
draftGenerator.set("output-path", name2.value.includes("openapi") ? "./generated-openapi" : name2.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
923062
923047
|
}
|
|
923063
923048
|
});
|
|
923064
|
-
await (0,
|
|
923049
|
+
await (0, import_promises149.writeFile)(filepath, parsedDocument.toString());
|
|
923065
923050
|
}
|
|
923066
923051
|
|
|
923067
923052
|
// ../cli-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -923072,7 +923057,7 @@ var versionMigrations3 = {
|
|
|
923072
923057
|
var __default3 = versionMigrations3;
|
|
923073
923058
|
|
|
923074
923059
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
923075
|
-
var
|
|
923060
|
+
var import_promises150 = require("fs/promises");
|
|
923076
923061
|
var import_yaml9 = __toESM(require_dist8(), 1);
|
|
923077
923062
|
|
|
923078
923063
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
@@ -923115,7 +923100,7 @@ var migration4 = {
|
|
|
923115
923100
|
}
|
|
923116
923101
|
};
|
|
923117
923102
|
async function migrateFile2(filepath, context3) {
|
|
923118
|
-
const contents = await (0,
|
|
923103
|
+
const contents = await (0, import_promises150.readFile)(filepath);
|
|
923119
923104
|
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
923120
923105
|
const addType = (typeName, typeDeclaration2) => {
|
|
923121
923106
|
const types4 = parsedDocument.get("types");
|
|
@@ -923159,7 +923144,7 @@ async function migrateFile2(filepath, context3) {
|
|
|
923159
923144
|
}
|
|
923160
923145
|
}
|
|
923161
923146
|
}
|
|
923162
|
-
await (0,
|
|
923147
|
+
await (0, import_promises150.writeFile)(filepath, parsedDocument.toString());
|
|
923163
923148
|
}
|
|
923164
923149
|
|
|
923165
923150
|
// ../cli-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -923170,7 +923155,7 @@ var versionMigrations4 = {
|
|
|
923170
923155
|
var __default4 = versionMigrations4;
|
|
923171
923156
|
|
|
923172
923157
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
923173
|
-
var
|
|
923158
|
+
var import_promises151 = require("fs/promises");
|
|
923174
923159
|
var import_yaml10 = __toESM(require_dist8(), 1);
|
|
923175
923160
|
|
|
923176
923161
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
@@ -923213,7 +923198,7 @@ var migration5 = {
|
|
|
923213
923198
|
}
|
|
923214
923199
|
};
|
|
923215
923200
|
async function migrateGeneratorsYml2(filepath, context3) {
|
|
923216
|
-
const contents = await (0,
|
|
923201
|
+
const contents = await (0, import_promises151.readFile)(filepath);
|
|
923217
923202
|
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
923218
923203
|
const releaseGenerators = parsedDocument.get("release");
|
|
923219
923204
|
if (releaseGenerators == null) {
|
|
@@ -923251,7 +923236,7 @@ async function migrateGeneratorsYml2(filepath, context3) {
|
|
|
923251
923236
|
}
|
|
923252
923237
|
releaseGenerator.delete("outputs");
|
|
923253
923238
|
});
|
|
923254
|
-
await (0,
|
|
923239
|
+
await (0, import_promises151.writeFile)(filepath, parsedDocument.toString());
|
|
923255
923240
|
}
|
|
923256
923241
|
|
|
923257
923242
|
// ../cli-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -923262,7 +923247,7 @@ var versionMigrations5 = {
|
|
|
923262
923247
|
var __default5 = versionMigrations5;
|
|
923263
923248
|
|
|
923264
923249
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
923265
|
-
var
|
|
923250
|
+
var import_promises152 = require("fs/promises");
|
|
923266
923251
|
|
|
923267
923252
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
923268
923253
|
init_lib6();
|
|
@@ -923295,9 +923280,9 @@ var migration6 = {
|
|
|
923295
923280
|
run: async ({ context: context3 }) => {
|
|
923296
923281
|
const yamlFiles = await getAllYamlFiles4(context3);
|
|
923297
923282
|
for (const filepath of yamlFiles) {
|
|
923298
|
-
const contents = await (0,
|
|
923283
|
+
const contents = await (0, import_promises152.readFile)(filepath);
|
|
923299
923284
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
923300
|
-
await (0,
|
|
923285
|
+
await (0, import_promises152.writeFile)(filepath, newContents);
|
|
923301
923286
|
}
|
|
923302
923287
|
}
|
|
923303
923288
|
};
|
|
@@ -923310,7 +923295,7 @@ var versionMigrations6 = {
|
|
|
923310
923295
|
var __default6 = versionMigrations6;
|
|
923311
923296
|
|
|
923312
923297
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
923313
|
-
var
|
|
923298
|
+
var import_promises153 = require("fs/promises");
|
|
923314
923299
|
|
|
923315
923300
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
923316
923301
|
init_lib6();
|
|
@@ -923343,9 +923328,9 @@ var migration7 = {
|
|
|
923343
923328
|
run: async ({ context: context3 }) => {
|
|
923344
923329
|
const yamlFiles = await getAllRootApiYamlFiles(context3);
|
|
923345
923330
|
for (const filepath of yamlFiles) {
|
|
923346
|
-
const contents = await (0,
|
|
923331
|
+
const contents = await (0, import_promises153.readFile)(filepath);
|
|
923347
923332
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
923348
|
-
await (0,
|
|
923333
|
+
await (0, import_promises153.writeFile)(filepath, newContents);
|
|
923349
923334
|
}
|
|
923350
923335
|
}
|
|
923351
923336
|
};
|
|
@@ -923359,7 +923344,7 @@ var __default7 = versionMigrations7;
|
|
|
923359
923344
|
|
|
923360
923345
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
923361
923346
|
init_lib4();
|
|
923362
|
-
var
|
|
923347
|
+
var import_promises154 = require("fs/promises");
|
|
923363
923348
|
|
|
923364
923349
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
923365
923350
|
init_lib6();
|
|
@@ -923468,7 +923453,7 @@ var migration8 = {
|
|
|
923468
923453
|
}
|
|
923469
923454
|
};
|
|
923470
923455
|
async function migrateGeneratorsYml3(filepath) {
|
|
923471
|
-
const contentsStr = await (0,
|
|
923456
|
+
const contentsStr = await (0, import_promises154.readFile)(filepath);
|
|
923472
923457
|
const contents = jsYaml.load(contentsStr.toString());
|
|
923473
923458
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
923474
923459
|
let newGeneratorsConfiguration = {};
|
|
@@ -923486,7 +923471,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
923486
923471
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
923487
923472
|
};
|
|
923488
923473
|
}
|
|
923489
|
-
await (0,
|
|
923474
|
+
await (0, import_promises154.writeFile)(filepath, jsYaml.dump(newGeneratorsConfiguration));
|
|
923490
923475
|
}
|
|
923491
923476
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
923492
923477
|
const newSchema = {
|
|
@@ -923561,7 +923546,7 @@ var versionMigrations8 = {
|
|
|
923561
923546
|
var __default8 = versionMigrations8;
|
|
923562
923547
|
|
|
923563
923548
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
923564
|
-
var
|
|
923549
|
+
var import_promises155 = require("fs/promises");
|
|
923565
923550
|
var import_yaml11 = __toESM(require_dist8(), 1);
|
|
923566
923551
|
|
|
923567
923552
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
@@ -923604,7 +923589,7 @@ var migration9 = {
|
|
|
923604
923589
|
}
|
|
923605
923590
|
};
|
|
923606
923591
|
async function migrateRootApiFile(filepath) {
|
|
923607
|
-
const contents = await (0,
|
|
923592
|
+
const contents = await (0, import_promises155.readFile)(filepath);
|
|
923608
923593
|
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
923609
923594
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
923610
923595
|
if (errorDiscriminant == null || !import_yaml11.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
@@ -923615,7 +923600,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
923615
923600
|
"property-name": errorDiscriminant.value
|
|
923616
923601
|
});
|
|
923617
923602
|
parsedDocument.delete("error-discriminant");
|
|
923618
|
-
await (0,
|
|
923603
|
+
await (0, import_promises155.writeFile)(filepath, parsedDocument.toString());
|
|
923619
923604
|
}
|
|
923620
923605
|
|
|
923621
923606
|
// ../cli-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -923626,7 +923611,7 @@ var versionMigrations9 = {
|
|
|
923626
923611
|
var __default9 = versionMigrations9;
|
|
923627
923612
|
|
|
923628
923613
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
923629
|
-
var
|
|
923614
|
+
var import_promises156 = require("fs/promises");
|
|
923630
923615
|
var import_yaml12 = __toESM(require_dist8(), 1);
|
|
923631
923616
|
|
|
923632
923617
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
@@ -923669,7 +923654,7 @@ var migration10 = {
|
|
|
923669
923654
|
}
|
|
923670
923655
|
};
|
|
923671
923656
|
async function migrateYamlFile(filepath, context3) {
|
|
923672
|
-
const contents = await (0,
|
|
923657
|
+
const contents = await (0, import_promises156.readFile)(filepath);
|
|
923673
923658
|
const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
|
|
923674
923659
|
const services = parsedDocument.get("services");
|
|
923675
923660
|
if (services == null) {
|
|
@@ -923709,7 +923694,7 @@ async function migrateYamlFile(filepath, context3) {
|
|
|
923709
923694
|
context3.failWithoutThrowing("Failed to convert endpoint", e6);
|
|
923710
923695
|
}
|
|
923711
923696
|
}
|
|
923712
|
-
await (0,
|
|
923697
|
+
await (0, import_promises156.writeFile)(filepath, parsedDocument.toString());
|
|
923713
923698
|
}
|
|
923714
923699
|
}
|
|
923715
923700
|
function convertEndpoint4({ document: document4, endpoint: endpoint3 }) {
|
|
@@ -923788,7 +923773,7 @@ var versionMigrations10 = {
|
|
|
923788
923773
|
var __default10 = versionMigrations10;
|
|
923789
923774
|
|
|
923790
923775
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
923791
|
-
var
|
|
923776
|
+
var import_promises157 = require("fs/promises");
|
|
923792
923777
|
var import_yaml13 = __toESM(require_dist8(), 1);
|
|
923793
923778
|
|
|
923794
923779
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
@@ -923831,7 +923816,7 @@ var migration11 = {
|
|
|
923831
923816
|
}
|
|
923832
923817
|
};
|
|
923833
923818
|
async function migrateYamlFile2(filepath, context3) {
|
|
923834
|
-
const contents = await (0,
|
|
923819
|
+
const contents = await (0, import_promises157.readFile)(filepath);
|
|
923835
923820
|
const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
|
|
923836
923821
|
const types4 = parsedDocument.get("types");
|
|
923837
923822
|
if (types4 == null) {
|
|
@@ -923857,7 +923842,7 @@ async function migrateYamlFile2(filepath, context3) {
|
|
|
923857
923842
|
examples.set(i11, { value });
|
|
923858
923843
|
}
|
|
923859
923844
|
}
|
|
923860
|
-
await (0,
|
|
923845
|
+
await (0, import_promises157.writeFile)(filepath, parsedDocument.toString());
|
|
923861
923846
|
}
|
|
923862
923847
|
|
|
923863
923848
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -923868,7 +923853,7 @@ var versionMigrations11 = {
|
|
|
923868
923853
|
var __default11 = versionMigrations11;
|
|
923869
923854
|
|
|
923870
923855
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
923871
|
-
var
|
|
923856
|
+
var import_promises158 = require("fs/promises");
|
|
923872
923857
|
var import_yaml14 = __toESM(require_dist8(), 1);
|
|
923873
923858
|
|
|
923874
923859
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
@@ -923911,7 +923896,7 @@ var migration12 = {
|
|
|
923911
923896
|
}
|
|
923912
923897
|
};
|
|
923913
923898
|
async function migrateYamlFile3(filepath, context3) {
|
|
923914
|
-
const contents = await (0,
|
|
923899
|
+
const contents = await (0, import_promises158.readFile)(filepath);
|
|
923915
923900
|
const parsedDocument = import_yaml14.default.parseDocument(contents.toString());
|
|
923916
923901
|
if (!import_yaml14.default.isMap(parsedDocument.contents)) {
|
|
923917
923902
|
return context3.failAndThrow("File is not a map");
|
|
@@ -923941,7 +923926,7 @@ async function migrateYamlFile3(filepath, context3) {
|
|
|
923941
923926
|
pair.value = firstService.value;
|
|
923942
923927
|
}
|
|
923943
923928
|
}
|
|
923944
|
-
await (0,
|
|
923929
|
+
await (0, import_promises158.writeFile)(filepath, parsedDocument.toString());
|
|
923945
923930
|
}
|
|
923946
923931
|
|
|
923947
923932
|
// ../cli-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -923952,7 +923937,7 @@ var versionMigrations12 = {
|
|
|
923952
923937
|
var __default12 = versionMigrations12;
|
|
923953
923938
|
|
|
923954
923939
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
923955
|
-
var
|
|
923940
|
+
var import_promises159 = require("fs/promises");
|
|
923956
923941
|
var import_yaml15 = __toESM(require_dist8(), 1);
|
|
923957
923942
|
|
|
923958
923943
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
@@ -923995,7 +923980,7 @@ var migration13 = {
|
|
|
923995
923980
|
}
|
|
923996
923981
|
};
|
|
923997
923982
|
async function migrateYamlFile4(filepath, context3) {
|
|
923998
|
-
const contents = await (0,
|
|
923983
|
+
const contents = await (0, import_promises159.readFile)(filepath);
|
|
923999
923984
|
const parsedDocument = import_yaml15.default.parseDocument(contents.toString());
|
|
924000
923985
|
if (!import_yaml15.default.isMap(parsedDocument.contents)) {
|
|
924001
923986
|
return context3.failAndThrow("File is not a map");
|
|
@@ -924014,7 +923999,7 @@ async function migrateYamlFile4(filepath, context3) {
|
|
|
924014
923999
|
}
|
|
924015
924000
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
924016
924001
|
parsedDocument.contents.items.unshift(docsPair);
|
|
924017
|
-
await (0,
|
|
924002
|
+
await (0, import_promises159.writeFile)(filepath, parsedDocument.toString());
|
|
924018
924003
|
}
|
|
924019
924004
|
|
|
924020
924005
|
// ../cli-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -924025,7 +924010,7 @@ var versionMigrations13 = {
|
|
|
924025
924010
|
var __default13 = versionMigrations13;
|
|
924026
924011
|
|
|
924027
924012
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
924028
|
-
var
|
|
924013
|
+
var import_promises160 = require("fs/promises");
|
|
924029
924014
|
|
|
924030
924015
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
924031
924016
|
init_lib6();
|
|
@@ -924067,14 +924052,14 @@ var migration14 = {
|
|
|
924067
924052
|
}
|
|
924068
924053
|
};
|
|
924069
924054
|
async function migrateYamlFile5(filepath) {
|
|
924070
|
-
const contents = await (0,
|
|
924055
|
+
const contents = await (0, import_promises160.readFile)(filepath);
|
|
924071
924056
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
924072
924057
|
const regex6 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
924073
924058
|
const updatedSnapshot = contents.toString().replace(regex6, (_match, _prefix, domain3) => {
|
|
924074
924059
|
return `docs:
|
|
924075
924060
|
domain: "${domain3}.${domainSuffix}"`;
|
|
924076
924061
|
});
|
|
924077
|
-
await (0,
|
|
924062
|
+
await (0, import_promises160.writeFile)(filepath, updatedSnapshot.toString());
|
|
924078
924063
|
}
|
|
924079
924064
|
|
|
924080
924065
|
// ../cli-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -924094,10 +924079,10 @@ var LegacyDocsSerializers = __toESM(require_serialization5(), 1);
|
|
|
924094
924079
|
|
|
924095
924080
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
924096
924081
|
init_lib6();
|
|
924097
|
-
var
|
|
924082
|
+
var import_promises161 = require("fs/promises");
|
|
924098
924083
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
924099
924084
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
924100
|
-
const contentsStr = await (0,
|
|
924085
|
+
const contentsStr = await (0, import_promises161.readFile)(filepath);
|
|
924101
924086
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
924102
924087
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
924103
924088
|
if (result.ok) {
|
|
@@ -924116,7 +924101,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
924116
924101
|
|
|
924117
924102
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
924118
924103
|
init_lib6();
|
|
924119
|
-
var
|
|
924104
|
+
var import_promises163 = require("fs/promises");
|
|
924120
924105
|
|
|
924121
924106
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
924122
924107
|
function convertLegacyDocsConfig({ docsConfiguration, docsURLs, apiName }) {
|
|
@@ -924299,10 +924284,10 @@ __export(legacy_exports, {
|
|
|
924299
924284
|
|
|
924300
924285
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
924301
924286
|
init_lib6();
|
|
924302
|
-
var
|
|
924287
|
+
var import_promises162 = require("fs/promises");
|
|
924303
924288
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
924304
924289
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
924305
|
-
const contentsStr = await (0,
|
|
924290
|
+
const contentsStr = await (0, import_promises162.readFile)(filepath);
|
|
924306
924291
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
924307
924292
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
924308
924293
|
if (result.success) {
|
|
@@ -924332,7 +924317,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
924332
924317
|
var APIS_DIRECTORY2 = "apis";
|
|
924333
924318
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
924334
924319
|
const absolutePathToApisDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY2));
|
|
924335
|
-
await (0,
|
|
924320
|
+
await (0, import_promises163.mkdir)(absolutePathToApisDirectory);
|
|
924336
924321
|
for (const workspace of workspaces) {
|
|
924337
924322
|
const absolutePathToWorkspace = join2(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
924338
924323
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -924340,11 +924325,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
924340
924325
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
924341
924326
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
924342
924327
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
924343
|
-
await (0,
|
|
924328
|
+
await (0, import_promises163.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
924344
924329
|
}
|
|
924345
924330
|
const absolutePathToNestedWorkspace = join2(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
924346
924331
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
924347
|
-
await (0,
|
|
924332
|
+
await (0, import_promises163.rm)(absolutePathToWorkspace, { recursive: true });
|
|
924348
924333
|
}
|
|
924349
924334
|
}
|
|
924350
924335
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -924357,7 +924342,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
924357
924342
|
generatorsConfiguration,
|
|
924358
924343
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
924359
924344
|
});
|
|
924360
|
-
await (0,
|
|
924345
|
+
await (0, import_promises163.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
924361
924346
|
return convertedResponse.docsURLs;
|
|
924362
924347
|
}
|
|
924363
924348
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -924371,20 +924356,20 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
924371
924356
|
apiName
|
|
924372
924357
|
});
|
|
924373
924358
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
924374
|
-
await (0,
|
|
924359
|
+
await (0, import_promises163.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
924375
924360
|
}
|
|
924376
924361
|
|
|
924377
924362
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
924378
924363
|
init_lib6();
|
|
924379
|
-
var
|
|
924364
|
+
var import_promises164 = require("fs/promises");
|
|
924380
924365
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
924381
924366
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
924382
924367
|
await migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs });
|
|
924383
924368
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
924384
924369
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
924385
924370
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
924386
|
-
await (0,
|
|
924387
|
-
await (0,
|
|
924371
|
+
await (0, import_promises164.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
924372
|
+
await (0, import_promises164.rm)(absolutePathToWorkspace, { recursive: true });
|
|
924388
924373
|
}
|
|
924389
924374
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
924390
924375
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -924397,7 +924382,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
924397
924382
|
apiName: void 0
|
|
924398
924383
|
});
|
|
924399
924384
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
924400
|
-
await (0,
|
|
924385
|
+
await (0, import_promises164.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
924401
924386
|
}
|
|
924402
924387
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
924403
924388
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -924409,23 +924394,23 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
924409
924394
|
generatorsConfiguration,
|
|
924410
924395
|
pathModificationStrategy: "MoveUp"
|
|
924411
924396
|
});
|
|
924412
|
-
await (0,
|
|
924397
|
+
await (0, import_promises164.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
924413
924398
|
return convertedResponse.docsURLs;
|
|
924414
924399
|
}
|
|
924415
924400
|
|
|
924416
924401
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
924417
924402
|
init_lib6();
|
|
924418
|
-
var
|
|
924403
|
+
var import_promises165 = require("fs/promises");
|
|
924419
924404
|
var APIS_DIRECTORY3 = "apis";
|
|
924420
924405
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
924421
924406
|
const absolutePathToApisDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY3));
|
|
924422
|
-
await (0,
|
|
924407
|
+
await (0, import_promises165.mkdir)(absolutePathToApisDirectory);
|
|
924423
924408
|
for (const workspace of workspaces) {
|
|
924424
924409
|
const absolutePathToWorkspace = join2(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
924425
924410
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
924426
924411
|
const absolutePathToNestedWorkspace = join2(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
924427
924412
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
924428
|
-
await (0,
|
|
924413
|
+
await (0, import_promises165.rm)(absolutePathToWorkspace, { recursive: true });
|
|
924429
924414
|
}
|
|
924430
924415
|
}
|
|
924431
924416
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -924438,16 +924423,16 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
924438
924423
|
generatorsConfiguration,
|
|
924439
924424
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
924440
924425
|
});
|
|
924441
|
-
await (0,
|
|
924426
|
+
await (0, import_promises165.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
924442
924427
|
}
|
|
924443
924428
|
|
|
924444
924429
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
924445
924430
|
init_lib6();
|
|
924446
|
-
var
|
|
924431
|
+
var import_promises166 = require("fs/promises");
|
|
924447
924432
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
924448
924433
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
924449
924434
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
924450
|
-
await (0,
|
|
924435
|
+
await (0, import_promises166.rm)(absolutePathToWorkspace, { recursive: true });
|
|
924451
924436
|
}
|
|
924452
924437
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
924453
924438
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -924459,7 +924444,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
924459
924444
|
generatorsConfiguration,
|
|
924460
924445
|
pathModificationStrategy: "MoveUp"
|
|
924461
924446
|
});
|
|
924462
|
-
await (0,
|
|
924447
|
+
await (0, import_promises166.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
924463
924448
|
}
|
|
924464
924449
|
|
|
924465
924450
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -924537,7 +924522,7 @@ var __default15 = versionMigrations15;
|
|
|
924537
924522
|
|
|
924538
924523
|
// ../cli-migrations/lib/migrations/0.41.0-rc0/require-generators-yml/migration.js
|
|
924539
924524
|
init_lib6();
|
|
924540
|
-
var
|
|
924525
|
+
var import_promises167 = require("fs/promises");
|
|
924541
924526
|
var import_yaml16 = __toESM(require_dist8(), 1);
|
|
924542
924527
|
var migration16 = {
|
|
924543
924528
|
name: "require-generators-yml",
|
|
@@ -924580,7 +924565,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
924580
924565
|
if (existingGeneratorsYml == null) {
|
|
924581
924566
|
if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
924582
924567
|
const absolutePathToGeneratorsYml = join2(absoluteFilepathToWorkspace, RelativeFilePath2.of("generators.yml"));
|
|
924583
|
-
await (0,
|
|
924568
|
+
await (0, import_promises167.writeFile)(absolutePathToGeneratorsYml, jsYaml.dump({
|
|
924584
924569
|
api: {
|
|
924585
924570
|
path: join2(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
924586
924571
|
}
|
|
@@ -924595,7 +924580,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
924595
924580
|
parsedDocument.set("api", {
|
|
924596
924581
|
path: join2(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
924597
924582
|
});
|
|
924598
|
-
await (0,
|
|
924583
|
+
await (0, import_promises167.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
|
|
924599
924584
|
context3.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
|
|
924600
924585
|
}
|
|
924601
924586
|
}
|
|
@@ -924623,7 +924608,7 @@ var __default16 = versionMigrations16;
|
|
|
924623
924608
|
|
|
924624
924609
|
// ../cli-migrations/lib/migrations/0.54.0-rc0/use-generators-yml-specs/migration.js
|
|
924625
924610
|
init_lib6();
|
|
924626
|
-
var
|
|
924611
|
+
var import_promises168 = require("fs/promises");
|
|
924627
924612
|
var import_yaml17 = __toESM(require_dist8(), 1);
|
|
924628
924613
|
var migration17 = {
|
|
924629
924614
|
name: "generators-yml-use-api-specs",
|
|
@@ -924803,7 +924788,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
|
|
|
924803
924788
|
if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
|
|
924804
924789
|
documentToWrite = `${schemaComment}${documentToWrite}`;
|
|
924805
924790
|
}
|
|
924806
|
-
await (0,
|
|
924791
|
+
await (0, import_promises168.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
924807
924792
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
924808
924793
|
}
|
|
924809
924794
|
async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, directories, context: context3, namespace }) {
|
|
@@ -924850,7 +924835,7 @@ async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, direc
|
|
|
924850
924835
|
}
|
|
924851
924836
|
let specContent;
|
|
924852
924837
|
try {
|
|
924853
|
-
const fileContents = await (0,
|
|
924838
|
+
const fileContents = await (0, import_promises168.readFile)(absoluteSpecPath, { encoding: "utf-8" });
|
|
924854
924839
|
specContent = jsYaml.load(fileContents);
|
|
924855
924840
|
} catch (e6) {
|
|
924856
924841
|
context3.logger.warn(`Failed to read API spec file ${spec.path}. Error: ${e6}. Skipping...`);
|
|
@@ -924954,7 +924939,7 @@ var __default17 = versionMigrations17;
|
|
|
924954
924939
|
|
|
924955
924940
|
// ../cli-migrations/lib/migrations/0.82.1/add-path-parameter-order-setting/migration.js
|
|
924956
924941
|
init_lib6();
|
|
924957
|
-
var
|
|
924942
|
+
var import_promises169 = require("fs/promises");
|
|
924958
924943
|
var migration18 = {
|
|
924959
924944
|
name: "add-path-parameter-order-setting",
|
|
924960
924945
|
summary: `Adds the 'path-parameter-order' setting to existing API configurations to maintain backwards compatibility.
|
|
@@ -925042,7 +925027,7 @@ async function updateGeneratorsYml({ context: context3, files }) {
|
|
|
925042
925027
|
documentToWrite = `${schemaComment}
|
|
925043
925028
|
${documentToWrite}`;
|
|
925044
925029
|
}
|
|
925045
|
-
await (0,
|
|
925030
|
+
await (0, import_promises169.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
925046
925031
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
925047
925032
|
}
|
|
925048
925033
|
async function getFilesAndDirectories3(absoluteFilepath) {
|
|
@@ -925079,7 +925064,7 @@ var __default18 = versionMigrations18;
|
|
|
925079
925064
|
|
|
925080
925065
|
// ../cli-migrations/lib/migrations/1.0.0/update-settings-defaults/migration.js
|
|
925081
925066
|
init_lib6();
|
|
925082
|
-
var
|
|
925067
|
+
var import_promises170 = require("fs/promises");
|
|
925083
925068
|
var migration19 = {
|
|
925084
925069
|
name: "update-1_0_0-defaults",
|
|
925085
925070
|
summary: `The defaults of the API spec settings have changed.
|
|
@@ -925254,7 +925239,7 @@ async function updateGeneratorsYml2({ context: context3, files }) {
|
|
|
925254
925239
|
documentToWrite = `${schemaComment}
|
|
925255
925240
|
${documentToWrite}`;
|
|
925256
925241
|
}
|
|
925257
|
-
await (0,
|
|
925242
|
+
await (0, import_promises170.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
925258
925243
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
925259
925244
|
}
|
|
925260
925245
|
async function getFilesAndDirectories4(absoluteFilepath) {
|
|
@@ -925324,7 +925309,7 @@ var __default19 = versionMigrations19;
|
|
|
925324
925309
|
|
|
925325
925310
|
// ../cli-migrations/lib/migrations/2.0.0-rc0/update-settings-defaults/migration.js
|
|
925326
925311
|
init_lib6();
|
|
925327
|
-
var
|
|
925312
|
+
var import_promises171 = require("fs/promises");
|
|
925328
925313
|
var migration20 = {
|
|
925329
925314
|
name: "update-2_0_0-defaults",
|
|
925330
925315
|
summary: `The default of 'coerce-enums-to-literals' has changed from true to false.
|
|
@@ -925499,7 +925484,7 @@ async function updateGeneratorsYml3({ context: context3, files }) {
|
|
|
925499
925484
|
documentToWrite = `${schemaComment}
|
|
925500
925485
|
${documentToWrite}`;
|
|
925501
925486
|
}
|
|
925502
|
-
await (0,
|
|
925487
|
+
await (0, import_promises171.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
925503
925488
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
925504
925489
|
}
|
|
925505
925490
|
async function getFilesAndDirectories5(absoluteFilepath) {
|
|
@@ -925546,7 +925531,7 @@ var __default20 = versionMigrations20;
|
|
|
925546
925531
|
|
|
925547
925532
|
// ../cli-migrations/lib/migrations/2.13.0/migrate-deprecated-generator-api-settings/migration.js
|
|
925548
925533
|
init_lib6();
|
|
925549
|
-
var
|
|
925534
|
+
var import_promises172 = require("fs/promises");
|
|
925550
925535
|
var migration21 = {
|
|
925551
925536
|
name: "migrate-deprecated-generator-api-settings",
|
|
925552
925537
|
summary: `Migrates deprecated generator-level API settings keys to their new equivalents:
|
|
@@ -925637,7 +925622,7 @@ async function updateGeneratorsYml4({ context: context3, files }) {
|
|
|
925637
925622
|
documentToWrite = `${schemaComment}
|
|
925638
925623
|
${documentToWrite}`;
|
|
925639
925624
|
}
|
|
925640
|
-
await (0,
|
|
925625
|
+
await (0, import_promises172.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
925641
925626
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
925642
925627
|
}
|
|
925643
925628
|
function migrateDeprecatedSettings(settings, context3) {
|
|
@@ -925684,7 +925669,7 @@ var __default21 = versionMigrations21;
|
|
|
925684
925669
|
|
|
925685
925670
|
// ../cli-migrations/lib/migrations/3.0.0/enable-smart-casing/migration.js
|
|
925686
925671
|
init_lib6();
|
|
925687
|
-
var
|
|
925672
|
+
var import_promises173 = require("fs/promises");
|
|
925688
925673
|
var migration22 = {
|
|
925689
925674
|
name: "enable-smart-casing",
|
|
925690
925675
|
summary: `Sets 'smart-casing: false' for existing generators to preserve backwards compatibility.
|
|
@@ -925768,7 +925753,7 @@ async function updateGeneratorsYml5({ context: context3, files }) {
|
|
|
925768
925753
|
documentToWrite = `${schemaComment}
|
|
925769
925754
|
${documentToWrite}`;
|
|
925770
925755
|
}
|
|
925771
|
-
await (0,
|
|
925756
|
+
await (0, import_promises173.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
925772
925757
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
925773
925758
|
}
|
|
925774
925759
|
function setSmartCasingFalseIfNotConfigured(generator, context3) {
|
|
@@ -925909,7 +925894,7 @@ ${source_default.dim(migration23.summary)}`
|
|
|
925909
925894
|
}
|
|
925910
925895
|
|
|
925911
925896
|
// src/commands/upgrade/upgrade.ts
|
|
925912
|
-
var
|
|
925897
|
+
var import_promises174 = require("fs/promises");
|
|
925913
925898
|
|
|
925914
925899
|
// src/cwd.ts
|
|
925915
925900
|
var FERN_CWD_ENV_VAR = "FERN_CWD";
|
|
@@ -926230,7 +926215,7 @@ async function upgrade({
|
|
|
926230
926215
|
const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
|
|
926231
926216
|
draft.version = resolvedTargetVersion;
|
|
926232
926217
|
});
|
|
926233
|
-
await (0,
|
|
926218
|
+
await (0, import_promises174.writeFile)(
|
|
926234
926219
|
projectConfig2._absolutePath,
|
|
926235
926220
|
ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2))
|
|
926236
926221
|
);
|
|
@@ -926331,17 +926316,24 @@ async function validateDocsBrokenLinks({
|
|
|
926331
926316
|
var import_fs34 = require("fs");
|
|
926332
926317
|
var import_gray_matter10 = __toESM(require_gray_matter(), 1);
|
|
926333
926318
|
var import_path90 = __toESM(require("path"), 1);
|
|
926319
|
+
function calculateVisualColumn(text9, charIndex, tabWidth = 4) {
|
|
926320
|
+
let visualColumn = 0;
|
|
926321
|
+
for (let i11 = 0; i11 < Math.min(charIndex, text9.length); i11++) {
|
|
926322
|
+
visualColumn += text9[i11] === " " ? tabWidth : 1;
|
|
926323
|
+
}
|
|
926324
|
+
return visualColumn;
|
|
926325
|
+
}
|
|
926334
926326
|
var MdxValidationError = class {
|
|
926335
|
-
constructor(filepath, message, line, column) {
|
|
926327
|
+
constructor(filepath, message, line, column, contextLines) {
|
|
926336
926328
|
this.filepath = filepath;
|
|
926337
926329
|
this.message = message;
|
|
926338
926330
|
this.line = line;
|
|
926339
926331
|
this.column = column;
|
|
926332
|
+
this.contextLines = contextLines;
|
|
926340
926333
|
}
|
|
926341
926334
|
toString() {
|
|
926342
926335
|
const relativePath = import_path90.default.relative(process.cwd(), this.filepath);
|
|
926343
|
-
let formatted = source_default.red(`
|
|
926344
|
-
${relativePath}`);
|
|
926336
|
+
let formatted = source_default.red(` ${relativePath}`);
|
|
926345
926337
|
if (this.line != null) {
|
|
926346
926338
|
formatted += source_default.yellow(`:${this.line}`);
|
|
926347
926339
|
if (this.column != null) {
|
|
@@ -926349,7 +926341,29 @@ var MdxValidationError = class {
|
|
|
926349
926341
|
}
|
|
926350
926342
|
}
|
|
926351
926343
|
formatted += source_default.gray(`
|
|
926352
|
-
|
|
926344
|
+
${this.message}`);
|
|
926345
|
+
if (this.contextLines && this.contextLines.length > 0) {
|
|
926346
|
+
formatted += "\n";
|
|
926347
|
+
const maxLineNum = Math.max(...this.contextLines.map((ctx) => ctx.lineNumber));
|
|
926348
|
+
const lineNumWidth = String(maxLineNum).length;
|
|
926349
|
+
for (const ctx of this.contextLines) {
|
|
926350
|
+
const lineNumStr = String(ctx.lineNumber).padStart(lineNumWidth, " ");
|
|
926351
|
+
const displayContent = ctx.content.replace(/\t/g, " ");
|
|
926352
|
+
if (ctx.isErrorLine) {
|
|
926353
|
+
formatted += `
|
|
926354
|
+
${source_default.cyan(lineNumStr)} | ${displayContent}`;
|
|
926355
|
+
if (this.column != null && this.column > 0) {
|
|
926356
|
+
const visualColumn = calculateVisualColumn(ctx.content, this.column - 1);
|
|
926357
|
+
const caretPadding = " ".repeat(lineNumWidth + 3 + visualColumn);
|
|
926358
|
+
formatted += source_default.red(`
|
|
926359
|
+
${caretPadding}^`);
|
|
926360
|
+
}
|
|
926361
|
+
} else {
|
|
926362
|
+
formatted += `
|
|
926363
|
+
${source_default.gray(lineNumStr + " | " + displayContent)}`;
|
|
926364
|
+
}
|
|
926365
|
+
}
|
|
926366
|
+
}
|
|
926353
926367
|
return formatted;
|
|
926354
926368
|
}
|
|
926355
926369
|
};
|
|
@@ -926394,7 +926408,21 @@ async function validateMdxFiles({
|
|
|
926394
926408
|
column = errorObj.position.start.column;
|
|
926395
926409
|
}
|
|
926396
926410
|
}
|
|
926397
|
-
|
|
926411
|
+
let contextLines;
|
|
926412
|
+
if (line != null) {
|
|
926413
|
+
const allLines = content5.split("\n");
|
|
926414
|
+
const contextStart = Math.max(0, line - 3);
|
|
926415
|
+
const contextEnd = Math.min(allLines.length, line);
|
|
926416
|
+
contextLines = [];
|
|
926417
|
+
for (let i11 = contextStart; i11 < contextEnd; i11++) {
|
|
926418
|
+
contextLines.push({
|
|
926419
|
+
lineNumber: i11 + 1,
|
|
926420
|
+
content: allLines[i11] ?? "",
|
|
926421
|
+
isErrorLine: i11 + 1 === line
|
|
926422
|
+
});
|
|
926423
|
+
}
|
|
926424
|
+
}
|
|
926425
|
+
errors4.push(new MdxValidationError(filepath, message, line, column, contextLines));
|
|
926398
926426
|
}
|
|
926399
926427
|
}
|
|
926400
926428
|
return { errors: errors4, totalFiles: filesToCheck.length };
|
|
@@ -926412,7 +926440,6 @@ function logMdxValidationResults({
|
|
|
926412
926440
|
for (const error50 of errors4) {
|
|
926413
926441
|
context3.logger.error(error50.toString());
|
|
926414
926442
|
}
|
|
926415
|
-
context3.logger.error("");
|
|
926416
926443
|
}
|
|
926417
926444
|
|
|
926418
926445
|
// src/commands/validate/validateWorkspaces.ts
|
|
@@ -926804,7 +926831,7 @@ async function validateWorkspaces({
|
|
|
926804
926831
|
|
|
926805
926832
|
// src/commands/write-definition/writeDefinitionForWorkspaces.ts
|
|
926806
926833
|
init_lib6();
|
|
926807
|
-
var
|
|
926834
|
+
var import_promises175 = require("fs/promises");
|
|
926808
926835
|
var import_path91 = __toESM(require("path"), 1);
|
|
926809
926836
|
async function writeDefinitionForWorkspaces({
|
|
926810
926837
|
project,
|
|
@@ -926885,28 +926912,28 @@ async function writeFernDefinition({
|
|
|
926885
926912
|
return a10.localeCompare(b19);
|
|
926886
926913
|
};
|
|
926887
926914
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
926888
|
-
await (0,
|
|
926915
|
+
await (0, import_promises175.rm)(absolutePathToOutputDirectory, { recursive: true });
|
|
926889
926916
|
}
|
|
926890
|
-
await (0,
|
|
926891
|
-
await (0,
|
|
926917
|
+
await (0, import_promises175.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
926918
|
+
await (0, import_promises175.writeFile)(
|
|
926892
926919
|
join2(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
|
|
926893
926920
|
jsYaml.dump(definition3.rootApiFile.contents, { sortKeys })
|
|
926894
926921
|
);
|
|
926895
926922
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
926896
926923
|
const absoluteFilepath = join2(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
926897
|
-
await (0,
|
|
926898
|
-
await (0,
|
|
926924
|
+
await (0, import_promises175.mkdir)(dirname4(absoluteFilepath), { recursive: true });
|
|
926925
|
+
await (0, import_promises175.writeFile)(absoluteFilepath, jsYaml.dump(packageMarker.contents, { sortKeys }));
|
|
926899
926926
|
}
|
|
926900
926927
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
926901
926928
|
const absoluteFilepath = join2(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
926902
|
-
await (0,
|
|
926903
|
-
await (0,
|
|
926929
|
+
await (0, import_promises175.mkdir)(dirname4(absoluteFilepath), { recursive: true });
|
|
926930
|
+
await (0, import_promises175.writeFile)(absoluteFilepath, jsYaml.dump(definitionFile.contents, { sortKeys }));
|
|
926904
926931
|
}
|
|
926905
926932
|
}
|
|
926906
926933
|
|
|
926907
926934
|
// src/commands/write-docs-definition/writeDocsDefinitionForProject.ts
|
|
926908
926935
|
init_lib6();
|
|
926909
|
-
var
|
|
926936
|
+
var import_promises176 = require("fs/promises");
|
|
926910
926937
|
async function writeDocsDefinitionForProject({
|
|
926911
926938
|
project,
|
|
926912
926939
|
outputPath,
|
|
@@ -926938,7 +926965,7 @@ async function writeDocsDefinitionForProject({
|
|
|
926938
926965
|
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
|
|
926939
926966
|
});
|
|
926940
926967
|
const docsDefinition = await docsResolver.resolve();
|
|
926941
|
-
await (0,
|
|
926968
|
+
await (0, import_promises176.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
|
|
926942
926969
|
context3.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
|
|
926943
926970
|
});
|
|
926944
926971
|
}
|
|
@@ -926947,7 +926974,7 @@ async function writeDocsDefinitionForProject({
|
|
|
926947
926974
|
init_lib6();
|
|
926948
926975
|
var import_cli_progress2 = __toESM(require_cli_progress(), 1);
|
|
926949
926976
|
var import_fs37 = require("fs");
|
|
926950
|
-
var
|
|
926977
|
+
var import_promises180 = require("fs/promises");
|
|
926951
926978
|
var import_is_ci3 = __toESM(require_is_ci(), 1);
|
|
926952
926979
|
var import_path94 = __toESM(require("path"), 1);
|
|
926953
926980
|
|
|
@@ -927437,7 +927464,7 @@ function shouldProcessFile(filePath, stub) {
|
|
|
927437
927464
|
|
|
927438
927465
|
// src/commands/write-translation/docs-config-utils.ts
|
|
927439
927466
|
init_lib6();
|
|
927440
|
-
var
|
|
927467
|
+
var import_promises177 = require("fs/promises");
|
|
927441
927468
|
|
|
927442
927469
|
// src/commands/write-translation/url-utils.ts
|
|
927443
927470
|
function addLanguageSuffixToUrl(url3, language) {
|
|
@@ -927594,7 +927621,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
927594
927621
|
stub = false
|
|
927595
927622
|
}) {
|
|
927596
927623
|
try {
|
|
927597
|
-
const originalConfigContent = await (0,
|
|
927624
|
+
const originalConfigContent = await (0, import_promises177.readFile)(originalDocsConfigPath, "utf-8");
|
|
927598
927625
|
const transformation = {
|
|
927599
927626
|
filePath: DOCS_CONFIGURATION_FILENAME,
|
|
927600
927627
|
language,
|
|
@@ -927608,7 +927635,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
927608
927635
|
const modifiedConfigContent = jsYaml.dump(modifiedConfig, {
|
|
927609
927636
|
sortKeys: false
|
|
927610
927637
|
});
|
|
927611
|
-
await (0,
|
|
927638
|
+
await (0, import_promises177.writeFile)(modifiedConfigPath, modifiedConfigContent, "utf-8");
|
|
927612
927639
|
context3.logger.debug(`Created language-specific docs config: ${modifiedConfigPath}`);
|
|
927613
927640
|
} catch (error50) {
|
|
927614
927641
|
if (error50 instanceof Error && error50.message.includes("403")) {
|
|
@@ -927621,11 +927648,11 @@ async function createLanguageSpecificDocsConfig({
|
|
|
927621
927648
|
// src/commands/write-translation/file-collection-utils.ts
|
|
927622
927649
|
init_lib6();
|
|
927623
927650
|
var import_fs35 = require("fs");
|
|
927624
|
-
var
|
|
927651
|
+
var import_promises178 = require("fs/promises");
|
|
927625
927652
|
var import_path92 = __toESM(require("path"), 1);
|
|
927626
927653
|
async function collectFiles(baseDirectory, relativeBase) {
|
|
927627
927654
|
const discoveredFiles = {};
|
|
927628
|
-
const entries21 = await (0,
|
|
927655
|
+
const entries21 = await (0, import_promises178.readdir)(baseDirectory);
|
|
927629
927656
|
for (const entry of entries21) {
|
|
927630
927657
|
if (entry === "translations") {
|
|
927631
927658
|
continue;
|
|
@@ -927648,7 +927675,7 @@ async function collectFiles(baseDirectory, relativeBase) {
|
|
|
927648
927675
|
// src/commands/write-translation/hash-utils.ts
|
|
927649
927676
|
var import_crypto13 = require("crypto");
|
|
927650
927677
|
var import_fs36 = require("fs");
|
|
927651
|
-
var
|
|
927678
|
+
var import_promises179 = require("fs/promises");
|
|
927652
927679
|
var import_path93 = __toESM(require("path"), 1);
|
|
927653
927680
|
function calculateContentHash(content5) {
|
|
927654
927681
|
return (0, import_crypto13.createHash)("sha256").update(content5, "utf-8").digest("hex");
|
|
@@ -927659,7 +927686,7 @@ async function loadHashMappings(translationsDirectory) {
|
|
|
927659
927686
|
return {};
|
|
927660
927687
|
}
|
|
927661
927688
|
try {
|
|
927662
|
-
const hashesContent = await (0,
|
|
927689
|
+
const hashesContent = await (0, import_promises179.readFile)(hashesFilePath, "utf-8");
|
|
927663
927690
|
const parsed = JSON.parse(hashesContent);
|
|
927664
927691
|
const { _comment, ...hashMappings } = parsed;
|
|
927665
927692
|
return hashMappings;
|
|
@@ -927680,11 +927707,11 @@ async function saveHashMappings(translationsDirectory, hashMappings) {
|
|
|
927680
927707
|
_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.",
|
|
927681
927708
|
...sortedMappings
|
|
927682
927709
|
};
|
|
927683
|
-
await (0,
|
|
927710
|
+
await (0, import_promises179.writeFile)(hashesFilePath, JSON.stringify(fileContent, null, 2), "utf-8");
|
|
927684
927711
|
}
|
|
927685
927712
|
async function hasFileChanged(filePath, relativePath, previousHashes) {
|
|
927686
927713
|
try {
|
|
927687
|
-
const content5 = await (0,
|
|
927714
|
+
const content5 = await (0, import_promises179.readFile)(filePath, "utf-8");
|
|
927688
927715
|
const currentHash = calculateContentHash(content5);
|
|
927689
927716
|
const previousHash = previousHashes[relativePath];
|
|
927690
927717
|
return currentHash !== previousHash;
|
|
@@ -927737,7 +927764,7 @@ async function writeTranslationForProject({
|
|
|
927737
927764
|
}
|
|
927738
927765
|
if (!(0, import_fs37.existsSync)(translationsDirectory)) {
|
|
927739
927766
|
context3.logger.debug(`Creating translations directory at: ${translationsDirectory}`);
|
|
927740
|
-
await (0,
|
|
927767
|
+
await (0, import_promises180.mkdir)(translationsDirectory, { recursive: true });
|
|
927741
927768
|
}
|
|
927742
927769
|
const languageStats = {};
|
|
927743
927770
|
const targetLanguages = languages.filter((lang) => lang !== sourceLanguage);
|
|
@@ -927750,7 +927777,7 @@ async function writeTranslationForProject({
|
|
|
927750
927777
|
RelativeFilePath2.of("fern")
|
|
927751
927778
|
);
|
|
927752
927779
|
if (!(0, import_fs37.existsSync)(languageDirectory)) {
|
|
927753
|
-
await (0,
|
|
927780
|
+
await (0, import_promises180.mkdir)(languageDirectory, { recursive: true });
|
|
927754
927781
|
}
|
|
927755
927782
|
languageStats[language] = {
|
|
927756
927783
|
filesProcessed: 0,
|
|
@@ -927852,7 +927879,7 @@ async function writeTranslationForProject({
|
|
|
927852
927879
|
`[COMPLETED] ${DOCS_CONFIGURATION_FILENAME} -> ${language}/${DOCS_CONFIGURATION_FILENAME}`
|
|
927853
927880
|
);
|
|
927854
927881
|
}
|
|
927855
|
-
const originalConfigContent = await (0,
|
|
927882
|
+
const originalConfigContent = await (0, import_promises180.readFile)(originalDocsConfigPath, "utf-8");
|
|
927856
927883
|
await updateAndSaveHashForFile(
|
|
927857
927884
|
translationsDirectory,
|
|
927858
927885
|
hashMappings,
|
|
@@ -927897,7 +927924,7 @@ async function writeTranslationForProject({
|
|
|
927897
927924
|
continue;
|
|
927898
927925
|
}
|
|
927899
927926
|
cliContext.logger.debug(`[PROCESSING] ${relativePath} (detected changes)`);
|
|
927900
|
-
const originalContent = await (0,
|
|
927927
|
+
const originalContent = await (0, import_promises180.readFile)(filePath, "utf-8");
|
|
927901
927928
|
await updateAndSaveHashForFile(translationsDirectory, hashMappings, relativePath, originalContent);
|
|
927902
927929
|
const sourceStats = languageStats[sourceLanguage];
|
|
927903
927930
|
if (sourceStats) {
|
|
@@ -927922,7 +927949,7 @@ async function writeTranslationForProject({
|
|
|
927922
927949
|
const destPath = join2(languageDirectory, relativePath);
|
|
927923
927950
|
const destDir = import_path94.default.dirname(destPath);
|
|
927924
927951
|
if (!(0, import_fs37.existsSync)(destDir)) {
|
|
927925
|
-
await (0,
|
|
927952
|
+
await (0, import_promises180.mkdir)(destDir, { recursive: true });
|
|
927926
927953
|
}
|
|
927927
927954
|
const transformation = {
|
|
927928
927955
|
filePath: relativePath,
|
|
@@ -927935,7 +927962,7 @@ async function writeTranslationForProject({
|
|
|
927935
927962
|
cliContext,
|
|
927936
927963
|
stub
|
|
927937
927964
|
});
|
|
927938
|
-
await (0,
|
|
927965
|
+
await (0, import_promises180.writeFile)(destPath, transformedContent, "utf-8");
|
|
927939
927966
|
const languageStatsForLang = languageStats[language];
|
|
927940
927967
|
if (languageStatsForLang) {
|
|
927941
927968
|
languageStatsForLang.filesProcessed++;
|
|
@@ -927966,9 +927993,9 @@ async function writeTranslationForProject({
|
|
|
927966
927993
|
const destPath = join2(languageDirectory, relativePath);
|
|
927967
927994
|
const destDir = import_path94.default.dirname(destPath);
|
|
927968
927995
|
if (!(0, import_fs37.existsSync)(destDir)) {
|
|
927969
|
-
await (0,
|
|
927996
|
+
await (0, import_promises180.mkdir)(destDir, { recursive: true });
|
|
927970
927997
|
}
|
|
927971
|
-
await (0,
|
|
927998
|
+
await (0, import_promises180.copyFile)(filePath, destPath);
|
|
927972
927999
|
assetsCopied++;
|
|
927973
928000
|
cliContext.logger.debug(`[ASSET COPIED] ${relativePath} -> ${language}/${relativePath}`);
|
|
927974
928001
|
}
|
|
@@ -929755,7 +929782,7 @@ function addDocsMdCheckCommand(cli, cliContext) {
|
|
|
929755
929782
|
}
|
|
929756
929783
|
});
|
|
929757
929784
|
if (hasErrors) {
|
|
929758
|
-
cliContext.
|
|
929785
|
+
cliContext.failWithoutThrowing();
|
|
929759
929786
|
}
|
|
929760
929787
|
}
|
|
929761
929788
|
);
|