@fern-api/fern-api-dev 3.47.3-2-ga2744e8348 → 3.47.3
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 +545 -871
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -26912,7 +26912,7 @@ var require_public_api = __commonJS({
|
|
|
26912
26912
|
return docs;
|
|
26913
26913
|
return Object.assign([], { empty: true }, composer$1.streamInfo());
|
|
26914
26914
|
}
|
|
26915
|
-
function
|
|
26915
|
+
function parseDocument3(source2, options2 = {}) {
|
|
26916
26916
|
const { lineCounter: lineCounter2, prettyErrors } = parseOptions2(options2);
|
|
26917
26917
|
const parser$1 = new parser4.Parser(lineCounter2?.addNewLine);
|
|
26918
26918
|
const composer$1 = new composer.Composer(options2);
|
|
@@ -26938,7 +26938,7 @@ var require_public_api = __commonJS({
|
|
|
26938
26938
|
} else if (options2 === void 0 && reviver && typeof reviver === "object") {
|
|
26939
26939
|
options2 = reviver;
|
|
26940
26940
|
}
|
|
26941
|
-
const doc =
|
|
26941
|
+
const doc = parseDocument3(src, options2);
|
|
26942
26942
|
if (!doc)
|
|
26943
26943
|
return null;
|
|
26944
26944
|
doc.warnings.forEach((warning) => log2.warn(doc.options.logLevel, warning));
|
|
@@ -26972,7 +26972,7 @@ var require_public_api = __commonJS({
|
|
|
26972
26972
|
}
|
|
26973
26973
|
exports2.parse = parse18;
|
|
26974
26974
|
exports2.parseAllDocuments = parseAllDocuments;
|
|
26975
|
-
exports2.parseDocument =
|
|
26975
|
+
exports2.parseDocument = parseDocument3;
|
|
26976
26976
|
exports2.stringify = stringify5;
|
|
26977
26977
|
}
|
|
26978
26978
|
});
|
|
@@ -74452,8 +74452,8 @@ var require_graceful_fs = __commonJS({
|
|
|
74452
74452
|
fs34.createReadStream = createReadStream3;
|
|
74453
74453
|
fs34.createWriteStream = createWriteStream7;
|
|
74454
74454
|
var fs$readFile = fs34.readFile;
|
|
74455
|
-
fs34.readFile =
|
|
74456
|
-
function
|
|
74455
|
+
fs34.readFile = readFile84;
|
|
74456
|
+
function readFile84(path76, options2, cb2) {
|
|
74457
74457
|
if (typeof options2 === "function")
|
|
74458
74458
|
cb2 = options2, options2 = null;
|
|
74459
74459
|
return go$readFile(path76, options2, cb2);
|
|
@@ -75818,7 +75818,7 @@ var require_jsonfile = __commonJS({
|
|
|
75818
75818
|
}
|
|
75819
75819
|
return obj;
|
|
75820
75820
|
}
|
|
75821
|
-
var
|
|
75821
|
+
var readFile84 = universalify.fromPromise(_readFile);
|
|
75822
75822
|
function readFileSync12(file2, options2 = {}) {
|
|
75823
75823
|
if (typeof options2 === "string") {
|
|
75824
75824
|
options2 = { encoding: options2 };
|
|
@@ -75850,7 +75850,7 @@ var require_jsonfile = __commonJS({
|
|
|
75850
75850
|
return fs33.writeFileSync(file2, str3, options2);
|
|
75851
75851
|
}
|
|
75852
75852
|
module2.exports = {
|
|
75853
|
-
readFile:
|
|
75853
|
+
readFile: readFile84,
|
|
75854
75854
|
readFileSync: readFileSync12,
|
|
75855
75855
|
writeFile: writeFile68,
|
|
75856
75856
|
writeFileSync: writeFileSync4
|
|
@@ -185194,8 +185194,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
185194
185194
|
fs34.createReadStream = createReadStream3;
|
|
185195
185195
|
fs34.createWriteStream = createWriteStream7;
|
|
185196
185196
|
var fs$readFile = fs34.readFile;
|
|
185197
|
-
fs34.readFile =
|
|
185198
|
-
function
|
|
185197
|
+
fs34.readFile = readFile84;
|
|
185198
|
+
function readFile84(path76, options2, cb2) {
|
|
185199
185199
|
if (typeof options2 === "function")
|
|
185200
185200
|
cb2 = options2, options2 = null;
|
|
185201
185201
|
return go$readFile(path76, options2, cb2);
|
|
@@ -1302292,7 +1302292,6 @@ function withContext(handler3) {
|
|
|
1302292
1302292
|
const context2 = createContext(args);
|
|
1302293
1302293
|
try {
|
|
1302294
1302294
|
await handler3(context2, args);
|
|
1302295
|
-
process.exit(0);
|
|
1302296
1302295
|
} catch (error49) {
|
|
1302297
1302296
|
handleError(context2, error49);
|
|
1302298
1302297
|
process.exit(1);
|
|
@@ -1323758,6 +1323757,36 @@ async function stringifyLargeObject(obj, { pretty, onWrite } = {}) {
|
|
|
1323758
1323757
|
return fileContents.toString();
|
|
1323759
1323758
|
}
|
|
1323760
1323759
|
|
|
1323760
|
+
// ../yaml/loader/lib/ValidationIssue.js
|
|
1323761
|
+
var ValidationIssue = class {
|
|
1323762
|
+
/** The validation error message */
|
|
1323763
|
+
message;
|
|
1323764
|
+
/** The source location where the issue was found */
|
|
1323765
|
+
location;
|
|
1323766
|
+
/** The path to the value in the YAML document (e.g., ["cli", "version"]) */
|
|
1323767
|
+
yamlPath;
|
|
1323768
|
+
constructor({ message, location: location2, yamlPath }) {
|
|
1323769
|
+
this.message = message;
|
|
1323770
|
+
this.location = location2;
|
|
1323771
|
+
this.yamlPath = yamlPath;
|
|
1323772
|
+
}
|
|
1323773
|
+
/**
|
|
1323774
|
+
* Formats as `<file>:<line>:<col>: <message>` for CLI output.
|
|
1323775
|
+
*
|
|
1323776
|
+
* @example
|
|
1323777
|
+
* ```
|
|
1323778
|
+
* fern.yml:6:13: org must be a string
|
|
1323779
|
+
* ```
|
|
1323780
|
+
*/
|
|
1323781
|
+
toString() {
|
|
1323782
|
+
return `${this.location}: ${this.message}`;
|
|
1323783
|
+
}
|
|
1323784
|
+
};
|
|
1323785
|
+
|
|
1323786
|
+
// ../yaml/loader/lib/YamlParser.js
|
|
1323787
|
+
var import_promises6 = require("fs/promises");
|
|
1323788
|
+
var import_yaml2 = __toESM(require_dist(), 1);
|
|
1323789
|
+
|
|
1323761
1323790
|
// ../source/lib/constants.js
|
|
1323762
1323791
|
var LOCATION_PROPERTY = "$loc";
|
|
1323763
1323792
|
|
|
@@ -1323923,22 +1323952,16 @@ var SourcedNullish = class {
|
|
|
1323923
1323952
|
};
|
|
1323924
1323953
|
|
|
1323925
1323954
|
// ../source/lib/SourceLocation.js
|
|
1323926
|
-
var SourceLocation = class
|
|
1323955
|
+
var SourceLocation = class {
|
|
1323927
1323956
|
absoluteFilePath;
|
|
1323928
1323957
|
relativeFilePath;
|
|
1323929
1323958
|
line;
|
|
1323930
1323959
|
column;
|
|
1323931
|
-
|
|
1323932
|
-
* If this location was resolved from a `$ref`, this contains the location
|
|
1323933
|
-
* of the file that contained the `$ref` reference.
|
|
1323934
|
-
*/
|
|
1323935
|
-
refFrom;
|
|
1323936
|
-
constructor({ absoluteFilePath, relativeFilePath, line, column, refFrom }) {
|
|
1323960
|
+
constructor({ absoluteFilePath, relativeFilePath, line, column }) {
|
|
1323937
1323961
|
this.absoluteFilePath = absoluteFilePath;
|
|
1323938
1323962
|
this.relativeFilePath = relativeFilePath;
|
|
1323939
1323963
|
this.line = line;
|
|
1323940
1323964
|
this.column = column;
|
|
1323941
|
-
this.refFrom = refFrom;
|
|
1323942
1323965
|
}
|
|
1323943
1323966
|
/**
|
|
1323944
1323967
|
* Formats as "filepath:line:column" using the relative file path.
|
|
@@ -1323958,50 +1323981,6 @@ var SourceLocation = class _SourceLocation {
|
|
|
1323958
1323981
|
toAbsoluteString() {
|
|
1323959
1323982
|
return `${this.absoluteFilePath}:${this.line}:${this.column}`;
|
|
1323960
1323983
|
}
|
|
1323961
|
-
/**
|
|
1323962
|
-
* Creates a new SourceLocation with the given `$ref` location.
|
|
1323963
|
-
* This is used when resolving `$ref` references to track where
|
|
1323964
|
-
* the reference originated.
|
|
1323965
|
-
*/
|
|
1323966
|
-
withRefFrom(refFrom) {
|
|
1323967
|
-
return new _SourceLocation({
|
|
1323968
|
-
absoluteFilePath: this.absoluteFilePath,
|
|
1323969
|
-
relativeFilePath: this.relativeFilePath,
|
|
1323970
|
-
line: this.line,
|
|
1323971
|
-
column: this.column,
|
|
1323972
|
-
refFrom
|
|
1323973
|
-
});
|
|
1323974
|
-
}
|
|
1323975
|
-
};
|
|
1323976
|
-
|
|
1323977
|
-
// ../yaml/loader/lib/ReferenceResolver.js
|
|
1323978
|
-
var import_promises6 = require("fs/promises");
|
|
1323979
|
-
var import_yaml2 = __toESM(require_dist(), 1);
|
|
1323980
|
-
|
|
1323981
|
-
// ../yaml/loader/lib/ValidationIssue.js
|
|
1323982
|
-
var ValidationIssue = class {
|
|
1323983
|
-
/** The validation error message */
|
|
1323984
|
-
message;
|
|
1323985
|
-
/** The source location where the issue was found */
|
|
1323986
|
-
location;
|
|
1323987
|
-
/** The path to the value in the YAML document (e.g., ["cli", "version"]) */
|
|
1323988
|
-
yamlPath;
|
|
1323989
|
-
constructor({ message, location: location2, yamlPath }) {
|
|
1323990
|
-
this.message = message;
|
|
1323991
|
-
this.location = location2;
|
|
1323992
|
-
this.yamlPath = yamlPath;
|
|
1323993
|
-
}
|
|
1323994
|
-
/**
|
|
1323995
|
-
* Formats as `<file>:<line>:<col>: <message>` for CLI output.
|
|
1323996
|
-
*
|
|
1323997
|
-
* @example
|
|
1323998
|
-
* ```
|
|
1323999
|
-
* fern.yml:6:13: org must be a string
|
|
1324000
|
-
* ```
|
|
1324001
|
-
*/
|
|
1324002
|
-
toString() {
|
|
1324003
|
-
return `${this.location}: ${this.message}`;
|
|
1324004
|
-
}
|
|
1324005
1323984
|
};
|
|
1324006
1323985
|
|
|
1324007
1323986
|
// ../yaml/loader/lib/YamlDocument.js
|
|
@@ -1324070,276 +1324049,7 @@ var YamlDocument = class {
|
|
|
1324070
1324049
|
}
|
|
1324071
1324050
|
};
|
|
1324072
1324051
|
|
|
1324073
|
-
// ../yaml/loader/lib/ReferenceResolver.js
|
|
1324074
|
-
var REF_KEY = "$ref";
|
|
1324075
|
-
var ReferenceResolver = class {
|
|
1324076
|
-
cwd;
|
|
1324077
|
-
constructor({ cwd: cwd2 }) {
|
|
1324078
|
-
this.cwd = cwd2;
|
|
1324079
|
-
}
|
|
1324080
|
-
/**
|
|
1324081
|
-
* Resolves all `$ref` references in the given YAML document.
|
|
1324082
|
-
*
|
|
1324083
|
-
* @param document - The parsed YAML document
|
|
1324084
|
-
* @returns Result with either the resolved data or resolution issues
|
|
1324085
|
-
*/
|
|
1324086
|
-
async resolve({ document: document4 }) {
|
|
1324087
|
-
const originalFile = document4.absoluteFilePath;
|
|
1324088
|
-
const context2 = {
|
|
1324089
|
-
cwd: this.cwd,
|
|
1324090
|
-
document: document4,
|
|
1324091
|
-
originalFile,
|
|
1324092
|
-
currentFile: originalFile,
|
|
1324093
|
-
resolutionStack: /* @__PURE__ */ new Set([originalFile]),
|
|
1324094
|
-
referencedDocuments: {},
|
|
1324095
|
-
issues: [],
|
|
1324096
|
-
pathMappings: [],
|
|
1324097
|
-
yamlPathIndex: 0,
|
|
1324098
|
-
refFromLocation: void 0
|
|
1324099
|
-
};
|
|
1324100
|
-
const resolved = await this.resolveValue({ context: context2, yamlPath: [], value: document4.toJS() });
|
|
1324101
|
-
if (context2.issues.length > 0) {
|
|
1324102
|
-
return {
|
|
1324103
|
-
success: false,
|
|
1324104
|
-
issues: context2.issues
|
|
1324105
|
-
};
|
|
1324106
|
-
}
|
|
1324107
|
-
return {
|
|
1324108
|
-
success: true,
|
|
1324109
|
-
data: resolved,
|
|
1324110
|
-
pathMappings: context2.pathMappings
|
|
1324111
|
-
};
|
|
1324112
|
-
}
|
|
1324113
|
-
/**
|
|
1324114
|
-
* Looks up the source location for a path, checking path mappings for referenced files.
|
|
1324115
|
-
*
|
|
1324116
|
-
* @param document - The original document.
|
|
1324117
|
-
* @param pathMappings - Path mappings returned from resolution.
|
|
1324118
|
-
* @param yamlPath - The path to look up.
|
|
1324119
|
-
* @returns The source location, with refFrom attached if the path is in a referenced file.
|
|
1324120
|
-
*/
|
|
1324121
|
-
getSourceLocationWithMappings({ document: document4, pathMappings, yamlPath }) {
|
|
1324122
|
-
let bestMatch;
|
|
1324123
|
-
for (const mapping of pathMappings) {
|
|
1324124
|
-
if (this.yamlPathStartsWith(yamlPath, mapping.yamlPath)) {
|
|
1324125
|
-
if (bestMatch == null || mapping.yamlPath.length > bestMatch.yamlPath.length) {
|
|
1324126
|
-
bestMatch = mapping;
|
|
1324127
|
-
}
|
|
1324128
|
-
}
|
|
1324129
|
-
}
|
|
1324130
|
-
if (bestMatch != null) {
|
|
1324131
|
-
const localYamlPath = yamlPath.slice(bestMatch.yamlPath.length);
|
|
1324132
|
-
const location2 = bestMatch.document.getSourceLocation(localYamlPath);
|
|
1324133
|
-
return location2.withRefFrom(bestMatch.refFromLocation);
|
|
1324134
|
-
}
|
|
1324135
|
-
return document4.getSourceLocation(yamlPath);
|
|
1324136
|
-
}
|
|
1324137
|
-
async resolveValue({ context: context2, yamlPath, value }) {
|
|
1324138
|
-
if (value == null) {
|
|
1324139
|
-
return value;
|
|
1324140
|
-
}
|
|
1324141
|
-
if (Array.isArray(value)) {
|
|
1324142
|
-
return Promise.all(value.map((item, index3) => this.resolveValue({ context: context2, yamlPath: [...yamlPath, index3], value: item })));
|
|
1324143
|
-
}
|
|
1324144
|
-
if (typeof value === "object") {
|
|
1324145
|
-
const obj = value;
|
|
1324146
|
-
if (REF_KEY in obj) {
|
|
1324147
|
-
const refYamlPath = [...yamlPath, REF_KEY];
|
|
1324148
|
-
return this.resolveRef({
|
|
1324149
|
-
context: context2,
|
|
1324150
|
-
yamlPath: refYamlPath,
|
|
1324151
|
-
location: this.getSourceLocation({ context: context2, yamlPath: refYamlPath }),
|
|
1324152
|
-
obj,
|
|
1324153
|
-
refValue: obj[REF_KEY]
|
|
1324154
|
-
});
|
|
1324155
|
-
}
|
|
1324156
|
-
const resolved = {};
|
|
1324157
|
-
for (const key of Object.keys(obj)) {
|
|
1324158
|
-
resolved[key] = await this.resolveValue({ context: context2, yamlPath: [...yamlPath, key], value: obj[key] });
|
|
1324159
|
-
}
|
|
1324160
|
-
return resolved;
|
|
1324161
|
-
}
|
|
1324162
|
-
return value;
|
|
1324163
|
-
}
|
|
1324164
|
-
async resolveRef({ context: context2, yamlPath, location: location2, obj, refValue }) {
|
|
1324165
|
-
if (typeof refValue !== "string") {
|
|
1324166
|
-
context2.issues.push(new ValidationIssue({
|
|
1324167
|
-
message: `$ref must be a string, got ${typeof refValue}`,
|
|
1324168
|
-
location: location2,
|
|
1324169
|
-
yamlPath
|
|
1324170
|
-
}));
|
|
1324171
|
-
return obj;
|
|
1324172
|
-
}
|
|
1324173
|
-
const keys11 = Object.keys(obj);
|
|
1324174
|
-
if (keys11.length > 1) {
|
|
1324175
|
-
const siblingKeys = keys11.filter((k18) => k18 !== REF_KEY);
|
|
1324176
|
-
context2.issues.push(new ValidationIssue({
|
|
1324177
|
-
message: `$ref cannot have sibling keys; found ${siblingKeys.join(", ")}`,
|
|
1324178
|
-
location: location2,
|
|
1324179
|
-
yamlPath
|
|
1324180
|
-
}));
|
|
1324181
|
-
return obj;
|
|
1324182
|
-
}
|
|
1324183
|
-
if (refValue.includes("#")) {
|
|
1324184
|
-
context2.issues.push(new ValidationIssue({
|
|
1324185
|
-
message: `JSON pointer and in-document references are not supported: ${refValue}`,
|
|
1324186
|
-
location: location2,
|
|
1324187
|
-
yamlPath
|
|
1324188
|
-
}));
|
|
1324189
|
-
return obj;
|
|
1324190
|
-
}
|
|
1324191
|
-
const referencedFilePath = this.resolveFilePath({ currentFile: context2.currentFile, refValue });
|
|
1324192
|
-
if (context2.resolutionStack.has(referencedFilePath)) {
|
|
1324193
|
-
const cycle = [...context2.resolutionStack, referencedFilePath].join(" -> ");
|
|
1324194
|
-
context2.issues.push(new ValidationIssue({
|
|
1324195
|
-
message: `Circular $ref detected: ${cycle}`,
|
|
1324196
|
-
location: location2,
|
|
1324197
|
-
yamlPath
|
|
1324198
|
-
}));
|
|
1324199
|
-
return obj;
|
|
1324200
|
-
}
|
|
1324201
|
-
const resolvedReference = await this.parseFile({
|
|
1324202
|
-
context: context2,
|
|
1324203
|
-
referencedFilePath,
|
|
1324204
|
-
yamlPath,
|
|
1324205
|
-
location: location2,
|
|
1324206
|
-
refValue
|
|
1324207
|
-
});
|
|
1324208
|
-
if (resolvedReference === void 0) {
|
|
1324209
|
-
return obj;
|
|
1324210
|
-
}
|
|
1324211
|
-
if (resolvedReference === null) {
|
|
1324212
|
-
context2.issues.push(new ValidationIssue({
|
|
1324213
|
-
message: `$ref resolves to null: ${refValue}`,
|
|
1324214
|
-
location: location2,
|
|
1324215
|
-
yamlPath
|
|
1324216
|
-
}));
|
|
1324217
|
-
return obj;
|
|
1324218
|
-
}
|
|
1324219
|
-
const parentYamlPath = yamlPath.slice(0, -1);
|
|
1324220
|
-
const referencedDocument = context2.referencedDocuments[referencedFilePath];
|
|
1324221
|
-
if (referencedDocument != null) {
|
|
1324222
|
-
context2.pathMappings.push({
|
|
1324223
|
-
yamlPath: parentYamlPath,
|
|
1324224
|
-
document: referencedDocument,
|
|
1324225
|
-
refFromLocation: location2
|
|
1324226
|
-
});
|
|
1324227
|
-
}
|
|
1324228
|
-
const fullyResolvedReference = await this.resolveReferencedFile({
|
|
1324229
|
-
context: context2,
|
|
1324230
|
-
referencedFilePath,
|
|
1324231
|
-
refFromLocation: location2,
|
|
1324232
|
-
yamlPath: parentYamlPath,
|
|
1324233
|
-
value: resolvedReference
|
|
1324234
|
-
});
|
|
1324235
|
-
return fullyResolvedReference;
|
|
1324236
|
-
}
|
|
1324237
|
-
/**
|
|
1324238
|
-
* Resolves a value within the context of a referenced file, handling
|
|
1324239
|
-
* the bookkeeping for tracking the current file and YAML path index.
|
|
1324240
|
-
*/
|
|
1324241
|
-
async resolveReferencedFile({ context: context2, referencedFilePath, refFromLocation, yamlPath, value }) {
|
|
1324242
|
-
const previousFile = context2.currentFile;
|
|
1324243
|
-
const previousYamlPathIndex = context2.yamlPathIndex;
|
|
1324244
|
-
const previousRefFromLocation = context2.refFromLocation;
|
|
1324245
|
-
context2.currentFile = referencedFilePath;
|
|
1324246
|
-
context2.yamlPathIndex = yamlPath.length;
|
|
1324247
|
-
context2.refFromLocation = refFromLocation;
|
|
1324248
|
-
context2.resolutionStack.add(referencedFilePath);
|
|
1324249
|
-
try {
|
|
1324250
|
-
return await this.resolveValue({ context: context2, yamlPath, value });
|
|
1324251
|
-
} finally {
|
|
1324252
|
-
context2.resolutionStack.delete(referencedFilePath);
|
|
1324253
|
-
context2.currentFile = previousFile;
|
|
1324254
|
-
context2.yamlPathIndex = previousYamlPathIndex;
|
|
1324255
|
-
context2.refFromLocation = previousRefFromLocation;
|
|
1324256
|
-
}
|
|
1324257
|
-
}
|
|
1324258
|
-
async parseFile({ context: context2, referencedFilePath, yamlPath, location: location2, refValue }) {
|
|
1324259
|
-
if (!await doesPathExist(referencedFilePath)) {
|
|
1324260
|
-
context2.issues.push(new ValidationIssue({
|
|
1324261
|
-
message: `Referenced file does not exist: ${refValue}`,
|
|
1324262
|
-
location: location2,
|
|
1324263
|
-
yamlPath
|
|
1324264
|
-
}));
|
|
1324265
|
-
return void 0;
|
|
1324266
|
-
}
|
|
1324267
|
-
const content5 = await (0, import_promises6.readFile)(referencedFilePath, "utf-8");
|
|
1324268
|
-
const parsedDocument = (0, import_yaml2.parseDocument)(content5);
|
|
1324269
|
-
if (parsedDocument.errors.length > 0) {
|
|
1324270
|
-
const errorMessages = parsedDocument.errors.map((e6) => e6.message).join("; ");
|
|
1324271
|
-
context2.issues.push(new ValidationIssue({
|
|
1324272
|
-
message: `Failed to parse referenced file ${refValue}: ${errorMessages}`,
|
|
1324273
|
-
location: location2,
|
|
1324274
|
-
yamlPath
|
|
1324275
|
-
}));
|
|
1324276
|
-
return void 0;
|
|
1324277
|
-
}
|
|
1324278
|
-
const yamlDocument = new YamlDocument({
|
|
1324279
|
-
absoluteFilePath: referencedFilePath,
|
|
1324280
|
-
relativeFilePath: RelativeFilePath2.of(relative3(context2.cwd, referencedFilePath)),
|
|
1324281
|
-
document: parsedDocument,
|
|
1324282
|
-
source: content5
|
|
1324283
|
-
});
|
|
1324284
|
-
context2.referencedDocuments[referencedFilePath] = yamlDocument;
|
|
1324285
|
-
return yamlDocument.toJS();
|
|
1324286
|
-
}
|
|
1324287
|
-
/**
|
|
1324288
|
-
* Returns the source location for a value at the given path.
|
|
1324289
|
-
*
|
|
1324290
|
-
* For the original document, we use the YamlDocument's precise location tracking.
|
|
1324291
|
-
* For referenced files, we look up the cached YamlDocument and compute the
|
|
1324292
|
-
* local path within that file, attaching the original `$ref` location via `withRefFrom`.
|
|
1324293
|
-
*/
|
|
1324294
|
-
getSourceLocation({ context: context2, yamlPath }) {
|
|
1324295
|
-
if (context2.currentFile === context2.originalFile) {
|
|
1324296
|
-
return context2.document.getSourceLocation(yamlPath);
|
|
1324297
|
-
}
|
|
1324298
|
-
const location2 = this.getSourceLocationFromCurrentFile({ context: context2, yamlPath });
|
|
1324299
|
-
if (context2.refFromLocation != null) {
|
|
1324300
|
-
return location2.withRefFrom(context2.refFromLocation);
|
|
1324301
|
-
}
|
|
1324302
|
-
return location2;
|
|
1324303
|
-
}
|
|
1324304
|
-
/**
|
|
1324305
|
-
* Checks if a YAML path starts with a given prefix.
|
|
1324306
|
-
*/
|
|
1324307
|
-
yamlPathStartsWith(path76, prefix2) {
|
|
1324308
|
-
if (prefix2.length > path76.length) {
|
|
1324309
|
-
return false;
|
|
1324310
|
-
}
|
|
1324311
|
-
for (let i11 = 0; i11 < prefix2.length; i11++) {
|
|
1324312
|
-
if (path76[i11] !== prefix2[i11]) {
|
|
1324313
|
-
return false;
|
|
1324314
|
-
}
|
|
1324315
|
-
}
|
|
1324316
|
-
return true;
|
|
1324317
|
-
}
|
|
1324318
|
-
getSourceLocationFromCurrentFile({ context: context2, yamlPath }) {
|
|
1324319
|
-
const doc = context2.referencedDocuments[context2.currentFile];
|
|
1324320
|
-
if (doc != null) {
|
|
1324321
|
-
const localYamlPath = yamlPath.slice(context2.yamlPathIndex);
|
|
1324322
|
-
return doc.getSourceLocation(localYamlPath);
|
|
1324323
|
-
}
|
|
1324324
|
-
return this.createLocationForReferencedFile({ context: context2, absoluteFilePath: context2.currentFile });
|
|
1324325
|
-
}
|
|
1324326
|
-
createLocationForReferencedFile({ context: context2, absoluteFilePath }) {
|
|
1324327
|
-
return new SourceLocation({
|
|
1324328
|
-
absoluteFilePath,
|
|
1324329
|
-
relativeFilePath: RelativeFilePath2.of(relative3(context2.cwd, absoluteFilePath)),
|
|
1324330
|
-
line: 1,
|
|
1324331
|
-
column: 1
|
|
1324332
|
-
});
|
|
1324333
|
-
}
|
|
1324334
|
-
resolveFilePath({ currentFile, refValue }) {
|
|
1324335
|
-
const currentDir = dirname4(currentFile);
|
|
1324336
|
-
return join2(currentDir, RelativeFilePath2.of(refValue));
|
|
1324337
|
-
}
|
|
1324338
|
-
};
|
|
1324339
|
-
|
|
1324340
1324052
|
// ../yaml/loader/lib/YamlParser.js
|
|
1324341
|
-
var import_promises7 = require("fs/promises");
|
|
1324342
|
-
var import_yaml3 = __toESM(require_dist(), 1);
|
|
1324343
1324053
|
var YamlParser = class {
|
|
1324344
1324054
|
/**
|
|
1324345
1324055
|
* Loads and parses a YAML file.
|
|
@@ -1324349,8 +1324059,8 @@ var YamlParser = class {
|
|
|
1324349
1324059
|
* @throws Error if the file cannot be read or contains invalid YAML.
|
|
1324350
1324060
|
*/
|
|
1324351
1324061
|
async parse(absoluteFilePath) {
|
|
1324352
|
-
const source2 = await (0,
|
|
1324353
|
-
return (0,
|
|
1324062
|
+
const source2 = await (0, import_promises6.readFile)(absoluteFilePath, "utf-8");
|
|
1324063
|
+
return (0, import_yaml2.parse)(source2);
|
|
1324354
1324064
|
}
|
|
1324355
1324065
|
/**
|
|
1324356
1324066
|
* Loads and parses a YAML file, preserving source location information.
|
|
@@ -1324363,8 +1324073,8 @@ var YamlParser = class {
|
|
|
1324363
1324073
|
* @throws Error if the file cannot be read or contains invalid YAML.
|
|
1324364
1324074
|
*/
|
|
1324365
1324075
|
async parseDocument({ absoluteFilePath, cwd: cwd2 }) {
|
|
1324366
|
-
const source2 = await (0,
|
|
1324367
|
-
const document4 = (0,
|
|
1324076
|
+
const source2 = await (0, import_promises6.readFile)(absoluteFilePath, "utf-8");
|
|
1324077
|
+
const document4 = (0, import_yaml2.parseDocument)(source2);
|
|
1324368
1324078
|
const relativeFilePath = RelativeFilePath.of(relative2(cwd2, absoluteFilePath));
|
|
1324369
1324079
|
return new YamlDocument({
|
|
1324370
1324080
|
absoluteFilePath,
|
|
@@ -1324423,18 +1324133,15 @@ var YamlSourceResolver = class {
|
|
|
1324423
1324133
|
var YamlConfigLoader = class {
|
|
1324424
1324134
|
parser;
|
|
1324425
1324135
|
cwd;
|
|
1324426
|
-
referenceResolver;
|
|
1324427
1324136
|
constructor({ cwd: cwd2 }) {
|
|
1324428
1324137
|
this.parser = new YamlParser();
|
|
1324429
1324138
|
this.cwd = cwd2;
|
|
1324430
|
-
this.referenceResolver = new ReferenceResolver({ cwd: cwd2 });
|
|
1324431
1324139
|
}
|
|
1324432
1324140
|
/**
|
|
1324433
1324141
|
* Loads and validates a YAML configuration file with source location tracking.
|
|
1324434
1324142
|
*
|
|
1324435
1324143
|
* @param absoluteFilePath - The absolute path to the YAML file.
|
|
1324436
1324144
|
* @param schema - The zod schema to validate against.
|
|
1324437
|
-
* @param resolveReferences - Whether to resolve `$ref` references before validation (default: true).
|
|
1324438
1324145
|
* @returns Result with either the parsed config (both plain and sourced) or validation errors.
|
|
1324439
1324146
|
*
|
|
1324440
1324147
|
* @example
|
|
@@ -1324447,27 +1324154,16 @@ var YamlConfigLoader = class {
|
|
|
1324447
1324154
|
* }
|
|
1324448
1324155
|
* ```
|
|
1324449
1324156
|
*/
|
|
1324450
|
-
async load({ absoluteFilePath, schema: schema2
|
|
1324157
|
+
async load({ absoluteFilePath, schema: schema2 }) {
|
|
1324451
1324158
|
const document4 = await this.parseDocument(absoluteFilePath);
|
|
1324452
|
-
const
|
|
1324453
|
-
if (!resolved.success) {
|
|
1324454
|
-
return {
|
|
1324455
|
-
success: false,
|
|
1324456
|
-
issues: resolved.issues
|
|
1324457
|
-
};
|
|
1324458
|
-
}
|
|
1324459
|
-
const parseResult = schema2.safeParse(resolved.data);
|
|
1324159
|
+
const parseResult = schema2.safeParse(document4.toJS());
|
|
1324460
1324160
|
if (!parseResult.success) {
|
|
1324461
1324161
|
const issues = parseResult.error.issues.map((issue2) => {
|
|
1324462
1324162
|
const yamlPath = issue2.path.filter((p9) => typeof p9 !== "symbol");
|
|
1324463
1324163
|
return new ValidationIssue({
|
|
1324464
1324164
|
yamlPath,
|
|
1324465
1324165
|
message: this.formatZodIssue(issue2),
|
|
1324466
|
-
location:
|
|
1324467
|
-
document: document4,
|
|
1324468
|
-
pathMappings: resolved.pathMappings,
|
|
1324469
|
-
yamlPath
|
|
1324470
|
-
})
|
|
1324166
|
+
location: document4.getSourceLocation(yamlPath)
|
|
1324471
1324167
|
});
|
|
1324472
1324168
|
});
|
|
1324473
1324169
|
return {
|
|
@@ -1324475,11 +1324171,11 @@ var YamlConfigLoader = class {
|
|
|
1324475
1324171
|
issues
|
|
1324476
1324172
|
};
|
|
1324477
1324173
|
}
|
|
1324478
|
-
const
|
|
1324174
|
+
const resolver2 = new YamlSourceResolver(document4);
|
|
1324479
1324175
|
return {
|
|
1324480
1324176
|
success: true,
|
|
1324481
1324177
|
data: parseResult.data,
|
|
1324482
|
-
sourced:
|
|
1324178
|
+
sourced: resolver2.toSourced(parseResult.data),
|
|
1324483
1324179
|
absoluteFilePath,
|
|
1324484
1324180
|
relativeFilePath: RelativeFilePath2.of(relative3(this.cwd, absoluteFilePath))
|
|
1324485
1324181
|
};
|
|
@@ -1324491,23 +1324187,6 @@ var YamlConfigLoader = class {
|
|
|
1324491
1324187
|
throw new Error(`Failed to parse YAML file ${absoluteFilePath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
1324492
1324188
|
}
|
|
1324493
1324189
|
}
|
|
1324494
|
-
async resolveReferences({ document: document4, resolveReferences }) {
|
|
1324495
|
-
if (!resolveReferences) {
|
|
1324496
|
-
return {
|
|
1324497
|
-
success: true,
|
|
1324498
|
-
data: document4.toJS(),
|
|
1324499
|
-
pathMappings: []
|
|
1324500
|
-
};
|
|
1324501
|
-
}
|
|
1324502
|
-
const resolveResult = await this.referenceResolver.resolve({ document: document4 });
|
|
1324503
|
-
if (!resolveResult.success) {
|
|
1324504
|
-
return {
|
|
1324505
|
-
success: false,
|
|
1324506
|
-
issues: resolveResult.issues
|
|
1324507
|
-
};
|
|
1324508
|
-
}
|
|
1324509
|
-
return resolveResult;
|
|
1324510
|
-
}
|
|
1324511
1324190
|
formatZodIssue(issue2) {
|
|
1324512
1324191
|
const path76 = issue2.path.join(".");
|
|
1324513
1324192
|
switch (issue2.code) {
|
|
@@ -1324834,18 +1324513,13 @@ var FernYmlSchemaLoader = class {
|
|
|
1324834
1324513
|
}
|
|
1324835
1324514
|
/**
|
|
1324836
1324515
|
* Finds, loads, and validates a fern.yml configuration file.
|
|
1324837
|
-
* This also resolves and validates any `$ref` nodes in the
|
|
1324838
|
-
* configuration.
|
|
1324839
1324516
|
*
|
|
1324840
1324517
|
* @returns Result with either the parsed config or validation errors.
|
|
1324841
1324518
|
* @throws Error if fern.yml is not found.
|
|
1324842
1324519
|
*/
|
|
1324843
1324520
|
async load() {
|
|
1324844
1324521
|
const absoluteFilePath = await this.finder.findOrThrow(FernYml.FILENAME);
|
|
1324845
|
-
return await this.loader.load({
|
|
1324846
|
-
absoluteFilePath,
|
|
1324847
|
-
schema: FernYmlSchema
|
|
1324848
|
-
});
|
|
1324522
|
+
return await this.loader.load({ absoluteFilePath, schema: FernYmlSchema });
|
|
1324849
1324523
|
}
|
|
1324850
1324524
|
};
|
|
1324851
1324525
|
|
|
@@ -1331776,10 +1331450,10 @@ var ProductFileConfig = schemas_exports4.object({
|
|
|
1331776
1331450
|
});
|
|
1331777
1331451
|
|
|
1331778
1331452
|
// ../configuration/lib/fernignoreUtils.js
|
|
1331779
|
-
var
|
|
1331453
|
+
var import_promises7 = require("fs/promises");
|
|
1331780
1331454
|
var NEW_LINE_REGEX = /\r?\n/;
|
|
1331781
1331455
|
async function getFernIgnorePaths({ absolutePathToFernignore }) {
|
|
1331782
|
-
const fernIgnoreFileContents = (await (0,
|
|
1331456
|
+
const fernIgnoreFileContents = (await (0, import_promises7.readFile)(absolutePathToFernignore)).toString();
|
|
1331783
1331457
|
return parseFernIgnoreContents(fernIgnoreFileContents);
|
|
1331784
1331458
|
}
|
|
1331785
1331459
|
function parseFernIgnoreContents(fernIgnoreFileContents) {
|
|
@@ -1334615,7 +1334289,7 @@ function isPath(value) {
|
|
|
1334615
1334289
|
}
|
|
1334616
1334290
|
|
|
1334617
1334291
|
// ../configuration-loader/lib/dependencies-yml/loadRawDependenciesConfiguration.js
|
|
1334618
|
-
var
|
|
1334292
|
+
var import_promises8 = require("fs/promises");
|
|
1334619
1334293
|
|
|
1334620
1334294
|
// ../../../node_modules/.pnpm/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.mjs
|
|
1334621
1334295
|
function isNothing(subject) {
|
|
@@ -1337252,7 +1336926,7 @@ async function loadRawDependenciesConfiguration({ absolutePathToWorkspace, conte
|
|
|
1337252
1336926
|
if (!await doesPathExist(absolutePathToDependenciesConfiguration)) {
|
|
1337253
1336927
|
return void 0;
|
|
1337254
1336928
|
}
|
|
1337255
|
-
const contentsStr = await (0,
|
|
1336929
|
+
const contentsStr = await (0, import_promises8.readFile)(absolutePathToDependenciesConfiguration);
|
|
1337256
1336930
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
1337257
1336931
|
return await validateSchema({
|
|
1337258
1336932
|
schema: DependenciesConfigurationSchema,
|
|
@@ -1410903,15 +1410577,15 @@ var Pruner = class _Pruner {
|
|
|
1410903
1410577
|
};
|
|
1410904
1410578
|
|
|
1410905
1410579
|
// ../configuration-loader/lib/docs-yml/parseDocsConfiguration.js
|
|
1410906
|
-
var
|
|
1410580
|
+
var import_promises11 = require("fs/promises");
|
|
1410907
1410581
|
var import_path16 = __toESM(require("path"), 1);
|
|
1410908
1410582
|
|
|
1410909
1410583
|
// ../configuration-loader/lib/docs-yml/getAllPages.js
|
|
1410910
|
-
var
|
|
1410584
|
+
var import_promises9 = require("fs/promises");
|
|
1410911
1410585
|
var BATCH_SIZE = 100;
|
|
1410912
1410586
|
async function loadBatch({ files, absolutePathToFernFolder }) {
|
|
1410913
1410587
|
const pairs2 = await Promise.all(files.map(async (file2) => {
|
|
1410914
|
-
const content5 = await (0,
|
|
1410588
|
+
const content5 = await (0, import_promises9.readFile)(file2, "utf-8");
|
|
1410915
1410589
|
return [relativize(absolutePathToFernFolder, file2), content5];
|
|
1410916
1410590
|
}));
|
|
1410917
1410591
|
return Object.fromEntries(pairs2);
|
|
@@ -1411020,7 +1410694,7 @@ function getAllPagesFromApiReferenceLayoutItem({ item }) {
|
|
|
1411020
1410694
|
}
|
|
1411021
1410695
|
|
|
1411022
1410696
|
// ../configuration-loader/lib/docs-yml/navigationUtils.js
|
|
1411023
|
-
var
|
|
1410697
|
+
var import_promises10 = require("fs/promises");
|
|
1411024
1410698
|
var import_gray_matter = __toESM(require_gray_matter(), 1);
|
|
1411025
1410699
|
function nameToSlug({ name: name3 }) {
|
|
1411026
1410700
|
return name3.replace(/\.(md|mdx)$/i, "").toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
|
|
@@ -1411028,7 +1410702,7 @@ function nameToSlug({ name: name3 }) {
|
|
|
1411028
1410702
|
function nameToTitle({ name: name3 }) {
|
|
1411029
1410703
|
return name3.replace(/\.(md|mdx)$/i, "").replace(/[-_]/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
|
|
1411030
1410704
|
}
|
|
1411031
|
-
async function getFrontmatterPosition({ absolutePath, readFileFn = (path76, encoding) => (0,
|
|
1410705
|
+
async function getFrontmatterPosition({ absolutePath, readFileFn = (path76, encoding) => (0, import_promises10.readFile)(path76, encoding) }) {
|
|
1411032
1410706
|
try {
|
|
1411033
1410707
|
const content5 = await readFileFn(absolutePath, "utf-8");
|
|
1411034
1410708
|
const { data: data2 } = (0, import_gray_matter.default)(content5);
|
|
@@ -1411044,7 +1410718,7 @@ async function getFrontmatterPosition({ absolutePath, readFileFn = (path76, enco
|
|
|
1411044
1410718
|
return void 0;
|
|
1411045
1410719
|
}
|
|
1411046
1410720
|
}
|
|
1411047
|
-
async function buildNavigationForDirectory({ directoryPath, getDir = getDirectoryContents, readFileFn = (path76, encoding) => (0,
|
|
1410721
|
+
async function buildNavigationForDirectory({ directoryPath, getDir = getDirectoryContents, readFileFn = (path76, encoding) => (0, import_promises10.readFile)(path76, encoding) }) {
|
|
1411048
1410722
|
const contents = await getDir(directoryPath);
|
|
1411049
1410723
|
const markdownFiles = contents.filter((item) => item.type === "file" && (item.name.endsWith(".md") || item.name.endsWith(".mdx")));
|
|
1411050
1410724
|
const subdirectories = contents.filter((item) => item.type === "directory");
|
|
@@ -1411301,7 +1410975,7 @@ async function convertCssConfig(css, absoluteFilepathToDocsConfig) {
|
|
|
1411301
1410975
|
const cssFilePaths = typeof css === "string" ? [css] : css;
|
|
1411302
1410976
|
return {
|
|
1411303
1410977
|
inline: await Promise.all(cssFilePaths.map(async (cssFilePath) => {
|
|
1411304
|
-
const content5 = await (0,
|
|
1410978
|
+
const content5 = await (0, import_promises11.readFile)(resolveFilepath(cssFilePath, absoluteFilepathToDocsConfig));
|
|
1411305
1410979
|
return content5.toString();
|
|
1411306
1410980
|
}))
|
|
1411307
1410981
|
};
|
|
@@ -1411460,7 +1411134,7 @@ async function getVersionedNavigationConfiguration({ versions, absolutePathToFer
|
|
|
1411460
1411134
|
const versionedNavbars = [];
|
|
1411461
1411135
|
for (const version7 of versions) {
|
|
1411462
1411136
|
const absoluteFilepathToVersionFile = resolve5(absolutePathToFernFolder, version7.path);
|
|
1411463
|
-
const versionContent = jsYaml.load((await (0,
|
|
1411137
|
+
const versionContent = jsYaml.load((await (0, import_promises11.readFile)(absoluteFilepathToVersionFile)).toString());
|
|
1411464
1411138
|
const removedPaths = [];
|
|
1411465
1411139
|
const sanitizedVersionContent = sanitizeNullValues(versionContent, [], removedPaths);
|
|
1411466
1411140
|
if (removedPaths.length > 0) {
|
|
@@ -1411508,7 +1411182,7 @@ async function getNavigationConfiguration({ tabs, products, versions, navigation
|
|
|
1411508
1411182
|
if ("path" in product) {
|
|
1411509
1411183
|
let navigation2;
|
|
1411510
1411184
|
const absoluteFilepathToProductFile = resolve5(absolutePathToFernFolder, product.path);
|
|
1411511
|
-
const content5 = jsYaml.load((await (0,
|
|
1411185
|
+
const content5 = jsYaml.load((await (0, import_promises11.readFile)(absoluteFilepathToProductFile)).toString());
|
|
1411512
1411186
|
const removedPaths = [];
|
|
1411513
1411187
|
const sanitizedContent = sanitizeNullValues(content5, [], removedPaths);
|
|
1411514
1411188
|
if (removedPaths.length > 0) {
|
|
@@ -1412202,7 +1411876,7 @@ function parseAudiences(raw2) {
|
|
|
1412202
1411876
|
}
|
|
1412203
1411877
|
|
|
1412204
1411878
|
// ../configuration-loader/lib/fern-config-json/loadProjectConfig.js
|
|
1412205
|
-
var
|
|
1411879
|
+
var import_promises12 = require("fs/promises");
|
|
1412206
1411880
|
|
|
1412207
1411881
|
// ../configuration-loader/lib/fern-config-json/schema/ProjectConfigSchema.js
|
|
1412208
1411882
|
var ProjectConfigSchema = external_exports2.strictObject({
|
|
@@ -1412213,7 +1411887,7 @@ var ProjectConfigSchema = external_exports2.strictObject({
|
|
|
1412213
1411887
|
// ../configuration-loader/lib/fern-config-json/loadProjectConfig.js
|
|
1412214
1411888
|
async function loadProjectConfig({ directory, context: context2 }) {
|
|
1412215
1411889
|
const pathToConfig = join2(directory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME));
|
|
1412216
|
-
const projectConfigStr = await (0,
|
|
1411890
|
+
const projectConfigStr = await (0, import_promises12.readFile)(pathToConfig);
|
|
1412217
1411891
|
const projectConfigParsed = JSON.parse(projectConfigStr.toString());
|
|
1412218
1411892
|
const rawProjectConfig = await validateSchema({
|
|
1412219
1411893
|
schema: ProjectConfigSchema,
|
|
@@ -1412615,7 +1412289,7 @@ async function addGenerator({ generatorName, generatorsConfiguration, groupName
|
|
|
1412615
1412289
|
}
|
|
1412616
1412290
|
|
|
1412617
1412291
|
// ../../commons/github/lib/ClonedRepository.js
|
|
1412618
|
-
var
|
|
1412292
|
+
var import_promises13 = require("fs/promises");
|
|
1412619
1412293
|
var import_path17 = __toESM(require("path"), 1);
|
|
1412620
1412294
|
|
|
1412621
1412295
|
// ../../../node_modules/.pnpm/simple-git@3.30.0/node_modules/simple-git/dist/esm/index.js
|
|
@@ -1417363,18 +1417037,18 @@ var ClonedRepository = class _ClonedRepository {
|
|
|
1417363
1417037
|
}
|
|
1417364
1417038
|
async overwriteLocalContents(sourceDirectoryPath) {
|
|
1417365
1417039
|
const [sourceContents, destContents] = await Promise.all([
|
|
1417366
|
-
(0,
|
|
1417367
|
-
(0,
|
|
1417040
|
+
(0, import_promises13.readdir)(sourceDirectoryPath),
|
|
1417041
|
+
(0, import_promises13.readdir)(this.clonePath)
|
|
1417368
1417042
|
]);
|
|
1417369
1417043
|
await Promise.all(destContents.filter((content5) => !DEFAULT_IGNORED_FILES.includes(content5)).map(async (content5) => {
|
|
1417370
|
-
await (0,
|
|
1417044
|
+
await (0, import_promises13.rm)((0, import_path17.resolve)(this.clonePath, content5), {
|
|
1417371
1417045
|
recursive: true,
|
|
1417372
1417046
|
force: true
|
|
1417373
1417047
|
});
|
|
1417374
1417048
|
}));
|
|
1417375
1417049
|
await Promise.all(sourceContents.filter((content5) => !DEFAULT_IGNORED_FILES.includes(content5)).map(async (content5) => {
|
|
1417376
1417050
|
const path76 = (0, import_path17.resolve)(sourceDirectoryPath, content5);
|
|
1417377
|
-
await (0,
|
|
1417051
|
+
await (0, import_promises13.cp)(path76, (0, import_path17.resolve)(this.clonePath, content5), { recursive: true });
|
|
1417378
1417052
|
}));
|
|
1417379
1417053
|
}
|
|
1417380
1417054
|
async readFile({ relativeFilePath }) {
|
|
@@ -1417382,12 +1417056,12 @@ var ClonedRepository = class _ClonedRepository {
|
|
|
1417382
1417056
|
if (!await doesPathExist2(absoluteFilePath)) {
|
|
1417383
1417057
|
return void 0;
|
|
1417384
1417058
|
}
|
|
1417385
|
-
return await (0,
|
|
1417059
|
+
return await (0, import_promises13.readFile)(absoluteFilePath, "utf-8");
|
|
1417386
1417060
|
}
|
|
1417387
1417061
|
};
|
|
1417388
1417062
|
async function doesPathExist2(filepath) {
|
|
1417389
1417063
|
try {
|
|
1417390
|
-
await (0,
|
|
1417064
|
+
await (0, import_promises13.lstat)(filepath);
|
|
1417391
1417065
|
return true;
|
|
1417392
1417066
|
} catch {
|
|
1417393
1417067
|
return false;
|
|
@@ -1417720,7 +1417394,7 @@ var LruObject = class {
|
|
|
1417720
1417394
|
// ../configuration-loader/lib/generators-yml/convertGeneratorsConfiguration.js
|
|
1417721
1417395
|
var import_fiddle_sdk = __toESM(require_fiddle_sdk(), 1);
|
|
1417722
1417396
|
var import_api = __toESM(require_api2(), 1);
|
|
1417723
|
-
var
|
|
1417397
|
+
var import_promises14 = require("fs/promises");
|
|
1417724
1417398
|
var import_path18 = __toESM(require("path"), 1);
|
|
1417725
1417399
|
var UNDEFINED_API_DEFINITION_SETTINGS = {
|
|
1417726
1417400
|
shouldUseTitleAsName: void 0,
|
|
@@ -1418357,7 +1418031,7 @@ async function getGithubLicense({ absolutePathToGeneratorsConfiguration, githubL
|
|
|
1418357
1418031
|
}
|
|
1418358
1418032
|
}
|
|
1418359
1418033
|
const absolutePathToLicense = join2(AbsoluteFilePath2.of(import_path18.default.dirname(absolutePathToGeneratorsConfiguration)), RelativeFilePath2.of(githubLicense.custom));
|
|
1418360
|
-
const licenseContent = await (0,
|
|
1418034
|
+
const licenseContent = await (0, import_promises14.readFile)(absolutePathToLicense);
|
|
1418361
1418035
|
return import_fiddle_sdk.FernFiddle.GithubLicense.custom({
|
|
1418362
1418036
|
contents: licenseContent.toString()
|
|
1418363
1418037
|
});
|
|
@@ -1418536,14 +1418210,14 @@ function isGithubSelfhosted(github) {
|
|
|
1418536
1418210
|
}
|
|
1418537
1418211
|
|
|
1418538
1418212
|
// ../configuration-loader/lib/generators-yml/loadGeneratorsConfiguration.js
|
|
1418539
|
-
var
|
|
1418213
|
+
var import_promises15 = require("fs/promises");
|
|
1418540
1418214
|
var import_path19 = __toESM(require("path"), 1);
|
|
1418541
1418215
|
async function loadRawGeneratorsConfiguration({ absolutePathToWorkspace, context: context2 }) {
|
|
1418542
1418216
|
const filepath = await getPathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
1418543
1418217
|
if (filepath == null) {
|
|
1418544
1418218
|
return void 0;
|
|
1418545
1418219
|
}
|
|
1418546
|
-
const contentsStr = await (0,
|
|
1418220
|
+
const contentsStr = await (0, import_promises15.readFile)(filepath);
|
|
1418547
1418221
|
try {
|
|
1418548
1418222
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
1418549
1418223
|
const parsed = generators_yml_exports.serialization.GeneratorsConfigurationSchema.parse(contentsParsed, {
|
|
@@ -1418620,7 +1418294,7 @@ async function getFernDirectory(nameOverride) {
|
|
|
1418620
1418294
|
}
|
|
1418621
1418295
|
|
|
1418622
1418296
|
// ../init/lib/initializeAPI.js
|
|
1418623
|
-
var
|
|
1418297
|
+
var import_promises23 = require("fs/promises");
|
|
1418624
1418298
|
var import_fs_extra = __toESM(require_lib6(), 1);
|
|
1418625
1418299
|
var import_path23 = __toESM(require("path"), 1);
|
|
1418626
1418300
|
|
|
@@ -1423214,7 +1422888,7 @@ async function createOrganizationIfDoesNotExist({ organization, token, context:
|
|
|
1423214
1422888
|
}
|
|
1423215
1422889
|
|
|
1423216
1422890
|
// ../auth/lib/persistence/getToken.js
|
|
1423217
|
-
var
|
|
1422891
|
+
var import_promises16 = require("fs/promises");
|
|
1423218
1422892
|
|
|
1423219
1422893
|
// ../auth/lib/persistence/getPathToTokenFile.js
|
|
1423220
1422894
|
var import_os = require("os");
|
|
@@ -1423245,7 +1422919,7 @@ async function getUserToken() {
|
|
|
1423245
1422919
|
if (!doesTokenFileExist) {
|
|
1423246
1422920
|
return void 0;
|
|
1423247
1422921
|
}
|
|
1423248
|
-
const tokenFileContents = await (0,
|
|
1422922
|
+
const tokenFileContents = await (0, import_promises16.readFile)(pathToTokenFile);
|
|
1423249
1422923
|
const tokenString = tokenFileContents.toString().trim();
|
|
1423250
1422924
|
if (tokenString.length === 0) {
|
|
1423251
1422925
|
return void 0;
|
|
@@ -1423257,11 +1422931,11 @@ async function getUserToken() {
|
|
|
1423257
1422931
|
}
|
|
1423258
1422932
|
|
|
1423259
1422933
|
// ../auth/lib/persistence/removeToken.js
|
|
1423260
|
-
var
|
|
1422934
|
+
var import_promises17 = require("fs/promises");
|
|
1423261
1422935
|
async function removeToken() {
|
|
1423262
1422936
|
const pathToTokenFile = getPathToTokenFile();
|
|
1423263
1422937
|
try {
|
|
1423264
|
-
await (0,
|
|
1422938
|
+
await (0, import_promises17.unlink)(pathToTokenFile);
|
|
1423265
1422939
|
} catch (error49) {
|
|
1423266
1422940
|
if (error49.code !== "ENOENT") {
|
|
1423267
1422941
|
throw error49;
|
|
@@ -1423270,12 +1422944,12 @@ async function removeToken() {
|
|
|
1423270
1422944
|
}
|
|
1423271
1422945
|
|
|
1423272
1422946
|
// ../auth/lib/persistence/storeToken.js
|
|
1423273
|
-
var
|
|
1422947
|
+
var import_promises18 = require("fs/promises");
|
|
1423274
1422948
|
var import_path20 = __toESM(require("path"), 1);
|
|
1423275
1422949
|
async function storeToken(token) {
|
|
1423276
1422950
|
const pathToTokenFile = getPathToTokenFile();
|
|
1423277
|
-
await (0,
|
|
1423278
|
-
await (0,
|
|
1422951
|
+
await (0, import_promises18.mkdir)(import_path20.default.dirname(pathToTokenFile), { recursive: true });
|
|
1422952
|
+
await (0, import_promises18.writeFile)(pathToTokenFile, token);
|
|
1423279
1422953
|
}
|
|
1423280
1422954
|
|
|
1423281
1422955
|
// ../auth/lib/users/getCurrentUser.js
|
|
@@ -1429260,7 +1428934,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1429260
1428934
|
properties: {
|
|
1429261
1428935
|
...event,
|
|
1429262
1428936
|
...event.properties,
|
|
1429263
|
-
version: "3.47.3
|
|
1428937
|
+
version: "3.47.3",
|
|
1429264
1428938
|
usingAccessToken: true
|
|
1429265
1428939
|
}
|
|
1429266
1428940
|
});
|
|
@@ -1429282,7 +1428956,7 @@ var NoopPosthogManager = class {
|
|
|
1429282
1428956
|
};
|
|
1429283
1428957
|
|
|
1429284
1428958
|
// ../posthog-manager/lib/UserPosthogManager.js
|
|
1429285
|
-
var
|
|
1428959
|
+
var import_promises19 = require("fs/promises");
|
|
1429286
1428960
|
var import_os2 = require("os");
|
|
1429287
1428961
|
var import_path22 = require("path");
|
|
1429288
1428962
|
|
|
@@ -1429359,7 +1429033,7 @@ var UserPosthogManager = class {
|
|
|
1429359
1429033
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1429360
1429034
|
event: "CLI",
|
|
1429361
1429035
|
properties: {
|
|
1429362
|
-
version: "3.47.3
|
|
1429036
|
+
version: "3.47.3",
|
|
1429363
1429037
|
...event,
|
|
1429364
1429038
|
...event.properties,
|
|
1429365
1429039
|
usingAccessToken: false,
|
|
@@ -1429398,10 +1429072,10 @@ var UserPosthogManager = class {
|
|
|
1429398
1429072
|
if (this.persistedDistinctId == null) {
|
|
1429399
1429073
|
const pathToFile = join2(AbsoluteFilePath2.of((0, import_os2.homedir)()), RelativeFilePath2.of(LOCAL_STORAGE_FOLDER2), RelativeFilePath2.of(DISTINCT_ID_FILENAME));
|
|
1429400
1429074
|
if (!await doesPathExist(pathToFile)) {
|
|
1429401
|
-
await (0,
|
|
1429402
|
-
await (0,
|
|
1429075
|
+
await (0, import_promises19.mkdir)((0, import_path22.dirname)(pathToFile), { recursive: true });
|
|
1429076
|
+
await (0, import_promises19.writeFile)(pathToFile, v4_default());
|
|
1429403
1429077
|
}
|
|
1429404
|
-
this.persistedDistinctId = (await (0,
|
|
1429078
|
+
this.persistedDistinctId = (await (0, import_promises19.readFile)(pathToFile)).toString();
|
|
1429405
1429079
|
}
|
|
1429406
1429080
|
return this.persistedDistinctId;
|
|
1429407
1429081
|
}
|
|
@@ -1433932,7 +1433606,7 @@ function constructAuth0LogoutUrl() {
|
|
|
1433932
1433606
|
}
|
|
1433933
1433607
|
|
|
1433934
1433608
|
// ../init/lib/createFernDirectoryAndOrganization.js
|
|
1433935
|
-
var
|
|
1433609
|
+
var import_promises20 = require("fs/promises");
|
|
1433936
1433610
|
var GITIGNORE_CONTENT = "**/.preview\n**/.definition\n";
|
|
1433937
1433611
|
async function createFernDirectoryAndWorkspace({ organization, taskContext, versionOfCli }) {
|
|
1433938
1433612
|
const pathToFernDirectory = join2(cwd(), RelativeFilePath2.of(FERN_DIRECTORY));
|
|
@@ -1433961,7 +1433635,7 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
|
|
|
1433961
1433635
|
}
|
|
1433962
1433636
|
}
|
|
1433963
1433637
|
}
|
|
1433964
|
-
await (0,
|
|
1433638
|
+
await (0, import_promises20.mkdir)(FERN_DIRECTORY);
|
|
1433965
1433639
|
await writeProjectConfig({
|
|
1433966
1433640
|
filepath: join2(pathToFernDirectory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)),
|
|
1433967
1433641
|
organization,
|
|
@@ -1433985,11 +1433659,11 @@ async function writeProjectConfig({ organization, filepath, versionOfCli }) {
|
|
|
1433985
1433659
|
organization,
|
|
1433986
1433660
|
version: versionOfCli
|
|
1433987
1433661
|
};
|
|
1433988
|
-
await (0,
|
|
1433662
|
+
await (0, import_promises20.writeFile)(filepath, JSON.stringify(projectConfig, void 0, 4));
|
|
1433989
1433663
|
}
|
|
1433990
1433664
|
async function writeGitignore({ absolutePathToFernDirectory }) {
|
|
1433991
1433665
|
const gitignorePath = join2(absolutePathToFernDirectory, RelativeFilePath2.of(".gitignore"));
|
|
1433992
|
-
await (0,
|
|
1433666
|
+
await (0, import_promises20.writeFile)(gitignorePath, GITIGNORE_CONTENT);
|
|
1433993
1433667
|
}
|
|
1433994
1433668
|
|
|
1433995
1433669
|
// ../fern-definition/formatter/lib/FernDefinitionFileFormatter.js
|
|
@@ -1434173,7 +1433847,7 @@ async function formatDefinitionFile({ fileContents }) {
|
|
|
1434173
1433847
|
}
|
|
1434174
1433848
|
|
|
1434175
1433849
|
// ../fern-definition/formatter/lib/formatWorkspace.js
|
|
1434176
|
-
var
|
|
1433850
|
+
var import_promises21 = require("fs/promises");
|
|
1434177
1433851
|
async function formatFernWorkspace({ workspace, context: context2, shouldFix }) {
|
|
1434178
1433852
|
for (const [relativeFilepath, file2] of entries(workspace.definition.namedDefinitionFiles)) {
|
|
1434179
1433853
|
const formatted = await formatDefinitionFile({
|
|
@@ -1434181,7 +1433855,7 @@ async function formatFernWorkspace({ workspace, context: context2, shouldFix })
|
|
|
1434181
1433855
|
});
|
|
1434182
1433856
|
if (formatted !== file2.rawContents) {
|
|
1434183
1433857
|
if (shouldFix) {
|
|
1434184
|
-
await (0,
|
|
1433858
|
+
await (0, import_promises21.writeFile)(file2.absoluteFilePath, formatted);
|
|
1434185
1433859
|
context2.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
|
|
1434186
1433860
|
} else {
|
|
1434187
1433861
|
context2.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
|
|
@@ -1434192,7 +1433866,7 @@ async function formatFernWorkspace({ workspace, context: context2, shouldFix })
|
|
|
1434192
1433866
|
}
|
|
1434193
1433867
|
|
|
1434194
1433868
|
// ../init/lib/createWorkspace.js
|
|
1434195
|
-
var
|
|
1433869
|
+
var import_promises22 = require("fs/promises");
|
|
1434196
1433870
|
|
|
1434197
1433871
|
// ../init/lib/sampleImdbApi.js
|
|
1434198
1433872
|
var SAMPLE_IMDB_API = `
|
|
@@ -1434260,7 +1433934,7 @@ errors:
|
|
|
1434260
1433934
|
// ../init/lib/createWorkspace.js
|
|
1434261
1433935
|
async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context: context2 }) {
|
|
1434262
1433936
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
1434263
|
-
await (0,
|
|
1433937
|
+
await (0, import_promises22.mkdir)(directoryOfWorkspace);
|
|
1434264
1433938
|
}
|
|
1434265
1433939
|
await writeGeneratorsConfiguration({
|
|
1434266
1433940
|
filepath: join2(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -1434274,7 +1433948,7 @@ async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context:
|
|
|
1434274
1433948
|
}
|
|
1434275
1433949
|
async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, cliVersion, context: context2 }) {
|
|
1434276
1433950
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
1434277
|
-
await (0,
|
|
1433951
|
+
await (0, import_promises22.mkdir)(directoryOfWorkspace);
|
|
1434278
1433952
|
}
|
|
1434279
1433953
|
await writeGeneratorsConfiguration({
|
|
1434280
1433954
|
filepath: join2(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -1434320,7 +1433994,7 @@ async function getDefaultGeneratorsConfiguration({ cliVersion, context: context2
|
|
|
1434320
1433994
|
return config3;
|
|
1434321
1433995
|
}
|
|
1434322
1433996
|
async function writeGeneratorsConfiguration({ filepath, cliVersion, context: context2, apiConfiguration }) {
|
|
1434323
|
-
await (0,
|
|
1433997
|
+
await (0, import_promises22.writeFile)(filepath, "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(await getDefaultGeneratorsConfiguration({ cliVersion, context: context2, apiConfiguration }), {
|
|
1434324
1433998
|
sortKeys: (a10, b18) => {
|
|
1434325
1433999
|
if (a10 === "api") {
|
|
1434326
1434000
|
return -1;
|
|
@@ -1434339,10 +1434013,10 @@ var ROOT_API = {
|
|
|
1434339
1434013
|
}
|
|
1434340
1434014
|
};
|
|
1434341
1434015
|
async function writeSampleApiDefinition({ directoryOfDefinition }) {
|
|
1434342
|
-
await (0,
|
|
1434343
|
-
await (0,
|
|
1434016
|
+
await (0, import_promises22.mkdir)(directoryOfDefinition);
|
|
1434017
|
+
await (0, import_promises22.writeFile)(join2(directoryOfDefinition, RelativeFilePath2.of(ROOT_API_FILENAME)), jsYaml.dump(ROOT_API));
|
|
1434344
1434018
|
const absoluteFilepathToImdbYaml = join2(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
|
|
1434345
|
-
await (0,
|
|
1434019
|
+
await (0, import_promises22.writeFile)(absoluteFilepathToImdbYaml, await formatDefinitionFile({
|
|
1434346
1434020
|
fileContents: SAMPLE_IMDB_API
|
|
1434347
1434021
|
}));
|
|
1434348
1434022
|
}
|
|
@@ -1434388,13 +1434062,13 @@ async function getDirectoryOfNewAPIWorkspace({ absolutePathToFernDirectory, task
|
|
|
1434388
1434062
|
const apiWorkspaceDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api"));
|
|
1434389
1434063
|
const inlinedDefinitionDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
1434390
1434064
|
const workspaceDefinitionDirectory = join2(apiWorkspaceDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
1434391
|
-
await (0,
|
|
1434065
|
+
await (0, import_promises23.mkdir)(apiWorkspaceDirectory, { recursive: true });
|
|
1434392
1434066
|
await import_fs_extra.default.move(inlinedDefinitionDirectory, workspaceDefinitionDirectory);
|
|
1434393
1434067
|
const inlinedGeneratorsYml = join2(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME));
|
|
1434394
1434068
|
const workspaceGeneratorsYml = join2(apiWorkspaceDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME));
|
|
1434395
1434069
|
await import_fs_extra.default.move(inlinedGeneratorsYml, workspaceGeneratorsYml);
|
|
1434396
1434070
|
const newApiDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api1"));
|
|
1434397
|
-
await (0,
|
|
1434071
|
+
await (0, import_promises23.mkdir)(workspaceDefinitionDirectory, { recursive: true });
|
|
1434398
1434072
|
return newApiDirectory;
|
|
1434399
1434073
|
}
|
|
1434400
1434074
|
return absolutePathToFernDirectory;
|
|
@@ -1434409,7 +1434083,7 @@ async function hasInlinedAPIDefinitions({ absolutePathToFernDirectory }) {
|
|
|
1434409
1434083
|
}
|
|
1434410
1434084
|
|
|
1434411
1434085
|
// ../init/lib/initializeDocs.js
|
|
1434412
|
-
var
|
|
1434086
|
+
var import_promises24 = require("fs/promises");
|
|
1434413
1434087
|
|
|
1434414
1434088
|
// ../../commons/core-utils/src/titleCase.ts
|
|
1434415
1434089
|
var import_title3 = __toESM(require_lib(), 1);
|
|
@@ -1434825,7 +1434499,7 @@ async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
|
1434825
1434499
|
} else {
|
|
1434826
1434500
|
try {
|
|
1434827
1434501
|
const docsConfig = getDocsConfig(createDirectoryResponse.organization);
|
|
1434828
|
-
await (0,
|
|
1434502
|
+
await (0, import_promises24.writeFile)(docsYmlPath, jsYaml.dump(docsConfig));
|
|
1434829
1434503
|
taskContext.logger.info(source_default.green("Created docs configuration"));
|
|
1434830
1434504
|
return;
|
|
1434831
1434505
|
} catch (writeError) {
|
|
@@ -1434873,7 +1434547,7 @@ var FernDocsBuilder = class {
|
|
|
1434873
1434547
|
};
|
|
1434874
1434548
|
|
|
1434875
1434549
|
// ../docs-importers/commons/lib/FernDocsBuilderImpl.js
|
|
1434876
|
-
var
|
|
1434550
|
+
var import_promises25 = require("fs/promises");
|
|
1434877
1434551
|
var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
1434878
1434552
|
openApiSpecs = {};
|
|
1434879
1434553
|
nonTabbedNavigation = new NonTabbedNavigationBuilderImpl();
|
|
@@ -1434932,7 +1434606,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
1434932
1434606
|
}
|
|
1434933
1434607
|
async build({ outputDirectory }) {
|
|
1434934
1434608
|
const absolutePathToFernDirectory = join2(outputDirectory, RelativeFilePath2.of(FERN_DIRECTORY));
|
|
1434935
|
-
await (0,
|
|
1434609
|
+
await (0, import_promises25.mkdir)(absolutePathToFernDirectory, { recursive: true });
|
|
1434936
1434610
|
if (Object.keys(this.tabbedNavigation).length > 0) {
|
|
1434937
1434611
|
this.docsYml.tabs = Object.fromEntries(Object.entries(this.tabbedNavigation).map(([key, value]) => {
|
|
1434938
1434612
|
return [value.tabId, value.tabConfig];
|
|
@@ -1434957,27 +1434631,27 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
1434957
1434631
|
}))
|
|
1434958
1434632
|
};
|
|
1434959
1434633
|
}
|
|
1434960
|
-
await (0,
|
|
1434634
|
+
await (0, import_promises25.writeFile)(join2(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)), jsYaml.dump(generators_yml_exports.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml)));
|
|
1434961
1434635
|
await Promise.all(Object.entries(this.openApiSpecs).map(async ([relativePath, absolutePath]) => {
|
|
1434962
1434636
|
const absolutePathToOpenAPI = join2(absolutePathToFernDirectory, RelativeFilePath2.of(relativePath));
|
|
1434963
|
-
await (0,
|
|
1434964
|
-
await (0,
|
|
1434637
|
+
await (0, import_promises25.mkdir)(dirname4(absolutePathToOpenAPI), { recursive: true });
|
|
1434638
|
+
await (0, import_promises25.cp)(absolutePath, absolutePathToOpenAPI);
|
|
1434965
1434639
|
}));
|
|
1434966
1434640
|
}
|
|
1434967
|
-
await (0,
|
|
1434641
|
+
await (0, import_promises25.writeFile)(join2(absolutePathToFernDirectory, RelativeFilePath2.of(DOCS_CONFIGURATION_FILENAME)), jsYaml.dump(docs_yml_exports.RawSchemas.Serializer.DocsConfiguration.jsonOrThrow(this.docsYml, { omitUndefined: true })));
|
|
1434968
1434642
|
await Promise.all(Object.entries(this.markdownPages).map(async ([filepath, page]) => {
|
|
1434969
1434643
|
const absoluteFilepathToMarkdownPage = join2(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
1434970
|
-
await (0,
|
|
1434644
|
+
await (0, import_promises25.mkdir)(dirname4(absoluteFilepathToMarkdownPage), { recursive: true });
|
|
1434971
1434645
|
const frontmatter = Object.keys(page.frontmatter).length > 0 ? `---
|
|
1434972
1434646
|
${jsYaml.dump(JSON.parse(JSON.stringify(page.frontmatter)))}---
|
|
1434973
1434647
|
|
|
1434974
1434648
|
` : "";
|
|
1434975
|
-
await (0,
|
|
1434649
|
+
await (0, import_promises25.writeFile)(absoluteFilepathToMarkdownPage, `${frontmatter}${page.markdown}`);
|
|
1434976
1434650
|
}));
|
|
1434977
1434651
|
await Promise.all(Object.entries(this.assets).map(async ([filepath, asset]) => {
|
|
1434978
1434652
|
const absolutePathToAsset = join2(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
1434979
|
-
await (0,
|
|
1434980
|
-
await (0,
|
|
1434653
|
+
await (0, import_promises25.mkdir)(dirname4(absolutePathToAsset), { recursive: true });
|
|
1434654
|
+
await (0, import_promises25.cp)(asset.absoluteFilePathToAsset, absolutePathToAsset);
|
|
1434981
1434655
|
}));
|
|
1434982
1434656
|
}
|
|
1434983
1434657
|
setInstance({ companyName }) {
|
|
@@ -1435009,7 +1434683,7 @@ var NonTabbedNavigationBuilderImpl = class {
|
|
|
1435009
1434683
|
};
|
|
1435010
1434684
|
|
|
1435011
1434685
|
// ../docs-importers/mintlify/lib/MintlifyImporter.js
|
|
1435012
|
-
var
|
|
1434686
|
+
var import_promises27 = require("fs/promises");
|
|
1435013
1434687
|
|
|
1435014
1434688
|
// ../docs-importers/mintlify/lib/convertColors.js
|
|
1435015
1434689
|
function convertColors(colors19) {
|
|
@@ -1435063,10 +1434737,10 @@ function convertLogo({ logo, builder, absolutePathToMintJson }) {
|
|
|
1435063
1434737
|
}
|
|
1435064
1434738
|
|
|
1435065
1434739
|
// ../docs-importers/mintlify/lib/convertMarkdown.js
|
|
1435066
|
-
var
|
|
1434740
|
+
var import_promises26 = require("fs/promises");
|
|
1435067
1434741
|
var import_gray_matter2 = __toESM(require_gray_matter(), 1);
|
|
1435068
1434742
|
async function convertMarkdown({ absolutePathToMintJson, absoluteFilepathToMarkdown, relativeFilepathFromRoot, builder }) {
|
|
1435069
|
-
const text9 = await (0,
|
|
1434743
|
+
const text9 = await (0, import_promises26.readFile)(absoluteFilepathToMarkdown, "utf-8");
|
|
1435070
1434744
|
const { data: data2, content: content5 } = parseMintlifyFrontmatter(text9);
|
|
1435071
1434745
|
const slug = relativeFilepathFromRoot.replace(/\.(md|mdx)$/, "");
|
|
1435072
1434746
|
const transformedContent = markReferencedAssets({
|
|
@@ -1435229,7 +1434903,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
1435229
1434903
|
documentationTab = void 0;
|
|
1435230
1434904
|
tabUrlToInfo = {};
|
|
1435231
1434905
|
async import({ args, builder }) {
|
|
1435232
|
-
const mintJsonContent = await (0,
|
|
1434906
|
+
const mintJsonContent = await (0, import_promises27.readFile)(args.absolutePathToMintJson, "utf-8");
|
|
1435233
1434907
|
const mint = JSON.parse(mintJsonContent);
|
|
1435234
1434908
|
builder.setTitle({ title: mint.name });
|
|
1435235
1434909
|
const relativePathToFavicon = RelativeFilePath2.of(mint.favicon.substring(1));
|
|
@@ -1435354,7 +1435028,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
1435354
1435028
|
};
|
|
1435355
1435029
|
|
|
1435356
1435030
|
// ../docs-importers/mintlify/lib/runMintlifyMigration.js
|
|
1435357
|
-
var
|
|
1435031
|
+
var import_promises28 = require("fs/promises");
|
|
1435358
1435032
|
async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskContext, versionOfCli, organization }) {
|
|
1435359
1435033
|
const mintlifyImporter = new MintlifyImporter({
|
|
1435360
1435034
|
context: taskContext
|
|
@@ -1435365,7 +1435039,7 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
|
|
|
1435365
1435039
|
builder
|
|
1435366
1435040
|
});
|
|
1435367
1435041
|
await builder.build({ outputDirectory: outputPath });
|
|
1435368
|
-
await (0,
|
|
1435042
|
+
await (0, import_promises28.writeFile)(join2(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
1435369
1435043
|
version: versionOfCli,
|
|
1435370
1435044
|
organization
|
|
1435371
1435045
|
}, void 0, 4));
|
|
@@ -1435610,7 +1435284,7 @@ function assertIsStringArray(val) {
|
|
|
1435610
1435284
|
}
|
|
1435611
1435285
|
|
|
1435612
1435286
|
// ../docs-importers/readme/lib/ReadmeImporter.js
|
|
1435613
|
-
var
|
|
1435287
|
+
var import_promises33 = require("fs/promises");
|
|
1435614
1435288
|
|
|
1435615
1435289
|
// ../docs-importers/readme/lib/extract/favicon.js
|
|
1435616
1435290
|
async function getFavicon(hast) {
|
|
@@ -1475462,7 +1475136,7 @@ init_AsyncIterableUtil();
|
|
|
1475462
1475136
|
init_disposable();
|
|
1475463
1475137
|
|
|
1475464
1475138
|
// ../../../node_modules/.pnpm/puppeteer-core@24.23.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js
|
|
1475465
|
-
var
|
|
1475139
|
+
var import_promises31 = require("fs/promises");
|
|
1475466
1475140
|
var import_node_os8 = __toESM(require("os"), 1);
|
|
1475467
1475141
|
var import_node_path16 = __toESM(require("path"), 1);
|
|
1475468
1475142
|
|
|
@@ -1476878,7 +1476552,7 @@ var TimeoutError2 = class extends Error {
|
|
|
1476878
1476552
|
var import_node_assert2 = __toESM(require("assert"), 1);
|
|
1476879
1476553
|
var import_node_child_process3 = require("child_process");
|
|
1476880
1476554
|
var import_node_fs10 = require("fs");
|
|
1476881
|
-
var
|
|
1476555
|
+
var import_promises30 = require("fs/promises");
|
|
1476882
1476556
|
var import_node_os6 = __toESM(require("os"), 1);
|
|
1476883
1476557
|
var import_node_path14 = __toESM(require("path"), 1);
|
|
1476884
1476558
|
var import_progress = __toESM(require_progress(), 1);
|
|
@@ -1476886,7 +1476560,7 @@ var import_progress = __toESM(require_progress(), 1);
|
|
|
1476886
1476560
|
// ../../../node_modules/.pnpm/@puppeteer+browsers@2.10.10/node_modules/@puppeteer/browsers/lib/esm/fileUtil.js
|
|
1476887
1476561
|
var import_node_child_process2 = require("child_process");
|
|
1476888
1476562
|
var import_node_fs9 = require("fs");
|
|
1476889
|
-
var
|
|
1476563
|
+
var import_promises29 = require("fs/promises");
|
|
1476890
1476564
|
var path28 = __toESM(require("path"), 1);
|
|
1476891
1476565
|
var import_node_stream3 = require("stream");
|
|
1476892
1476566
|
var import_debug5 = __toESM(require_src(), 1);
|
|
@@ -1477320,7 +1476994,7 @@ var ChromeLauncher = class extends BrowserLauncher {
|
|
|
1477320
1476994
|
});
|
|
1477321
1476995
|
if (userDataDirIndex < 0) {
|
|
1477322
1476996
|
isTempUserDataDir = true;
|
|
1477323
|
-
chromeArguments.push(`--user-data-dir=${await (0,
|
|
1476997
|
+
chromeArguments.push(`--user-data-dir=${await (0, import_promises31.mkdtemp)(this.getProfilePath())}`);
|
|
1477324
1476998
|
userDataDirIndex = chromeArguments.length - 1;
|
|
1477325
1476999
|
}
|
|
1477326
1477000
|
const userDataDir = chromeArguments[userDataDirIndex].split("=", 2)[1];
|
|
@@ -1477484,7 +1477158,7 @@ function removeMatchingFlags(array2, flag) {
|
|
|
1477484
1477158
|
|
|
1477485
1477159
|
// ../../../node_modules/.pnpm/puppeteer-core@24.23.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/FirefoxLauncher.js
|
|
1477486
1477160
|
var import_node_fs13 = __toESM(require("fs"), 1);
|
|
1477487
|
-
var
|
|
1477161
|
+
var import_promises32 = require("fs/promises");
|
|
1477488
1477162
|
var import_node_os9 = __toESM(require("os"), 1);
|
|
1477489
1477163
|
var import_node_path17 = __toESM(require("path"), 1);
|
|
1477490
1477164
|
init_util2();
|
|
@@ -1477537,7 +1477211,7 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
1477537
1477211
|
}
|
|
1477538
1477212
|
isTempUserDataDir = false;
|
|
1477539
1477213
|
} else {
|
|
1477540
|
-
userDataDir = await (0,
|
|
1477214
|
+
userDataDir = await (0, import_promises32.mkdtemp)(this.getProfilePath());
|
|
1477541
1477215
|
firefoxArguments.push("--profile");
|
|
1477542
1477216
|
firefoxArguments.push(userDataDir);
|
|
1477543
1477217
|
}
|
|
@@ -1477578,8 +1477252,8 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
1477578
1477252
|
const prefsBackupPath = import_node_path17.default.join(userDataDir, file2 + backupSuffix);
|
|
1477579
1477253
|
if (import_node_fs13.default.existsSync(prefsBackupPath)) {
|
|
1477580
1477254
|
const prefsPath = import_node_path17.default.join(userDataDir, file2);
|
|
1477581
|
-
await (0,
|
|
1477582
|
-
await (0,
|
|
1477255
|
+
await (0, import_promises32.unlink)(prefsPath);
|
|
1477256
|
+
await (0, import_promises32.rename)(prefsBackupPath, prefsPath);
|
|
1477583
1477257
|
}
|
|
1477584
1477258
|
}));
|
|
1477585
1477259
|
for (const result of results) {
|
|
@@ -1478611,7 +1478285,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1478611
1478285
|
if (response.ok) {
|
|
1478612
1478286
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
1478613
1478287
|
const faviconPath = join2(assetsDirectory, RelativeFilePath2.of("favicon"));
|
|
1478614
|
-
await (0,
|
|
1478288
|
+
await (0, import_promises33.writeFile)(faviconPath, new Uint8Array(imageBuffer));
|
|
1478615
1478289
|
builder.setFavicon({ favicon: relativize(this.absolutePathToFernDirectory, faviconPath) });
|
|
1478616
1478290
|
}
|
|
1478617
1478291
|
}
|
|
@@ -1478628,7 +1478302,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1478628
1478302
|
*/
|
|
1478629
1478303
|
async getAndCreateAssetsDirectory() {
|
|
1478630
1478304
|
const assetsDirectory = join2(this.absolutePathToFernDirectory, RelativeFilePath2.of("assets"));
|
|
1478631
|
-
await (0,
|
|
1478305
|
+
await (0, import_promises33.mkdir)(assetsDirectory, { recursive: true });
|
|
1478632
1478306
|
return assetsDirectory;
|
|
1478633
1478307
|
}
|
|
1478634
1478308
|
/**
|
|
@@ -1478678,7 +1478352,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1478678
1478352
|
absolutePathToOutputDirectory,
|
|
1478679
1478353
|
section
|
|
1478680
1478354
|
});
|
|
1478681
|
-
await (0,
|
|
1478355
|
+
await (0, import_promises33.mkdir)(absolutePathToOutputDirectoryForSection, { recursive: true });
|
|
1478682
1478356
|
await Promise.all(section.pages.filter((page) => page.type === "page").map(async (page) => {
|
|
1478683
1478357
|
const url3 = new URL(page.slug.toString(), this.url);
|
|
1478684
1478358
|
this.logger.debug(`Fetching page: ${url3.toString()}`);
|
|
@@ -1478693,7 +1478367,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1478693
1478367
|
absolutePathToOutputDirectoryForSection,
|
|
1478694
1478368
|
page: page.slug
|
|
1478695
1478369
|
});
|
|
1478696
|
-
await (0,
|
|
1478370
|
+
await (0, import_promises33.writeFile)(absolutePathForPage, result.data.mdx);
|
|
1478697
1478371
|
if (result.data.images.imageURLs.length > 0) {
|
|
1478698
1478372
|
this.logger.debug(`Found ${result.data.images.imageURLs.length} images to download for ${url3.toString()}`);
|
|
1478699
1478373
|
await Promise.all(Object.entries(result.data.images.imageURLToFilename).map(async ([imageUrl, filename]) => {
|
|
@@ -1478706,8 +1478380,8 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1478706
1478380
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
1478707
1478381
|
const imagePath = join2(absolutePathToOutputDirectoryForSection, RelativeFilePath2.of(filename));
|
|
1478708
1478382
|
const imageDir = dirname4(imagePath);
|
|
1478709
|
-
await (0,
|
|
1478710
|
-
await (0,
|
|
1478383
|
+
await (0, import_promises33.mkdir)(imageDir, { recursive: true });
|
|
1478384
|
+
await (0, import_promises33.writeFile)(imagePath, new Uint8Array(imageBuffer));
|
|
1478711
1478385
|
this.logger.debug(`Saved image to ${imagePath}`);
|
|
1478712
1478386
|
} catch (error49) {
|
|
1478713
1478387
|
this.logger.warn(`Error downloading image ${imageUrl}: ${error49}`);
|
|
@@ -1478789,7 +1478463,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1478789
1478463
|
};
|
|
1478790
1478464
|
|
|
1478791
1478465
|
// ../docs-importers/readme/lib/runReadmeMigration.js
|
|
1478792
|
-
var
|
|
1478466
|
+
var import_promises34 = require("fs/promises");
|
|
1478793
1478467
|
async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionOfCli, organization }) {
|
|
1478794
1478468
|
const builder = new FernDocsBuilderImpl();
|
|
1478795
1478469
|
builder.setInstance({ companyName: organization });
|
|
@@ -1478804,7 +1478478,7 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
|
|
|
1478804
1478478
|
builder
|
|
1478805
1478479
|
});
|
|
1478806
1478480
|
await builder.build({ outputDirectory: outputPath });
|
|
1478807
|
-
await (0,
|
|
1478481
|
+
await (0, import_promises34.writeFile)(join2(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
1478808
1478482
|
version: versionOfCli,
|
|
1478809
1478483
|
organization
|
|
1478810
1478484
|
}, void 0, 4));
|
|
@@ -1498422,7 +1498096,7 @@ var AbstractConverter = class _AbstractConverter {
|
|
|
1498422
1498096
|
};
|
|
1498423
1498097
|
|
|
1498424
1498098
|
// ../api-importers/v3-importer-commons/lib/ErrorCollector.js
|
|
1498425
|
-
var
|
|
1498099
|
+
var import_promises35 = require("fs/promises");
|
|
1498426
1498100
|
|
|
1498427
1498101
|
// ../../../node_modules/.pnpm/js-yaml-source-map@0.2.2_js-yaml@4.1.1/node_modules/js-yaml-source-map/dist/esm/index.js
|
|
1498428
1498102
|
var SourceMap = class {
|
|
@@ -1498709,7 +1498383,7 @@ var BreadcrumbToLineNumber = class {
|
|
|
1498709
1498383
|
return;
|
|
1498710
1498384
|
}
|
|
1498711
1498385
|
try {
|
|
1498712
|
-
const fileContent = await (0,
|
|
1498386
|
+
const fileContent = await (0, import_promises35.readFile)(this.relativePathToFile, "utf-8");
|
|
1498713
1498387
|
jsYaml.load(fileContent, { listener: this.map.listen() });
|
|
1498714
1498388
|
this.initialized = true;
|
|
1498715
1498389
|
} catch (error49) {
|
|
@@ -1505430,7 +1505104,7 @@ Yargs2.Parser = Parser5;
|
|
|
1505430
1505104
|
var yargs_default2 = Yargs2;
|
|
1505431
1505105
|
|
|
1505432
1505106
|
// ../init/src/utils/loadOpenApiFromUrl.ts
|
|
1505433
|
-
var
|
|
1505107
|
+
var import_promises36 = require("fs/promises");
|
|
1505434
1505108
|
var import_path24 = require("path");
|
|
1505435
1505109
|
var import_tmp_promise3 = __toESM(require_tmp_promise(), 1);
|
|
1505436
1505110
|
async function loadOpenAPIFromUrl({ url: url3, logger }) {
|
|
@@ -1505440,7 +1505114,7 @@ async function loadOpenAPIFromUrl({ url: url3, logger }) {
|
|
|
1505440
1505114
|
const filePath = (0, import_path24.join)(tmpDir.path, url3.endsWith(".json") ? "openapi.json" : "openapi.yaml");
|
|
1505441
1505115
|
logger.debug("tmpDir", tmpDir.path);
|
|
1505442
1505116
|
logger.debug("filePath", filePath);
|
|
1505443
|
-
await (0,
|
|
1505117
|
+
await (0, import_promises36.writeFile)(filePath, data2);
|
|
1505444
1505118
|
return {
|
|
1505445
1505119
|
status: "success" /* Success */,
|
|
1505446
1505120
|
filePath
|
|
@@ -1508732,7 +1508406,7 @@ var CliContext = class {
|
|
|
1508732
1508406
|
if (false) {
|
|
1508733
1508407
|
this.logger.error("CLI_VERSION is not defined");
|
|
1508734
1508408
|
}
|
|
1508735
|
-
return "3.47.3
|
|
1508409
|
+
return "3.47.3";
|
|
1508736
1508410
|
}
|
|
1508737
1508411
|
getCliName() {
|
|
1508738
1508412
|
if (false) {
|
|
@@ -1538107,7 +1537781,7 @@ __export(types_exports10, {
|
|
|
1538107
1537781
|
});
|
|
1538108
1537782
|
|
|
1538109
1537783
|
// ../api-importers/conjure/conjure-to-fern/lib/utils/listConjureFiles.js
|
|
1538110
|
-
var
|
|
1537784
|
+
var import_promises37 = require("fs/promises");
|
|
1538111
1537785
|
async function listConjureFiles(root6, extensionGlob) {
|
|
1538112
1537786
|
const files = [];
|
|
1538113
1537787
|
for (const absoluteFilepath of await listFiles(root6, extensionGlob)) {
|
|
@@ -1538119,7 +1537793,7 @@ async function listConjureFiles(root6, extensionGlob) {
|
|
|
1538119
1537793
|
return files;
|
|
1538120
1537794
|
}
|
|
1538121
1537795
|
async function createConjureFile({ relativeFilepath, absoluteFilepath }) {
|
|
1538122
|
-
const rawContents = (await (0,
|
|
1537796
|
+
const rawContents = (await (0, import_promises37.readFile)(absoluteFilepath)).toString().replaceAll(/: rid(?:$|\s)/g, ": string\n").replaceAll("<rid>", "<string>").replaceAll("rid>", "string>").replaceAll(": safelong", ": long").replaceAll("<safelong>", "<long>").replaceAll("safelong>", "long>").replaceAll(": any", ": unknown").replaceAll("<any>", "<unknown>").replaceAll("any>", "unknown>");
|
|
1538123
1537797
|
return {
|
|
1538124
1537798
|
relativeFilepath,
|
|
1538125
1537799
|
absoluteFilepath,
|
|
@@ -1538621,7 +1538295,7 @@ function parseZodIssue(issue2) {
|
|
|
1538621
1538295
|
}
|
|
1538622
1538296
|
|
|
1538623
1538297
|
// ../workspace/lazy-fern-workspace/lib/utils/listFernFiles.js
|
|
1538624
|
-
var
|
|
1538298
|
+
var import_promises38 = require("fs/promises");
|
|
1538625
1538299
|
async function listFernFiles(root6, extensionGlob) {
|
|
1538626
1538300
|
const files = [];
|
|
1538627
1538301
|
for (const absoluteFilepath of await listFiles(root6, extensionGlob)) {
|
|
@@ -1538636,7 +1538310,7 @@ async function createFernFile({ relativeFilepath, absoluteFilepath }) {
|
|
|
1538636
1538310
|
return {
|
|
1538637
1538311
|
relativeFilepath,
|
|
1538638
1538312
|
absoluteFilepath,
|
|
1538639
|
-
fileContents: (await (0,
|
|
1538313
|
+
fileContents: (await (0, import_promises38.readFile)(absoluteFilepath)).toString()
|
|
1538640
1538314
|
};
|
|
1538641
1538315
|
}
|
|
1538642
1538316
|
|
|
@@ -1538677,10 +1538351,10 @@ async function parseYamlFiles(files) {
|
|
|
1538677
1538351
|
// ../workspace/lazy-fern-workspace/lib/utils/loadDependency.js
|
|
1538678
1538352
|
var import_fiddle_sdk3 = __toESM(require_fiddle_sdk(), 1);
|
|
1538679
1538353
|
var import_fs16 = require("fs");
|
|
1538680
|
-
var
|
|
1538354
|
+
var import_promises40 = require("fs/promises");
|
|
1538681
1538355
|
var import_os3 = require("os");
|
|
1538682
1538356
|
var import_path29 = __toESM(require("path"), 1);
|
|
1538683
|
-
var
|
|
1538357
|
+
var import_promises41 = require("stream/promises");
|
|
1538684
1538358
|
|
|
1538685
1538359
|
// ../../../node_modules/.pnpm/@isaacs+fs-minipass@4.0.1/node_modules/@isaacs/fs-minipass/dist/esm/index.js
|
|
1538686
1538360
|
var import_events10 = __toESM(require("events"), 1);
|
|
@@ -1542327,7 +1542001,7 @@ var chownrSync = (p9, uid, gid) => {
|
|
|
1542327
1542001
|
|
|
1542328
1542002
|
// ../../../node_modules/.pnpm/tar@7.5.3/node_modules/tar/dist/esm/mkdir.js
|
|
1542329
1542003
|
var import_node_fs19 = __toESM(require("fs"), 1);
|
|
1542330
|
-
var
|
|
1542004
|
+
var import_promises39 = __toESM(require("fs/promises"), 1);
|
|
1542331
1542005
|
var import_node_path27 = __toESM(require("path"), 1);
|
|
1542332
1542006
|
|
|
1542333
1542007
|
// ../../../node_modules/.pnpm/tar@7.5.3/node_modules/tar/dist/esm/cwd-error.js
|
|
@@ -1542398,7 +1542072,7 @@ var mkdir11 = (dir, opt, cb2) => {
|
|
|
1542398
1542072
|
return checkCwd(dir, done);
|
|
1542399
1542073
|
}
|
|
1542400
1542074
|
if (preserve) {
|
|
1542401
|
-
return
|
|
1542075
|
+
return import_promises39.default.mkdir(dir, { mode, recursive: true }).then(
|
|
1542402
1542076
|
(made) => done(null, made ?? void 0),
|
|
1542403
1542077
|
// oh, ts
|
|
1542404
1542078
|
done
|
|
@@ -1543717,7 +1543391,7 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
1543717
1543391
|
}
|
|
1543718
1543392
|
context2.logger.info("Downloading...");
|
|
1543719
1543393
|
context2.logger.debug("Remote URL: " + response.body.definitionS3DownloadUrl);
|
|
1543720
|
-
await (0,
|
|
1543394
|
+
await (0, import_promises40.mkdir)(pathToDefinition, { recursive: true });
|
|
1543721
1543395
|
try {
|
|
1543722
1543396
|
await downloadDependency({
|
|
1543723
1543397
|
s3PreSignedReadUrl: response.body.definitionS3DownloadUrl,
|
|
@@ -1543728,9 +1543402,9 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
1543728
1543402
|
return void 0;
|
|
1543729
1543403
|
}
|
|
1543730
1543404
|
metadata = response.body;
|
|
1543731
|
-
await (0,
|
|
1543405
|
+
await (0, import_promises40.writeFile)(pathToMetadata, JSON.stringify(metadata));
|
|
1543732
1543406
|
} else {
|
|
1543733
|
-
metadata = JSON.parse((await (0,
|
|
1543407
|
+
metadata = JSON.parse((await (0, import_promises40.readFile)(pathToMetadata)).toString());
|
|
1543734
1543408
|
}
|
|
1543735
1543409
|
context2.logger.info("Parsing...");
|
|
1543736
1543410
|
if (loadAPIWorkspace2 == null) {
|
|
@@ -1543760,7 +1543434,7 @@ async function downloadDependency({ s3PreSignedReadUrl, absolutePathToLocalOutpu
|
|
|
1543760
1543434
|
});
|
|
1543761
1543435
|
const tmpDir = await import_tmp_promise4.default.dir();
|
|
1543762
1543436
|
const outputTarPath = import_path29.default.join(tmpDir.path, "api.tgz");
|
|
1543763
|
-
await (0,
|
|
1543437
|
+
await (0, import_promises41.pipeline)(request6.data, (0, import_fs16.createWriteStream)(outputTarPath));
|
|
1543764
1543438
|
await extract({ file: outputTarPath, cwd: absolutePathToLocalOutput });
|
|
1543765
1543439
|
}
|
|
1543766
1543440
|
function stringifyDependency(dependency) {
|
|
@@ -1553214,7 +1552888,7 @@ var LazyFernWorkspace = class extends AbstractAPIWorkspace {
|
|
|
1553214
1552888
|
};
|
|
1553215
1552889
|
|
|
1553216
1552890
|
// ../workspace/lazy-fern-workspace/lib/loaders/OpenAPILoader.js
|
|
1553217
|
-
var
|
|
1552891
|
+
var import_promises46 = require("fs/promises");
|
|
1553218
1552892
|
|
|
1553219
1552893
|
// ../workspace/lazy-fern-workspace/lib/utils/convertOpenAPIV2ToV3.js
|
|
1553220
1552894
|
var import_swagger2openapi = __toESM(require_swagger2openapi(), 1);
|
|
@@ -1553224,14 +1552898,14 @@ async function convertOpenAPIV2ToV3(openAPI) {
|
|
|
1553224
1552898
|
}
|
|
1553225
1552899
|
|
|
1553226
1552900
|
// ../workspace/lazy-fern-workspace/lib/utils/loadAsyncAPI.js
|
|
1553227
|
-
var
|
|
1552901
|
+
var import_promises43 = require("fs/promises");
|
|
1553228
1552902
|
|
|
1553229
1552903
|
// ../workspace/lazy-fern-workspace/lib/loaders/mergeWithOverrides.js
|
|
1553230
|
-
var
|
|
1552904
|
+
var import_promises42 = require("fs/promises");
|
|
1553231
1552905
|
async function mergeWithOverrides2({ absoluteFilePathToOverrides, data: data2, context: context2, allowNullKeys }) {
|
|
1553232
1552906
|
let parsedOverrides = null;
|
|
1553233
1552907
|
try {
|
|
1553234
|
-
const contents = (await (0,
|
|
1552908
|
+
const contents = (await (0, import_promises42.readFile)(absoluteFilePathToOverrides, "utf8")).toString();
|
|
1553235
1552909
|
try {
|
|
1553236
1552910
|
parsedOverrides = JSON.parse(contents);
|
|
1553237
1552911
|
} catch (err) {
|
|
@@ -1553245,7 +1552919,7 @@ async function mergeWithOverrides2({ absoluteFilePathToOverrides, data: data2, c
|
|
|
1553245
1552919
|
|
|
1553246
1552920
|
// ../workspace/lazy-fern-workspace/lib/utils/loadAsyncAPI.js
|
|
1553247
1552921
|
async function loadAsyncAPI({ context: context2, absoluteFilePath, absoluteFilePathToOverrides }) {
|
|
1553248
|
-
const contents = (await (0,
|
|
1552922
|
+
const contents = (await (0, import_promises43.readFile)(absoluteFilePath)).toString();
|
|
1553249
1552923
|
const parsed = await jsYaml.load(contents);
|
|
1553250
1552924
|
if (absoluteFilePathToOverrides != null) {
|
|
1553251
1552925
|
return await mergeWithOverrides2({
|
|
@@ -1553258,10 +1552932,10 @@ async function loadAsyncAPI({ context: context2, absoluteFilePath, absoluteFileP
|
|
|
1553258
1552932
|
}
|
|
1553259
1552933
|
|
|
1553260
1552934
|
// ../workspace/lazy-fern-workspace/lib/utils/loadOpenAPI.js
|
|
1553261
|
-
var
|
|
1552935
|
+
var import_promises45 = require("fs/promises");
|
|
1553262
1552936
|
|
|
1553263
1552937
|
// ../workspace/lazy-fern-workspace/lib/loaders/applyOverlays.js
|
|
1553264
|
-
var
|
|
1552938
|
+
var import_promises44 = require("fs/promises");
|
|
1553265
1552939
|
var import_path31 = __toESM(require("path"), 1);
|
|
1553266
1552940
|
var import_tmp_promise5 = __toESM(require_tmp_promise(), 1);
|
|
1553267
1552941
|
var tempDir;
|
|
@@ -1553286,14 +1552960,14 @@ async function applyOverlays({ absoluteFilePathToOverlay, absoluteFilePathToOpen
|
|
|
1553286
1552960
|
const originalFileName = import_path31.default.basename(absoluteFilePathToOpenAPI);
|
|
1553287
1552961
|
const outputFileName = `${import_path31.default.parse(originalFileName).name}.overlaid.json`;
|
|
1553288
1552962
|
const outputPath = import_path31.default.join(dir, outputFileName);
|
|
1553289
|
-
await (0,
|
|
1552963
|
+
await (0, import_promises44.writeFile)(outputPath, JSON.stringify(result, null, 2), "utf8");
|
|
1553290
1552964
|
context2.logger.info(`Wrote overlaid OpenAPI spec to: ${outputPath}`);
|
|
1553291
1552965
|
return result;
|
|
1553292
1552966
|
}
|
|
1553293
1552967
|
async function parseOverlayFile(absoluteFilePathToOverlay, context2) {
|
|
1553294
1552968
|
let contents;
|
|
1553295
1552969
|
try {
|
|
1553296
|
-
contents = await (0,
|
|
1552970
|
+
contents = await (0, import_promises44.readFile)(absoluteFilePathToOverlay, "utf8");
|
|
1553297
1552971
|
} catch (err) {
|
|
1553298
1552972
|
return context2.failAndThrow(`Failed to read overlay file at ${absoluteFilePathToOverlay}: ${err}`);
|
|
1553299
1552973
|
}
|
|
@@ -1553448,7 +1553122,7 @@ async function loadOpenAPI({ context: context2, absolutePathToOpenAPI, absoluteP
|
|
|
1553448
1553122
|
if (loadAiExamples) {
|
|
1553449
1553123
|
const aiExamplesOverrideFilepath = join2(dirname4(absolutePathToOpenAPI), RelativeFilePath2.of("ai_examples_override.yml"));
|
|
1553450
1553124
|
try {
|
|
1553451
|
-
const overrideContent = await (0,
|
|
1553125
|
+
const overrideContent = await (0, import_promises45.readFile)(aiExamplesOverrideFilepath, "utf-8");
|
|
1553452
1553126
|
const overrideData = jsYaml.load(overrideContent);
|
|
1553453
1553127
|
if (overrideData?.paths && result.paths) {
|
|
1553454
1553128
|
for (const [path76, methods] of Object.entries(overrideData.paths)) {
|
|
@@ -1553503,7 +1553177,7 @@ var OpenAPILoader = class {
|
|
|
1553503
1553177
|
const documents = [];
|
|
1553504
1553178
|
for (const spec of specs) {
|
|
1553505
1553179
|
try {
|
|
1553506
|
-
const contents = (await (0,
|
|
1553180
|
+
const contents = (await (0, import_promises46.readFile)(spec.absoluteFilepath)).toString();
|
|
1553507
1553181
|
let sourceRelativePath = relative3(this.absoluteFilePath, spec.source.file);
|
|
1553508
1553182
|
if (spec.source.relativePathToDependency != null) {
|
|
1553509
1553183
|
sourceRelativePath = join2(spec.source.relativePathToDependency, sourceRelativePath);
|
|
@@ -1558203,7 +1557877,7 @@ var OpenRPCConverterContext3_1 = class extends AbstractConverterContext {
|
|
|
1558203
1557877
|
};
|
|
1558204
1557878
|
|
|
1558205
1557879
|
// ../workspace/lazy-fern-workspace/lib/OSSWorkspace.js
|
|
1558206
|
-
var
|
|
1557880
|
+
var import_promises50 = require("fs/promises");
|
|
1558207
1557881
|
|
|
1558208
1557882
|
// ../../commons/casings-generator/src/reserved.ts
|
|
1558209
1557883
|
var RESERVED_KEYWORDS2 = {
|
|
@@ -1558964,9 +1558638,9 @@ function preprocessName2(name3) {
|
|
|
1558964
1558638
|
}
|
|
1558965
1558639
|
|
|
1558966
1558640
|
// ../workspace/lazy-fern-workspace/lib/utils/loadOpenRpc.js
|
|
1558967
|
-
var
|
|
1558641
|
+
var import_promises47 = require("fs/promises");
|
|
1558968
1558642
|
async function loadOpenRpc({ context: context2, absoluteFilePath, absoluteFilePathToOverrides }) {
|
|
1558969
|
-
const contents = (await (0,
|
|
1558643
|
+
const contents = (await (0, import_promises47.readFile)(absoluteFilePath)).toString();
|
|
1558970
1558644
|
let parsed;
|
|
1558971
1558645
|
try {
|
|
1558972
1558646
|
parsed = JSON.parse(contents);
|
|
@@ -1559019,7 +1558693,7 @@ function createLoggingExecutable(executable, { logger, ...loggingExecaOptions }
|
|
|
1559019
1558693
|
}
|
|
1559020
1558694
|
|
|
1559021
1558695
|
// ../workspace/lazy-fern-workspace/lib/protobuf/ProtobufIRGenerator.js
|
|
1559022
|
-
var
|
|
1558696
|
+
var import_promises48 = require("fs/promises");
|
|
1559023
1558697
|
var import_path35 = __toESM(require("path"), 1);
|
|
1559024
1558698
|
var import_tmp_promise7 = __toESM(require_tmp_promise(), 1);
|
|
1559025
1558699
|
|
|
@@ -1559175,7 +1558849,7 @@ var ProtobufIRGenerator = class {
|
|
|
1559175
1558849
|
this.context.logger.info(`Using buf export with version: ${version7}`);
|
|
1559176
1558850
|
const tmpBufConfigFile = await import_tmp_promise7.default.file({ postfix: ".yaml" });
|
|
1559177
1558851
|
const configContent = version7 === "v1" ? PROTOBUF_EXPORT_CONFIG_V1 : PROTOBUF_EXPORT_CONFIG_V2;
|
|
1559178
|
-
await (0,
|
|
1558852
|
+
await (0, import_promises48.writeFile)(tmpBufConfigFile.path, configContent, "utf8");
|
|
1559179
1558853
|
try {
|
|
1559180
1558854
|
const result = await runExeca(this.context.logger, "buf", [
|
|
1559181
1558855
|
"export",
|
|
@@ -1559204,7 +1558878,7 @@ var ProtobufIRGenerator = class {
|
|
|
1559204
1558878
|
}
|
|
1559205
1558879
|
}
|
|
1559206
1558880
|
async copyProtobufFilesFromRoot({ protobufGeneratorConfigPath, absoluteFilepathToProtobufRoot }) {
|
|
1559207
|
-
await (0,
|
|
1558881
|
+
await (0, import_promises48.cp)(absoluteFilepathToProtobufRoot, protobufGeneratorConfigPath, {
|
|
1559208
1558882
|
recursive: true,
|
|
1559209
1558883
|
filter: (src) => {
|
|
1559210
1558884
|
const basename6 = import_path35.default.basename(src);
|
|
@@ -1559213,7 +1558887,7 @@ var ProtobufIRGenerator = class {
|
|
|
1559213
1558887
|
});
|
|
1559214
1558888
|
}
|
|
1559215
1558889
|
async setupRemainingProtobufConfig({ protobufGeneratorConfigPath }) {
|
|
1559216
|
-
await (0,
|
|
1558890
|
+
await (0, import_promises48.writeFile)(join2(protobufGeneratorConfigPath, RelativeFilePath2.of("package.json")), PROTOBUF_MODULE_PACKAGE_JSON);
|
|
1559217
1558891
|
await runExeca(void 0, "npm", ["install"], {
|
|
1559218
1558892
|
cwd: protobufGeneratorConfigPath,
|
|
1559219
1558893
|
stdout: "ignore",
|
|
@@ -1559224,10 +1558898,10 @@ var ProtobufIRGenerator = class {
|
|
|
1559224
1558898
|
stdout: "ignore",
|
|
1559225
1558899
|
stderr: "pipe"
|
|
1559226
1558900
|
});
|
|
1559227
|
-
await (0,
|
|
1558901
|
+
await (0, import_promises48.writeFile)(join2(protobufGeneratorConfigPath, RelativeFilePath2.of(PROTOBUF_GENERATOR_CONFIG_FILENAME)), PROTOBUF_GEN_CONFIG);
|
|
1559228
1558902
|
const shellProxyPath = join2(protobufGeneratorConfigPath, RelativeFilePath2.of(PROTOBUF_SHELL_PROXY_FILENAME));
|
|
1559229
|
-
await (0,
|
|
1559230
|
-
await (0,
|
|
1558903
|
+
await (0, import_promises48.writeFile)(shellProxyPath, PROTOBUF_SHELL_PROXY);
|
|
1558904
|
+
await (0, import_promises48.chmod)(shellProxyPath, 493);
|
|
1559231
1558905
|
}
|
|
1559232
1558906
|
async doGenerateLocal({ cwd: cwd2, deps }) {
|
|
1559233
1558907
|
const which = createLoggingExecutable("which", {
|
|
@@ -1559249,13 +1558923,13 @@ var ProtobufIRGenerator = class {
|
|
|
1559249
1558923
|
stderr: "pipe"
|
|
1559250
1558924
|
});
|
|
1559251
1558925
|
try {
|
|
1559252
|
-
await (0,
|
|
1558926
|
+
await (0, import_promises48.writeFile)(bufYamlPath, configContent);
|
|
1559253
1558927
|
if (deps.length > 0) {
|
|
1559254
1558928
|
if (this.isAirGapped) {
|
|
1559255
1558929
|
this.context.logger.debug("Air-gapped mode: skipping buf dep update");
|
|
1559256
1558930
|
const bufLockPath = join2(cwd2, RelativeFilePath2.of("buf.lock"));
|
|
1559257
1558931
|
try {
|
|
1559258
|
-
await (0,
|
|
1558932
|
+
await (0, import_promises48.access)(bufLockPath);
|
|
1559259
1558933
|
} catch {
|
|
1559260
1558934
|
this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.");
|
|
1559261
1558935
|
}
|
|
@@ -1559267,9 +1558941,9 @@ var ProtobufIRGenerator = class {
|
|
|
1559267
1558941
|
if (bufGenerateResult.exitCode !== 0) {
|
|
1559268
1558942
|
this.context.failAndThrow(bufGenerateResult.stderr);
|
|
1559269
1558943
|
}
|
|
1559270
|
-
await (0,
|
|
1558944
|
+
await (0, import_promises48.unlink)(bufYamlPath);
|
|
1559271
1558945
|
} catch (error49) {
|
|
1559272
|
-
await (0,
|
|
1558946
|
+
await (0, import_promises48.unlink)(bufYamlPath);
|
|
1559273
1558947
|
throw error49;
|
|
1559274
1558948
|
}
|
|
1559275
1558949
|
return join2(cwd2, RelativeFilePath2.of(PROTOBUF_GENERATOR_OUTPUT_FILEPATH));
|
|
@@ -1559280,7 +1558954,7 @@ var ProtobufIRGenerator = class {
|
|
|
1559280
1558954
|
};
|
|
1559281
1558955
|
|
|
1559282
1558956
|
// ../workspace/lazy-fern-workspace/lib/protobuf/ProtobufOpenAPIGenerator.js
|
|
1559283
|
-
var
|
|
1558957
|
+
var import_promises49 = require("fs/promises");
|
|
1559284
1558958
|
var import_tmp_promise8 = __toESM(require_tmp_promise(), 1);
|
|
1559285
1558959
|
var PROTOBUF_GENERATOR_CONFIG_FILENAME2 = "buf.gen.yaml";
|
|
1559286
1558960
|
var PROTOBUF_GENERATOR_OUTPUT_PATH2 = "output";
|
|
@@ -1559321,8 +1558995,8 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
1559321
1558995
|
}
|
|
1559322
1558996
|
async setupProtobufGeneratorConfig({ absoluteFilepathToProtobufRoot, relativeFilepathToProtobufRoot }) {
|
|
1559323
1558997
|
const protobufGeneratorConfigPath = AbsoluteFilePath2.of((await import_tmp_promise8.default.dir()).path);
|
|
1559324
|
-
await (0,
|
|
1559325
|
-
await (0,
|
|
1558998
|
+
await (0, import_promises49.cp)(absoluteFilepathToProtobufRoot, protobufGeneratorConfigPath, { recursive: true });
|
|
1558999
|
+
await (0, import_promises49.writeFile)(join2(protobufGeneratorConfigPath, RelativeFilePath2.of(PROTOBUF_GENERATOR_CONFIG_FILENAME2)), getProtobufGeneratorConfig({ relativeFilepathToProtobufRoot }));
|
|
1559326
1559000
|
return protobufGeneratorConfigPath;
|
|
1559327
1559001
|
}
|
|
1559328
1559002
|
async doGenerateLocal({ cwd: cwd2, target, deps, existingBufLockContents }) {
|
|
@@ -1559353,15 +1559027,15 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
1559353
1559027
|
stderr: "pipe"
|
|
1559354
1559028
|
});
|
|
1559355
1559029
|
try {
|
|
1559356
|
-
await (0,
|
|
1559030
|
+
await (0, import_promises49.writeFile)(bufYamlPath, configContent);
|
|
1559357
1559031
|
if (existingBufLockContents != null) {
|
|
1559358
|
-
await (0,
|
|
1559032
|
+
await (0, import_promises49.writeFile)(bufLockPath, existingBufLockContents);
|
|
1559359
1559033
|
cleanupBufLock = true;
|
|
1559360
1559034
|
} else if (deps.length > 0) {
|
|
1559361
1559035
|
if (this.isAirGapped) {
|
|
1559362
1559036
|
this.context.logger.debug("Air-gapped mode: skipping buf dep update");
|
|
1559363
1559037
|
try {
|
|
1559364
|
-
await (0,
|
|
1559038
|
+
await (0, import_promises49.access)(bufLockPath);
|
|
1559365
1559039
|
} catch {
|
|
1559366
1559040
|
this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.");
|
|
1559367
1559041
|
}
|
|
@@ -1559369,7 +1559043,7 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
1559369
1559043
|
await buf(["dep", "update"]);
|
|
1559370
1559044
|
}
|
|
1559371
1559045
|
try {
|
|
1559372
|
-
bufLockContents = await (0,
|
|
1559046
|
+
bufLockContents = await (0, import_promises49.readFile)(bufLockPath, "utf-8");
|
|
1559373
1559047
|
} catch {
|
|
1559374
1559048
|
bufLockContents = void 0;
|
|
1559375
1559049
|
}
|
|
@@ -1559379,14 +1559053,14 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
1559379
1559053
|
this.context.failAndThrow(bufGenerateResult.stderr);
|
|
1559380
1559054
|
}
|
|
1559381
1559055
|
if (cleanupBufLock) {
|
|
1559382
|
-
await (0,
|
|
1559056
|
+
await (0, import_promises49.unlink)(bufLockPath);
|
|
1559383
1559057
|
}
|
|
1559384
|
-
await (0,
|
|
1559058
|
+
await (0, import_promises49.unlink)(bufYamlPath);
|
|
1559385
1559059
|
} catch (error49) {
|
|
1559386
1559060
|
if (cleanupBufLock) {
|
|
1559387
|
-
await (0,
|
|
1559061
|
+
await (0, import_promises49.unlink)(bufLockPath);
|
|
1559388
1559062
|
}
|
|
1559389
|
-
await (0,
|
|
1559063
|
+
await (0, import_promises49.unlink)(bufYamlPath);
|
|
1559390
1559064
|
throw error49;
|
|
1559391
1559065
|
}
|
|
1559392
1559066
|
return {
|
|
@@ -1559687,7 +1559361,7 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
|
|
|
1559687
1559361
|
local: true,
|
|
1559688
1559362
|
deps: spec.dependencies
|
|
1559689
1559363
|
});
|
|
1559690
|
-
const result = await (0,
|
|
1559364
|
+
const result = await (0, import_promises50.readFile)(protobufIRFilepath, "utf-8");
|
|
1559691
1559365
|
const casingsGenerator = constructCasingsGenerator2({
|
|
1559692
1559366
|
generationLanguage: "typescript",
|
|
1559693
1559367
|
keywords: void 0,
|
|
@@ -1559944,7 +1559618,7 @@ function parseIssue(issue2) {
|
|
|
1559944
1559618
|
}
|
|
1559945
1559619
|
|
|
1559946
1559620
|
// ../workspace/loader/lib/listFernFiles.js
|
|
1559947
|
-
var
|
|
1559621
|
+
var import_promises51 = require("fs/promises");
|
|
1559948
1559622
|
async function listFernFiles2(root6, extensionGlob) {
|
|
1559949
1559623
|
const files = [];
|
|
1559950
1559624
|
for (const absoluteFilepath of await listFiles(root6, extensionGlob)) {
|
|
@@ -1559959,7 +1559633,7 @@ async function createFernFile2({ relativeFilepath, absoluteFilepath }) {
|
|
|
1559959
1559633
|
return {
|
|
1559960
1559634
|
relativeFilepath,
|
|
1559961
1559635
|
absoluteFilepath,
|
|
1559962
|
-
fileContents: (await (0,
|
|
1559636
|
+
fileContents: (await (0, import_promises51.readFile)(absoluteFilepath)).toString()
|
|
1559963
1559637
|
};
|
|
1559964
1559638
|
}
|
|
1559965
1559639
|
|
|
@@ -1560211,7 +1559885,7 @@ async function loadAPIWorkspace({ absolutePathToWorkspace, context: context2, cl
|
|
|
1560211
1559885
|
}
|
|
1560212
1559886
|
|
|
1560213
1559887
|
// ../workspace/loader/lib/loadDocsWorkspace.js
|
|
1560214
|
-
var
|
|
1559888
|
+
var import_promises52 = require("fs/promises");
|
|
1560215
1559889
|
|
|
1560216
1559890
|
// ../workspace/loader/lib/docs-yml.schema.json
|
|
1560217
1559891
|
var docs_yml_schema_exports = {};
|
|
@@ -1565389,7 +1565063,7 @@ async function loadDocsConfiguration({ absolutePathToDocsDefinition, context: co
|
|
|
1565389
1565063
|
});
|
|
1565390
1565064
|
}
|
|
1565391
1565065
|
async function loadRawDocsConfiguration({ absolutePathOfConfiguration, context: context2 }) {
|
|
1565392
|
-
const contentsStr = await (0,
|
|
1565066
|
+
const contentsStr = await (0, import_promises52.readFile)(absolutePathOfConfiguration);
|
|
1565393
1565067
|
const contentsJson = jsYaml.load(contentsStr.toString());
|
|
1565394
1565068
|
const result = validateAgainstJsonSchema(contentsJson, docs_yml_schema_exports, {
|
|
1565395
1565069
|
filePath: absolutePathOfConfiguration
|
|
@@ -1565418,7 +1565092,7 @@ ${result.error?.message ?? "Unknown error"}`);
|
|
|
1565418
1565092
|
}
|
|
1565419
1565093
|
|
|
1565420
1565094
|
// ../project-loader/lib/loadProject.js
|
|
1565421
|
-
var
|
|
1565095
|
+
var import_promises53 = require("fs/promises");
|
|
1565422
1565096
|
async function loadProject({ context: context2, nameOverride, ...args }) {
|
|
1565423
1565097
|
const fernDirectory = await getFernDirectory(nameOverride);
|
|
1565424
1565098
|
if (fernDirectory == null) {
|
|
@@ -1565473,7 +1565147,7 @@ async function loadApis({ cliName, fernDirectory, context: context2, cliVersion,
|
|
|
1565473
1565147
|
const apisDirectory = join2(fernDirectory, RelativeFilePath2.of(APIS_DIRECTORY));
|
|
1565474
1565148
|
const apisDirectoryExists = await doesPathExist(apisDirectory);
|
|
1565475
1565149
|
if (apisDirectoryExists) {
|
|
1565476
|
-
const apiDirectoryContents = await (0,
|
|
1565150
|
+
const apiDirectoryContents = await (0, import_promises53.readdir)(apisDirectory, { withFileTypes: true });
|
|
1565477
1565151
|
const apiWorkspaceDirectoryNames = apiDirectoryContents.reduce((all9, item) => {
|
|
1565478
1565152
|
if (item.isDirectory()) {
|
|
1565479
1565153
|
all9.push(item.name);
|
|
@@ -1565550,10 +1565224,10 @@ async function loadProjectAndRegisterWorkspacesWithContext(cliContext, args, reg
|
|
|
1565550
1565224
|
|
|
1565551
1565225
|
// src/cliV2.ts
|
|
1565552
1565226
|
var import_generators_sdk4 = __toESM(require_generators_sdk(), 1);
|
|
1565553
|
-
var
|
|
1565227
|
+
var import_promises58 = require("fs/promises");
|
|
1565554
1565228
|
|
|
1565555
1565229
|
// src/commands/generator-list/getGeneratorList.ts
|
|
1565556
|
-
var
|
|
1565230
|
+
var import_promises54 = require("fs/promises");
|
|
1565557
1565231
|
var GenerationModeFilter = {
|
|
1565558
1565232
|
GitHub: "github",
|
|
1565559
1565233
|
Local: "local-file-system",
|
|
@@ -1565613,7 +1565287,7 @@ async function getGeneratorList({
|
|
|
1565613
1565287
|
return;
|
|
1565614
1565288
|
}
|
|
1565615
1565289
|
try {
|
|
1565616
|
-
await (0,
|
|
1565290
|
+
await (0, import_promises54.writeFile)(outputLocation, generatorsListYaml);
|
|
1565617
1565291
|
} catch (error49) {
|
|
1565618
1565292
|
cliContext.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error49);
|
|
1565619
1565293
|
}
|
|
@@ -1565679,7 +1565353,7 @@ async function getGeneratorMetadata({
|
|
|
1565679
1565353
|
}
|
|
1565680
1565354
|
|
|
1565681
1565355
|
// src/commands/organization/getOrganization.ts
|
|
1565682
|
-
var
|
|
1565356
|
+
var import_promises55 = require("fs/promises");
|
|
1565683
1565357
|
async function getOrganization({
|
|
1565684
1565358
|
project,
|
|
1565685
1565359
|
outputLocation,
|
|
@@ -1565691,20 +1565365,20 @@ async function getOrganization({
|
|
|
1565691
1565365
|
return;
|
|
1565692
1565366
|
}
|
|
1565693
1565367
|
try {
|
|
1565694
|
-
await (0,
|
|
1565368
|
+
await (0, import_promises55.writeFile)(outputLocation, org);
|
|
1565695
1565369
|
} catch (error49) {
|
|
1565696
1565370
|
context2.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error49);
|
|
1565697
1565371
|
}
|
|
1565698
1565372
|
}
|
|
1565699
1565373
|
|
|
1565700
1565374
|
// src/commands/upgrade/upgradeGenerator.ts
|
|
1565701
|
-
var
|
|
1565375
|
+
var import_promises57 = require("fs/promises");
|
|
1565702
1565376
|
var import_path37 = __toESM(require("path"), 1);
|
|
1565703
1565377
|
var import_semver8 = __toESM(require_semver2(), 1);
|
|
1565704
|
-
var
|
|
1565378
|
+
var import_yaml3 = __toESM(require_dist(), 1);
|
|
1565705
1565379
|
|
|
1565706
1565380
|
// src/commands/upgrade/migrations/loader.ts
|
|
1565707
|
-
var
|
|
1565381
|
+
var import_promises56 = require("fs/promises");
|
|
1565708
1565382
|
var import_os4 = require("os");
|
|
1565709
1565383
|
var import_path36 = require("path");
|
|
1565710
1565384
|
var import_semver7 = __toESM(require_semver2(), 1);
|
|
@@ -1565715,7 +1565389,7 @@ function getMigrationCacheDir() {
|
|
|
1565715
1565389
|
async function loadMigrationModule(params2) {
|
|
1565716
1565390
|
const { generatorName, logger } = params2;
|
|
1565717
1565391
|
const cacheDir = getMigrationCacheDir();
|
|
1565718
|
-
await (0,
|
|
1565392
|
+
await (0, import_promises56.mkdir)(cacheDir, { recursive: true });
|
|
1565719
1565393
|
try {
|
|
1565720
1565394
|
await loggingExeca(logger, "npm", [
|
|
1565721
1565395
|
"install",
|
|
@@ -1565728,7 +1565402,7 @@ async function loadMigrationModule(params2) {
|
|
|
1565728
1565402
|
]);
|
|
1565729
1565403
|
const packageDir = (0, import_path36.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME);
|
|
1565730
1565404
|
const packageJsonPath = (0, import_path36.join)(packageDir, "package.json");
|
|
1565731
|
-
const packageJsonContent = await (0,
|
|
1565405
|
+
const packageJsonContent = await (0, import_promises56.readFile)(packageJsonPath, "utf-8");
|
|
1565732
1565406
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
1565733
1565407
|
if (packageJson2.main == null) {
|
|
1565734
1565408
|
throw new Error(`No main field found in package.json for ${MIGRATION_PACKAGE_NAME}`);
|
|
@@ -1565879,15 +1565553,15 @@ async function loadAndUpdateGenerators({
|
|
|
1565879
1565553
|
context2.logger.debug("Generators configuration file was not found, no generators to upgrade.");
|
|
1565880
1565554
|
return { updatedConfiguration: void 0, skippedMajorUpgrades: [], appliedUpgrades: [], alreadyUpToDate: [] };
|
|
1565881
1565555
|
}
|
|
1565882
|
-
const contents = await (0,
|
|
1565556
|
+
const contents = await (0, import_promises57.readFile)(filepath);
|
|
1565883
1565557
|
context2.logger.debug(`Found generators: ${contents.toString()}`);
|
|
1565884
|
-
const parsedDocument =
|
|
1565558
|
+
const parsedDocument = import_yaml3.default.parseDocument(contents.toString());
|
|
1565885
1565559
|
const generatorGroups = parsedDocument.get("groups");
|
|
1565886
1565560
|
if (generatorGroups == null) {
|
|
1565887
1565561
|
context2.logger.debug("No groups were found within the generators configuration, no generators to upgrade.");
|
|
1565888
1565562
|
return { updatedConfiguration: void 0, skippedMajorUpgrades: [], appliedUpgrades: [], alreadyUpToDate: [] };
|
|
1565889
1565563
|
}
|
|
1565890
|
-
if (!
|
|
1565564
|
+
if (!import_yaml3.default.isMap(generatorGroups)) {
|
|
1565891
1565565
|
context2.failAndThrow(`Expected 'groups' to be a map in ${import_path37.default.relative(process.cwd(), filepath)}`);
|
|
1565892
1565566
|
return { updatedConfiguration: void 0, skippedMajorUpgrades: [], appliedUpgrades: [], alreadyUpToDate: [] };
|
|
1565893
1565567
|
}
|
|
@@ -1565898,7 +1565572,7 @@ async function loadAndUpdateGenerators({
|
|
|
1565898
1565572
|
for (const groupBlock of generatorGroups.items) {
|
|
1565899
1565573
|
const groupName = groupBlock.key.value;
|
|
1565900
1565574
|
const group = groupBlock.value;
|
|
1565901
|
-
if (!
|
|
1565575
|
+
if (!import_yaml3.default.isMap(group)) {
|
|
1565902
1565576
|
context2.failAndThrow(
|
|
1565903
1565577
|
`Expected group ${groupName} to be a map in ${import_path37.default.relative(process.cwd(), filepath)}`
|
|
1565904
1565578
|
);
|
|
@@ -1565909,7 +1565583,7 @@ async function loadAndUpdateGenerators({
|
|
|
1565909
1565583
|
continue;
|
|
1565910
1565584
|
}
|
|
1565911
1565585
|
const generators = group.get("generators");
|
|
1565912
|
-
if (!
|
|
1565586
|
+
if (!import_yaml3.default.isSeq(generators)) {
|
|
1565913
1565587
|
context2.failAndThrow(
|
|
1565914
1565588
|
`Expected group ${groupName} to have a 'generators' key in ${import_path37.default.relative(process.cwd(), filepath)}`
|
|
1565915
1565589
|
);
|
|
@@ -1565917,7 +1565591,7 @@ async function loadAndUpdateGenerators({
|
|
|
1565917
1565591
|
}
|
|
1565918
1565592
|
context2.logger.debug(`Generators found: ${generators.toString()}`);
|
|
1565919
1565593
|
for (const generator of generators.items) {
|
|
1565920
|
-
if (!
|
|
1565594
|
+
if (!import_yaml3.default.isMap(generator)) {
|
|
1565921
1565595
|
context2.failAndThrow(
|
|
1565922
1565596
|
`Expected generator in group ${groupName} to be a map in ${import_path37.default.relative(process.cwd(), filepath)}`
|
|
1565923
1565597
|
);
|
|
@@ -1566060,7 +1565734,7 @@ async function upgradeGenerator({
|
|
|
1566060
1565734
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
1566061
1565735
|
});
|
|
1566062
1565736
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
1566063
|
-
await (0,
|
|
1565737
|
+
await (0, import_promises57.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
1566064
1565738
|
}
|
|
1566065
1565739
|
allSkippedMajorUpgrades.push(...result.skippedMajorUpgrades);
|
|
1566066
1565740
|
if (result.appliedUpgrades.length > 0) {
|
|
@@ -1566414,7 +1566088,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
1566414
1566088
|
}
|
|
1566415
1566089
|
if (argv.output) {
|
|
1566416
1566090
|
try {
|
|
1566417
|
-
await (0,
|
|
1566091
|
+
await (0, import_promises58.writeFile)(argv.output, JSON.stringify(generatorMetadata, null, 2));
|
|
1566418
1566092
|
} catch (error49) {
|
|
1566419
1566093
|
cliContext.failAndThrow(
|
|
1566420
1566094
|
`Could not write file to the specified location: ${argv.output}`,
|
|
@@ -1566428,7 +1566102,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
1566428
1566102
|
}
|
|
1566429
1566103
|
|
|
1566430
1566104
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
1566431
|
-
var
|
|
1566105
|
+
var import_promises59 = require("fs/promises");
|
|
1566432
1566106
|
async function addGeneratorToWorkspaces({
|
|
1566433
1566107
|
project: { apiWorkspaces },
|
|
1566434
1566108
|
generatorName,
|
|
@@ -1566455,7 +1566129,7 @@ async function addGeneratorToWorkspaces({
|
|
|
1566455
1566129
|
if (absolutePathToGeneratorsConfiguration == null) {
|
|
1566456
1566130
|
return;
|
|
1566457
1566131
|
}
|
|
1566458
|
-
await (0,
|
|
1566132
|
+
await (0, import_promises59.writeFile)(
|
|
1566459
1566133
|
absolutePathToGeneratorsConfiguration,
|
|
1566460
1566134
|
"# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(newConfiguration)
|
|
1566461
1566135
|
);
|
|
@@ -1566466,7 +1566140,7 @@ async function addGeneratorToWorkspaces({
|
|
|
1566466
1566140
|
}
|
|
1566467
1566141
|
|
|
1566468
1566142
|
// src/commands/diff/diff.ts
|
|
1566469
|
-
var
|
|
1566143
|
+
var import_promises60 = require("fs/promises");
|
|
1566470
1566144
|
var import_semver9 = __toESM(require_semver2(), 1);
|
|
1566471
1566145
|
async function diff({
|
|
1566472
1566146
|
context: context2,
|
|
@@ -1566509,7 +1566183,7 @@ async function readIr({
|
|
|
1566509
1566183
|
context2.failWithoutThrowing(`File not found: ${absoluteFilepath}`);
|
|
1566510
1566184
|
throw new FernCliError();
|
|
1566511
1566185
|
}
|
|
1566512
|
-
const ir14 = await (0,
|
|
1566186
|
+
const ir14 = await (0, import_promises60.readFile)(absoluteFilepath, "utf-8");
|
|
1566513
1566187
|
const parsed = serialization_exports4.IntermediateRepresentation.parse(JSON.parse(ir14));
|
|
1566514
1566188
|
if (!parsed.ok) {
|
|
1566515
1566189
|
context2.failWithoutThrowing(`Invalid --${flagName}; expected a filepath containing a valid IR`);
|
|
@@ -1584262,9 +1583936,9 @@ function replaceFrontmatterImagesforLogo(data2, mapImage) {
|
|
|
1584262
1583936
|
}
|
|
1584263
1583937
|
|
|
1584264
1583938
|
// ../docs-markdown-utils/lib/replaceReferencedCode.js
|
|
1584265
|
-
var
|
|
1583939
|
+
var import_promises61 = require("fs/promises");
|
|
1584266
1583940
|
async function defaultFileLoader(filepath) {
|
|
1584267
|
-
const file2 = await (0,
|
|
1583941
|
+
const file2 = await (0, import_promises61.readFile)(filepath);
|
|
1584268
1583942
|
return file2.toString();
|
|
1584269
1583943
|
}
|
|
1584270
1583944
|
function isUrl2(src) {
|
|
@@ -1584431,10 +1584105,10 @@ ${replacement}
|
|
|
1584431
1584105
|
}
|
|
1584432
1584106
|
|
|
1584433
1584107
|
// ../docs-markdown-utils/lib/replaceReferencedMarkdown.js
|
|
1584434
|
-
var
|
|
1584108
|
+
var import_promises62 = require("fs/promises");
|
|
1584435
1584109
|
var import_gray_matter5 = __toESM(require_gray_matter(), 1);
|
|
1584436
1584110
|
async function defaultMarkdownLoader(filepath) {
|
|
1584437
|
-
const { content: content5 } = (0, import_gray_matter5.default)(await (0,
|
|
1584111
|
+
const { content: content5 } = (0, import_gray_matter5.default)(await (0, import_promises62.readFile)(filepath));
|
|
1584438
1584112
|
return content5;
|
|
1584439
1584113
|
}
|
|
1584440
1584114
|
function extractAttributes(markdownTag) {
|
|
@@ -1592186,7 +1591860,7 @@ function computeServiceTypeReferenceInfo(irGraph) {
|
|
|
1592186
1591860
|
// ../docs-resolver/lib/DocsDefinitionResolver.js
|
|
1592187
1591861
|
var import_dayjs3 = __toESM(require_dayjs_min(), 1);
|
|
1592188
1591862
|
var import_utc3 = __toESM(require_utc(), 1);
|
|
1592189
|
-
var
|
|
1591863
|
+
var import_promises66 = require("fs/promises");
|
|
1592190
1591864
|
var import_gray_matter6 = __toESM(require_gray_matter(), 1);
|
|
1592191
1591865
|
|
|
1592192
1591866
|
// ../../../node_modules/.pnpm/@fern-api+ui-core-utils@0.129.4-b6c699ad2/node_modules/@fern-api/ui-core-utils/dist/assertNever.js
|
|
@@ -1596300,7 +1595974,7 @@ var OpenAPIPruner = class {
|
|
|
1596300
1595974
|
};
|
|
1596301
1595975
|
|
|
1596302
1595976
|
// ../register/lib/ai-example-enhancer/enhanceExamplesWithAI.js
|
|
1596303
|
-
var
|
|
1595977
|
+
var import_promises65 = require("fs/promises");
|
|
1596304
1595978
|
|
|
1596305
1595979
|
// ../register/lib/ai-example-enhancer/lambdaClient.js
|
|
1596306
1595980
|
var DEFAULT_AI_ENHANCEMENT_MAX_RETRIES = 0;
|
|
@@ -1596517,12 +1596191,12 @@ var SpinnerStatusCoordinator = class _SpinnerStatusCoordinator {
|
|
|
1596517
1596191
|
};
|
|
1596518
1596192
|
|
|
1596519
1596193
|
// ../register/lib/ai-example-enhancer/validateAiExamples.js
|
|
1596520
|
-
var
|
|
1596194
|
+
var import_promises63 = require("fs/promises");
|
|
1596521
1596195
|
async function parseAiExamplesOverride(sourceFilePath, context2) {
|
|
1596522
1596196
|
const overrideFilePath = AbsoluteFilePath2.of(`${dirname4(sourceFilePath)}/ai_examples_override.yml`);
|
|
1596523
1596197
|
const aiExamples = [];
|
|
1596524
1596198
|
try {
|
|
1596525
|
-
const existingContent = await (0,
|
|
1596199
|
+
const existingContent = await (0, import_promises63.readFile)(overrideFilePath, "utf-8");
|
|
1596526
1596200
|
const parsed = jsYaml.load(existingContent);
|
|
1596527
1596201
|
if (parsed && typeof parsed === "object" && "paths" in parsed) {
|
|
1596528
1596202
|
const paths = parsed.paths;
|
|
@@ -1596571,7 +1596245,7 @@ async function validateAiExamplesFromFile({ sourceFilePath, context: context2 })
|
|
|
1596571
1596245
|
}
|
|
1596572
1596246
|
let spec;
|
|
1596573
1596247
|
try {
|
|
1596574
|
-
const specContent = await (0,
|
|
1596248
|
+
const specContent = await (0, import_promises63.readFile)(sourceFilePath, "utf-8");
|
|
1596575
1596249
|
try {
|
|
1596576
1596250
|
spec = JSON.parse(specContent);
|
|
1596577
1596251
|
} catch {
|
|
@@ -1596630,7 +1596304,7 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context2 }) {
|
|
|
1596630
1596304
|
}
|
|
1596631
1596305
|
const overrideFilePath = AbsoluteFilePath2.of(`${dirname4(sourceFilePath)}/ai_examples_override.yml`);
|
|
1596632
1596306
|
try {
|
|
1596633
|
-
const existingContent = await (0,
|
|
1596307
|
+
const existingContent = await (0, import_promises63.readFile)(overrideFilePath, "utf-8");
|
|
1596634
1596308
|
const parsed = jsYaml.load(existingContent);
|
|
1596635
1596309
|
if (!parsed || !parsed.paths) {
|
|
1596636
1596310
|
return {
|
|
@@ -1596674,7 +1596348,7 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context2 }) {
|
|
|
1596674
1596348
|
}
|
|
1596675
1596349
|
|
|
1596676
1596350
|
// ../register/lib/ai-example-enhancer/writeAiExamplesOverride.js
|
|
1596677
|
-
var
|
|
1596351
|
+
var import_promises64 = require("fs/promises");
|
|
1596678
1596352
|
|
|
1596679
1596353
|
// ../register/lib/ai-example-enhancer/filterHelpers.js
|
|
1596680
1596354
|
function isEmptyObject2(value) {
|
|
@@ -1596746,7 +1596420,7 @@ async function loadExistingOverrideCoverage(sourceFilePath, context2) {
|
|
|
1596746
1596420
|
const overrideFilePath = AbsoluteFilePath2.of(`${dirname4(sourceFilePath)}/ai_examples_override.yml`);
|
|
1596747
1596421
|
const coveredEndpoints = /* @__PURE__ */ new Set();
|
|
1596748
1596422
|
try {
|
|
1596749
|
-
const existingContent = await (0,
|
|
1596423
|
+
const existingContent = await (0, import_promises64.readFile)(overrideFilePath, "utf-8");
|
|
1596750
1596424
|
const parsed = jsYaml.load(existingContent);
|
|
1596751
1596425
|
if (parsed && typeof parsed === "object" && "paths" in parsed) {
|
|
1596752
1596426
|
const paths = parsed.paths;
|
|
@@ -1596856,7 +1596530,7 @@ async function writeAiExamplesOverride({ enhancedExamples, sourceFilePath, conte
|
|
|
1596856
1596530
|
try {
|
|
1596857
1596531
|
let existingOverride = {};
|
|
1596858
1596532
|
try {
|
|
1596859
|
-
const existingContent = await (0,
|
|
1596533
|
+
const existingContent = await (0, import_promises64.readFile)(overrideFilePath, "utf-8");
|
|
1596860
1596534
|
const parsed = jsYaml.load(existingContent);
|
|
1596861
1596535
|
if (parsed && typeof parsed === "object") {
|
|
1596862
1596536
|
existingOverride = parsed;
|
|
@@ -1596899,7 +1596573,7 @@ async function writeAiExamplesOverride({ enhancedExamples, sourceFilePath, conte
|
|
|
1596899
1596573
|
lineWidth: -1,
|
|
1596900
1596574
|
noRefs: true
|
|
1596901
1596575
|
});
|
|
1596902
|
-
await (0,
|
|
1596576
|
+
await (0, import_promises64.writeFile)(overrideFilePath, yamlContent, "utf-8");
|
|
1596903
1596577
|
context2.logger.debug(`AI enhanced examples written to: ${overrideFilePath}`);
|
|
1596904
1596578
|
} catch (error49) {
|
|
1596905
1596579
|
context2.logger.warn(`Failed to write AI examples override file: ${error49}`);
|
|
@@ -1597136,7 +1596810,7 @@ async function performAIEnhancement(apiDefinition, config3, context2, token, org
|
|
|
1597136
1596810
|
let endpointsNeedingRegeneration = /* @__PURE__ */ new Set();
|
|
1597137
1596811
|
if (sourceFilePath != null) {
|
|
1597138
1596812
|
try {
|
|
1597139
|
-
const specContent = await (0,
|
|
1596813
|
+
const specContent = await (0, import_promises65.readFile)(sourceFilePath, "utf-8");
|
|
1597140
1596814
|
if (!isOpenApiSpec(specContent)) {
|
|
1597141
1596815
|
context2.logger.debug("Non-OpenAPI spec detected, skipping AI example enhancement");
|
|
1597142
1596816
|
return apiDefinition;
|
|
@@ -1599999,7 +1599673,7 @@ var DocsDefinitionResolver = class {
|
|
|
1599999
1599673
|
const jsFilePaths = /* @__PURE__ */ new Set();
|
|
1600000
1599674
|
await Promise.all(this._parsedDocsConfig.experimental.mdxComponents.map(async (filepath) => {
|
|
1600001
1599675
|
const absoluteFilePath = resolve5(this.docsWorkspace.absoluteFilePath, filepath);
|
|
1600002
|
-
const stats = await (0,
|
|
1599676
|
+
const stats = await (0, import_promises66.stat)(absoluteFilePath);
|
|
1600003
1599677
|
if (stats.isDirectory()) {
|
|
1600004
1599678
|
const files = await listFiles(absoluteFilePath, "{js,ts,jsx,tsx,md,mdx}");
|
|
1600005
1599679
|
files.forEach((file2) => {
|
|
@@ -1600011,7 +1599685,7 @@ var DocsDefinitionResolver = class {
|
|
|
1600011
1599685
|
}));
|
|
1600012
1599686
|
jsFiles = Object.fromEntries(await Promise.all([...jsFilePaths].map(async (filePath) => {
|
|
1600013
1599687
|
const relativeFilePath = this.toRelativeFilepath(filePath);
|
|
1600014
|
-
const contents = (await (0,
|
|
1599688
|
+
const contents = (await (0, import_promises66.readFile)(filePath)).toString();
|
|
1600015
1599689
|
return [relativeFilePath, contents];
|
|
1600016
1599690
|
})));
|
|
1600017
1599691
|
const mdxTime = performance.now() - mdxStart;
|
|
@@ -1608058,7 +1607732,7 @@ async function generateFdrFromOpenApiWorkspace(workspace, context2) {
|
|
|
1608058
1607732
|
// ../docs-preview/lib/runAppPreviewServer.js
|
|
1608059
1607733
|
var import_cors = __toESM(require_lib16(), 1);
|
|
1608060
1607734
|
var import_express = __toESM(require_express3(), 1);
|
|
1608061
|
-
var
|
|
1607735
|
+
var import_promises72 = require("fs/promises");
|
|
1608062
1607736
|
var import_http6 = __toESM(require("http"), 1);
|
|
1608063
1607737
|
var import_path42 = __toESM(require("path"), 1);
|
|
1608064
1607738
|
|
|
@@ -1609730,13 +1609404,13 @@ var watcher_default = Watcher;
|
|
|
1609730
1609404
|
init_wrapper();
|
|
1609731
1609405
|
|
|
1609732
1609406
|
// ../docs-preview/lib/DebugLogger.js
|
|
1609733
|
-
var
|
|
1609407
|
+
var import_promises67 = require("fs/promises");
|
|
1609734
1609408
|
var import_os5 = require("os");
|
|
1609735
1609409
|
var import_path40 = __toESM(require("path"), 1);
|
|
1609736
1609410
|
var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
1609737
1609411
|
var LOGS_FOLDER_NAME = "logs";
|
|
1609738
1609412
|
function getCliSource() {
|
|
1609739
|
-
const version7 = "3.47.3
|
|
1609413
|
+
const version7 = "3.47.3";
|
|
1609740
1609414
|
return `cli@${version7}`;
|
|
1609741
1609415
|
}
|
|
1609742
1609416
|
var DebugLogger = class {
|
|
@@ -1609756,7 +1609430,7 @@ var DebugLogger = class {
|
|
|
1609756
1609430
|
const localStorageFolder = join2(AbsoluteFilePath2.of((0, import_os5.homedir)()), RelativeFilePath2.of(LOCAL_STORAGE_FOLDER4));
|
|
1609757
1609431
|
const logsDir = join2(localStorageFolder, RelativeFilePath2.of(LOGS_FOLDER_NAME));
|
|
1609758
1609432
|
if (!await doesPathExist(logsDir)) {
|
|
1609759
|
-
await (0,
|
|
1609433
|
+
await (0, import_promises67.mkdir)(logsDir, { recursive: true });
|
|
1609760
1609434
|
}
|
|
1609761
1609435
|
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
1609762
1609436
|
const logFileName = `${timestamp2}.debug.log`;
|
|
@@ -1609769,7 +1609443,7 @@ var DebugLogger = class {
|
|
|
1609769
1609443
|
"================================================================================",
|
|
1609770
1609444
|
""
|
|
1609771
1609445
|
].join("\n");
|
|
1609772
|
-
await (0,
|
|
1609446
|
+
await (0, import_promises67.writeFile)(this.logFilePath, header, "utf-8");
|
|
1609773
1609447
|
this.initialized = true;
|
|
1609774
1609448
|
}
|
|
1609775
1609449
|
/**
|
|
@@ -1609787,7 +1609461,7 @@ var DebugLogger = class {
|
|
|
1609787
1609461
|
}
|
|
1609788
1609462
|
const line = JSON.stringify(entry) + "\n";
|
|
1609789
1609463
|
try {
|
|
1609790
|
-
await (0,
|
|
1609464
|
+
await (0, import_promises67.appendFile)(this.logFilePath, line, "utf-8");
|
|
1609791
1609465
|
} catch (error49) {
|
|
1609792
1609466
|
}
|
|
1609793
1609467
|
}
|
|
@@ -1609911,7 +1609585,7 @@ var DebugLogger = class {
|
|
|
1609911
1609585
|
// ../docs-preview/lib/downloadLocalDocsBundle.js
|
|
1609912
1609586
|
var import_cli_progress = __toESM(require_cli_progress(), 1);
|
|
1609913
1609587
|
var import_decompress = __toESM(require_decompress(), 1);
|
|
1609914
|
-
var
|
|
1609588
|
+
var import_promises68 = require("fs/promises");
|
|
1609915
1609589
|
var import_os6 = require("os");
|
|
1609916
1609590
|
var import_tmp_promise9 = __toESM(require_tmp_promise(), 1);
|
|
1609917
1609591
|
var import_xml2js = __toESM(require_xml2js(), 1);
|
|
@@ -1609999,7 +1609673,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1609999
1609673
|
let currentETag = void 0;
|
|
1610000
1609674
|
if (currentETagExists) {
|
|
1610001
1609675
|
logger.debug("Reading existing ETag");
|
|
1610002
|
-
currentETag = (await (0,
|
|
1609676
|
+
currentETag = (await (0, import_promises68.readFile)(eTagFilepath)).toString();
|
|
1610003
1609677
|
}
|
|
1610004
1609678
|
if (currentETag != null && currentETag === eTag) {
|
|
1610005
1609679
|
logger.debug("ETag matches. Using already downloaded bundle");
|
|
@@ -1610063,16 +1609737,16 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1610063
1609737
|
}
|
|
1610064
1609738
|
}
|
|
1610065
1609739
|
const nodeBuffer = Buffer.concat(chunks);
|
|
1610066
|
-
await (0,
|
|
1609740
|
+
await (0, import_promises68.writeFile)(outputZipPath, new Uint8Array(nodeBuffer));
|
|
1610067
1609741
|
logger.debug(`Wrote ${tryTar ? "output.tar.gz" : "output.zip"} to ${outputZipPath}`);
|
|
1610068
1609742
|
const absolutePathToPreviewFolder = getPathToPreviewFolder({ app });
|
|
1610069
1609743
|
if (await doesPathExist(absolutePathToPreviewFolder)) {
|
|
1610070
1609744
|
logger.debug(`Removing previously cached bundle at: ${absolutePathToPreviewFolder}`);
|
|
1610071
|
-
await (0,
|
|
1609745
|
+
await (0, import_promises68.rm)(absolutePathToPreviewFolder, { recursive: true });
|
|
1610072
1609746
|
}
|
|
1610073
|
-
await (0,
|
|
1609747
|
+
await (0, import_promises68.mkdir)(absolutePathToPreviewFolder, { recursive: true });
|
|
1610074
1609748
|
const absolutePathToBundleFolder = getPathToBundleFolder({ app });
|
|
1610075
|
-
await (0,
|
|
1609749
|
+
await (0, import_promises68.mkdir)(absolutePathToBundleFolder, { recursive: true });
|
|
1610076
1609750
|
logger.debug(`Decompressing bundle from ${outputZipPath} to ${absolutePathToBundleFolder}`);
|
|
1610077
1609751
|
let unzipProgressBar;
|
|
1610078
1609752
|
let unzipInterval;
|
|
@@ -1610107,7 +1609781,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1610107
1609781
|
unzipProgressBar.stop();
|
|
1610108
1609782
|
}
|
|
1610109
1609783
|
}
|
|
1610110
|
-
await (0,
|
|
1609784
|
+
await (0, import_promises68.writeFile)(eTagFilepath, eTag);
|
|
1610111
1609785
|
logger.debug(`Downloaded bundle to ${absolutePathToBundleFolder}`);
|
|
1610112
1609786
|
if (app) {
|
|
1610113
1609787
|
logger.debug("Checking if pnpm is installed");
|
|
@@ -1610189,15 +1609863,15 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1610189
1609863
|
}
|
|
1610190
1609864
|
if (!pnpmfileExists) {
|
|
1610191
1609865
|
logger.debug(`Writing pnpmfile.cjs at ${pnpmfilePath}`);
|
|
1610192
|
-
await (0,
|
|
1609866
|
+
await (0, import_promises68.writeFile)(pnpmfilePath, PNPMFILE_CJS_CONTENTS);
|
|
1610193
1609867
|
}
|
|
1610194
1609868
|
if (!npmrcExists) {
|
|
1610195
1609869
|
logger.debug(`Writing .npmrc at ${npmrcPath}`);
|
|
1610196
|
-
await (0,
|
|
1609870
|
+
await (0, import_promises68.writeFile)(npmrcPath, NPMRC_CONTENTS);
|
|
1610197
1609871
|
}
|
|
1610198
1609872
|
if (instrumentationJsExists) {
|
|
1610199
1609873
|
logger.debug(`Removing instrumentation.js at ${absPathToInstrumentationJs}`);
|
|
1610200
|
-
await (0,
|
|
1609874
|
+
await (0, import_promises68.rm)(absPathToInstrumentationJs);
|
|
1610201
1609875
|
}
|
|
1610202
1609876
|
try {
|
|
1610203
1609877
|
logger.debug("Running pnpm install within standalone");
|
|
@@ -1610217,7 +1609891,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1610217
1609891
|
logger.error(`Error: ${error49}`);
|
|
1610218
1609892
|
const absolutePathToPreviewFolder = getPathToPreviewFolder({ app });
|
|
1610219
1609893
|
if (await doesPathExist(absolutePathToPreviewFolder)) {
|
|
1610220
|
-
await (0,
|
|
1609894
|
+
await (0, import_promises68.rm)(absolutePathToPreviewFolder, { recursive: true });
|
|
1610221
1609895
|
}
|
|
1610222
1609896
|
logger.debug(`Removing incomplete bundle: rm -rf ${absolutePathToPreviewFolder}`);
|
|
1610223
1609897
|
return {
|
|
@@ -1610227,7 +1609901,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1610227
1609901
|
}
|
|
1610228
1609902
|
|
|
1610229
1609903
|
// ../docs-preview/lib/previewDocs.js
|
|
1610230
|
-
var
|
|
1609904
|
+
var import_promises71 = require("fs/promises");
|
|
1610231
1609905
|
var import_gray_matter10 = __toESM(require_gray_matter(), 1);
|
|
1610232
1609906
|
|
|
1610233
1609907
|
// ../docs-markdown-utils/src/extract-literals.ts
|
|
@@ -1611070,9 +1610744,9 @@ function replaceFrontmatterImagesforLogo2(data2, mapImage) {
|
|
|
1611070
1610744
|
}
|
|
1611071
1610745
|
|
|
1611072
1610746
|
// ../docs-markdown-utils/src/replaceReferencedCode.ts
|
|
1611073
|
-
var
|
|
1610747
|
+
var import_promises69 = require("fs/promises");
|
|
1611074
1610748
|
async function defaultFileLoader2(filepath) {
|
|
1611075
|
-
const file2 = await (0,
|
|
1610749
|
+
const file2 = await (0, import_promises69.readFile)(filepath);
|
|
1611076
1610750
|
return file2.toString();
|
|
1611077
1610751
|
}
|
|
1611078
1610752
|
function isUrl3(src) {
|
|
@@ -1611246,10 +1610920,10 @@ ${replacement}
|
|
|
1611246
1610920
|
}
|
|
1611247
1610921
|
|
|
1611248
1610922
|
// ../docs-markdown-utils/src/replaceReferencedMarkdown.ts
|
|
1611249
|
-
var
|
|
1610923
|
+
var import_promises70 = require("fs/promises");
|
|
1611250
1610924
|
var import_gray_matter9 = __toESM(require_gray_matter(), 1);
|
|
1611251
1610925
|
async function defaultMarkdownLoader2(filepath) {
|
|
1611252
|
-
const { content: content5 } = (0, import_gray_matter9.default)(await (0,
|
|
1610926
|
+
const { content: content5 } = (0, import_gray_matter9.default)(await (0, import_promises70.readFile)(filepath));
|
|
1611253
1610927
|
return content5;
|
|
1611254
1610928
|
}
|
|
1611255
1610929
|
function extractAttributes2(markdownTag) {
|
|
@@ -1611448,7 +1611122,7 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
|
|
|
1611448
1611122
|
navAffectingChange = true;
|
|
1611449
1611123
|
continue;
|
|
1611450
1611124
|
}
|
|
1611451
|
-
const markdown = (await (0,
|
|
1611125
|
+
const markdown = (await (0, import_promises71.readFile)(absoluteFilePath)).toString();
|
|
1611452
1611126
|
const isNewFile = previousValue == null;
|
|
1611453
1611127
|
if (isNewFile) {
|
|
1611454
1611128
|
navAffectingChange = true;
|
|
@@ -1611838,7 +1611512,7 @@ var SnippetDependencyTracker = class {
|
|
|
1611838
1611512
|
const markdownFiles = await this.findMarkdownFiles(docsWorkspace.absoluteFilePath);
|
|
1611839
1611513
|
for (const markdownFile of markdownFiles) {
|
|
1611840
1611514
|
try {
|
|
1611841
|
-
const content5 = await (0,
|
|
1611515
|
+
const content5 = await (0, import_promises72.readFile)(markdownFile, "utf-8");
|
|
1611842
1611516
|
const referencedFiles = this.extractReferences(content5, markdownFile, docsWorkspace.absoluteFilePath);
|
|
1611843
1611517
|
this.pageToSnippets.set(markdownFile, referencedFiles);
|
|
1611844
1611518
|
for (const referencedFile of referencedFiles) {
|
|
@@ -1611920,7 +1611594,7 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
|
|
|
1611920
1611594
|
const appPreviewFolder = getPathToPreviewFolder({ app: true });
|
|
1611921
1611595
|
if (await doesPathExist(appPreviewFolder)) {
|
|
1611922
1611596
|
context2.logger.info("Force download requested. Deleting cached bundle...");
|
|
1611923
|
-
await (0,
|
|
1611597
|
+
await (0, import_promises72.rm)(appPreviewFolder, { recursive: true });
|
|
1611924
1611598
|
}
|
|
1611925
1611599
|
}
|
|
1611926
1611600
|
if (bundlePath != null) {
|
|
@@ -1614414,7 +1614088,7 @@ async function validateVersionConfigFileSchema({ value }) {
|
|
|
1614414
1614088
|
}
|
|
1614415
1614089
|
|
|
1614416
1614090
|
// ../yaml/docs-validator/lib/docsAst/visitDocsConfigFileYamlAst.js
|
|
1614417
|
-
var
|
|
1614091
|
+
var import_promises74 = require("fs/promises");
|
|
1614418
1614092
|
|
|
1614419
1614093
|
// ../yaml/docs-validator/lib/docsAst/products-yml.schema.json
|
|
1614420
1614094
|
var products_yml_schema_exports = {};
|
|
@@ -1616265,7 +1615939,7 @@ async function visitFilepath({ absoluteFilepathToConfiguration, rawUnresolvedFil
|
|
|
1616265
1615939
|
}
|
|
1616266
1615940
|
|
|
1616267
1615941
|
// ../yaml/docs-validator/lib/docsAst/visitNavigationAst.js
|
|
1616268
|
-
var
|
|
1615942
|
+
var import_promises73 = require("fs/promises");
|
|
1616269
1615943
|
|
|
1616270
1615944
|
// ../yaml/docs-validator/lib/utils/asyncPool.js
|
|
1616271
1615945
|
async function asyncPool(limit, items, fn4) {
|
|
@@ -1616416,13 +1616090,13 @@ async function visitNavigationItem2({ absolutePathToFernFolder, navigationItem,
|
|
|
1616416
1616090
|
if (navigationItemIsPage(navigationItem)) {
|
|
1616417
1616091
|
const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), navigationItem.path);
|
|
1616418
1616092
|
if (await doesPathExist(absoluteFilepath)) {
|
|
1616419
|
-
const fileStats = await (0,
|
|
1616093
|
+
const fileStats = await (0, import_promises73.stat)(absoluteFilepath);
|
|
1616420
1616094
|
const fileSizeMB = fileStats.size / (1024 * 1024);
|
|
1616421
1616095
|
if (fileSizeMB > 1) {
|
|
1616422
1616096
|
context2.logger.trace(`Processing large markdown file: ${navigationItem.path} (${fileSizeMB.toFixed(2)} MB)`);
|
|
1616423
1616097
|
}
|
|
1616424
1616098
|
const startTime = performance.now();
|
|
1616425
|
-
const content5 = (await (0,
|
|
1616099
|
+
const content5 = (await (0, import_promises73.readFile)(absoluteFilepath, "utf8")).toString();
|
|
1616426
1616100
|
const readTime = performance.now() - startTime;
|
|
1616427
1616101
|
if (readTime > 2e3) {
|
|
1616428
1616102
|
context2.logger.debug(`Slow file read: ${navigationItem.path} took ${readTime.toFixed(0)}ms`);
|
|
@@ -1616469,12 +1616143,12 @@ async function visitNavigationItem2({ absolutePathToFernFolder, navigationItem,
|
|
|
1616469
1616143
|
context2.logger.trace(`Starting changelog processing for directory: ${changelogDir}`);
|
|
1616470
1616144
|
if (await doesPathExist(changelogDir)) {
|
|
1616471
1616145
|
const startTime = performance.now();
|
|
1616472
|
-
const files = await (0,
|
|
1616146
|
+
const files = await (0, import_promises73.readdir)(changelogDir);
|
|
1616473
1616147
|
const markdownFiles = files.filter((file2) => file2.endsWith(".md") || file2.endsWith(".mdx"));
|
|
1616474
1616148
|
context2.logger.debug(`Processing ${markdownFiles.length} changelog files in ${changelogDir}`);
|
|
1616475
1616149
|
await asyncPool(VALIDATION_CONCURRENCY, markdownFiles, async (file2) => {
|
|
1616476
1616150
|
const absoluteFilepath = resolve5(changelogDir, file2);
|
|
1616477
|
-
const content5 = (await (0,
|
|
1616151
|
+
const content5 = (await (0, import_promises73.readFile)(absoluteFilepath, "utf8")).toString();
|
|
1616478
1616152
|
context2.logger.trace(`Validating changelog file: ${file2}`);
|
|
1616479
1616153
|
await visitor.markdownPage?.({
|
|
1616480
1616154
|
title: file2,
|
|
@@ -1616664,7 +1616338,7 @@ async function visitDocsConfigFileYamlAst({ contents, visitor, absoluteFilepathT
|
|
|
1616664
1616338
|
willBeUploaded: false
|
|
1616665
1616339
|
});
|
|
1616666
1616340
|
const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), product.path);
|
|
1616667
|
-
const content5 = jsYaml.load((await (0,
|
|
1616341
|
+
const content5 = jsYaml.load((await (0, import_promises74.readFile)(absoluteFilepath)).toString());
|
|
1616668
1616342
|
if (await doesPathExist(absoluteFilepath)) {
|
|
1616669
1616343
|
await visitor.productFile?.({
|
|
1616670
1616344
|
path: product.path,
|
|
@@ -1616742,7 +1616416,7 @@ async function visitDocsConfigFileYamlAst({ contents, visitor, absoluteFilepathT
|
|
|
1616742
1616416
|
willBeUploaded: false
|
|
1616743
1616417
|
});
|
|
1616744
1616418
|
const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), version7.path);
|
|
1616745
|
-
const content5 = jsYaml.load((await (0,
|
|
1616419
|
+
const content5 = jsYaml.load((await (0, import_promises74.readFile)(absoluteFilepath)).toString());
|
|
1616746
1616420
|
if (await doesPathExist(absoluteFilepath)) {
|
|
1616747
1616421
|
await visitor.versionFile?.({
|
|
1616748
1616422
|
path: version7.path,
|
|
@@ -1617176,7 +1616850,7 @@ var import_web = require("stream/web");
|
|
|
1617176
1616850
|
var import_node_stream5 = require("stream");
|
|
1617177
1616851
|
|
|
1617178
1616852
|
// ../../../node_modules/.pnpm/strtok3@9.1.1/node_modules/strtok3/lib/index.js
|
|
1617179
|
-
var
|
|
1616853
|
+
var import_promises76 = require("fs/promises");
|
|
1617180
1616854
|
|
|
1617181
1616855
|
// ../../../node_modules/.pnpm/peek-readable@5.4.2/node_modules/peek-readable/lib/EndOfStreamError.js
|
|
1617182
1616856
|
var defaultMessages = "End-Of-Stream";
|
|
@@ -1617547,14 +1617221,14 @@ function fromBuffer(uint8Array, options2) {
|
|
|
1617547
1617221
|
}
|
|
1617548
1617222
|
|
|
1617549
1617223
|
// ../../../node_modules/.pnpm/strtok3@9.1.1/node_modules/strtok3/lib/FileTokenizer.js
|
|
1617550
|
-
var
|
|
1617224
|
+
var import_promises75 = require("fs/promises");
|
|
1617551
1617225
|
var FileTokenizer = class _FileTokenizer extends AbstractTokenizer {
|
|
1617552
1617226
|
/**
|
|
1617553
1617227
|
* Create tokenizer from provided file path
|
|
1617554
1617228
|
* @param sourceFilePath File path
|
|
1617555
1617229
|
*/
|
|
1617556
1617230
|
static async fromFile(sourceFilePath) {
|
|
1617557
|
-
const fileHandle = await (0,
|
|
1617231
|
+
const fileHandle = await (0, import_promises75.open)(sourceFilePath, "r");
|
|
1617558
1617232
|
const stat3 = await fileHandle.stat();
|
|
1617559
1617233
|
return new _FileTokenizer(fileHandle, { fileInfo: { path: sourceFilePath, size: stat3.size } });
|
|
1617560
1617234
|
}
|
|
@@ -1619516,7 +1619190,7 @@ var supportedExtensions = new Set(extensions);
|
|
|
1619516
1619190
|
var supportedMimeTypes = new Set(mimeTypes);
|
|
1619517
1619191
|
|
|
1619518
1619192
|
// ../yaml/docs-validator/lib/rules/valid-file-types/valid-file-types.js
|
|
1619519
|
-
var
|
|
1619193
|
+
var import_promises77 = require("fs/promises");
|
|
1619520
1619194
|
var import_path44 = __toESM(require("path"), 1);
|
|
1619521
1619195
|
var ALLOWED_FILE_TYPES = /* @__PURE__ */ new Set([
|
|
1619522
1619196
|
// image files
|
|
@@ -1619637,7 +1619311,7 @@ var ValidFileTypes = {
|
|
|
1619637
1619311
|
}
|
|
1619638
1619312
|
};
|
|
1619639
1619313
|
var getViolationsForFile = async (absoluteFilepath) => {
|
|
1619640
|
-
const file2 = new Uint8Array(await (0,
|
|
1619314
|
+
const file2 = new Uint8Array(await (0, import_promises77.readFile)(absoluteFilepath));
|
|
1619641
1619315
|
const fileType = await fileTypeFromBuffer(file2);
|
|
1619642
1619316
|
if (fileType != null) {
|
|
1619643
1619317
|
if (ALLOWED_FILE_TYPES.has(fileType.mime)) {
|
|
@@ -1619676,7 +1619350,7 @@ var getViolationsForFile = async (absoluteFilepath) => {
|
|
|
1619676
1619350
|
};
|
|
1619677
1619351
|
|
|
1619678
1619352
|
// ../yaml/docs-validator/lib/rules/valid-frontmatter/valid-frontmatter.js
|
|
1619679
|
-
var
|
|
1619353
|
+
var import_promises78 = require("fs/promises");
|
|
1619680
1619354
|
var import_gray_matter11 = __toESM(require_gray_matter(), 1);
|
|
1619681
1619355
|
var ValidFrontmatter = {
|
|
1619682
1619356
|
name: "valid-frontmatter",
|
|
@@ -1619687,7 +1619361,7 @@ var ValidFrontmatter = {
|
|
|
1619687
1619361
|
return [];
|
|
1619688
1619362
|
}
|
|
1619689
1619363
|
try {
|
|
1619690
|
-
const fileContents = await (0,
|
|
1619364
|
+
const fileContents = await (0, import_promises78.readFile)(absoluteFilepath, "utf-8");
|
|
1619691
1619365
|
(0, import_gray_matter11.default)(fileContents);
|
|
1619692
1619366
|
return [];
|
|
1619693
1619367
|
} catch (error49) {
|
|
@@ -1624144,7 +1623818,7 @@ function compile(vfileCompatible, compileOptions) {
|
|
|
1624144
1623818
|
}
|
|
1624145
1623819
|
|
|
1624146
1623820
|
// ../../../node_modules/.pnpm/vfile-matter@5.0.1/node_modules/vfile-matter/lib/index.js
|
|
1624147
|
-
var
|
|
1623821
|
+
var import_yaml4 = __toESM(require_dist(), 1);
|
|
1624148
1623822
|
var regex4 = /^---(?:\r?\n|\r)(?:([\s\S]*?)(?:\r?\n|\r))?---(?:\r?\n|\r|$)/;
|
|
1624149
1623823
|
var emptyOptions10 = {};
|
|
1624150
1623824
|
var emptyYamlOptions = {};
|
|
@@ -1624155,7 +1623829,7 @@ function matter2(file2, options2) {
|
|
|
1624155
1623829
|
let document4 = String(file2);
|
|
1624156
1623830
|
const match3 = regex4.exec(document4);
|
|
1624157
1623831
|
if (match3) {
|
|
1624158
|
-
file2.data.matter =
|
|
1623832
|
+
file2.data.matter = import_yaml4.default.parse(match3[1] || "", yamlOptions) || {};
|
|
1624159
1623833
|
if (strip) {
|
|
1624160
1623834
|
document4 = document4.slice(match3[0].length);
|
|
1624161
1623835
|
file2.value = file2.value && typeof file2.value === "object" ? new TextEncoder().encode(document4) : document4;
|
|
@@ -1624563,7 +1624237,7 @@ async function parseMarkdown({ markdown, absoluteFilepath, absolutePathToFernFol
|
|
|
1624563
1624237
|
}
|
|
1624564
1624238
|
|
|
1624565
1624239
|
// ../yaml/docs-validator/lib/rules/valid-markdown-file-reference/valid-markdown-file-reference.js
|
|
1624566
|
-
var
|
|
1624240
|
+
var import_promises79 = require("fs/promises");
|
|
1624567
1624241
|
var import_gray_matter12 = __toESM(require_gray_matter(), 1);
|
|
1624568
1624242
|
var ValidMarkdownFileReferences = {
|
|
1624569
1624243
|
name: "valid-markdown-file-references",
|
|
@@ -1624574,7 +1624248,7 @@ var ValidMarkdownFileReferences = {
|
|
|
1624574
1624248
|
return [];
|
|
1624575
1624249
|
}
|
|
1624576
1624250
|
try {
|
|
1624577
|
-
const fileContents = await (0,
|
|
1624251
|
+
const fileContents = await (0, import_promises79.readFile)(absoluteFilepath, "utf-8");
|
|
1624578
1624252
|
const { content: content5 } = (0, import_gray_matter12.default)(fileContents, {});
|
|
1624579
1624253
|
const tree = parseMarkdownToTree(content5);
|
|
1624580
1624254
|
const errors4 = [];
|
|
@@ -1625251,7 +1624925,7 @@ var MDX_NODE_TYPES = [
|
|
|
1625251
1624925
|
"mdxTextExpression",
|
|
1625252
1624926
|
"mdxjsEsm"
|
|
1625253
1624927
|
];
|
|
1625254
|
-
function collectLinksAndSources({ readFile:
|
|
1624928
|
+
function collectLinksAndSources({ readFile: readFile84 = (path76) => (0, import_node_fs27.readFileSync)(path76, "utf-8"), ...opts }) {
|
|
1625255
1624929
|
const visitedAbsoluteFilepaths = /* @__PURE__ */ new Set();
|
|
1625256
1624930
|
const contentQueue = [opts];
|
|
1625257
1624931
|
const links = [];
|
|
@@ -1625289,7 +1624963,7 @@ function collectLinksAndSources({ readFile: readFile85 = (path76) => (0, import_
|
|
|
1625289
1624963
|
const resolvedImportPath = resolve5(dirname4(absoluteFilepath), importPath);
|
|
1625290
1624964
|
if (resolvedImportPath.endsWith(".mdx") || resolvedImportPath.endsWith(".md")) {
|
|
1625291
1624965
|
contentQueue.push({
|
|
1625292
|
-
content:
|
|
1624966
|
+
content: readFile84(resolvedImportPath),
|
|
1625293
1624967
|
absoluteFilepath: resolvedImportPath
|
|
1625294
1624968
|
});
|
|
1625295
1624969
|
}
|
|
@@ -1625332,7 +1625006,7 @@ function collectLinksAndSources({ readFile: readFile85 = (path76) => (0, import_
|
|
|
1625332
1625006
|
if (absoluteFilepath && typeof src === "string") {
|
|
1625333
1625007
|
const resolvedImportPath = resolve5(dirname4(absoluteFilepath), src);
|
|
1625334
1625008
|
contentQueue.push({
|
|
1625335
|
-
content:
|
|
1625009
|
+
content: readFile84(resolvedImportPath),
|
|
1625336
1625010
|
absoluteFilepath: resolvedImportPath
|
|
1625337
1625011
|
});
|
|
1625338
1625012
|
}
|
|
@@ -1625716,7 +1625390,7 @@ function createDocsConfigFileAstVisitorForRules({ relativeFilepath, allRuleVisit
|
|
|
1625716
1625390
|
}
|
|
1625717
1625391
|
|
|
1625718
1625392
|
// ../yaml/docs-validator/lib/rules/no-non-component-refs/no-non-component-refs.js
|
|
1625719
|
-
var
|
|
1625393
|
+
var import_promises80 = require("fs/promises");
|
|
1625720
1625394
|
var NoNonComponentRefsRule = {
|
|
1625721
1625395
|
name: "no-non-component-refs",
|
|
1625722
1625396
|
create: ({ ossWorkspaces, logger, workspace: docsWorkspace }) => {
|
|
@@ -1625730,7 +1625404,7 @@ var NoNonComponentRefsRule = {
|
|
|
1625730
1625404
|
if (!processedFiles.has(spec.absoluteFilepath)) {
|
|
1625731
1625405
|
processedFiles.add(spec.absoluteFilepath);
|
|
1625732
1625406
|
try {
|
|
1625733
|
-
const contents = (await (0,
|
|
1625407
|
+
const contents = (await (0, import_promises80.readFile)(spec.absoluteFilepath)).toString();
|
|
1625734
1625408
|
const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
|
|
1625735
1625409
|
const isOpenApiV2 = contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"));
|
|
1625736
1625410
|
if (isOpenApiV2) {
|
|
@@ -1625770,7 +1625444,7 @@ var NoNonComponentRefsRule = {
|
|
|
1625770
1625444
|
};
|
|
1625771
1625445
|
|
|
1625772
1625446
|
// ../yaml/docs-validator/lib/rules/no-openapi-v2-in-docs/no-openapi-v2-in-docs.js
|
|
1625773
|
-
var
|
|
1625447
|
+
var import_promises81 = require("fs/promises");
|
|
1625774
1625448
|
var NoOpenApiV2InDocsRule = {
|
|
1625775
1625449
|
name: "no-openapi-v2-in-docs",
|
|
1625776
1625450
|
create: ({ ossWorkspaces, logger, workspace: docsWorkspace }) => {
|
|
@@ -1625783,7 +1625457,7 @@ var NoOpenApiV2InDocsRule = {
|
|
|
1625783
1625457
|
if (spec.type === "openapi" && !processedFiles.has(spec.absoluteFilepath)) {
|
|
1625784
1625458
|
processedFiles.add(spec.absoluteFilepath);
|
|
1625785
1625459
|
try {
|
|
1625786
|
-
const contents = (await (0,
|
|
1625460
|
+
const contents = (await (0, import_promises81.readFile)(spec.absoluteFilepath)).toString();
|
|
1625787
1625461
|
const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
|
|
1625788
1625462
|
if (contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"))) {
|
|
1625789
1625463
|
violations.push({
|
|
@@ -1625906,7 +1625580,7 @@ var ValidInstanceUrlRule = {
|
|
|
1625906
1625580
|
};
|
|
1625907
1625581
|
|
|
1625908
1625582
|
// ../yaml/docs-validator/lib/rules/valid-local-references/valid-local-references.js
|
|
1625909
|
-
var
|
|
1625583
|
+
var import_promises82 = require("fs/promises");
|
|
1625910
1625584
|
function validateReference(ref2, spec) {
|
|
1625911
1625585
|
const pathParts = ref2.replace(/^#\//, "").split("/").map((part) => (
|
|
1625912
1625586
|
// Decode JSON Pointer escapes: ~1 -> /, ~0 -> ~
|
|
@@ -1625973,7 +1625647,7 @@ var ValidLocalReferencesRule = {
|
|
|
1625973
1625647
|
if (spec.type === "openapi" && !processedFiles.has(spec.absoluteFilepath)) {
|
|
1625974
1625648
|
processedFiles.add(spec.absoluteFilepath);
|
|
1625975
1625649
|
try {
|
|
1625976
|
-
const contents = (await (0,
|
|
1625650
|
+
const contents = (await (0, import_promises82.readFile)(spec.absoluteFilepath)).toString();
|
|
1625977
1625651
|
const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
|
|
1625978
1625652
|
const isOpenApiV2 = contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"));
|
|
1625979
1625653
|
if (isOpenApiV2) {
|
|
@@ -1626026,7 +1625700,7 @@ var ValidLocalReferencesRule = {
|
|
|
1626026
1625700
|
};
|
|
1626027
1625701
|
|
|
1626028
1625702
|
// ../yaml/docs-validator/lib/rules/valid-openapi-examples/valid-openapi-examples.js
|
|
1626029
|
-
var
|
|
1625703
|
+
var import_promises83 = require("fs/promises");
|
|
1626030
1625704
|
var ValidOpenApiExamples = {
|
|
1626031
1625705
|
name: "valid-openapi-examples",
|
|
1626032
1625706
|
create: ({ ossWorkspaces, logger, workspace: docsWorkspace }) => {
|
|
@@ -1626124,7 +1625798,7 @@ var ValidOpenApiExamples = {
|
|
|
1626124
1625798
|
};
|
|
1626125
1625799
|
async function validateOpenApiExamples({ specPath, logger }) {
|
|
1626126
1625800
|
try {
|
|
1626127
|
-
const specContent = await (0,
|
|
1625801
|
+
const specContent = await (0, import_promises83.readFile)(specPath, "utf-8");
|
|
1626128
1625802
|
let spec;
|
|
1626129
1625803
|
try {
|
|
1626130
1625804
|
spec = JSON.parse(specContent);
|
|
@@ -1626818,7 +1626492,7 @@ Found ${previewDeployments.length} preview deployment(s):
|
|
|
1626818
1626492
|
}
|
|
1626819
1626493
|
|
|
1626820
1626494
|
// src/commands/downgrade/downgrade.ts
|
|
1626821
|
-
var
|
|
1626495
|
+
var import_promises84 = require("fs/promises");
|
|
1626822
1626496
|
|
|
1626823
1626497
|
// ../../../node_modules/.pnpm/immer@10.1.3/node_modules/immer/dist/immer.mjs
|
|
1626824
1626498
|
var NOTHING = Symbol.for("immer-nothing");
|
|
@@ -1627507,12 +1627181,12 @@ async function downgrade({
|
|
|
1627507
1627181
|
const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
|
|
1627508
1627182
|
draft.version = targetVersion;
|
|
1627509
1627183
|
});
|
|
1627510
|
-
await (0,
|
|
1627184
|
+
await (0, import_promises84.writeFile)(projectConfig._absolutePath, ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2)));
|
|
1627511
1627185
|
cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
|
|
1627512
1627186
|
}
|
|
1627513
1627187
|
|
|
1627514
1627188
|
// src/commands/export/generateOpenAPIForWorkspaces.ts
|
|
1627515
|
-
var
|
|
1627189
|
+
var import_promises85 = require("fs/promises");
|
|
1627516
1627190
|
|
|
1627517
1627191
|
// src/commands/export/converters/servicesConverter.ts
|
|
1627518
1627192
|
var import_openapi_types3 = __toESM(require_dist20(), 1);
|
|
@@ -1628765,8 +1628439,8 @@ async function generateOpenAPIForWorkspaces({
|
|
|
1628765
1628439
|
ir: ir14,
|
|
1628766
1628440
|
mode: "openapi"
|
|
1628767
1628441
|
});
|
|
1628768
|
-
await (0,
|
|
1628769
|
-
await (0,
|
|
1628442
|
+
await (0, import_promises85.mkdir)(dirname4(outputPath), { recursive: true });
|
|
1628443
|
+
await (0, import_promises85.writeFile)(
|
|
1628770
1628444
|
outputPath,
|
|
1628771
1628445
|
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent3) : jsYaml.dump(openapi, { indent: indent3 })
|
|
1628772
1628446
|
);
|
|
@@ -1628805,10 +1628479,10 @@ var APPROVED_DIRECTORIES_FILENAME = "approved-output-directories";
|
|
|
1628805
1628479
|
var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
|
|
1628806
1628480
|
|
|
1628807
1628481
|
// src/commands/generate/checkOutputDirectory.ts
|
|
1628808
|
-
var
|
|
1628482
|
+
var import_promises88 = require("fs/promises");
|
|
1628809
1628483
|
|
|
1628810
1628484
|
// src/persistence/output-directories/getOutputDirectories.ts
|
|
1628811
|
-
var
|
|
1628485
|
+
var import_promises86 = require("fs/promises");
|
|
1628812
1628486
|
|
|
1628813
1628487
|
// src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
|
|
1628814
1628488
|
var import_os7 = require("os");
|
|
@@ -1628827,17 +1628501,17 @@ async function getOutputDirectories() {
|
|
|
1628827
1628501
|
if (!doesOutputDirectoriesFileExist) {
|
|
1628828
1628502
|
return [];
|
|
1628829
1628503
|
}
|
|
1628830
|
-
const outputDirectoriesFileContents = await (0,
|
|
1628504
|
+
const outputDirectoriesFileContents = await (0, import_promises86.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
|
|
1628831
1628505
|
const outputDirectories = JSON.parse(outputDirectoriesFileContents);
|
|
1628832
1628506
|
return outputDirectories;
|
|
1628833
1628507
|
}
|
|
1628834
1628508
|
|
|
1628835
1628509
|
// src/persistence/output-directories/storeOutputDirectories.ts
|
|
1628836
|
-
var
|
|
1628510
|
+
var import_promises87 = require("fs/promises");
|
|
1628837
1628511
|
var import_path46 = __toESM(require("path"), 1);
|
|
1628838
1628512
|
async function storeOutputDirectories(outputDirectories) {
|
|
1628839
|
-
await (0,
|
|
1628840
|
-
await (0,
|
|
1628513
|
+
await (0, import_promises87.mkdir)(import_path46.default.dirname(getPathToOutputDirectoriesFile()), { recursive: true });
|
|
1628514
|
+
await (0, import_promises87.writeFile)(getPathToOutputDirectoriesFile(), JSON.stringify(outputDirectories, null, 2));
|
|
1628841
1628515
|
}
|
|
1628842
1628516
|
|
|
1628843
1628517
|
// src/commands/generate/checkOutputDirectory.ts
|
|
@@ -1628859,7 +1628533,7 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
|
1628859
1628533
|
shouldProceed: true
|
|
1628860
1628534
|
};
|
|
1628861
1628535
|
}
|
|
1628862
|
-
const files = await (0,
|
|
1628536
|
+
const files = await (0, import_promises88.readdir)(outputPath);
|
|
1628863
1628537
|
if (files.length === 0) {
|
|
1628864
1628538
|
return {
|
|
1628865
1628539
|
shouldProceed: true
|
|
@@ -1629221,7 +1628895,7 @@ var AutoVersioningService = class {
|
|
|
1629221
1628895
|
};
|
|
1629222
1628896
|
|
|
1629223
1628897
|
// ../generation/local-generation/docker-utils/lib/runDocker.js
|
|
1629224
|
-
var
|
|
1628898
|
+
var import_promises89 = require("fs/promises");
|
|
1629225
1628899
|
var import_tmp_promise10 = __toESM(require_tmp_promise(), 1);
|
|
1629226
1628900
|
async function runContainer({ logger, imageName, args = [], binds = [], envVars = {}, ports = {}, writeLogsToFile = true, removeAfterCompletion = false, runner }) {
|
|
1629227
1628901
|
const tryRun = () => tryRunContainer({
|
|
@@ -1629270,7 +1628944,7 @@ async function tryRunContainer({ logger, imageName, args, binds, envVars = {}, p
|
|
|
1629270
1628944
|
const logs = stdout + stderr;
|
|
1629271
1628945
|
if (writeLogsToFile) {
|
|
1629272
1628946
|
const tmpFile = await import_tmp_promise10.default.file();
|
|
1629273
|
-
await (0,
|
|
1628947
|
+
await (0, import_promises89.writeFile)(tmpFile.path, logs);
|
|
1629274
1628948
|
logger.info(`Generator logs here: ${tmpFile.path}`);
|
|
1629275
1628949
|
}
|
|
1629276
1628950
|
if (exitCode == null) {
|
|
@@ -1629363,7 +1629037,7 @@ var ContainerExecutionEnvironment = class {
|
|
|
1629363
1629037
|
|
|
1629364
1629038
|
// ../generation/local-generation/local-workspace-runner/lib/runGenerator.js
|
|
1629365
1629039
|
var import_serialization = __toESM(require_serialization3(), 1);
|
|
1629366
|
-
var
|
|
1629040
|
+
var import_promises91 = require("fs/promises");
|
|
1629367
1629041
|
var path61 = __toESM(require("path"), 1);
|
|
1629368
1629042
|
var import_path49 = require("path");
|
|
1629369
1629043
|
var import_tmp_promise12 = __toESM(require_tmp_promise(), 1);
|
|
@@ -1643190,7 +1642864,7 @@ function configureBamlClient(config3) {
|
|
|
1643190
1642864
|
|
|
1643191
1642865
|
// ../generation/local-generation/local-workspace-runner/lib/LocalTaskHandler.js
|
|
1643192
1642866
|
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
1643193
|
-
var
|
|
1642867
|
+
var import_promises90 = require("fs/promises");
|
|
1643194
1642868
|
var import_os8 = require("os");
|
|
1643195
1642869
|
var import_path48 = require("path");
|
|
1643196
1642870
|
var import_semver10 = __toESM(require_semver2(), 1);
|
|
@@ -1643273,7 +1642947,7 @@ var LocalTaskHandler = class {
|
|
|
1643273
1642947
|
try {
|
|
1643274
1642948
|
this.context.logger.info("Analyzing SDK changes for automatic semantic versioning");
|
|
1643275
1642949
|
diffFile = await this.generateDiffFile();
|
|
1643276
|
-
const diffContent = await (0,
|
|
1642950
|
+
const diffContent = await (0, import_promises90.readFile)(diffFile, "utf-8");
|
|
1643277
1642951
|
if (diffContent.trim().length === 0) {
|
|
1643278
1642952
|
this.context.logger.info("No changes detected in generated SDK");
|
|
1643279
1642953
|
return null;
|
|
@@ -1643320,7 +1642994,7 @@ var LocalTaskHandler = class {
|
|
|
1643320
1642994
|
} finally {
|
|
1643321
1642995
|
if (diffFile) {
|
|
1643322
1642996
|
try {
|
|
1643323
|
-
await (0,
|
|
1642997
|
+
await (0, import_promises90.rm)(diffFile);
|
|
1643324
1642998
|
} catch (cleanupError) {
|
|
1643325
1642999
|
this.context.logger.warn(`Failed to delete temp diff file: ${diffFile}`, String(cleanupError));
|
|
1643326
1643000
|
}
|
|
@@ -1643399,7 +1643073,7 @@ var LocalTaskHandler = class {
|
|
|
1643399
1643073
|
const tmpOutputResolutionDir = AbsoluteFilePath2.of((await import_tmp_promise11.default.dir({})).path);
|
|
1643400
1643074
|
const absolutePathToFernignore = AbsoluteFilePath2.of(join2(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
|
|
1643401
1643075
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
1643402
|
-
await (0,
|
|
1643076
|
+
await (0, import_promises90.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
1643403
1643077
|
await this.runGitCommand(["init"], tmpOutputResolutionDir);
|
|
1643404
1643078
|
await this.runGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
1643405
1643079
|
const response = await this.runGitCommand(["config", "--list"], tmpOutputResolutionDir);
|
|
@@ -1643413,13 +1643087,13 @@ var LocalTaskHandler = class {
|
|
|
1643413
1643087
|
await this.runGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
1643414
1643088
|
await this.runGitCommand(["reset", "--", ...fernIgnorePaths], tmpOutputResolutionDir);
|
|
1643415
1643089
|
await this.runGitCommand(["restore", "."], tmpOutputResolutionDir);
|
|
1643416
|
-
await (0,
|
|
1643417
|
-
await (0,
|
|
1643418
|
-
await (0,
|
|
1643090
|
+
await (0, import_promises90.rm)(join2(tmpOutputResolutionDir, RelativeFilePath2.of(".git")), { recursive: true });
|
|
1643091
|
+
await (0, import_promises90.rm)(this.absolutePathToLocalOutput, { recursive: true });
|
|
1643092
|
+
await (0, import_promises90.cp)(tmpOutputResolutionDir, this.absolutePathToLocalOutput, { recursive: true });
|
|
1643419
1643093
|
}
|
|
1643420
1643094
|
async copyGeneratedFilesNoFernIgnorePreservingGit() {
|
|
1643421
|
-
const contents = await (0,
|
|
1643422
|
-
await Promise.all(contents.filter((item) => item !== ".git").map((item) => (0,
|
|
1643095
|
+
const contents = await (0, import_promises90.readdir)(this.absolutePathToLocalOutput);
|
|
1643096
|
+
await Promise.all(contents.filter((item) => item !== ".git").map((item) => (0, import_promises90.rm)(join2(this.absolutePathToLocalOutput, RelativeFilePath2.of(item)), {
|
|
1643423
1643097
|
force: true,
|
|
1643424
1643098
|
recursive: true
|
|
1643425
1643099
|
})));
|
|
@@ -1643427,11 +1643101,11 @@ var LocalTaskHandler = class {
|
|
|
1643427
1643101
|
}
|
|
1643428
1643102
|
async copyGeneratedFilesNoFernIgnoreDeleteAll() {
|
|
1643429
1643103
|
this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
|
|
1643430
|
-
await (0,
|
|
1643104
|
+
await (0, import_promises90.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
|
|
1643431
1643105
|
await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
|
|
1643432
1643106
|
}
|
|
1643433
1643107
|
async copyGeneratedFilesToDirectory(outputPath) {
|
|
1643434
|
-
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0,
|
|
1643108
|
+
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises90.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
1643435
1643109
|
if (firstLocalOutputItem == null) {
|
|
1643436
1643110
|
return;
|
|
1643437
1643111
|
}
|
|
@@ -1643439,15 +1643113,15 @@ var LocalTaskHandler = class {
|
|
|
1643439
1643113
|
if (firstLocalOutputItem.endsWith(".zip")) {
|
|
1643440
1643114
|
await (0, import_decompress2.default)(join2(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(firstLocalOutputItem)), outputPath);
|
|
1643441
1643115
|
for (const localOutputItem of remaininglocalOutputItems) {
|
|
1643442
|
-
await (0,
|
|
1643116
|
+
await (0, import_promises90.cp)(join2(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(localOutputItem)), join2(outputPath, RelativeFilePath2.of(localOutputItem)), { recursive: true });
|
|
1643443
1643117
|
}
|
|
1643444
1643118
|
} else {
|
|
1643445
|
-
await (0,
|
|
1643119
|
+
await (0, import_promises90.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true });
|
|
1643446
1643120
|
}
|
|
1643447
1643121
|
}
|
|
1643448
1643122
|
async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
|
|
1643449
1643123
|
this.context.logger.debug(`Copying generated snippets to ${absolutePathToLocalSnippetJSON}`);
|
|
1643450
|
-
await (0,
|
|
1643124
|
+
await (0, import_promises90.cp)(absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON);
|
|
1643451
1643125
|
}
|
|
1643452
1643126
|
async runGitCommand(options2, cwd2) {
|
|
1643453
1643127
|
const response = await loggingExeca(this.context.logger, "git", options2, {
|
|
@@ -1643502,24 +1643176,24 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
1643502
1643176
|
context2.logger.debug("Wrote IR to: " + absolutePathToIr);
|
|
1643503
1643177
|
const configJsonFile = (0, import_path49.join)(workspaceTempDir.path, GENERATOR_CONFIG_FILENAME);
|
|
1643504
1643178
|
const absolutePathToWriteConfigJson = AbsoluteFilePath2.of(configJsonFile);
|
|
1643505
|
-
await (0,
|
|
1643179
|
+
await (0, import_promises91.writeFile)(configJsonFile, "");
|
|
1643506
1643180
|
context2.logger.debug("Will write config.json to: " + absolutePathToWriteConfigJson);
|
|
1643507
1643181
|
const tmpOutputDirectory = (0, import_path49.join)(workspaceTempDir.path, CODEGEN_OUTPUT_DIRECTORY_NAME);
|
|
1643508
1643182
|
const absolutePathToTmpOutputDirectory = AbsoluteFilePath2.of(tmpOutputDirectory);
|
|
1643509
|
-
await (0,
|
|
1643183
|
+
await (0, import_promises91.mkdir)(tmpOutputDirectory, { recursive: true });
|
|
1643510
1643184
|
context2.logger.debug("Will write output to: " + absolutePathToTmpOutputDirectory);
|
|
1643511
1643185
|
let absolutePathToTmpSnippetJSON = void 0;
|
|
1643512
1643186
|
if (absolutePathToLocalSnippetJSON != null) {
|
|
1643513
1643187
|
const snippetJsonFile = (0, import_path49.join)(workspaceTempDir.path, "snippet.json");
|
|
1643514
1643188
|
absolutePathToTmpSnippetJSON = AbsoluteFilePath2.of(snippetJsonFile);
|
|
1643515
|
-
await (0,
|
|
1643189
|
+
await (0, import_promises91.writeFile)(snippetJsonFile, "");
|
|
1643516
1643190
|
context2.logger.debug("Will write snippet.json to: " + absolutePathToTmpSnippetJSON);
|
|
1643517
1643191
|
}
|
|
1643518
1643192
|
let absolutePathToTmpSnippetTemplatesJSON = void 0;
|
|
1643519
1643193
|
if (absolutePathToLocalSnippetTemplateJSON != null) {
|
|
1643520
1643194
|
const snippetTemplatesJsonFile = (0, import_path49.join)(workspaceTempDir.path, SNIPPET_TEMPLATES_JSON_FILENAME);
|
|
1643521
1643195
|
absolutePathToTmpSnippetTemplatesJSON = AbsoluteFilePath2.of(snippetTemplatesJsonFile);
|
|
1643522
|
-
await (0,
|
|
1643196
|
+
await (0, import_promises91.writeFile)(snippetTemplatesJsonFile, "");
|
|
1643523
1643197
|
context2.logger.debug("Will write snippet-templates.json to: " + absolutePathToTmpSnippetTemplatesJSON);
|
|
1643524
1643198
|
}
|
|
1643525
1643199
|
const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
|
|
@@ -1643555,7 +1643229,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
1643555
1643229
|
whiteLabel,
|
|
1643556
1643230
|
paths
|
|
1643557
1643231
|
});
|
|
1643558
|
-
await (0,
|
|
1643232
|
+
await (0, import_promises91.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(await import_serialization.GeneratorConfig.jsonOrThrow(config3), void 0, 4));
|
|
1643559
1643233
|
const absolutePathToLicenseFile = extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig);
|
|
1643560
1643234
|
await environment2.execute({
|
|
1643561
1643235
|
generatorName: generatorInvocation.name,
|
|
@@ -1643797,8 +1643471,8 @@ var import_fiddle_sdk5 = __toESM(require_fiddle_sdk(), 1);
|
|
|
1643797
1643471
|
|
|
1643798
1643472
|
// ../generation/remote-generation/remote-workspace-runner/lib/downloadSnippetsForTask.js
|
|
1643799
1643473
|
var import_fs21 = require("fs");
|
|
1643800
|
-
var
|
|
1643801
|
-
var
|
|
1643474
|
+
var import_promises92 = require("fs/promises");
|
|
1643475
|
+
var import_promises93 = require("stream/promises");
|
|
1643802
1643476
|
async function downloadSnippetsForTask({ snippetsS3PreSignedReadUrl, absolutePathToLocalSnippetJSON, context: context2 }) {
|
|
1643803
1643477
|
try {
|
|
1643804
1643478
|
await downloadFileForTask({
|
|
@@ -1643815,22 +1643489,22 @@ async function downloadFileForTask({ s3PreSignedReadUrl, absolutePathToLocalOutp
|
|
|
1643815
1643489
|
responseType: "stream"
|
|
1643816
1643490
|
});
|
|
1643817
1643491
|
if (await doesPathExist(absolutePathToLocalOutput)) {
|
|
1643818
|
-
await (0,
|
|
1643492
|
+
await (0, import_promises92.rm)(absolutePathToLocalOutput, { recursive: true });
|
|
1643819
1643493
|
}
|
|
1643820
|
-
await (0,
|
|
1643821
|
-
await (0,
|
|
1643494
|
+
await (0, import_promises92.mkdir)(dirname4(absolutePathToLocalOutput), { recursive: true });
|
|
1643495
|
+
await (0, import_promises93.pipeline)(request6.data, (0, import_fs21.createWriteStream)(absolutePathToLocalOutput));
|
|
1643822
1643496
|
}
|
|
1643823
1643497
|
|
|
1643824
1643498
|
// ../generation/remote-generation/remote-workspace-runner/lib/createAndStartJob.js
|
|
1643825
1643499
|
var import_fiddle_sdk4 = __toESM(require_fiddle_sdk(), 1);
|
|
1643826
1643500
|
var import_form_data4 = __toESM(require_form_data(), 1);
|
|
1643827
|
-
var
|
|
1643501
|
+
var import_promises94 = require("fs/promises");
|
|
1643828
1643502
|
var import_url_join23 = __toESM(require_url_join(), 1);
|
|
1643829
1643503
|
async function createAndStartJob({ projectConfig, workspace, organization, intermediateRepresentation, generatorInvocation, version: version7, context: context2, shouldLogS3Url, token, whitelabel, irVersionOverride, absolutePathToPreview, fernignorePath }) {
|
|
1643830
1643504
|
let fernignoreContents;
|
|
1643831
1643505
|
if (fernignorePath != null) {
|
|
1643832
1643506
|
try {
|
|
1643833
|
-
fernignoreContents = await (0,
|
|
1643507
|
+
fernignoreContents = await (0, import_promises94.readFile)(fernignorePath, "utf-8");
|
|
1643834
1643508
|
} catch (error49) {
|
|
1643835
1643509
|
context2.failAndThrow(`Failed to read fernignore file at ${fernignorePath}: ${error49}`);
|
|
1643836
1643510
|
}
|
|
@@ -1644024,9 +1643698,9 @@ function pollJobAndReportStatus({ job, taskId, taskHandler, context: context2 })
|
|
|
1644024
1643698
|
// ../generation/remote-generation/remote-workspace-runner/lib/RemoteTaskHandler.js
|
|
1644025
1643699
|
var import_decompress3 = __toESM(require_decompress(), 1);
|
|
1644026
1643700
|
var import_fs22 = require("fs");
|
|
1644027
|
-
var
|
|
1643701
|
+
var import_promises95 = require("fs/promises");
|
|
1644028
1643702
|
var import_path50 = __toESM(require("path"), 1);
|
|
1644029
|
-
var
|
|
1643703
|
+
var import_promises96 = require("stream/promises");
|
|
1644030
1643704
|
|
|
1644031
1643705
|
// ../../../node_modules/.pnpm/terminal-link@3.0.0/node_modules/terminal-link/index.js
|
|
1644032
1643706
|
var import_supports_hyperlinks = __toESM(require_supports_hyperlinks(), 1);
|
|
@@ -1644194,9 +1643868,9 @@ async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutpu
|
|
|
1644194
1643868
|
});
|
|
1644195
1643869
|
const tmpDir = await import_tmp_promise13.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
1644196
1643870
|
const outputZipPath = import_path50.default.join(tmpDir.path, "output.zip");
|
|
1644197
|
-
await (0,
|
|
1643871
|
+
await (0, import_promises96.pipeline)(request6.data, (0, import_fs22.createWriteStream)(outputZipPath));
|
|
1644198
1643872
|
await forceRemoveDirectory(absolutePathToLocalOutput);
|
|
1644199
|
-
await (0,
|
|
1643873
|
+
await (0, import_promises95.mkdir)(absolutePathToLocalOutput, { recursive: true });
|
|
1644200
1643874
|
await (0, import_decompress3.default)(outputZipPath, absolutePathToLocalOutput);
|
|
1644201
1643875
|
}
|
|
1644202
1643876
|
async function forceRemoveDirectory(dirPath) {
|
|
@@ -1644204,22 +1643878,22 @@ async function forceRemoveDirectory(dirPath) {
|
|
|
1644204
1643878
|
return;
|
|
1644205
1643879
|
}
|
|
1644206
1643880
|
await makeWritableRecursive(dirPath);
|
|
1644207
|
-
await (0,
|
|
1643881
|
+
await (0, import_promises95.rm)(dirPath, { recursive: true, force: true });
|
|
1644208
1643882
|
}
|
|
1644209
1643883
|
async function makeWritableRecursive(dirPath) {
|
|
1644210
1643884
|
try {
|
|
1644211
|
-
const entries10 = await (0,
|
|
1643885
|
+
const entries10 = await (0, import_promises95.readdir)(dirPath, { withFileTypes: true });
|
|
1644212
1643886
|
for (const entry of entries10) {
|
|
1644213
1643887
|
const fullPath = AbsoluteFilePath2.of(import_path50.default.join(dirPath, entry.name));
|
|
1644214
1643888
|
if (entry.isDirectory()) {
|
|
1644215
1643889
|
await makeWritableRecursive(fullPath);
|
|
1644216
1643890
|
}
|
|
1644217
1643891
|
try {
|
|
1644218
|
-
await (0,
|
|
1643892
|
+
await (0, import_promises95.chmod)(fullPath, 493);
|
|
1644219
1643893
|
} catch {
|
|
1644220
1643894
|
}
|
|
1644221
1643895
|
}
|
|
1644222
|
-
await (0,
|
|
1643896
|
+
await (0, import_promises95.chmod)(dirPath, 493);
|
|
1644223
1643897
|
} catch {
|
|
1644224
1643898
|
}
|
|
1644225
1643899
|
}
|
|
@@ -1644270,7 +1643944,7 @@ async function downloadFilesWithFernIgnoreInTempRepo({ s3PreSignedReadUrl, absol
|
|
|
1644270
1643944
|
const tmpOutputResolutionDir = AbsoluteFilePath2.of((await import_tmp_promise13.default.dir({})).path);
|
|
1644271
1643945
|
const absolutePathToFernignore = join2(absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME));
|
|
1644272
1643946
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
1644273
|
-
await (0,
|
|
1643947
|
+
await (0, import_promises95.cp)(absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
1644274
1643948
|
await runGitCommand(["init"], tmpOutputResolutionDir, context2);
|
|
1644275
1643949
|
await runGitCommand(["add", "."], tmpOutputResolutionDir, context2);
|
|
1644276
1643950
|
const gitConfigResponse = await runGitCommand(["config", "--list"], tmpOutputResolutionDir, context2);
|
|
@@ -1644286,7 +1643960,7 @@ async function downloadFilesWithFernIgnoreInTempRepo({ s3PreSignedReadUrl, absol
|
|
|
1644286
1643960
|
await runGitCommand(["restore", "."], tmpOutputResolutionDir, context2);
|
|
1644287
1643961
|
await forceRemoveDirectory(join2(tmpOutputResolutionDir, RelativeFilePath2.of(".git")));
|
|
1644288
1643962
|
await forceRemoveDirectory(absolutePathToLocalOutput);
|
|
1644289
|
-
await (0,
|
|
1643963
|
+
await (0, import_promises95.cp)(tmpOutputResolutionDir, absolutePathToLocalOutput, { recursive: true });
|
|
1644290
1643964
|
}
|
|
1644291
1643965
|
async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath }) {
|
|
1644292
1643966
|
const request6 = await axios_default.get(s3PreSignedReadUrl, {
|
|
@@ -1644294,12 +1643968,12 @@ async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath
|
|
|
1644294
1643968
|
});
|
|
1644295
1643969
|
const tmpDir = await import_tmp_promise13.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
1644296
1643970
|
const outputZipPath = import_path50.default.join(tmpDir.path, "output.zip");
|
|
1644297
|
-
await (0,
|
|
1643971
|
+
await (0, import_promises96.pipeline)(request6.data, (0, import_fs22.createWriteStream)(outputZipPath));
|
|
1644298
1643972
|
await (0, import_decompress3.default)(outputZipPath, outputPath);
|
|
1644299
1643973
|
}
|
|
1644300
1643974
|
|
|
1644301
1643975
|
// ../generation/remote-generation/remote-workspace-runner/lib/SourceUploader.js
|
|
1644302
|
-
var
|
|
1643976
|
+
var import_promises97 = require("fs/promises");
|
|
1644303
1643977
|
var import_tmp_promise14 = __toESM(require_tmp_promise(), 1);
|
|
1644304
1643978
|
var PROTOBUF_ZIP_FILENAME = "proto.zip";
|
|
1644305
1643979
|
var SourceUploader = class {
|
|
@@ -1644320,7 +1643994,7 @@ var SourceUploader = class {
|
|
|
1644320
1643994
|
}
|
|
1644321
1643995
|
async uploadSource(source2, uploadURL) {
|
|
1644322
1643996
|
const uploadCommand = await this.getUploadCommand(source2);
|
|
1644323
|
-
const fileData = await (0,
|
|
1643997
|
+
const fileData = await (0, import_promises97.readFile)(uploadCommand.absoluteFilePath);
|
|
1644324
1643998
|
const response = await fetch(uploadURL, {
|
|
1644325
1643999
|
method: "PUT",
|
|
1644326
1644000
|
body: fileData,
|
|
@@ -1644340,7 +1644014,7 @@ var SourceUploader = class {
|
|
|
1644340
1644014
|
absoluteFilePath,
|
|
1644341
1644015
|
cleanup: async () => {
|
|
1644342
1644016
|
this.context.logger.debug(`Removing ${absoluteFilePath}`);
|
|
1644343
|
-
await (0,
|
|
1644017
|
+
await (0, import_promises97.unlink)(absoluteFilePath);
|
|
1644344
1644018
|
}
|
|
1644345
1644019
|
};
|
|
1644346
1644020
|
}
|
|
@@ -1644782,7 +1644456,7 @@ async function runRemoteGenerationForAPIWorkspace({ projectConfig, organization,
|
|
|
1644782
1644456
|
|
|
1644783
1644457
|
// ../generation/remote-generation/remote-workspace-runner/lib/publishDocs.js
|
|
1644784
1644458
|
var import_crypto9 = require("crypto");
|
|
1644785
|
-
var
|
|
1644459
|
+
var import_promises98 = require("fs/promises");
|
|
1644786
1644460
|
var mime = __toESM(require_mime_types(), 1);
|
|
1644787
1644461
|
|
|
1644788
1644462
|
// ../generation/remote-generation/remote-workspace-runner/lib/measureImageSizes.js
|
|
@@ -1644839,7 +1644513,7 @@ var MEASURE_IMAGE_BATCH_SIZE = 10;
|
|
|
1644839
1644513
|
var UPLOAD_FILE_BATCH_SIZE = 10;
|
|
1644840
1644514
|
var HASH_CONCURRENCY = parseInt(process.env.FERN_DOCS_ASSET_HASH_CONCURRENCY ?? "32", 10);
|
|
1644841
1644515
|
async function calculateFileHash(absoluteFilePath) {
|
|
1644842
|
-
const fileBuffer = await (0,
|
|
1644516
|
+
const fileBuffer = await (0, import_promises98.readFile)(absoluteFilePath);
|
|
1644843
1644517
|
return (0, import_crypto9.createHash)("sha256").update(new Uint8Array(fileBuffer)).digest("hex");
|
|
1644844
1644518
|
}
|
|
1644845
1644519
|
async function publishDocs({ token, organization, docsWorkspace, domain: domain3, customDomains, apiWorkspaces, ossWorkspaces, context: context2, preview, editThisPage, isPrivate = false, disableTemplates = false, skipUpload = false, withAiExamples = true, excludeApis = false, targetAudiences }) {
|
|
@@ -1645158,7 +1644832,7 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context2, batchSize
|
|
|
1645158
1644832
|
const absoluteFilePath = resolve5(docsWorkspacePath, relativeFilePath);
|
|
1645159
1644833
|
try {
|
|
1645160
1644834
|
const mimeType = mime.lookup(absoluteFilePath);
|
|
1645161
|
-
await axios_default.put(uploadUrl, await (0,
|
|
1644835
|
+
await axios_default.put(uploadUrl, await (0, import_promises98.readFile)(absoluteFilePath), {
|
|
1645162
1644836
|
headers: {
|
|
1645163
1644837
|
"Content-Type": mimeType === false ? "application/octet-stream" : mimeType,
|
|
1645164
1644838
|
// Set max cache control for S3 uploads
|
|
@@ -1655150,14 +1654824,14 @@ async function validateGeneratorsYmlFile({ contents, allRuleVisitors, cliVersion
|
|
|
1655150
1654824
|
}
|
|
1655151
1654825
|
|
|
1655152
1654826
|
// ../workspace/oss-validator/lib/rules/no-duplicate-overrides/no-duplicate-overrides.js
|
|
1655153
|
-
var
|
|
1654827
|
+
var import_promises99 = require("fs/promises");
|
|
1655154
1654828
|
var NoDuplicateOverridesRule = {
|
|
1655155
1654829
|
name: "no-duplicate-overrides",
|
|
1655156
1654830
|
run: async ({ workspace, specs, context: context2 }) => {
|
|
1655157
1654831
|
const violations = [];
|
|
1655158
1654832
|
const seenMethodsByAudience = /* @__PURE__ */ new Map();
|
|
1655159
1654833
|
for (const spec of specs) {
|
|
1655160
|
-
const contents = (await (0,
|
|
1654834
|
+
const contents = (await (0, import_promises99.readFile)(spec.absoluteFilepath)).toString();
|
|
1655161
1654835
|
if (contents.includes("openapi") || contents.includes("swagger")) {
|
|
1655162
1654836
|
const openAPI = await loadOpenAPI({
|
|
1655163
1654837
|
absolutePathToOpenAPI: spec.absoluteFilepath,
|
|
@@ -1655983,7 +1655657,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
1655983
1655657
|
}
|
|
1655984
1655658
|
|
|
1655985
1655659
|
// src/commands/generate-overrides/compareOpenAPISpecs.ts
|
|
1655986
|
-
var
|
|
1655660
|
+
var import_promises100 = require("fs/promises");
|
|
1655987
1655661
|
async function compareOpenAPISpecs({
|
|
1655988
1655662
|
originalPath,
|
|
1655989
1655663
|
modifiedPath,
|
|
@@ -1656020,12 +1655694,12 @@ async function compareOpenAPISpecs({
|
|
|
1656020
1655694
|
}
|
|
1656021
1655695
|
outputPath = join2(dirname4(originalPath), RelativeFilePath2.of(overridesFilename));
|
|
1656022
1655696
|
}
|
|
1656023
|
-
await (0,
|
|
1655697
|
+
await (0, import_promises100.writeFile)(outputPath, jsYaml.dump(overrides, { lineWidth: -1, noRefs: true }));
|
|
1656024
1655698
|
context2.logger.info(`Overrides written to ${outputPath}`);
|
|
1656025
1655699
|
});
|
|
1656026
1655700
|
}
|
|
1656027
1655701
|
async function loadSpec(filepath, context2) {
|
|
1656028
|
-
const contents = await (0,
|
|
1655702
|
+
const contents = await (0, import_promises100.readFile)(filepath, "utf8");
|
|
1656029
1655703
|
try {
|
|
1656030
1655704
|
return JSON.parse(contents);
|
|
1656031
1655705
|
} catch {
|
|
@@ -1656126,7 +1655800,7 @@ function deepEqual(a10, b18) {
|
|
|
1656126
1655800
|
}
|
|
1656127
1655801
|
|
|
1656128
1655802
|
// src/commands/generate-overrides/writeOverridesForWorkspaces.ts
|
|
1656129
|
-
var
|
|
1655803
|
+
var import_promises101 = require("fs/promises");
|
|
1656130
1655804
|
async function writeOverridesForWorkspaces({
|
|
1656131
1655805
|
project,
|
|
1656132
1655806
|
includeModels,
|
|
@@ -1656151,7 +1655825,7 @@ async function writeOverridesForWorkspaces({
|
|
|
1656151
1655825
|
async function readExistingOverrides(overridesFilepath, context2) {
|
|
1656152
1655826
|
let parsedOverrides = null;
|
|
1656153
1655827
|
try {
|
|
1656154
|
-
const contents = (await (0,
|
|
1655828
|
+
const contents = (await (0, import_promises101.readFile)(overridesFilepath, "utf8")).toString();
|
|
1656155
1655829
|
try {
|
|
1656156
1655830
|
parsedOverrides = JSON.parse(contents);
|
|
1656157
1655831
|
} catch (err) {
|
|
@@ -1656215,7 +1655889,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
1656215
1655889
|
overridesFilename = `${nameWithoutExt}-overrides${extension2}`;
|
|
1656216
1655890
|
}
|
|
1656217
1655891
|
}
|
|
1656218
|
-
await (0,
|
|
1655892
|
+
await (0, import_promises101.writeFile)(
|
|
1656219
1655893
|
join2(dirname4(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
|
|
1656220
1655894
|
jsYaml.dump({ paths, components })
|
|
1656221
1655895
|
);
|
|
@@ -1656580,7 +1656254,7 @@ function convertIRtoJsonSchema(args) {
|
|
|
1656580
1656254
|
}
|
|
1656581
1656255
|
|
|
1656582
1656256
|
// src/commands/jsonschema/generateJsonschemaForWorkspace.ts
|
|
1656583
|
-
var
|
|
1656257
|
+
var import_promises102 = require("fs/promises");
|
|
1656584
1656258
|
async function generateJsonschemaForWorkspaces({
|
|
1656585
1656259
|
typeLocator,
|
|
1656586
1656260
|
project,
|
|
@@ -1656628,9 +1656302,9 @@ async function generateJsonschemaForWorkspaces({
|
|
|
1656628
1656302
|
context: context2
|
|
1656629
1656303
|
});
|
|
1656630
1656304
|
if (!await doesPathExist(dirname4(jsonschemaFilepath))) {
|
|
1656631
|
-
await (0,
|
|
1656305
|
+
await (0, import_promises102.mkdir)(dirname4(jsonschemaFilepath), { recursive: true });
|
|
1656632
1656306
|
}
|
|
1656633
|
-
await (0,
|
|
1656307
|
+
await (0, import_promises102.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
|
|
1656634
1656308
|
context2.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
|
|
1656635
1656309
|
});
|
|
1656636
1656310
|
})
|
|
@@ -1656987,7 +1656661,7 @@ async function mockServer({
|
|
|
1656987
1656661
|
|
|
1656988
1656662
|
// src/commands/register/registerWorkspacesV1.ts
|
|
1656989
1656663
|
var import_fiddle_sdk7 = __toESM(require_fiddle_sdk(), 1);
|
|
1656990
|
-
var
|
|
1656664
|
+
var import_promises103 = require("fs/promises");
|
|
1656991
1656665
|
var import_path59 = __toESM(require("path"), 1);
|
|
1656992
1656666
|
var import_tmp_promise16 = __toESM(require_tmp_promise(), 1);
|
|
1656993
1656667
|
async function registerWorkspacesV1({
|
|
@@ -1657036,7 +1656710,7 @@ async function registerWorkspacesV1({
|
|
|
1657036
1656710
|
context2.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
1657037
1656711
|
await create6({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
|
|
1657038
1656712
|
context2.logger.info("Uploading definition...");
|
|
1657039
|
-
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
1656713
|
+
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises103.readFile)(tarPath));
|
|
1657040
1656714
|
context2.logger.info(
|
|
1657041
1656715
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
1657042
1656716
|
);
|
|
@@ -1657174,7 +1656848,7 @@ async function generateDiff({
|
|
|
1657174
1656848
|
}
|
|
1657175
1656849
|
|
|
1657176
1656850
|
// src/commands/self-update/selfUpdate.ts
|
|
1657177
|
-
var
|
|
1656851
|
+
var import_promises104 = require("fs/promises");
|
|
1657178
1656852
|
var import_path60 = require("path");
|
|
1657179
1656853
|
async function getPackageManagerBinDir(logger, pm) {
|
|
1657180
1656854
|
let command3;
|
|
@@ -1657220,7 +1656894,7 @@ async function detectInstallationMethod(logger) {
|
|
|
1657220
1656894
|
logger.debug(`Found fern at: ${fernPath}`);
|
|
1657221
1656895
|
let resolvedPath;
|
|
1657222
1656896
|
try {
|
|
1657223
|
-
resolvedPath = await (0,
|
|
1656897
|
+
resolvedPath = await (0, import_promises104.realpath)(fernPath);
|
|
1657224
1656898
|
logger.debug(`Resolved to: ${resolvedPath}`);
|
|
1657225
1656899
|
} catch (error49) {
|
|
1657226
1656900
|
logger.debug(`Failed to resolve symlink: ${error49}`);
|
|
@@ -1657501,20 +1657175,20 @@ async function generateToken({
|
|
|
1657501
1657175
|
|
|
1657502
1657176
|
// src/commands/upgrade/updateApiSpec.ts
|
|
1657503
1657177
|
var fs31 = __toESM(require("fs"), 1);
|
|
1657504
|
-
var
|
|
1657178
|
+
var import_promises105 = require("fs/promises");
|
|
1657505
1657179
|
var import_stream9 = require("stream");
|
|
1657506
|
-
var
|
|
1657180
|
+
var import_promises106 = require("stream/promises");
|
|
1657507
1657181
|
async function fetchAndWriteFile(url3, path76, logger, indent3) {
|
|
1657508
1657182
|
const resp = await fetch(url3);
|
|
1657509
1657183
|
if (resp.ok && resp.body) {
|
|
1657510
1657184
|
logger.debug("Origin successfully fetched, writing to file");
|
|
1657511
1657185
|
const fileStream = fs31.createWriteStream(path76);
|
|
1657512
|
-
await (0,
|
|
1657513
|
-
const fileContents = await (0,
|
|
1657186
|
+
await (0, import_promises106.finished)(import_stream9.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
1657187
|
+
const fileContents = await (0, import_promises105.readFile)(path76, "utf8");
|
|
1657514
1657188
|
try {
|
|
1657515
|
-
await (0,
|
|
1657189
|
+
await (0, import_promises105.writeFile)(path76, JSON.stringify(JSON.parse(fileContents), void 0, indent3), "utf8");
|
|
1657516
1657190
|
} catch (e6) {
|
|
1657517
|
-
await (0,
|
|
1657191
|
+
await (0, import_promises105.writeFile)(path76, jsYaml.dump(jsYaml.load(fileContents), { indent: indent3 }), "utf8");
|
|
1657518
1657192
|
}
|
|
1657519
1657193
|
logger.debug("File written successfully");
|
|
1657520
1657194
|
}
|
|
@@ -1657610,7 +1657284,7 @@ async function processDefinitions({
|
|
|
1657610
1657284
|
}
|
|
1657611
1657285
|
|
|
1657612
1657286
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
1657613
|
-
var
|
|
1657287
|
+
var import_promises107 = require("fs/promises");
|
|
1657614
1657288
|
|
|
1657615
1657289
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
1657616
1657290
|
var FERN_DIRECTORY2 = "fern";
|
|
@@ -1657644,7 +1657318,7 @@ var migration = {
|
|
|
1657644
1657318
|
try {
|
|
1657645
1657319
|
const fileContents = await getFileContents(yamlFilepath);
|
|
1657646
1657320
|
const newContents = addDiscriminantToFile(fileContents);
|
|
1657647
|
-
await (0,
|
|
1657321
|
+
await (0, import_promises107.writeFile)(yamlFilepath, newContents);
|
|
1657648
1657322
|
} catch (error49) {
|
|
1657649
1657323
|
context2.failAndThrow("Failed to migrate " + yamlFilepath, error49);
|
|
1657650
1657324
|
}
|
|
@@ -1657652,7 +1657326,7 @@ var migration = {
|
|
|
1657652
1657326
|
}
|
|
1657653
1657327
|
};
|
|
1657654
1657328
|
async function getFileContents(filepath) {
|
|
1657655
|
-
const buffer = await (0,
|
|
1657329
|
+
const buffer = await (0, import_promises107.readFile)(filepath);
|
|
1657656
1657330
|
return buffer.toString();
|
|
1657657
1657331
|
}
|
|
1657658
1657332
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -1657681,8 +1657355,8 @@ var versionMigrations = {
|
|
|
1657681
1657355
|
var __default = versionMigrations;
|
|
1657682
1657356
|
|
|
1657683
1657357
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
1657684
|
-
var
|
|
1657685
|
-
var
|
|
1657358
|
+
var import_promises108 = require("fs/promises");
|
|
1657359
|
+
var import_yaml5 = __toESM(require_dist(), 1);
|
|
1657686
1657360
|
|
|
1657687
1657361
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
1657688
1657362
|
var FERN_DIRECTORY3 = "fern";
|
|
@@ -1657722,39 +1657396,39 @@ var migration2 = {
|
|
|
1657722
1657396
|
}
|
|
1657723
1657397
|
};
|
|
1657724
1657398
|
async function migrateFile(filepath, context2) {
|
|
1657725
|
-
const contents = await (0,
|
|
1657726
|
-
const parsedDocument =
|
|
1657399
|
+
const contents = await (0, import_promises108.readFile)(filepath);
|
|
1657400
|
+
const parsedDocument = import_yaml5.default.parseDocument(contents.toString());
|
|
1657727
1657401
|
const types4 = parsedDocument.get("types");
|
|
1657728
1657402
|
if (types4 == null) {
|
|
1657729
1657403
|
return;
|
|
1657730
1657404
|
}
|
|
1657731
|
-
if (!
|
|
1657405
|
+
if (!import_yaml5.default.isMap(types4)) {
|
|
1657732
1657406
|
context2.failWithoutThrowing(`"types" is not a map in ${filepath}`);
|
|
1657733
1657407
|
return;
|
|
1657734
1657408
|
}
|
|
1657735
1657409
|
for (const typeDeclaration of types4.items) {
|
|
1657736
|
-
if (
|
|
1657410
|
+
if (import_yaml5.default.isMap(typeDeclaration.value)) {
|
|
1657737
1657411
|
const union9 = typeDeclaration.value.get("union");
|
|
1657738
1657412
|
if (union9 == null) {
|
|
1657739
1657413
|
continue;
|
|
1657740
1657414
|
}
|
|
1657741
|
-
if (!
|
|
1657415
|
+
if (!import_yaml5.default.isMap(union9)) {
|
|
1657742
1657416
|
context2.failWithoutThrowing(`"union" is not a map in ${filepath}`);
|
|
1657743
1657417
|
continue;
|
|
1657744
1657418
|
}
|
|
1657745
1657419
|
for (const singleUnionType of union9.items) {
|
|
1657746
|
-
if (
|
|
1657420
|
+
if (import_yaml5.default.isScalar(singleUnionType.value)) {
|
|
1657747
1657421
|
singleUnionType.value = {
|
|
1657748
1657422
|
type: singleUnionType.value,
|
|
1657749
1657423
|
key: singleUnionType.key
|
|
1657750
1657424
|
};
|
|
1657751
|
-
} else if (
|
|
1657752
|
-
singleUnionType.value.add(new
|
|
1657425
|
+
} else if (import_yaml5.default.isMap(singleUnionType.value)) {
|
|
1657426
|
+
singleUnionType.value.add(new import_yaml5.default.Pair("key", singleUnionType.key));
|
|
1657753
1657427
|
}
|
|
1657754
1657428
|
}
|
|
1657755
1657429
|
}
|
|
1657756
1657430
|
}
|
|
1657757
|
-
await (0,
|
|
1657431
|
+
await (0, import_promises108.writeFile)(filepath, parsedDocument.toString());
|
|
1657758
1657432
|
}
|
|
1657759
1657433
|
|
|
1657760
1657434
|
// ../cli-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -1657765,8 +1657439,8 @@ var versionMigrations2 = {
|
|
|
1657765
1657439
|
var __default2 = versionMigrations2;
|
|
1657766
1657440
|
|
|
1657767
1657441
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
1657768
|
-
var
|
|
1657769
|
-
var
|
|
1657442
|
+
var import_promises109 = require("fs/promises");
|
|
1657443
|
+
var import_yaml6 = __toESM(require_dist(), 1);
|
|
1657770
1657444
|
|
|
1657771
1657445
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
1657772
1657446
|
var FERN_DIRECTORY4 = "fern";
|
|
@@ -1657806,18 +1657480,18 @@ var migration3 = {
|
|
|
1657806
1657480
|
}
|
|
1657807
1657481
|
};
|
|
1657808
1657482
|
async function migrateGeneratorsYml(filepath, context2) {
|
|
1657809
|
-
const contents = await (0,
|
|
1657810
|
-
const parsedDocument =
|
|
1657483
|
+
const contents = await (0, import_promises109.readFile)(filepath);
|
|
1657484
|
+
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
1657811
1657485
|
const draftGenerators = parsedDocument.get("draft");
|
|
1657812
1657486
|
if (draftGenerators == null) {
|
|
1657813
1657487
|
return;
|
|
1657814
1657488
|
}
|
|
1657815
|
-
if (!
|
|
1657489
|
+
if (!import_yaml6.default.isSeq(draftGenerators)) {
|
|
1657816
1657490
|
context2.failWithoutThrowing(`draft generators are not a list in ${filepath}`);
|
|
1657817
1657491
|
return;
|
|
1657818
1657492
|
}
|
|
1657819
1657493
|
draftGenerators.items.forEach((draftGenerator) => {
|
|
1657820
|
-
if (!
|
|
1657494
|
+
if (!import_yaml6.default.isMap(draftGenerator)) {
|
|
1657821
1657495
|
context2.failWithoutThrowing(`draft generator is not an object in ${filepath}`);
|
|
1657822
1657496
|
return;
|
|
1657823
1657497
|
}
|
|
@@ -1657833,7 +1657507,7 @@ async function migrateGeneratorsYml(filepath, context2) {
|
|
|
1657833
1657507
|
draftGenerator.set("output-path", name3.value.includes("openapi") ? "./generated-openapi" : name3.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
1657834
1657508
|
}
|
|
1657835
1657509
|
});
|
|
1657836
|
-
await (0,
|
|
1657510
|
+
await (0, import_promises109.writeFile)(filepath, parsedDocument.toString());
|
|
1657837
1657511
|
}
|
|
1657838
1657512
|
|
|
1657839
1657513
|
// ../cli-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -1657844,8 +1657518,8 @@ var versionMigrations3 = {
|
|
|
1657844
1657518
|
var __default3 = versionMigrations3;
|
|
1657845
1657519
|
|
|
1657846
1657520
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
1657847
|
-
var
|
|
1657848
|
-
var
|
|
1657521
|
+
var import_promises110 = require("fs/promises");
|
|
1657522
|
+
var import_yaml7 = __toESM(require_dist(), 1);
|
|
1657849
1657523
|
|
|
1657850
1657524
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
1657851
1657525
|
var FERN_DIRECTORY5 = "fern";
|
|
@@ -1657885,15 +1657559,15 @@ var migration4 = {
|
|
|
1657885
1657559
|
}
|
|
1657886
1657560
|
};
|
|
1657887
1657561
|
async function migrateFile2(filepath, context2) {
|
|
1657888
|
-
const contents = await (0,
|
|
1657889
|
-
const parsedDocument =
|
|
1657562
|
+
const contents = await (0, import_promises110.readFile)(filepath);
|
|
1657563
|
+
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
1657890
1657564
|
const addType = (typeName, typeDeclaration) => {
|
|
1657891
1657565
|
const types4 = parsedDocument.get("types");
|
|
1657892
1657566
|
if (types4 == null) {
|
|
1657893
1657567
|
parsedDocument.set("types", {
|
|
1657894
1657568
|
[typeName]: typeDeclaration
|
|
1657895
1657569
|
});
|
|
1657896
|
-
} else if (!
|
|
1657570
|
+
} else if (!import_yaml7.default.isMap(types4)) {
|
|
1657897
1657571
|
context2.failWithoutThrowing(`"types" is not a map in ${filepath}`);
|
|
1657898
1657572
|
} else {
|
|
1657899
1657573
|
types4.set(typeName, typeDeclaration);
|
|
@@ -1657903,12 +1657577,12 @@ async function migrateFile2(filepath, context2) {
|
|
|
1657903
1657577
|
if (errors4 == null) {
|
|
1657904
1657578
|
return;
|
|
1657905
1657579
|
}
|
|
1657906
|
-
if (!
|
|
1657580
|
+
if (!import_yaml7.default.isMap(errors4)) {
|
|
1657907
1657581
|
context2.failWithoutThrowing(`"errors" is not a map in ${filepath}`);
|
|
1657908
1657582
|
return;
|
|
1657909
1657583
|
}
|
|
1657910
1657584
|
for (const errorDeclaration of errors4.items) {
|
|
1657911
|
-
if (!
|
|
1657585
|
+
if (!import_yaml7.default.isMap(errorDeclaration.value)) {
|
|
1657912
1657586
|
context2.failWithoutThrowing(`Error "${errorDeclaration.key}" is not a map in ${filepath}`);
|
|
1657913
1657587
|
continue;
|
|
1657914
1657588
|
}
|
|
@@ -1657920,7 +1657594,7 @@ async function migrateFile2(filepath, context2) {
|
|
|
1657920
1657594
|
}
|
|
1657921
1657595
|
const httpSection = errorDeclaration.value.get("http");
|
|
1657922
1657596
|
if (httpSection != null) {
|
|
1657923
|
-
if (!
|
|
1657597
|
+
if (!import_yaml7.default.isMap(httpSection)) {
|
|
1657924
1657598
|
context2.failWithoutThrowing(`http in "${errorDeclaration.key}" is not a map in ${filepath}`);
|
|
1657925
1657599
|
} else {
|
|
1657926
1657600
|
const statusCode = httpSection.get("statusCode", true);
|
|
@@ -1657929,7 +1657603,7 @@ async function migrateFile2(filepath, context2) {
|
|
|
1657929
1657603
|
}
|
|
1657930
1657604
|
}
|
|
1657931
1657605
|
}
|
|
1657932
|
-
await (0,
|
|
1657606
|
+
await (0, import_promises110.writeFile)(filepath, parsedDocument.toString());
|
|
1657933
1657607
|
}
|
|
1657934
1657608
|
|
|
1657935
1657609
|
// ../cli-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -1657940,8 +1657614,8 @@ var versionMigrations4 = {
|
|
|
1657940
1657614
|
var __default4 = versionMigrations4;
|
|
1657941
1657615
|
|
|
1657942
1657616
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
1657943
|
-
var
|
|
1657944
|
-
var
|
|
1657617
|
+
var import_promises111 = require("fs/promises");
|
|
1657618
|
+
var import_yaml8 = __toESM(require_dist(), 1);
|
|
1657945
1657619
|
|
|
1657946
1657620
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
1657947
1657621
|
var FERN_DIRECTORY6 = "fern";
|
|
@@ -1657981,37 +1657655,37 @@ var migration5 = {
|
|
|
1657981
1657655
|
}
|
|
1657982
1657656
|
};
|
|
1657983
1657657
|
async function migrateGeneratorsYml2(filepath, context2) {
|
|
1657984
|
-
const contents = await (0,
|
|
1657985
|
-
const parsedDocument =
|
|
1657658
|
+
const contents = await (0, import_promises111.readFile)(filepath);
|
|
1657659
|
+
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
1657986
1657660
|
const releaseGenerators = parsedDocument.get("release");
|
|
1657987
1657661
|
if (releaseGenerators == null) {
|
|
1657988
1657662
|
return;
|
|
1657989
1657663
|
}
|
|
1657990
|
-
if (!
|
|
1657664
|
+
if (!import_yaml8.default.isSeq(releaseGenerators)) {
|
|
1657991
1657665
|
context2.failWithoutThrowing(`release generators are not a list in ${filepath}`);
|
|
1657992
1657666
|
return;
|
|
1657993
1657667
|
}
|
|
1657994
1657668
|
releaseGenerators.items.forEach((releaseGenerator) => {
|
|
1657995
|
-
if (!
|
|
1657669
|
+
if (!import_yaml8.default.isMap(releaseGenerator)) {
|
|
1657996
1657670
|
context2.failWithoutThrowing(`release generator is not an object in ${filepath}`);
|
|
1657997
1657671
|
return;
|
|
1657998
1657672
|
}
|
|
1657999
1657673
|
const outputs = releaseGenerator.get("outputs");
|
|
1658000
|
-
if (!
|
|
1657674
|
+
if (!import_yaml8.default.isMap(outputs)) {
|
|
1658001
1657675
|
context2.failWithoutThrowing(`outputs is not an object in ${filepath}`);
|
|
1658002
1657676
|
return;
|
|
1658003
1657677
|
}
|
|
1658004
1657678
|
const githubOutput = outputs.get("github");
|
|
1658005
|
-
if (
|
|
1657679
|
+
if (import_yaml8.default.isMap(githubOutput) && githubOutput.has("repository")) {
|
|
1658006
1657680
|
releaseGenerator.set("github", githubOutput);
|
|
1658007
1657681
|
}
|
|
1658008
1657682
|
const publishing = {};
|
|
1658009
1657683
|
const npmOutput = outputs.get("npm");
|
|
1658010
|
-
if (
|
|
1657684
|
+
if (import_yaml8.default.isMap(npmOutput)) {
|
|
1658011
1657685
|
publishing.npm = npmOutput;
|
|
1658012
1657686
|
}
|
|
1658013
1657687
|
const mavenOutput = outputs.get("maven");
|
|
1658014
|
-
if (
|
|
1657688
|
+
if (import_yaml8.default.isMap(mavenOutput)) {
|
|
1658015
1657689
|
publishing.maven = mavenOutput;
|
|
1658016
1657690
|
}
|
|
1658017
1657691
|
if (Object.keys(publishing).length > 0) {
|
|
@@ -1658019,7 +1657693,7 @@ async function migrateGeneratorsYml2(filepath, context2) {
|
|
|
1658019
1657693
|
}
|
|
1658020
1657694
|
releaseGenerator.delete("outputs");
|
|
1658021
1657695
|
});
|
|
1658022
|
-
await (0,
|
|
1657696
|
+
await (0, import_promises111.writeFile)(filepath, parsedDocument.toString());
|
|
1658023
1657697
|
}
|
|
1658024
1657698
|
|
|
1658025
1657699
|
// ../cli-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -1658030,7 +1657704,7 @@ var versionMigrations5 = {
|
|
|
1658030
1657704
|
var __default5 = versionMigrations5;
|
|
1658031
1657705
|
|
|
1658032
1657706
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
1658033
|
-
var
|
|
1657707
|
+
var import_promises112 = require("fs/promises");
|
|
1658034
1657708
|
|
|
1658035
1657709
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
1658036
1657710
|
var FERN_DIRECTORY7 = "fern";
|
|
@@ -1658061,9 +1657735,9 @@ var migration6 = {
|
|
|
1658061
1657735
|
run: async ({ context: context2 }) => {
|
|
1658062
1657736
|
const yamlFiles = await getAllYamlFiles4(context2);
|
|
1658063
1657737
|
for (const filepath of yamlFiles) {
|
|
1658064
|
-
const contents = await (0,
|
|
1657738
|
+
const contents = await (0, import_promises112.readFile)(filepath);
|
|
1658065
1657739
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
1658066
|
-
await (0,
|
|
1657740
|
+
await (0, import_promises112.writeFile)(filepath, newContents);
|
|
1658067
1657741
|
}
|
|
1658068
1657742
|
}
|
|
1658069
1657743
|
};
|
|
@@ -1658076,7 +1657750,7 @@ var versionMigrations6 = {
|
|
|
1658076
1657750
|
var __default6 = versionMigrations6;
|
|
1658077
1657751
|
|
|
1658078
1657752
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
1658079
|
-
var
|
|
1657753
|
+
var import_promises113 = require("fs/promises");
|
|
1658080
1657754
|
|
|
1658081
1657755
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
1658082
1657756
|
var FERN_DIRECTORY8 = "fern";
|
|
@@ -1658107,9 +1657781,9 @@ var migration7 = {
|
|
|
1658107
1657781
|
run: async ({ context: context2 }) => {
|
|
1658108
1657782
|
const yamlFiles = await getAllRootApiYamlFiles(context2);
|
|
1658109
1657783
|
for (const filepath of yamlFiles) {
|
|
1658110
|
-
const contents = await (0,
|
|
1657784
|
+
const contents = await (0, import_promises113.readFile)(filepath);
|
|
1658111
1657785
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
1658112
|
-
await (0,
|
|
1657786
|
+
await (0, import_promises113.writeFile)(filepath, newContents);
|
|
1658113
1657787
|
}
|
|
1658114
1657788
|
}
|
|
1658115
1657789
|
};
|
|
@@ -1658122,7 +1657796,7 @@ var versionMigrations7 = {
|
|
|
1658122
1657796
|
var __default7 = versionMigrations7;
|
|
1658123
1657797
|
|
|
1658124
1657798
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
1658125
|
-
var
|
|
1657799
|
+
var import_promises114 = require("fs/promises");
|
|
1658126
1657800
|
|
|
1658127
1657801
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
1658128
1657802
|
var FERN_DIRECTORY9 = "fern";
|
|
@@ -1658229,7 +1657903,7 @@ var migration8 = {
|
|
|
1658229
1657903
|
}
|
|
1658230
1657904
|
};
|
|
1658231
1657905
|
async function migrateGeneratorsYml3(filepath) {
|
|
1658232
|
-
const contentsStr = await (0,
|
|
1657906
|
+
const contentsStr = await (0, import_promises114.readFile)(filepath);
|
|
1658233
1657907
|
const contents = jsYaml.load(contentsStr.toString());
|
|
1658234
1657908
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
1658235
1657909
|
let newGeneratorsConfiguration = {};
|
|
@@ -1658247,7 +1657921,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
1658247
1657921
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
1658248
1657922
|
};
|
|
1658249
1657923
|
}
|
|
1658250
|
-
await (0,
|
|
1657924
|
+
await (0, import_promises114.writeFile)(filepath, jsYaml.dump(newGeneratorsConfiguration));
|
|
1658251
1657925
|
}
|
|
1658252
1657926
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
1658253
1657927
|
const newSchema = {
|
|
@@ -1658322,8 +1657996,8 @@ var versionMigrations8 = {
|
|
|
1658322
1657996
|
var __default8 = versionMigrations8;
|
|
1658323
1657997
|
|
|
1658324
1657998
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
1658325
|
-
var
|
|
1658326
|
-
var
|
|
1657999
|
+
var import_promises115 = require("fs/promises");
|
|
1658000
|
+
var import_yaml9 = __toESM(require_dist(), 1);
|
|
1658327
1658001
|
|
|
1658328
1658002
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
1658329
1658003
|
var FERN_DIRECTORY10 = "fern";
|
|
@@ -1658363,10 +1658037,10 @@ var migration9 = {
|
|
|
1658363
1658037
|
}
|
|
1658364
1658038
|
};
|
|
1658365
1658039
|
async function migrateRootApiFile(filepath) {
|
|
1658366
|
-
const contents = await (0,
|
|
1658367
|
-
const parsedDocument =
|
|
1658040
|
+
const contents = await (0, import_promises115.readFile)(filepath);
|
|
1658041
|
+
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
1658368
1658042
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
1658369
|
-
if (errorDiscriminant == null || !
|
|
1658043
|
+
if (errorDiscriminant == null || !import_yaml9.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
1658370
1658044
|
return;
|
|
1658371
1658045
|
}
|
|
1658372
1658046
|
parsedDocument.set("error-discrimination", {
|
|
@@ -1658374,7 +1658048,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
1658374
1658048
|
"property-name": errorDiscriminant.value
|
|
1658375
1658049
|
});
|
|
1658376
1658050
|
parsedDocument.delete("error-discriminant");
|
|
1658377
|
-
await (0,
|
|
1658051
|
+
await (0, import_promises115.writeFile)(filepath, parsedDocument.toString());
|
|
1658378
1658052
|
}
|
|
1658379
1658053
|
|
|
1658380
1658054
|
// ../cli-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -1658385,8 +1658059,8 @@ var versionMigrations9 = {
|
|
|
1658385
1658059
|
var __default9 = versionMigrations9;
|
|
1658386
1658060
|
|
|
1658387
1658061
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
1658388
|
-
var
|
|
1658389
|
-
var
|
|
1658062
|
+
var import_promises116 = require("fs/promises");
|
|
1658063
|
+
var import_yaml10 = __toESM(require_dist(), 1);
|
|
1658390
1658064
|
|
|
1658391
1658065
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
1658392
1658066
|
var FERN_DIRECTORY11 = "fern";
|
|
@@ -1658426,24 +1658100,24 @@ var migration10 = {
|
|
|
1658426
1658100
|
}
|
|
1658427
1658101
|
};
|
|
1658428
1658102
|
async function migrateYamlFile(filepath, context2) {
|
|
1658429
|
-
const contents = await (0,
|
|
1658430
|
-
const parsedDocument =
|
|
1658103
|
+
const contents = await (0, import_promises116.readFile)(filepath);
|
|
1658104
|
+
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
1658431
1658105
|
const services = parsedDocument.get("services");
|
|
1658432
1658106
|
if (services == null) {
|
|
1658433
1658107
|
return;
|
|
1658434
1658108
|
}
|
|
1658435
|
-
if (!
|
|
1658109
|
+
if (!import_yaml10.default.isMap(services)) {
|
|
1658436
1658110
|
throw new Error("'services' is not a map");
|
|
1658437
1658111
|
}
|
|
1658438
1658112
|
const httpServices = services.get("http");
|
|
1658439
1658113
|
if (httpServices == null) {
|
|
1658440
1658114
|
return;
|
|
1658441
1658115
|
}
|
|
1658442
|
-
if (!
|
|
1658116
|
+
if (!import_yaml10.default.isMap(httpServices)) {
|
|
1658443
1658117
|
throw new Error("'http' is not a map");
|
|
1658444
1658118
|
}
|
|
1658445
1658119
|
for (const service of httpServices.items) {
|
|
1658446
|
-
if (!
|
|
1658120
|
+
if (!import_yaml10.default.isMap(service.value)) {
|
|
1658447
1658121
|
context2.failWithoutThrowing(`Service '${service.key}' is not a map`);
|
|
1658448
1658122
|
continue;
|
|
1658449
1658123
|
}
|
|
@@ -1658451,12 +1658125,12 @@ async function migrateYamlFile(filepath, context2) {
|
|
|
1658451
1658125
|
if (endpoints == null) {
|
|
1658452
1658126
|
continue;
|
|
1658453
1658127
|
}
|
|
1658454
|
-
if (!
|
|
1658128
|
+
if (!import_yaml10.default.isMap(endpoints)) {
|
|
1658455
1658129
|
context2.failWithoutThrowing(`Endpoints are not a map in service '${service.key}'`);
|
|
1658456
1658130
|
continue;
|
|
1658457
1658131
|
}
|
|
1658458
1658132
|
for (const endpoint3 of endpoints.items) {
|
|
1658459
|
-
if (!
|
|
1658133
|
+
if (!import_yaml10.default.isMap(endpoint3.value)) {
|
|
1658460
1658134
|
context2.failWithoutThrowing(`Endpoint ${endpoint3.key} is not a map in service '${service.key}'`);
|
|
1658461
1658135
|
continue;
|
|
1658462
1658136
|
}
|
|
@@ -1658466,14 +1658140,14 @@ async function migrateYamlFile(filepath, context2) {
|
|
|
1658466
1658140
|
context2.failWithoutThrowing("Failed to convert endpoint", e6);
|
|
1658467
1658141
|
}
|
|
1658468
1658142
|
}
|
|
1658469
|
-
await (0,
|
|
1658143
|
+
await (0, import_promises116.writeFile)(filepath, parsedDocument.toString());
|
|
1658470
1658144
|
}
|
|
1658471
1658145
|
}
|
|
1658472
1658146
|
function convertEndpoint20({ document: document4, endpoint: endpoint3 }) {
|
|
1658473
|
-
const newRequest = new
|
|
1658147
|
+
const newRequest = new import_yaml10.default.YAMLMap();
|
|
1658474
1658148
|
const parsedRequestBody = parseRequestBody(endpoint3);
|
|
1658475
1658149
|
if (parsedRequestBody != null) {
|
|
1658476
|
-
let newBody = new
|
|
1658150
|
+
let newBody = new import_yaml10.default.YAMLMap();
|
|
1658477
1658151
|
const { requestBodyType, docs: originalRequestDocs } = parsedRequestBody;
|
|
1658478
1658152
|
if (originalRequestDocs != null) {
|
|
1658479
1658153
|
newBody.set("docs", originalRequestDocs);
|
|
@@ -1658481,11 +1658155,11 @@ function convertEndpoint20({ document: document4, endpoint: endpoint3 }) {
|
|
|
1658481
1658155
|
newBody.set("type", requestBodyType);
|
|
1658482
1658156
|
const documentTypes = document4.get("types");
|
|
1658483
1658157
|
if (documentTypes != null) {
|
|
1658484
|
-
if (!
|
|
1658158
|
+
if (!import_yaml10.default.isMap(documentTypes)) {
|
|
1658485
1658159
|
throw new Error("types are not a map");
|
|
1658486
1658160
|
}
|
|
1658487
1658161
|
const maybeTypeDeclarationForRequest = documentTypes.get(requestBodyType);
|
|
1658488
|
-
if (maybeTypeDeclarationForRequest != null &&
|
|
1658162
|
+
if (maybeTypeDeclarationForRequest != null && import_yaml10.default.isMap(maybeTypeDeclarationForRequest)) {
|
|
1658489
1658163
|
const objectExtends = maybeTypeDeclarationForRequest.get("extends");
|
|
1658490
1658164
|
const objectProperties = maybeTypeDeclarationForRequest.get("properties");
|
|
1658491
1658165
|
if (objectExtends != null || objectProperties != null) {
|
|
@@ -1658520,7 +1658194,7 @@ function parseRequestBody(endpoint3) {
|
|
|
1658520
1658194
|
if (typeof requestBody === "string") {
|
|
1658521
1658195
|
return { requestBodyType: requestBody, docs: void 0 };
|
|
1658522
1658196
|
}
|
|
1658523
|
-
if (
|
|
1658197
|
+
if (import_yaml10.default.isMap(requestBody)) {
|
|
1658524
1658198
|
const type8 = requestBody.get("type");
|
|
1658525
1658199
|
if (type8 == null) {
|
|
1658526
1658200
|
throw new Error("request type does not exist");
|
|
@@ -1658545,8 +1658219,8 @@ var versionMigrations10 = {
|
|
|
1658545
1658219
|
var __default10 = versionMigrations10;
|
|
1658546
1658220
|
|
|
1658547
1658221
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
1658548
|
-
var
|
|
1658549
|
-
var
|
|
1658222
|
+
var import_promises117 = require("fs/promises");
|
|
1658223
|
+
var import_yaml11 = __toESM(require_dist(), 1);
|
|
1658550
1658224
|
|
|
1658551
1658225
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
1658552
1658226
|
var FERN_DIRECTORY12 = "fern";
|
|
@@ -1658586,24 +1658260,24 @@ var migration11 = {
|
|
|
1658586
1658260
|
}
|
|
1658587
1658261
|
};
|
|
1658588
1658262
|
async function migrateYamlFile2(filepath, context2) {
|
|
1658589
|
-
const contents = await (0,
|
|
1658590
|
-
const parsedDocument =
|
|
1658263
|
+
const contents = await (0, import_promises117.readFile)(filepath);
|
|
1658264
|
+
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
1658591
1658265
|
const types4 = parsedDocument.get("types");
|
|
1658592
1658266
|
if (types4 == null) {
|
|
1658593
1658267
|
return;
|
|
1658594
1658268
|
}
|
|
1658595
|
-
if (!
|
|
1658269
|
+
if (!import_yaml11.default.isMap(types4)) {
|
|
1658596
1658270
|
throw new Error("'types' is not a map");
|
|
1658597
1658271
|
}
|
|
1658598
1658272
|
for (const type8 of types4.items) {
|
|
1658599
|
-
if (!
|
|
1658273
|
+
if (!import_yaml11.default.isMap(type8.value)) {
|
|
1658600
1658274
|
continue;
|
|
1658601
1658275
|
}
|
|
1658602
1658276
|
const examples = type8.value.get("examples");
|
|
1658603
1658277
|
if (examples == null) {
|
|
1658604
1658278
|
continue;
|
|
1658605
1658279
|
}
|
|
1658606
|
-
if (!
|
|
1658280
|
+
if (!import_yaml11.default.isSeq(examples)) {
|
|
1658607
1658281
|
context2.failWithoutThrowing("'examples' are not a list");
|
|
1658608
1658282
|
continue;
|
|
1658609
1658283
|
}
|
|
@@ -1658612,7 +1658286,7 @@ async function migrateYamlFile2(filepath, context2) {
|
|
|
1658612
1658286
|
examples.set(i11, { value });
|
|
1658613
1658287
|
}
|
|
1658614
1658288
|
}
|
|
1658615
|
-
await (0,
|
|
1658289
|
+
await (0, import_promises117.writeFile)(filepath, parsedDocument.toString());
|
|
1658616
1658290
|
}
|
|
1658617
1658291
|
|
|
1658618
1658292
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -1658623,8 +1658297,8 @@ var versionMigrations11 = {
|
|
|
1658623
1658297
|
var __default11 = versionMigrations11;
|
|
1658624
1658298
|
|
|
1658625
1658299
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
1658626
|
-
var
|
|
1658627
|
-
var
|
|
1658300
|
+
var import_promises118 = require("fs/promises");
|
|
1658301
|
+
var import_yaml12 = __toESM(require_dist(), 1);
|
|
1658628
1658302
|
|
|
1658629
1658303
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
1658630
1658304
|
var FERN_DIRECTORY13 = "fern";
|
|
@@ -1658664,14 +1658338,14 @@ var migration12 = {
|
|
|
1658664
1658338
|
}
|
|
1658665
1658339
|
};
|
|
1658666
1658340
|
async function migrateYamlFile3(filepath, context2) {
|
|
1658667
|
-
const contents = await (0,
|
|
1658668
|
-
const parsedDocument =
|
|
1658669
|
-
if (!
|
|
1658341
|
+
const contents = await (0, import_promises118.readFile)(filepath);
|
|
1658342
|
+
const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
|
|
1658343
|
+
if (!import_yaml12.default.isMap(parsedDocument.contents)) {
|
|
1658670
1658344
|
return context2.failAndThrow("File is not a map");
|
|
1658671
1658345
|
}
|
|
1658672
1658346
|
for (const pair of parsedDocument.contents.items) {
|
|
1658673
|
-
if (
|
|
1658674
|
-
if (!
|
|
1658347
|
+
if (import_yaml12.default.isScalar(pair.key) && pair.key.value === "services") {
|
|
1658348
|
+
if (!import_yaml12.default.isMap(pair.value)) {
|
|
1658675
1658349
|
return context2.failAndThrow("Services are not a map");
|
|
1658676
1658350
|
}
|
|
1658677
1658351
|
const httpServices = pair.value.get("http");
|
|
@@ -1658679,7 +1658353,7 @@ async function migrateYamlFile3(filepath, context2) {
|
|
|
1658679
1658353
|
parsedDocument.contents.delete("services");
|
|
1658680
1658354
|
return;
|
|
1658681
1658355
|
}
|
|
1658682
|
-
if (!
|
|
1658356
|
+
if (!import_yaml12.default.isMap(httpServices)) {
|
|
1658683
1658357
|
return context2.failAndThrow("http is not a map");
|
|
1658684
1658358
|
}
|
|
1658685
1658359
|
const [firstService, ...remainingServices] = httpServices.items;
|
|
@@ -1658694,7 +1658368,7 @@ async function migrateYamlFile3(filepath, context2) {
|
|
|
1658694
1658368
|
pair.value = firstService.value;
|
|
1658695
1658369
|
}
|
|
1658696
1658370
|
}
|
|
1658697
|
-
await (0,
|
|
1658371
|
+
await (0, import_promises118.writeFile)(filepath, parsedDocument.toString());
|
|
1658698
1658372
|
}
|
|
1658699
1658373
|
|
|
1658700
1658374
|
// ../cli-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -1658705,8 +1658379,8 @@ var versionMigrations12 = {
|
|
|
1658705
1658379
|
var __default12 = versionMigrations12;
|
|
1658706
1658380
|
|
|
1658707
1658381
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
1658708
|
-
var
|
|
1658709
|
-
var
|
|
1658382
|
+
var import_promises119 = require("fs/promises");
|
|
1658383
|
+
var import_yaml13 = __toESM(require_dist(), 1);
|
|
1658710
1658384
|
|
|
1658711
1658385
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
1658712
1658386
|
var FERN_DIRECTORY14 = "fern";
|
|
@@ -1658746,26 +1658420,26 @@ var migration13 = {
|
|
|
1658746
1658420
|
}
|
|
1658747
1658421
|
};
|
|
1658748
1658422
|
async function migrateYamlFile4(filepath, context2) {
|
|
1658749
|
-
const contents = await (0,
|
|
1658750
|
-
const parsedDocument =
|
|
1658751
|
-
if (!
|
|
1658423
|
+
const contents = await (0, import_promises119.readFile)(filepath);
|
|
1658424
|
+
const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
|
|
1658425
|
+
if (!import_yaml13.default.isMap(parsedDocument.contents)) {
|
|
1658752
1658426
|
return context2.failAndThrow("File is not a map");
|
|
1658753
1658427
|
}
|
|
1658754
1658428
|
const service = parsedDocument.contents.get("service");
|
|
1658755
1658429
|
if (service == null) {
|
|
1658756
1658430
|
return;
|
|
1658757
1658431
|
}
|
|
1658758
|
-
if (!
|
|
1658432
|
+
if (!import_yaml13.default.isMap(service)) {
|
|
1658759
1658433
|
return context2.failAndThrow("service is not a map");
|
|
1658760
1658434
|
}
|
|
1658761
|
-
const indexOfServiceDocsPair = service.items.findIndex((item) =>
|
|
1658435
|
+
const indexOfServiceDocsPair = service.items.findIndex((item) => import_yaml13.default.isScalar(item.key) && item.key.value === "docs");
|
|
1658762
1658436
|
const docsPair = service.items[indexOfServiceDocsPair];
|
|
1658763
1658437
|
if (docsPair == null) {
|
|
1658764
1658438
|
return;
|
|
1658765
1658439
|
}
|
|
1658766
1658440
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
1658767
1658441
|
parsedDocument.contents.items.unshift(docsPair);
|
|
1658768
|
-
await (0,
|
|
1658442
|
+
await (0, import_promises119.writeFile)(filepath, parsedDocument.toString());
|
|
1658769
1658443
|
}
|
|
1658770
1658444
|
|
|
1658771
1658445
|
// ../cli-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -1658776,7 +1658450,7 @@ var versionMigrations13 = {
|
|
|
1658776
1658450
|
var __default13 = versionMigrations13;
|
|
1658777
1658451
|
|
|
1658778
1658452
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
1658779
|
-
var
|
|
1658453
|
+
var import_promises120 = require("fs/promises");
|
|
1658780
1658454
|
|
|
1658781
1658455
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
1658782
1658456
|
var FERN_DIRECTORY15 = "fern";
|
|
@@ -1658816,14 +1658490,14 @@ var migration14 = {
|
|
|
1658816
1658490
|
}
|
|
1658817
1658491
|
};
|
|
1658818
1658492
|
async function migrateYamlFile5(filepath) {
|
|
1658819
|
-
const contents = await (0,
|
|
1658493
|
+
const contents = await (0, import_promises120.readFile)(filepath);
|
|
1658820
1658494
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
1658821
1658495
|
const regex5 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
1658822
1658496
|
const updatedSnapshot = contents.toString().replace(regex5, (_match, _prefix, domain3) => {
|
|
1658823
1658497
|
return `docs:
|
|
1658824
1658498
|
domain: "${domain3}.${domainSuffix}"`;
|
|
1658825
1658499
|
});
|
|
1658826
|
-
await (0,
|
|
1658500
|
+
await (0, import_promises120.writeFile)(filepath, updatedSnapshot.toString());
|
|
1658827
1658501
|
}
|
|
1658828
1658502
|
|
|
1658829
1658503
|
// ../cli-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -1658839,10 +1658513,10 @@ var import_legacy_docs_config = __toESM(require_legacy_docs_config(), 1);
|
|
|
1658839
1658513
|
var LegacyDocsSerializers = __toESM(require_serialization44(), 1);
|
|
1658840
1658514
|
|
|
1658841
1658515
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
1658842
|
-
var
|
|
1658516
|
+
var import_promises121 = require("fs/promises");
|
|
1658843
1658517
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
1658844
1658518
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1658845
|
-
const contentsStr = await (0,
|
|
1658519
|
+
const contentsStr = await (0, import_promises121.readFile)(filepath);
|
|
1658846
1658520
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
1658847
1658521
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
1658848
1658522
|
if (result.ok) {
|
|
@@ -1658860,7 +1658534,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
1658860
1658534
|
}
|
|
1658861
1658535
|
|
|
1658862
1658536
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
1658863
|
-
var
|
|
1658537
|
+
var import_promises123 = require("fs/promises");
|
|
1658864
1658538
|
|
|
1658865
1658539
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
1658866
1658540
|
function convertLegacyDocsConfig({ docsConfiguration, docsURLs, apiName }) {
|
|
@@ -1659038,10 +1658712,10 @@ __export(legacy_exports, {
|
|
|
1659038
1658712
|
});
|
|
1659039
1658713
|
|
|
1659040
1658714
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
1659041
|
-
var
|
|
1658715
|
+
var import_promises122 = require("fs/promises");
|
|
1659042
1658716
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
1659043
1658717
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
1659044
|
-
const contentsStr = await (0,
|
|
1658718
|
+
const contentsStr = await (0, import_promises122.readFile)(filepath);
|
|
1659045
1658719
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
1659046
1658720
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
1659047
1658721
|
if (result.success) {
|
|
@@ -1659071,7 +1658745,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
1659071
1658745
|
var APIS_DIRECTORY2 = "apis";
|
|
1659072
1658746
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
1659073
1658747
|
const absolutePathToApisDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY2));
|
|
1659074
|
-
await (0,
|
|
1658748
|
+
await (0, import_promises123.mkdir)(absolutePathToApisDirectory);
|
|
1659075
1658749
|
for (const workspace of workspaces) {
|
|
1659076
1658750
|
const absolutePathToWorkspace = join2(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
1659077
1658751
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -1659079,11 +1658753,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
1659079
1658753
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
1659080
1658754
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
1659081
1658755
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
1659082
|
-
await (0,
|
|
1658756
|
+
await (0, import_promises123.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
1659083
1658757
|
}
|
|
1659084
1658758
|
const absolutePathToNestedWorkspace = join2(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
1659085
1658759
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
1659086
|
-
await (0,
|
|
1658760
|
+
await (0, import_promises123.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1659087
1658761
|
}
|
|
1659088
1658762
|
}
|
|
1659089
1658763
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -1659096,7 +1658770,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
1659096
1658770
|
generatorsConfiguration,
|
|
1659097
1658771
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
1659098
1658772
|
});
|
|
1659099
|
-
await (0,
|
|
1658773
|
+
await (0, import_promises123.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
1659100
1658774
|
return convertedResponse.docsURLs;
|
|
1659101
1658775
|
}
|
|
1659102
1658776
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -1659110,19 +1658784,19 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
1659110
1658784
|
apiName
|
|
1659111
1658785
|
});
|
|
1659112
1658786
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1659113
|
-
await (0,
|
|
1658787
|
+
await (0, import_promises123.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
1659114
1658788
|
}
|
|
1659115
1658789
|
|
|
1659116
1658790
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
1659117
|
-
var
|
|
1658791
|
+
var import_promises124 = require("fs/promises");
|
|
1659118
1658792
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
1659119
1658793
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
1659120
1658794
|
await migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs });
|
|
1659121
1658795
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
1659122
1658796
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
1659123
1658797
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
1659124
|
-
await (0,
|
|
1659125
|
-
await (0,
|
|
1658798
|
+
await (0, import_promises124.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
1658799
|
+
await (0, import_promises124.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1659126
1658800
|
}
|
|
1659127
1658801
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
1659128
1658802
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1659135,7 +1658809,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
1659135
1658809
|
apiName: void 0
|
|
1659136
1658810
|
});
|
|
1659137
1658811
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1659138
|
-
await (0,
|
|
1658812
|
+
await (0, import_promises124.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
1659139
1658813
|
}
|
|
1659140
1658814
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
1659141
1658815
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1659147,22 +1658821,22 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
1659147
1658821
|
generatorsConfiguration,
|
|
1659148
1658822
|
pathModificationStrategy: "MoveUp"
|
|
1659149
1658823
|
});
|
|
1659150
|
-
await (0,
|
|
1658824
|
+
await (0, import_promises124.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
1659151
1658825
|
return convertedResponse.docsURLs;
|
|
1659152
1658826
|
}
|
|
1659153
1658827
|
|
|
1659154
1658828
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
1659155
|
-
var
|
|
1658829
|
+
var import_promises125 = require("fs/promises");
|
|
1659156
1658830
|
var APIS_DIRECTORY3 = "apis";
|
|
1659157
1658831
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
1659158
1658832
|
const absolutePathToApisDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY3));
|
|
1659159
|
-
await (0,
|
|
1658833
|
+
await (0, import_promises125.mkdir)(absolutePathToApisDirectory);
|
|
1659160
1658834
|
for (const workspace of workspaces) {
|
|
1659161
1658835
|
const absolutePathToWorkspace = join2(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
1659162
1658836
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
1659163
1658837
|
const absolutePathToNestedWorkspace = join2(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
1659164
1658838
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
1659165
|
-
await (0,
|
|
1658839
|
+
await (0, import_promises125.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1659166
1658840
|
}
|
|
1659167
1658841
|
}
|
|
1659168
1658842
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -1659175,15 +1658849,15 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
1659175
1658849
|
generatorsConfiguration,
|
|
1659176
1658850
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
1659177
1658851
|
});
|
|
1659178
|
-
await (0,
|
|
1658852
|
+
await (0, import_promises125.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
1659179
1658853
|
}
|
|
1659180
1658854
|
|
|
1659181
1658855
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
1659182
|
-
var
|
|
1658856
|
+
var import_promises126 = require("fs/promises");
|
|
1659183
1658857
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
1659184
1658858
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
1659185
1658859
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
1659186
|
-
await (0,
|
|
1658860
|
+
await (0, import_promises126.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1659187
1658861
|
}
|
|
1659188
1658862
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
1659189
1658863
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1659195,7 +1658869,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
1659195
1658869
|
generatorsConfiguration,
|
|
1659196
1658870
|
pathModificationStrategy: "MoveUp"
|
|
1659197
1658871
|
});
|
|
1659198
|
-
await (0,
|
|
1658872
|
+
await (0, import_promises126.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
1659199
1658873
|
}
|
|
1659200
1658874
|
|
|
1659201
1658875
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -1659272,8 +1658946,8 @@ var versionMigrations15 = {
|
|
|
1659272
1658946
|
var __default15 = versionMigrations15;
|
|
1659273
1658947
|
|
|
1659274
1658948
|
// ../cli-migrations/lib/migrations/0.41.0-rc0/require-generators-yml/migration.js
|
|
1659275
|
-
var
|
|
1659276
|
-
var
|
|
1658949
|
+
var import_promises127 = require("fs/promises");
|
|
1658950
|
+
var import_yaml14 = __toESM(require_dist(), 1);
|
|
1659277
1658951
|
var migration16 = {
|
|
1659278
1658952
|
name: "require-generators-yml",
|
|
1659279
1658953
|
summary: "A generators.yml file is now required if you are using OpenAPI, AsyncAPI, or gRPC.",
|
|
@@ -1659315,7 +1658989,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
1659315
1658989
|
if (existingGeneratorsYml == null) {
|
|
1659316
1658990
|
if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
1659317
1658991
|
const absolutePathToGeneratorsYml = join2(absoluteFilepathToWorkspace, RelativeFilePath2.of("generators.yml"));
|
|
1659318
|
-
await (0,
|
|
1658992
|
+
await (0, import_promises127.writeFile)(absolutePathToGeneratorsYml, jsYaml.dump({
|
|
1659319
1658993
|
api: {
|
|
1659320
1658994
|
path: join2(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
1659321
1658995
|
}
|
|
@@ -1659326,11 +1659000,11 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
1659326
1659000
|
const generatorsYmlContents = jsYaml.load(existingGeneratorsYml.contents);
|
|
1659327
1659001
|
if (generatorsYmlContents?.api != null) {
|
|
1659328
1659002
|
} else if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
1659329
|
-
const parsedDocument =
|
|
1659003
|
+
const parsedDocument = import_yaml14.default.parseDocument(existingGeneratorsYml.contents);
|
|
1659330
1659004
|
parsedDocument.set("api", {
|
|
1659331
1659005
|
path: join2(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
1659332
1659006
|
});
|
|
1659333
|
-
await (0,
|
|
1659007
|
+
await (0, import_promises127.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
|
|
1659334
1659008
|
context2.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
|
|
1659335
1659009
|
}
|
|
1659336
1659010
|
}
|
|
@@ -1659357,8 +1659031,8 @@ var versionMigrations16 = {
|
|
|
1659357
1659031
|
var __default16 = versionMigrations16;
|
|
1659358
1659032
|
|
|
1659359
1659033
|
// ../cli-migrations/lib/migrations/0.54.0-rc0/use-generators-yml-specs/migration.js
|
|
1659360
|
-
var
|
|
1659361
|
-
var
|
|
1659034
|
+
var import_promises128 = require("fs/promises");
|
|
1659035
|
+
var import_yaml15 = __toESM(require_dist(), 1);
|
|
1659362
1659036
|
var migration17 = {
|
|
1659363
1659037
|
name: "generators-yml-use-api-specs",
|
|
1659364
1659038
|
summary: "API specification must use the api.specs[] array syntax.",
|
|
@@ -1659526,7 +1659200,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
|
|
|
1659526
1659200
|
if (firstLine?.startsWith("# yaml-language-server:")) {
|
|
1659527
1659201
|
schemaComment = firstLine;
|
|
1659528
1659202
|
}
|
|
1659529
|
-
const parsedDocument =
|
|
1659203
|
+
const parsedDocument = import_yaml15.default.parseDocument(generatorsYmlFile.contents);
|
|
1659530
1659204
|
parsedDocument.delete("api-settings");
|
|
1659531
1659205
|
parsedDocument.delete("openapi");
|
|
1659532
1659206
|
parsedDocument.delete("openapi-overrides");
|
|
@@ -1659537,7 +1659211,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
|
|
|
1659537
1659211
|
if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
|
|
1659538
1659212
|
documentToWrite = `${schemaComment}${documentToWrite}`;
|
|
1659539
1659213
|
}
|
|
1659540
|
-
await (0,
|
|
1659214
|
+
await (0, import_promises128.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1659541
1659215
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1659542
1659216
|
}
|
|
1659543
1659217
|
async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, directories, context: context2, namespace }) {
|
|
@@ -1659584,7 +1659258,7 @@ async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, direc
|
|
|
1659584
1659258
|
}
|
|
1659585
1659259
|
let specContent;
|
|
1659586
1659260
|
try {
|
|
1659587
|
-
const fileContents = await (0,
|
|
1659261
|
+
const fileContents = await (0, import_promises128.readFile)(absoluteSpecPath, { encoding: "utf-8" });
|
|
1659588
1659262
|
specContent = jsYaml.load(fileContents);
|
|
1659589
1659263
|
} catch (e6) {
|
|
1659590
1659264
|
context2.logger.warn(`Failed to read API spec file ${spec.path}. Error: ${e6}. Skipping...`);
|
|
@@ -1659687,7 +1659361,7 @@ var versionMigrations17 = {
|
|
|
1659687
1659361
|
var __default17 = versionMigrations17;
|
|
1659688
1659362
|
|
|
1659689
1659363
|
// ../cli-migrations/lib/migrations/0.82.1/add-path-parameter-order-setting/migration.js
|
|
1659690
|
-
var
|
|
1659364
|
+
var import_promises129 = require("fs/promises");
|
|
1659691
1659365
|
var migration18 = {
|
|
1659692
1659366
|
name: "add-path-parameter-order-setting",
|
|
1659693
1659367
|
summary: `Adds the 'path-parameter-order' setting to existing API configurations to maintain backwards compatibility.
|
|
@@ -1659775,7 +1659449,7 @@ async function updateGeneratorsYml({ context: context2, files }) {
|
|
|
1659775
1659449
|
documentToWrite = `${schemaComment}
|
|
1659776
1659450
|
${documentToWrite}`;
|
|
1659777
1659451
|
}
|
|
1659778
|
-
await (0,
|
|
1659452
|
+
await (0, import_promises129.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1659779
1659453
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1659780
1659454
|
}
|
|
1659781
1659455
|
async function getFilesAndDirectories3(absoluteFilepath) {
|
|
@@ -1659811,7 +1659485,7 @@ var versionMigrations18 = {
|
|
|
1659811
1659485
|
var __default18 = versionMigrations18;
|
|
1659812
1659486
|
|
|
1659813
1659487
|
// ../cli-migrations/lib/migrations/1.0.0/update-settings-defaults/migration.js
|
|
1659814
|
-
var
|
|
1659488
|
+
var import_promises130 = require("fs/promises");
|
|
1659815
1659489
|
var migration19 = {
|
|
1659816
1659490
|
name: "update-1_0_0-defaults",
|
|
1659817
1659491
|
summary: `The defaults of the API spec settings have changed.
|
|
@@ -1659986,7 +1659660,7 @@ async function updateGeneratorsYml2({ context: context2, files }) {
|
|
|
1659986
1659660
|
documentToWrite = `${schemaComment}
|
|
1659987
1659661
|
${documentToWrite}`;
|
|
1659988
1659662
|
}
|
|
1659989
|
-
await (0,
|
|
1659663
|
+
await (0, import_promises130.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1659990
1659664
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1659991
1659665
|
}
|
|
1659992
1659666
|
async function getFilesAndDirectories4(absoluteFilepath) {
|
|
@@ -1660055,7 +1659729,7 @@ var versionMigrations19 = {
|
|
|
1660055
1659729
|
var __default19 = versionMigrations19;
|
|
1660056
1659730
|
|
|
1660057
1659731
|
// ../cli-migrations/lib/migrations/2.0.0-rc0/update-settings-defaults/migration.js
|
|
1660058
|
-
var
|
|
1659732
|
+
var import_promises131 = require("fs/promises");
|
|
1660059
1659733
|
var migration20 = {
|
|
1660060
1659734
|
name: "update-2_0_0-defaults",
|
|
1660061
1659735
|
summary: `The default of 'coerce-enums-to-literals' has changed from true to false.
|
|
@@ -1660230,7 +1659904,7 @@ async function updateGeneratorsYml3({ context: context2, files }) {
|
|
|
1660230
1659904
|
documentToWrite = `${schemaComment}
|
|
1660231
1659905
|
${documentToWrite}`;
|
|
1660232
1659906
|
}
|
|
1660233
|
-
await (0,
|
|
1659907
|
+
await (0, import_promises131.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1660234
1659908
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1660235
1659909
|
}
|
|
1660236
1659910
|
async function getFilesAndDirectories5(absoluteFilepath) {
|
|
@@ -1660276,7 +1659950,7 @@ var versionMigrations20 = {
|
|
|
1660276
1659950
|
var __default20 = versionMigrations20;
|
|
1660277
1659951
|
|
|
1660278
1659952
|
// ../cli-migrations/lib/migrations/2.13.0/migrate-deprecated-generator-api-settings/migration.js
|
|
1660279
|
-
var
|
|
1659953
|
+
var import_promises132 = require("fs/promises");
|
|
1660280
1659954
|
var migration21 = {
|
|
1660281
1659955
|
name: "migrate-deprecated-generator-api-settings",
|
|
1660282
1659956
|
summary: `Migrates deprecated generator-level API settings keys to their new equivalents:
|
|
@@ -1660367,7 +1660041,7 @@ async function updateGeneratorsYml4({ context: context2, files }) {
|
|
|
1660367
1660041
|
documentToWrite = `${schemaComment}
|
|
1660368
1660042
|
${documentToWrite}`;
|
|
1660369
1660043
|
}
|
|
1660370
|
-
await (0,
|
|
1660044
|
+
await (0, import_promises132.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1660371
1660045
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1660372
1660046
|
}
|
|
1660373
1660047
|
function migrateDeprecatedSettings(settings, context2) {
|
|
@@ -1660413,7 +1660087,7 @@ var versionMigrations21 = {
|
|
|
1660413
1660087
|
var __default21 = versionMigrations21;
|
|
1660414
1660088
|
|
|
1660415
1660089
|
// ../cli-migrations/lib/migrations/3.0.0/enable-smart-casing/migration.js
|
|
1660416
|
-
var
|
|
1660090
|
+
var import_promises133 = require("fs/promises");
|
|
1660417
1660091
|
var migration22 = {
|
|
1660418
1660092
|
name: "enable-smart-casing",
|
|
1660419
1660093
|
summary: `Sets 'smart-casing: false' for existing generators to preserve backwards compatibility.
|
|
@@ -1660497,7 +1660171,7 @@ async function updateGeneratorsYml5({ context: context2, files }) {
|
|
|
1660497
1660171
|
documentToWrite = `${schemaComment}
|
|
1660498
1660172
|
${documentToWrite}`;
|
|
1660499
1660173
|
}
|
|
1660500
|
-
await (0,
|
|
1660174
|
+
await (0, import_promises133.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1660501
1660175
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1660502
1660176
|
}
|
|
1660503
1660177
|
function setSmartCasingFalseIfNotConfigured(generator, context2) {
|
|
@@ -1660638,7 +1660312,7 @@ ${source_default.dim(migration23.summary)}`
|
|
|
1660638
1660312
|
}
|
|
1660639
1660313
|
|
|
1660640
1660314
|
// src/commands/upgrade/upgrade.ts
|
|
1660641
|
-
var
|
|
1660315
|
+
var import_promises134 = require("fs/promises");
|
|
1660642
1660316
|
|
|
1660643
1660317
|
// src/cwd.ts
|
|
1660644
1660318
|
var FERN_CWD_ENV_VAR = "FERN_CWD";
|
|
@@ -1660955,7 +1660629,7 @@ async function upgrade({
|
|
|
1660955
1660629
|
const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
|
|
1660956
1660630
|
draft.version = resolvedTargetVersion;
|
|
1660957
1660631
|
});
|
|
1660958
|
-
await (0,
|
|
1660632
|
+
await (0, import_promises134.writeFile)(
|
|
1660959
1660633
|
projectConfig2._absolutePath,
|
|
1660960
1660634
|
ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2))
|
|
1660961
1660635
|
);
|
|
@@ -1661380,7 +1661054,7 @@ async function validateWorkspaces({
|
|
|
1661380
1661054
|
}
|
|
1661381
1661055
|
|
|
1661382
1661056
|
// src/commands/write-definition/writeDefinitionForWorkspaces.ts
|
|
1661383
|
-
var
|
|
1661057
|
+
var import_promises135 = require("fs/promises");
|
|
1661384
1661058
|
var import_path61 = __toESM(require("path"), 1);
|
|
1661385
1661059
|
async function writeDefinitionForWorkspaces({
|
|
1661386
1661060
|
project,
|
|
@@ -1661461,27 +1661135,27 @@ async function writeFernDefinition({
|
|
|
1661461
1661135
|
return a10.localeCompare(b18);
|
|
1661462
1661136
|
};
|
|
1661463
1661137
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
1661464
|
-
await (0,
|
|
1661138
|
+
await (0, import_promises135.rm)(absolutePathToOutputDirectory, { recursive: true });
|
|
1661465
1661139
|
}
|
|
1661466
|
-
await (0,
|
|
1661467
|
-
await (0,
|
|
1661140
|
+
await (0, import_promises135.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
1661141
|
+
await (0, import_promises135.writeFile)(
|
|
1661468
1661142
|
join2(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
|
|
1661469
1661143
|
jsYaml.dump(definition3.rootApiFile.contents, { sortKeys })
|
|
1661470
1661144
|
);
|
|
1661471
1661145
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
1661472
1661146
|
const absoluteFilepath = join2(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
1661473
|
-
await (0,
|
|
1661474
|
-
await (0,
|
|
1661147
|
+
await (0, import_promises135.mkdir)(dirname4(absoluteFilepath), { recursive: true });
|
|
1661148
|
+
await (0, import_promises135.writeFile)(absoluteFilepath, jsYaml.dump(packageMarker.contents, { sortKeys }));
|
|
1661475
1661149
|
}
|
|
1661476
1661150
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
1661477
1661151
|
const absoluteFilepath = join2(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
1661478
|
-
await (0,
|
|
1661479
|
-
await (0,
|
|
1661152
|
+
await (0, import_promises135.mkdir)(dirname4(absoluteFilepath), { recursive: true });
|
|
1661153
|
+
await (0, import_promises135.writeFile)(absoluteFilepath, jsYaml.dump(definitionFile.contents, { sortKeys }));
|
|
1661480
1661154
|
}
|
|
1661481
1661155
|
}
|
|
1661482
1661156
|
|
|
1661483
1661157
|
// src/commands/write-docs-definition/writeDocsDefinitionForProject.ts
|
|
1661484
|
-
var
|
|
1661158
|
+
var import_promises136 = require("fs/promises");
|
|
1661485
1661159
|
async function writeDocsDefinitionForProject({
|
|
1661486
1661160
|
project,
|
|
1661487
1661161
|
outputPath,
|
|
@@ -1661513,7 +1661187,7 @@ async function writeDocsDefinitionForProject({
|
|
|
1661513
1661187
|
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
|
|
1661514
1661188
|
});
|
|
1661515
1661189
|
const docsDefinition = await docsResolver.resolve();
|
|
1661516
|
-
await (0,
|
|
1661190
|
+
await (0, import_promises136.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
|
|
1661517
1661191
|
context2.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
|
|
1661518
1661192
|
});
|
|
1661519
1661193
|
}
|
|
@@ -1661521,7 +1661195,7 @@ async function writeDocsDefinitionForProject({
|
|
|
1661521
1661195
|
// src/commands/write-translation/writeTranslationForProject.ts
|
|
1661522
1661196
|
var import_cli_progress2 = __toESM(require_cli_progress(), 1);
|
|
1661523
1661197
|
var import_fs25 = require("fs");
|
|
1661524
|
-
var
|
|
1661198
|
+
var import_promises140 = require("fs/promises");
|
|
1661525
1661199
|
var import_is_ci2 = __toESM(require_is_ci(), 1);
|
|
1661526
1661200
|
var import_path64 = __toESM(require("path"), 1);
|
|
1661527
1661201
|
|
|
@@ -1662006,7 +1661680,7 @@ function shouldProcessFile(filePath, stub) {
|
|
|
1662006
1661680
|
}
|
|
1662007
1661681
|
|
|
1662008
1661682
|
// src/commands/write-translation/docs-config-utils.ts
|
|
1662009
|
-
var
|
|
1661683
|
+
var import_promises137 = require("fs/promises");
|
|
1662010
1661684
|
|
|
1662011
1661685
|
// src/commands/write-translation/url-utils.ts
|
|
1662012
1661686
|
function addLanguageSuffixToUrl(url3, language) {
|
|
@@ -1662163,7 +1661837,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
1662163
1661837
|
stub = false
|
|
1662164
1661838
|
}) {
|
|
1662165
1661839
|
try {
|
|
1662166
|
-
const originalConfigContent = await (0,
|
|
1661840
|
+
const originalConfigContent = await (0, import_promises137.readFile)(originalDocsConfigPath, "utf-8");
|
|
1662167
1661841
|
const transformation = {
|
|
1662168
1661842
|
filePath: DOCS_CONFIGURATION_FILENAME,
|
|
1662169
1661843
|
language,
|
|
@@ -1662177,7 +1661851,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
1662177
1661851
|
const modifiedConfigContent = jsYaml.dump(modifiedConfig, {
|
|
1662178
1661852
|
sortKeys: false
|
|
1662179
1661853
|
});
|
|
1662180
|
-
await (0,
|
|
1661854
|
+
await (0, import_promises137.writeFile)(modifiedConfigPath, modifiedConfigContent, "utf-8");
|
|
1662181
1661855
|
context2.logger.debug(`Created language-specific docs config: ${modifiedConfigPath}`);
|
|
1662182
1661856
|
} catch (error49) {
|
|
1662183
1661857
|
if (error49 instanceof Error && error49.message.includes("403")) {
|
|
@@ -1662189,11 +1661863,11 @@ async function createLanguageSpecificDocsConfig({
|
|
|
1662189
1661863
|
|
|
1662190
1661864
|
// src/commands/write-translation/file-collection-utils.ts
|
|
1662191
1661865
|
var import_fs23 = require("fs");
|
|
1662192
|
-
var
|
|
1661866
|
+
var import_promises138 = require("fs/promises");
|
|
1662193
1661867
|
var import_path62 = __toESM(require("path"), 1);
|
|
1662194
1661868
|
async function collectFiles(baseDirectory, relativeBase) {
|
|
1662195
1661869
|
const discoveredFiles = {};
|
|
1662196
|
-
const entries10 = await (0,
|
|
1661870
|
+
const entries10 = await (0, import_promises138.readdir)(baseDirectory);
|
|
1662197
1661871
|
for (const entry of entries10) {
|
|
1662198
1661872
|
if (entry === "translations") {
|
|
1662199
1661873
|
continue;
|
|
@@ -1662216,7 +1661890,7 @@ async function collectFiles(baseDirectory, relativeBase) {
|
|
|
1662216
1661890
|
// src/commands/write-translation/hash-utils.ts
|
|
1662217
1661891
|
var import_crypto10 = require("crypto");
|
|
1662218
1661892
|
var import_fs24 = require("fs");
|
|
1662219
|
-
var
|
|
1661893
|
+
var import_promises139 = require("fs/promises");
|
|
1662220
1661894
|
var import_path63 = __toESM(require("path"), 1);
|
|
1662221
1661895
|
function calculateContentHash(content5) {
|
|
1662222
1661896
|
return (0, import_crypto10.createHash)("sha256").update(content5, "utf-8").digest("hex");
|
|
@@ -1662227,7 +1661901,7 @@ async function loadHashMappings(translationsDirectory) {
|
|
|
1662227
1661901
|
return {};
|
|
1662228
1661902
|
}
|
|
1662229
1661903
|
try {
|
|
1662230
|
-
const hashesContent = await (0,
|
|
1661904
|
+
const hashesContent = await (0, import_promises139.readFile)(hashesFilePath, "utf-8");
|
|
1662231
1661905
|
const parsed = JSON.parse(hashesContent);
|
|
1662232
1661906
|
const { _comment, ...hashMappings } = parsed;
|
|
1662233
1661907
|
return hashMappings;
|
|
@@ -1662248,11 +1661922,11 @@ async function saveHashMappings(translationsDirectory, hashMappings) {
|
|
|
1662248
1661922
|
_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.",
|
|
1662249
1661923
|
...sortedMappings
|
|
1662250
1661924
|
};
|
|
1662251
|
-
await (0,
|
|
1661925
|
+
await (0, import_promises139.writeFile)(hashesFilePath, JSON.stringify(fileContent, null, 2), "utf-8");
|
|
1662252
1661926
|
}
|
|
1662253
1661927
|
async function hasFileChanged(filePath, relativePath, previousHashes) {
|
|
1662254
1661928
|
try {
|
|
1662255
|
-
const content5 = await (0,
|
|
1661929
|
+
const content5 = await (0, import_promises139.readFile)(filePath, "utf-8");
|
|
1662256
1661930
|
const currentHash = calculateContentHash(content5);
|
|
1662257
1661931
|
const previousHash = previousHashes[relativePath];
|
|
1662258
1661932
|
return currentHash !== previousHash;
|
|
@@ -1662305,7 +1661979,7 @@ async function writeTranslationForProject({
|
|
|
1662305
1661979
|
}
|
|
1662306
1661980
|
if (!(0, import_fs25.existsSync)(translationsDirectory)) {
|
|
1662307
1661981
|
context2.logger.debug(`Creating translations directory at: ${translationsDirectory}`);
|
|
1662308
|
-
await (0,
|
|
1661982
|
+
await (0, import_promises140.mkdir)(translationsDirectory, { recursive: true });
|
|
1662309
1661983
|
}
|
|
1662310
1661984
|
const languageStats = {};
|
|
1662311
1661985
|
const targetLanguages = languages.filter((lang) => lang !== sourceLanguage);
|
|
@@ -1662318,7 +1661992,7 @@ async function writeTranslationForProject({
|
|
|
1662318
1661992
|
RelativeFilePath2.of("fern")
|
|
1662319
1661993
|
);
|
|
1662320
1661994
|
if (!(0, import_fs25.existsSync)(languageDirectory)) {
|
|
1662321
|
-
await (0,
|
|
1661995
|
+
await (0, import_promises140.mkdir)(languageDirectory, { recursive: true });
|
|
1662322
1661996
|
}
|
|
1662323
1661997
|
languageStats[language] = {
|
|
1662324
1661998
|
filesProcessed: 0,
|
|
@@ -1662420,7 +1662094,7 @@ async function writeTranslationForProject({
|
|
|
1662420
1662094
|
`[COMPLETED] ${DOCS_CONFIGURATION_FILENAME} -> ${language}/${DOCS_CONFIGURATION_FILENAME}`
|
|
1662421
1662095
|
);
|
|
1662422
1662096
|
}
|
|
1662423
|
-
const originalConfigContent = await (0,
|
|
1662097
|
+
const originalConfigContent = await (0, import_promises140.readFile)(originalDocsConfigPath, "utf-8");
|
|
1662424
1662098
|
await updateAndSaveHashForFile(
|
|
1662425
1662099
|
translationsDirectory,
|
|
1662426
1662100
|
hashMappings,
|
|
@@ -1662465,7 +1662139,7 @@ async function writeTranslationForProject({
|
|
|
1662465
1662139
|
continue;
|
|
1662466
1662140
|
}
|
|
1662467
1662141
|
cliContext.logger.debug(`[PROCESSING] ${relativePath} (detected changes)`);
|
|
1662468
|
-
const originalContent = await (0,
|
|
1662142
|
+
const originalContent = await (0, import_promises140.readFile)(filePath, "utf-8");
|
|
1662469
1662143
|
await updateAndSaveHashForFile(translationsDirectory, hashMappings, relativePath, originalContent);
|
|
1662470
1662144
|
const sourceStats = languageStats[sourceLanguage];
|
|
1662471
1662145
|
if (sourceStats) {
|
|
@@ -1662490,7 +1662164,7 @@ async function writeTranslationForProject({
|
|
|
1662490
1662164
|
const destPath = join2(languageDirectory, relativePath);
|
|
1662491
1662165
|
const destDir = import_path64.default.dirname(destPath);
|
|
1662492
1662166
|
if (!(0, import_fs25.existsSync)(destDir)) {
|
|
1662493
|
-
await (0,
|
|
1662167
|
+
await (0, import_promises140.mkdir)(destDir, { recursive: true });
|
|
1662494
1662168
|
}
|
|
1662495
1662169
|
const transformation = {
|
|
1662496
1662170
|
filePath: relativePath,
|
|
@@ -1662503,7 +1662177,7 @@ async function writeTranslationForProject({
|
|
|
1662503
1662177
|
cliContext,
|
|
1662504
1662178
|
stub
|
|
1662505
1662179
|
});
|
|
1662506
|
-
await (0,
|
|
1662180
|
+
await (0, import_promises140.writeFile)(destPath, transformedContent, "utf-8");
|
|
1662507
1662181
|
const languageStatsForLang = languageStats[language];
|
|
1662508
1662182
|
if (languageStatsForLang) {
|
|
1662509
1662183
|
languageStatsForLang.filesProcessed++;
|
|
@@ -1662534,9 +1662208,9 @@ async function writeTranslationForProject({
|
|
|
1662534
1662208
|
const destPath = join2(languageDirectory, relativePath);
|
|
1662535
1662209
|
const destDir = import_path64.default.dirname(destPath);
|
|
1662536
1662210
|
if (!(0, import_fs25.existsSync)(destDir)) {
|
|
1662537
|
-
await (0,
|
|
1662211
|
+
await (0, import_promises140.mkdir)(destDir, { recursive: true });
|
|
1662538
1662212
|
}
|
|
1662539
|
-
await (0,
|
|
1662213
|
+
await (0, import_promises140.copyFile)(filePath, destPath);
|
|
1662540
1662214
|
assetsCopied++;
|
|
1662541
1662215
|
cliContext.logger.debug(`[ASSET COPIED] ${relativePath} -> ${language}/${relativePath}`);
|
|
1662542
1662216
|
}
|