@fern-api/fern-api-dev 3.52.0-27-g9ab08bc50b3 → 3.52.0-29-gac0ea830b7b
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 +653 -363
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -81013,8 +81013,8 @@ var require_graceful_fs = __commonJS({
|
|
|
81013
81013
|
fs34.createReadStream = createReadStream3;
|
|
81014
81014
|
fs34.createWriteStream = createWriteStream7;
|
|
81015
81015
|
var fs$readFile = fs34.readFile;
|
|
81016
|
-
fs34.readFile =
|
|
81017
|
-
function
|
|
81016
|
+
fs34.readFile = readFile86;
|
|
81017
|
+
function readFile86(path86, options2, cb2) {
|
|
81018
81018
|
if (typeof options2 === "function")
|
|
81019
81019
|
cb2 = options2, options2 = null;
|
|
81020
81020
|
return go$readFile(path86, options2, cb2);
|
|
@@ -1151729,8 +1151729,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
1151729
1151729
|
fs34.createReadStream = createReadStream3;
|
|
1151730
1151730
|
fs34.createWriteStream = createWriteStream7;
|
|
1151731
1151731
|
var fs$readFile = fs34.readFile;
|
|
1151732
|
-
fs34.readFile =
|
|
1151733
|
-
function
|
|
1151732
|
+
fs34.readFile = readFile86;
|
|
1151733
|
+
function readFile86(path86, options2, cb2) {
|
|
1151734
1151734
|
if (typeof options2 === "function")
|
|
1151735
1151735
|
cb2 = options2, options2 = null;
|
|
1151736
1151736
|
return go$readFile(path86, options2, cb2);
|
|
@@ -1175688,7 +1175688,7 @@ var require_jsonfile = __commonJS({
|
|
|
1175688
1175688
|
}
|
|
1175689
1175689
|
return obj;
|
|
1175690
1175690
|
}
|
|
1175691
|
-
var
|
|
1175691
|
+
var readFile86 = universalify.fromPromise(_readFile);
|
|
1175692
1175692
|
function readFileSync12(file4, options2 = {}) {
|
|
1175693
1175693
|
if (typeof options2 === "string") {
|
|
1175694
1175694
|
options2 = { encoding: options2 };
|
|
@@ -1175720,7 +1175720,7 @@ var require_jsonfile = __commonJS({
|
|
|
1175720
1175720
|
return fs33.writeFileSync(file4, str3, options2);
|
|
1175721
1175721
|
}
|
|
1175722
1175722
|
module4.exports = {
|
|
1175723
|
-
readFile:
|
|
1175723
|
+
readFile: readFile86,
|
|
1175724
1175724
|
readFileSync: readFileSync12,
|
|
1175725
1175725
|
writeFile: writeFile77,
|
|
1175726
1175726
|
writeFileSync: writeFileSync5
|
|
@@ -1402815,7 +1402815,7 @@ function parseLogLevel(level) {
|
|
|
1402815
1402815
|
// ../cli-v2/lib/commands/_internal/command.js
|
|
1402816
1402816
|
function command2(cli, name3, description, handler3, builder) {
|
|
1402817
1402817
|
cli.command(name3, description, (yargs) => {
|
|
1402818
|
-
const configured = yargs.usage(`$0 ${name3} [options]
|
|
1402818
|
+
const configured = yargs.version(false).usage(`$0 ${name3} [options]
|
|
1402819
1402819
|
|
|
1402820
1402820
|
${description}`);
|
|
1402821
1402821
|
return builder != null ? builder(configured) : configured;
|
|
@@ -1402851,6 +1402851,52 @@ function addAuthCommand(cli) {
|
|
|
1402851
1402851
|
commandGroup(cli, "auth <command>", "Authenticate fern", [addLoginCommand, addLogoutCommand, addTokenCommand]);
|
|
1402852
1402852
|
}
|
|
1402853
1402853
|
|
|
1402854
|
+
// ../config/lib/schemas/index.js
|
|
1402855
|
+
var schemas_exports4 = {};
|
|
1402856
|
+
__export(schemas_exports4, {
|
|
1402857
|
+
AiConfigSchema: () => AiConfigSchema,
|
|
1402858
|
+
AiProviderSchema: () => AiProviderSchema,
|
|
1402859
|
+
ApiDefinitionSchema: () => ApiDefinitionSchema,
|
|
1402860
|
+
ApiSpecSchema: () => ApiSpecSchema,
|
|
1402861
|
+
ApisSchema: () => ApisSchema,
|
|
1402862
|
+
AsyncApiSettingsSchema: () => AsyncApiSettingsSchema,
|
|
1402863
|
+
AsyncApiSpecSchema: () => AsyncApiSpecSchema,
|
|
1402864
|
+
BaseApiSettingsSchema: () => BaseApiSettingsSchema,
|
|
1402865
|
+
CliSchema: () => CliSchema,
|
|
1402866
|
+
ConjureSettingsSchema: () => ConjureSettingsSchema,
|
|
1402867
|
+
ConjureSpecSchema: () => ConjureSpecSchema,
|
|
1402868
|
+
DefaultIntegerFormatSchema: () => DefaultIntegerFormatSchema,
|
|
1402869
|
+
ExampleGenerationSchema: () => ExampleGenerationSchema,
|
|
1402870
|
+
FernSettingsSchema: () => FernSettingsSchema,
|
|
1402871
|
+
FernSpecSchema: () => FernSpecSchema,
|
|
1402872
|
+
FernYmlSchema: () => FernYmlSchema,
|
|
1402873
|
+
FormParameterEncodingSchema: () => FormParameterEncodingSchema,
|
|
1402874
|
+
GitOutputModeSchema: () => GitOutputModeSchema,
|
|
1402875
|
+
GitOutputSchema: () => GitOutputSchema,
|
|
1402876
|
+
LicenseSchema: () => LicenseSchema,
|
|
1402877
|
+
MessageNamingVersionSchema: () => MessageNamingVersionSchema,
|
|
1402878
|
+
NpmPublishSchema: () => NpmPublishSchema,
|
|
1402879
|
+
OpenApiExampleGenerationSchema: () => OpenApiExampleGenerationSchema,
|
|
1402880
|
+
OpenApiFilterSchema: () => OpenApiFilterSchema,
|
|
1402881
|
+
OpenApiSettingsSchema: () => OpenApiSettingsSchema,
|
|
1402882
|
+
OpenApiSpecSchema: () => OpenApiSpecSchema,
|
|
1402883
|
+
OpenRpcSettingsSchema: () => OpenRpcSettingsSchema,
|
|
1402884
|
+
OpenRpcSpecSchema: () => OpenRpcSpecSchema,
|
|
1402885
|
+
OutputSchema: () => OutputSchema,
|
|
1402886
|
+
PathParameterOrderSchema: () => PathParameterOrderSchema,
|
|
1402887
|
+
ProtobufDefinitionSchema: () => ProtobufDefinitionSchema,
|
|
1402888
|
+
ProtobufSettingsSchema: () => ProtobufSettingsSchema,
|
|
1402889
|
+
ProtobufSpecSchema: () => ProtobufSpecSchema,
|
|
1402890
|
+
PublishSchema: () => PublishSchema,
|
|
1402891
|
+
ReadmeSchema: () => ReadmeSchema,
|
|
1402892
|
+
RemoveDiscriminantsFromSchemasSchema: () => RemoveDiscriminantsFromSchemasSchema,
|
|
1402893
|
+
ResolveAliasesSchema: () => ResolveAliasesSchema,
|
|
1402894
|
+
SdkTargetLanguageSchema: () => SdkTargetLanguageSchema,
|
|
1402895
|
+
SdkTargetSchema: () => SdkTargetSchema,
|
|
1402896
|
+
SdksSchema: () => SdksSchema,
|
|
1402897
|
+
isWellKnownLicense: () => isWellKnownLicense
|
|
1402898
|
+
});
|
|
1402899
|
+
|
|
1402854
1402900
|
// ../../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/classic/external.js
|
|
1402855
1402901
|
var external_exports = {};
|
|
1402856
1402902
|
__export(external_exports, {
|
|
@@ -1416619,6 +1416665,15 @@ function date5(params2) {
|
|
|
1416619
1416665
|
// ../../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/classic/external.js
|
|
1416620
1416666
|
config(en_default());
|
|
1416621
1416667
|
|
|
1416668
|
+
// ../config/lib/schemas/AiProviderSchema.js
|
|
1416669
|
+
var AiProviderSchema = external_exports.enum(["openai", "anthropic", "bedrock"]);
|
|
1416670
|
+
|
|
1416671
|
+
// ../config/lib/schemas/AiConfigSchema.js
|
|
1416672
|
+
var AiConfigSchema = external_exports.object({
|
|
1416673
|
+
provider: AiProviderSchema,
|
|
1416674
|
+
model: external_exports.string()
|
|
1416675
|
+
});
|
|
1416676
|
+
|
|
1416622
1416677
|
// ../config/lib/schemas/settings/PathParameterOrderSchema.js
|
|
1416623
1416678
|
var PathParameterOrderSchema = external_exports.enum(["urlOrder", "specOrder"]);
|
|
1416624
1416679
|
|
|
@@ -1416877,12 +1416932,22 @@ var ReadmeSchema = external_exports.object({
|
|
|
1416877
1416932
|
defaultEndpoint: external_exports.string().optional()
|
|
1416878
1416933
|
});
|
|
1416879
1416934
|
|
|
1416935
|
+
// ../config/lib/schemas/GitOutputModeSchema.js
|
|
1416936
|
+
var GitOutputModeSchema = external_exports.enum(["pr", "release", "push"]);
|
|
1416937
|
+
|
|
1416938
|
+
// ../config/lib/schemas/LicenseSchema.js
|
|
1416939
|
+
var WELL_KNOWN_LICENSES = ["MIT", "Apache-2.0"];
|
|
1416940
|
+
function isWellKnownLicense(license) {
|
|
1416941
|
+
return WELL_KNOWN_LICENSES.includes(license);
|
|
1416942
|
+
}
|
|
1416943
|
+
var LicenseSchema = external_exports.string();
|
|
1416944
|
+
|
|
1416880
1416945
|
// ../config/lib/schemas/GitOutputSchema.js
|
|
1416881
|
-
var GitModeSchema = external_exports.enum(["pr", "release", "push"]);
|
|
1416882
1416946
|
var GitOutputSchema = external_exports.object({
|
|
1416883
1416947
|
repository: external_exports.string(),
|
|
1416884
|
-
mode:
|
|
1416885
|
-
branch: external_exports.string().optional()
|
|
1416948
|
+
mode: GitOutputModeSchema.optional(),
|
|
1416949
|
+
branch: external_exports.string().optional(),
|
|
1416950
|
+
license: LicenseSchema.optional()
|
|
1416886
1416951
|
});
|
|
1416887
1416952
|
|
|
1416888
1416953
|
// ../config/lib/schemas/OutputSchema.js
|
|
@@ -1416918,6 +1416983,7 @@ var SdkTargetLanguageSchema = external_exports.enum([
|
|
|
1416918
1416983
|
var SdkTargetSchema = external_exports.object({
|
|
1416919
1416984
|
api: external_exports.string().optional(),
|
|
1416920
1416985
|
lang: SdkTargetLanguageSchema.optional(),
|
|
1416986
|
+
image: external_exports.string().optional(),
|
|
1416921
1416987
|
version: external_exports.string().optional(),
|
|
1416922
1416988
|
config: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
1416923
1416989
|
publish: PublishSchema.optional(),
|
|
@@ -1416937,6 +1417003,7 @@ var SdksSchema = external_exports.object({
|
|
|
1416937
1417003
|
var FernYmlSchema = external_exports.object({
|
|
1416938
1417004
|
edition: external_exports.string(),
|
|
1416939
1417005
|
org: external_exports.string(),
|
|
1417006
|
+
ai: AiConfigSchema.optional(),
|
|
1416940
1417007
|
cli: CliSchema.optional(),
|
|
1416941
1417008
|
sdks: SdksSchema.optional(),
|
|
1416942
1417009
|
// At most one of 'api' or 'apis' should be present.
|
|
@@ -1642614,6 +1642681,16 @@ var TaskContextAdapter = class {
|
|
|
1642614
1642681
|
}
|
|
1642615
1642682
|
};
|
|
1642616
1642683
|
|
|
1642684
|
+
// ../cli-v2/lib/api/config/ConjureSpec.js
|
|
1642685
|
+
function isConjureSpec(spec) {
|
|
1642686
|
+
return "conjure" in spec;
|
|
1642687
|
+
}
|
|
1642688
|
+
|
|
1642689
|
+
// ../cli-v2/lib/api/config/FernSpec.js
|
|
1642690
|
+
function isFernSpec(spec) {
|
|
1642691
|
+
return "fern" in spec;
|
|
1642692
|
+
}
|
|
1642693
|
+
|
|
1642617
1642694
|
// ../cli-v2/lib/api/config/AsyncApiSpec.js
|
|
1642618
1642695
|
function isAsyncApiSpec(spec) {
|
|
1642619
1642696
|
return "asyncapi" in spec;
|
|
@@ -1642839,12 +1642916,52 @@ var LegacyFernWorkspaceAdapter = class {
|
|
|
1642839
1642916
|
/**
|
|
1642840
1642917
|
* Adapt an ApiDefinition into a FernWorkspace.
|
|
1642841
1642918
|
*
|
|
1642842
|
-
*
|
|
1642843
|
-
*
|
|
1642919
|
+
* Supports three mutually exclusive modes:
|
|
1642920
|
+
* - Fern definition: Uses LazyFernWorkspace
|
|
1642921
|
+
* - Conjure definition: Uses ConjureWorkspace
|
|
1642922
|
+
* - OpenAPI/AsyncAPI/Protobuf: Uses OSSWorkspace (can be mixed together)
|
|
1642923
|
+
*
|
|
1642924
|
+
* Note: Spec combination validation is performed earlier in ApiDefinitionConverter.
|
|
1642844
1642925
|
*/
|
|
1642845
1642926
|
async adapt(definition3) {
|
|
1642927
|
+
const fernSpec = definition3.specs.find(isFernSpec);
|
|
1642928
|
+
if (fernSpec != null) {
|
|
1642929
|
+
return this.adaptFernSpec(fernSpec);
|
|
1642930
|
+
}
|
|
1642931
|
+
const conjureSpec = definition3.specs.find(isConjureSpec);
|
|
1642932
|
+
if (conjureSpec != null) {
|
|
1642933
|
+
return this.adaptConjureSpec(conjureSpec);
|
|
1642934
|
+
}
|
|
1642935
|
+
return this.adaptOssSpecs(definition3.specs);
|
|
1642936
|
+
}
|
|
1642937
|
+
async adaptFernSpec(spec) {
|
|
1642938
|
+
const workspaceRoot = dirname4(spec.fern);
|
|
1642939
|
+
const lazyWorkspace = new LazyFernWorkspace({
|
|
1642940
|
+
absoluteFilePath: workspaceRoot,
|
|
1642941
|
+
context: this.taskContext,
|
|
1642942
|
+
cliVersion: this.cliVersion,
|
|
1642943
|
+
generatorsConfiguration: void 0,
|
|
1642944
|
+
workspaceName: void 0,
|
|
1642945
|
+
changelog: void 0
|
|
1642946
|
+
});
|
|
1642947
|
+
return lazyWorkspace.toFernWorkspace({ context: this.taskContext });
|
|
1642948
|
+
}
|
|
1642949
|
+
async adaptConjureSpec(spec) {
|
|
1642950
|
+
const conjureWorkspace = new ConjureWorkspace({
|
|
1642951
|
+
absoluteFilePath: this.context.cwd,
|
|
1642952
|
+
relativePathToConjureDirectory: relativize(this.context.cwd, spec.conjure),
|
|
1642953
|
+
context: this.taskContext,
|
|
1642954
|
+
cliVersion: this.cliVersion,
|
|
1642955
|
+
generatorsConfiguration: void 0,
|
|
1642956
|
+
workspaceName: void 0,
|
|
1642957
|
+
changelog: void 0
|
|
1642958
|
+
});
|
|
1642959
|
+
return conjureWorkspace.toFernWorkspace({ context: this.taskContext });
|
|
1642960
|
+
}
|
|
1642961
|
+
async adaptOssSpecs(specs) {
|
|
1642962
|
+
const ossSpecs = specs.filter((spec) => !isFernSpec(spec) && !isConjureSpec(spec));
|
|
1642846
1642963
|
const specAdapter = new LegacyApiSpecAdapter({ context: this.context });
|
|
1642847
|
-
const v1Specs = specAdapter.convertAll(
|
|
1642964
|
+
const v1Specs = specAdapter.convertAll(ossSpecs);
|
|
1642848
1642965
|
const filteredSpecs = v1Specs.filter((spec) => {
|
|
1642849
1642966
|
if (spec.type === "openrpc") {
|
|
1642850
1642967
|
return false;
|
|
@@ -1642875,41 +1642992,43 @@ var LegacyFernWorkspaceAdapter = class {
|
|
|
1642875
1642992
|
|
|
1642876
1642993
|
// ../cli-v2/lib/sdk/adapter/LegacyGeneratorInvocationAdapter.js
|
|
1642877
1642994
|
var import_fiddle_sdk6 = __toESM(require_fiddle_sdk(), 1);
|
|
1642995
|
+
var import_promises63 = require("fs/promises");
|
|
1642878
1642996
|
var LegacyGeneratorInvocationAdapter = class {
|
|
1642879
1642997
|
context;
|
|
1642880
1642998
|
constructor(config3) {
|
|
1642881
1642999
|
this.context = config3.context;
|
|
1642882
1643000
|
}
|
|
1642883
|
-
adapt(target) {
|
|
1643001
|
+
async adapt(target) {
|
|
1642884
1643002
|
return {
|
|
1642885
1643003
|
name: target.image,
|
|
1642886
1643004
|
version: target.version,
|
|
1642887
1643005
|
config: target.config,
|
|
1642888
1643006
|
language: this.mapLanguage(target.lang),
|
|
1642889
|
-
outputMode: this.buildOutputMode(target),
|
|
1643007
|
+
outputMode: await this.buildOutputMode(target),
|
|
1642890
1643008
|
absolutePathToLocalOutput: this.context.resolveOutputFilePath(target.output.path),
|
|
1642891
|
-
|
|
1643009
|
+
smartCasing: target.smartCasing ?? true,
|
|
1643010
|
+
readme: target.readme,
|
|
1643011
|
+
// Legacy options which are no longer supported.
|
|
1642892
1643012
|
absolutePathToLocalSnippets: void 0,
|
|
1642893
|
-
keywords: void 0,
|
|
1642894
|
-
smartCasing: false,
|
|
1642895
1643013
|
disableExamples: false,
|
|
1643014
|
+
irVersionOverride: void 0,
|
|
1643015
|
+
keywords: void 0,
|
|
1642896
1643016
|
publishMetadata: void 0,
|
|
1642897
|
-
|
|
1642898
|
-
settings: void 0,
|
|
1642899
|
-
irVersionOverride: void 0
|
|
1643017
|
+
settings: void 0
|
|
1642900
1643018
|
};
|
|
1642901
1643019
|
}
|
|
1642902
|
-
buildOutputMode(target) {
|
|
1643020
|
+
async buildOutputMode(target) {
|
|
1642903
1643021
|
if (target.output.git != null) {
|
|
1642904
1643022
|
const git = target.output.git;
|
|
1642905
1643023
|
const repository = parseRepository2(git.repository);
|
|
1643024
|
+
const license = git.license != null ? await this.convertLicense(git.license) : void 0;
|
|
1642906
1643025
|
switch (git.mode) {
|
|
1642907
1643026
|
case "pr":
|
|
1642908
1643027
|
return import_fiddle_sdk6.FernFiddle.remoteGen.OutputMode.githubV2(import_fiddle_sdk6.FernFiddle.GithubOutputModeV2.pullRequest({
|
|
1642909
1643028
|
owner: repository.owner,
|
|
1642910
1643029
|
repo: repository.repo,
|
|
1643030
|
+
license,
|
|
1642911
1643031
|
publishInfo: void 0,
|
|
1642912
|
-
license: void 0,
|
|
1642913
1643032
|
downloadSnippets: void 0,
|
|
1642914
1643033
|
reviewers: void 0
|
|
1642915
1643034
|
}));
|
|
@@ -1642917,8 +1643036,8 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
1642917
1643036
|
return import_fiddle_sdk6.FernFiddle.remoteGen.OutputMode.githubV2(import_fiddle_sdk6.FernFiddle.GithubOutputModeV2.commitAndRelease({
|
|
1642918
1643037
|
owner: repository.owner,
|
|
1642919
1643038
|
repo: repository.repo,
|
|
1643039
|
+
license,
|
|
1642920
1643040
|
publishInfo: void 0,
|
|
1642921
|
-
license: void 0,
|
|
1642922
1643041
|
downloadSnippets: void 0
|
|
1642923
1643042
|
}));
|
|
1642924
1643043
|
case "push":
|
|
@@ -1642926,8 +1643045,8 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
1642926
1643045
|
owner: repository.owner,
|
|
1642927
1643046
|
repo: repository.repo,
|
|
1642928
1643047
|
branch: git.branch,
|
|
1643048
|
+
license,
|
|
1642929
1643049
|
publishInfo: void 0,
|
|
1642930
|
-
license: void 0,
|
|
1642931
1643050
|
downloadSnippets: void 0
|
|
1642932
1643051
|
}));
|
|
1642933
1643052
|
default:
|
|
@@ -1642936,6 +1643055,28 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
1642936
1643055
|
}
|
|
1642937
1643056
|
return import_fiddle_sdk6.FernFiddle.remoteGen.OutputMode.downloadFiles({});
|
|
1642938
1643057
|
}
|
|
1643058
|
+
async convertLicense(license) {
|
|
1643059
|
+
switch (license.type) {
|
|
1643060
|
+
case "MIT":
|
|
1643061
|
+
return import_fiddle_sdk6.FernFiddle.GithubLicense.basic({
|
|
1643062
|
+
id: import_fiddle_sdk6.FernFiddle.GithubLicenseId.Mit
|
|
1643063
|
+
});
|
|
1643064
|
+
case "Apache-2.0":
|
|
1643065
|
+
return import_fiddle_sdk6.FernFiddle.GithubLicense.basic({
|
|
1643066
|
+
id: import_fiddle_sdk6.FernFiddle.GithubLicenseId.Apache
|
|
1643067
|
+
});
|
|
1643068
|
+
case "custom": {
|
|
1643069
|
+
const absolutePath = join4(this.context.cwd, RelativeFilePath2.of(license.path));
|
|
1643070
|
+
if (!await doesPathExist(absolutePath, "file")) {
|
|
1643071
|
+
throw new Error(`Custom license file "${absolutePath}" does not exist; did you mean to use either MIT or Apache-2.0?`);
|
|
1643072
|
+
}
|
|
1643073
|
+
const contents = await (0, import_promises63.readFile)(absolutePath, "utf-8");
|
|
1643074
|
+
return import_fiddle_sdk6.FernFiddle.GithubLicense.custom({ contents });
|
|
1643075
|
+
}
|
|
1643076
|
+
default:
|
|
1643077
|
+
assertNever(license);
|
|
1643078
|
+
}
|
|
1643079
|
+
}
|
|
1642939
1643080
|
mapLanguage(lang) {
|
|
1642940
1643081
|
const languageMap = {
|
|
1642941
1643082
|
typescript: generators_yml_exports.GenerationLanguage.TYPESCRIPT,
|
|
@@ -1642965,7 +1643106,7 @@ var LegacyGenerationRunner = class {
|
|
|
1642965
1643106
|
async run(args) {
|
|
1642966
1643107
|
const taskContext = new TaskContextAdapter({ context: this.context, task: args.task });
|
|
1642967
1643108
|
try {
|
|
1642968
|
-
const generatorInvocation = this.invocationAdapter.adapt(args.target);
|
|
1643109
|
+
const generatorInvocation = await this.invocationAdapter.adapt(args.target);
|
|
1642969
1643110
|
const generatorGroup = {
|
|
1642970
1643111
|
groupName: args.target.name,
|
|
1642971
1643112
|
audiences: args.audiences ?? { type: "all" },
|
|
@@ -1642975,7 +1643116,8 @@ var LegacyGenerationRunner = class {
|
|
|
1642975
1643116
|
const containerImage = `${args.target.image}:${args.target.version}`;
|
|
1642976
1643117
|
const executionEnvironment = new ContainerExecutionEnvironment({
|
|
1642977
1643118
|
containerImage,
|
|
1642978
|
-
keepContainer: args.keepContainer ?? false
|
|
1643119
|
+
keepContainer: args.keepContainer ?? false,
|
|
1643120
|
+
runner: args.containerEngine
|
|
1642979
1643121
|
});
|
|
1642980
1643122
|
const workspaceAdapter = new LegacyFernWorkspaceAdapter({
|
|
1642981
1643123
|
context: this.context,
|
|
@@ -1642990,12 +1643132,12 @@ var LegacyGenerationRunner = class {
|
|
|
1642990
1643132
|
generatorGroup,
|
|
1642991
1643133
|
context: taskContext,
|
|
1642992
1643134
|
outputVersionOverride: args.version,
|
|
1643135
|
+
ai: args.ai,
|
|
1643136
|
+
absolutePathToFernConfig: void 0,
|
|
1643137
|
+
irVersionOverride: void 0,
|
|
1642993
1643138
|
shouldGenerateDynamicSnippetTests: false,
|
|
1642994
1643139
|
skipUnstableDynamicSnippetTests: true,
|
|
1642995
|
-
|
|
1642996
|
-
absolutePathToFernConfig: void 0,
|
|
1642997
|
-
inspect: false,
|
|
1642998
|
-
ai: void 0
|
|
1643140
|
+
inspect: false
|
|
1642999
1643141
|
});
|
|
1643000
1643142
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
1643001
1643143
|
return {
|
|
@@ -1643028,7 +1643170,7 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
1643028
1643170
|
async run(args) {
|
|
1643029
1643171
|
const taskContext = new TaskContextAdapter({ task: args.task, context: this.context });
|
|
1643030
1643172
|
try {
|
|
1643031
|
-
const generatorInvocation = this.invocationAdapter.adapt(args.target);
|
|
1643173
|
+
const generatorInvocation = await this.invocationAdapter.adapt(args.target);
|
|
1643032
1643174
|
const generatorGroup = {
|
|
1643033
1643175
|
groupName: args.target.name,
|
|
1643034
1643176
|
audiences: args.audiences ?? { type: "all" },
|
|
@@ -1643134,20 +1643276,22 @@ var GeneratorPipeline = class {
|
|
|
1643134
1643276
|
}
|
|
1643135
1643277
|
}
|
|
1643136
1643278
|
async runLocalGeneration(args) {
|
|
1643137
|
-
const
|
|
1643279
|
+
const generationRunner = new LegacyGenerationRunner({
|
|
1643138
1643280
|
context: this.context,
|
|
1643139
1643281
|
cliVersion: this.cliVersion
|
|
1643140
1643282
|
});
|
|
1643141
|
-
const result = await
|
|
1643283
|
+
const result = await generationRunner.run({
|
|
1643142
1643284
|
target: args.target,
|
|
1643143
1643285
|
apiDefinition: args.apiDefinition,
|
|
1643144
1643286
|
organization: args.organization,
|
|
1643287
|
+
ai: args.ai,
|
|
1643145
1643288
|
audiences: args.audiences,
|
|
1643146
1643289
|
version: args.version,
|
|
1643147
1643290
|
keepContainer: args.keepContainer,
|
|
1643148
1643291
|
preview: args.preview,
|
|
1643149
1643292
|
outputPath: args.outputPath,
|
|
1643150
|
-
task: args.task
|
|
1643293
|
+
task: args.task,
|
|
1643294
|
+
containerEngine: args.containerEngine
|
|
1643151
1643295
|
});
|
|
1643152
1643296
|
if (!result.success) {
|
|
1643153
1643297
|
return {
|
|
@@ -1643175,6 +1643319,7 @@ var GeneratorPipeline = class {
|
|
|
1643175
1643319
|
apiDefinition: args.apiDefinition,
|
|
1643176
1643320
|
organization: args.organization,
|
|
1643177
1643321
|
token: args.token,
|
|
1643322
|
+
ai: args.ai,
|
|
1643178
1643323
|
audiences: args.audiences,
|
|
1643179
1643324
|
version: args.version,
|
|
1643180
1643325
|
shouldLogS3Url: args.shouldLogS3Url,
|
|
@@ -1644048,6 +1644193,7 @@ var ApiDefinitionConverter = class {
|
|
|
1644048
1644193
|
return result;
|
|
1644049
1644194
|
}
|
|
1644050
1644195
|
async convertSpecs({ absoluteFernYmlPath, specs, sourced }) {
|
|
1644196
|
+
this.validateSpecCombinations({ specs, sourced });
|
|
1644051
1644197
|
const results = [];
|
|
1644052
1644198
|
for (let i11 = 0; i11 < specs.length; i11++) {
|
|
1644053
1644199
|
const spec = specs[i11];
|
|
@@ -1644239,13 +1644385,76 @@ var ApiDefinitionConverter = class {
|
|
|
1644239
1644385
|
}
|
|
1644240
1644386
|
return absoluteFilePath;
|
|
1644241
1644387
|
}
|
|
1644388
|
+
/**
|
|
1644389
|
+
* Validates that the spec combinations in an API definition are valid.
|
|
1644390
|
+
*
|
|
1644391
|
+
* Rules:
|
|
1644392
|
+
* - At most one Fern spec is allowed
|
|
1644393
|
+
* - At most one Conjure spec is allowed
|
|
1644394
|
+
* - Fern specs cannot be mixed with other spec types
|
|
1644395
|
+
* - Conjure specs cannot be mixed with other spec types
|
|
1644396
|
+
* - OpenAPI/AsyncAPI/Protobuf/OpenRPC specs can be mixed together
|
|
1644397
|
+
*/
|
|
1644398
|
+
validateSpecCombinations({ specs, sourced }) {
|
|
1644399
|
+
const fernSpecs = [];
|
|
1644400
|
+
const conjureSpecs = [];
|
|
1644401
|
+
const ossSpecs = [];
|
|
1644402
|
+
for (let i11 = 0; i11 < specs.length; i11++) {
|
|
1644403
|
+
const spec = specs[i11];
|
|
1644404
|
+
const sourcedSpec = sourced[i11];
|
|
1644405
|
+
if (spec == null || isNullish(sourcedSpec)) {
|
|
1644406
|
+
continue;
|
|
1644407
|
+
}
|
|
1644408
|
+
if ("fern" in spec) {
|
|
1644409
|
+
fernSpecs.push(sourcedSpec);
|
|
1644410
|
+
continue;
|
|
1644411
|
+
}
|
|
1644412
|
+
if ("conjure" in spec) {
|
|
1644413
|
+
conjureSpecs.push(sourcedSpec);
|
|
1644414
|
+
continue;
|
|
1644415
|
+
}
|
|
1644416
|
+
ossSpecs.push(sourcedSpec);
|
|
1644417
|
+
}
|
|
1644418
|
+
if (fernSpecs.length > 1) {
|
|
1644419
|
+
for (const sourced2 of fernSpecs) {
|
|
1644420
|
+
this.issues.push(new ValidationIssue({
|
|
1644421
|
+
message: "Multiple Fern specs are not allowed. Use multiple definition files within a single Fern definition directory instead.",
|
|
1644422
|
+
location: sourced2.fern.$loc
|
|
1644423
|
+
}));
|
|
1644424
|
+
}
|
|
1644425
|
+
}
|
|
1644426
|
+
if (conjureSpecs.length > 1) {
|
|
1644427
|
+
for (const sourced2 of conjureSpecs) {
|
|
1644428
|
+
this.issues.push(new ValidationIssue({
|
|
1644429
|
+
message: "Multiple Conjure specs are not allowed.",
|
|
1644430
|
+
location: sourced2.conjure.$loc
|
|
1644431
|
+
}));
|
|
1644432
|
+
}
|
|
1644433
|
+
}
|
|
1644434
|
+
if (fernSpecs.length > 0 && (conjureSpecs.length > 0 || ossSpecs.length > 0)) {
|
|
1644435
|
+
for (const sourced2 of fernSpecs) {
|
|
1644436
|
+
this.issues.push(new ValidationIssue({
|
|
1644437
|
+
message: "Fern specs cannot be mixed with other spec types. Fern definitions are a standalone definition type.",
|
|
1644438
|
+
location: sourced2.fern.$loc
|
|
1644439
|
+
}));
|
|
1644440
|
+
}
|
|
1644441
|
+
}
|
|
1644442
|
+
if (conjureSpecs.length > 0 && (ossSpecs.length > 0 || fernSpecs.length > 0)) {
|
|
1644443
|
+
for (const sourced2 of conjureSpecs) {
|
|
1644444
|
+
this.issues.push(new ValidationIssue({
|
|
1644445
|
+
message: "Conjure specs cannot be mixed with other spec types. Conjure definitions are a standalone definition type.",
|
|
1644446
|
+
location: sourced2.conjure.$loc
|
|
1644447
|
+
}));
|
|
1644448
|
+
}
|
|
1644449
|
+
}
|
|
1644450
|
+
}
|
|
1644242
1644451
|
};
|
|
1644243
1644452
|
|
|
1644244
1644453
|
// ../cli-v2/lib/sdk/config/Language.js
|
|
1644245
1644454
|
var LANGUAGES = ["csharp", "go", "java", "php", "python", "ruby", "rust", "swift", "typescript"];
|
|
1644246
1644455
|
|
|
1644247
|
-
// ../cli-v2/lib/sdk/config/converter/
|
|
1644248
|
-
var
|
|
1644456
|
+
// ../cli-v2/lib/sdk/config/converter/constants.js
|
|
1644457
|
+
var LANGUAGE_TO_DOCKER_IMAGE = {
|
|
1644249
1644458
|
csharp: "fernapi/fern-csharp-sdk",
|
|
1644250
1644459
|
go: "fernapi/fern-go-sdk",
|
|
1644251
1644460
|
java: "fernapi/fern-java-sdk",
|
|
@@ -1644256,8 +1644465,26 @@ var SDK_DOCKER_IMAGES = {
|
|
|
1644256
1644465
|
swift: "fernapi/fern-swift-sdk",
|
|
1644257
1644466
|
typescript: "fernapi/fern-typescript-sdk"
|
|
1644258
1644467
|
};
|
|
1644259
|
-
|
|
1644260
|
-
|
|
1644468
|
+
var DOCKER_IMAGE_TO_LANGUAGE = {
|
|
1644469
|
+
// Client SDKs
|
|
1644470
|
+
"fernapi/fern-csharp-sdk": "csharp",
|
|
1644471
|
+
"fernapi/fern-go-sdk": "go",
|
|
1644472
|
+
"fernapi/fern-java-sdk": "java",
|
|
1644473
|
+
"fernapi/fern-php-sdk": "php",
|
|
1644474
|
+
"fernapi/fern-python-sdk": "python",
|
|
1644475
|
+
"fernapi/fern-ruby-sdk": "ruby",
|
|
1644476
|
+
"fernapi/fern-rust-sdk": "rust",
|
|
1644477
|
+
"fernapi/fern-swift-sdk": "swift",
|
|
1644478
|
+
"fernapi/fern-typescript-sdk": "typescript",
|
|
1644479
|
+
// Server stubs
|
|
1644480
|
+
"fernapi/fern-typescript-express": "typescript",
|
|
1644481
|
+
"fernapi/fern-fastapi-server": "python",
|
|
1644482
|
+
"fernapi/fern-java-spring": "java"
|
|
1644483
|
+
};
|
|
1644484
|
+
|
|
1644485
|
+
// ../cli-v2/lib/sdk/config/converter/getImageReferenceFromLanguage.js
|
|
1644486
|
+
function getImageReferenceFromLanguage({ lang, version: version7 }) {
|
|
1644487
|
+
const image3 = LANGUAGE_TO_DOCKER_IMAGE[lang];
|
|
1644261
1644488
|
const tag2 = version7 ?? "latest";
|
|
1644262
1644489
|
return {
|
|
1644263
1644490
|
image: image3,
|
|
@@ -1644265,6 +1644492,11 @@ function getDockerImageReference({ lang, version: version7 }) {
|
|
|
1644265
1644492
|
};
|
|
1644266
1644493
|
}
|
|
1644267
1644494
|
|
|
1644495
|
+
// ../cli-v2/lib/sdk/config/converter/getLanguageFromImage.js
|
|
1644496
|
+
function getLanguageFromImage({ image: image3 }) {
|
|
1644497
|
+
return DOCKER_IMAGE_TO_LANGUAGE[image3];
|
|
1644498
|
+
}
|
|
1644499
|
+
|
|
1644268
1644500
|
// ../cli-v2/lib/sdk/config/converter/SdkConfigConverter.js
|
|
1644269
1644501
|
var SdkConfigConverter = class {
|
|
1644270
1644502
|
logger;
|
|
@@ -1644331,16 +1644563,15 @@ var SdkConfigConverter = class {
|
|
|
1644331
1644563
|
return targets2;
|
|
1644332
1644564
|
}
|
|
1644333
1644565
|
convertTarget({ name: name3, target, sourced }) {
|
|
1644334
|
-
const
|
|
1644335
|
-
if (
|
|
1644566
|
+
const generatorInfo = this.resolveGeneratorInfo({ name: name3, target, sourced });
|
|
1644567
|
+
if (generatorInfo == null) {
|
|
1644336
1644568
|
return void 0;
|
|
1644337
1644569
|
}
|
|
1644338
|
-
const resolvedDockerImage = this.resolveDockerImage({ name: name3, lang, version: target.version });
|
|
1644339
1644570
|
return {
|
|
1644340
1644571
|
name: name3,
|
|
1644341
|
-
lang,
|
|
1644342
|
-
image:
|
|
1644343
|
-
version:
|
|
1644572
|
+
lang: generatorInfo.lang,
|
|
1644573
|
+
image: generatorInfo.image,
|
|
1644574
|
+
version: generatorInfo.version,
|
|
1644344
1644575
|
api: this.resolveApi({ api: target.api }),
|
|
1644345
1644576
|
config: target.config != null ? this.convertConfig(target.config) : void 0,
|
|
1644346
1644577
|
output: this.convertOutput({ output: target.output, sourced: sourced.output }),
|
|
@@ -1644351,12 +1644582,17 @@ var SdkConfigConverter = class {
|
|
|
1644351
1644582
|
resolveApi({ api }) {
|
|
1644352
1644583
|
return api ?? DEFAULT_API_NAME;
|
|
1644353
1644584
|
}
|
|
1644354
|
-
|
|
1644355
|
-
const
|
|
1644356
|
-
if (
|
|
1644357
|
-
|
|
1644585
|
+
resolveGeneratorInfo({ name: name3, target, sourced }) {
|
|
1644586
|
+
const lang = this.resolveLanguage({ name: name3, target, sourced });
|
|
1644587
|
+
if (lang == null) {
|
|
1644588
|
+
return void 0;
|
|
1644358
1644589
|
}
|
|
1644359
|
-
|
|
1644590
|
+
const resolvedDockerImage = this.resolveDockerImage({ name: name3, lang, version: target.version });
|
|
1644591
|
+
return {
|
|
1644592
|
+
lang,
|
|
1644593
|
+
image: resolvedDockerImage.image,
|
|
1644594
|
+
version: resolvedDockerImage.tag
|
|
1644595
|
+
};
|
|
1644360
1644596
|
}
|
|
1644361
1644597
|
convertConfig(config3) {
|
|
1644362
1644598
|
return config3;
|
|
@@ -1644371,9 +1644607,16 @@ var SdkConfigConverter = class {
|
|
|
1644371
1644607
|
return {
|
|
1644372
1644608
|
repository: git.repository,
|
|
1644373
1644609
|
mode: git.mode ?? "pr",
|
|
1644374
|
-
branch: git.branch
|
|
1644610
|
+
branch: git.branch,
|
|
1644611
|
+
license: git.license != null ? this.convertLicense(git.license) : void 0
|
|
1644375
1644612
|
};
|
|
1644376
1644613
|
}
|
|
1644614
|
+
convertLicense(license) {
|
|
1644615
|
+
if (schemas_exports4.isWellKnownLicense(license)) {
|
|
1644616
|
+
return { type: license };
|
|
1644617
|
+
}
|
|
1644618
|
+
return { type: "custom", path: license };
|
|
1644619
|
+
}
|
|
1644377
1644620
|
convertPublish({ publish: publish2, sourced }) {
|
|
1644378
1644621
|
return {
|
|
1644379
1644622
|
npm: publish2.npm != null && !isNullish(sourced.npm) ? this.convertNpm({ npm: publish2.npm, sourced: sourced.npm }) : void 0
|
|
@@ -1644388,6 +1644631,9 @@ var SdkConfigConverter = class {
|
|
|
1644388
1644631
|
if (target.lang != null) {
|
|
1644389
1644632
|
return target.lang;
|
|
1644390
1644633
|
}
|
|
1644634
|
+
if (target.image != null) {
|
|
1644635
|
+
return getLanguageFromImage({ image: target.image });
|
|
1644636
|
+
}
|
|
1644391
1644637
|
const lang = name3;
|
|
1644392
1644638
|
if (LANGUAGES.includes(lang)) {
|
|
1644393
1644639
|
return lang;
|
|
@@ -1644398,6 +1644644,13 @@ var SdkConfigConverter = class {
|
|
|
1644398
1644644
|
}));
|
|
1644399
1644645
|
return void 0;
|
|
1644400
1644646
|
}
|
|
1644647
|
+
resolveDockerImage({ name: name3, lang, version: version7 }) {
|
|
1644648
|
+
const dockerImage = getImageReferenceFromLanguage({ lang, version: version7 });
|
|
1644649
|
+
if (version7 == null) {
|
|
1644650
|
+
this.logger.debug(`Target "${name3}" has no version specified, using ${dockerImage}`);
|
|
1644651
|
+
}
|
|
1644652
|
+
return dockerImage;
|
|
1644653
|
+
}
|
|
1644401
1644654
|
};
|
|
1644402
1644655
|
|
|
1644403
1644656
|
// ../cli-v2/lib/version.js
|
|
@@ -1644419,6 +1644672,7 @@ var WorkspaceLoader = class {
|
|
|
1644419
1644672
|
issues: fernYml.issues
|
|
1644420
1644673
|
};
|
|
1644421
1644674
|
}
|
|
1644675
|
+
const ai6 = this.convertAi({ fernYml });
|
|
1644422
1644676
|
const apis = await this.convertApis({ fernYml });
|
|
1644423
1644677
|
const cliVersion = await this.convertCliVersion({ fernYml });
|
|
1644424
1644678
|
const sdks = await this.convertSdks({ fernYml });
|
|
@@ -1644429,6 +1644683,7 @@ var WorkspaceLoader = class {
|
|
|
1644429
1644683
|
};
|
|
1644430
1644684
|
}
|
|
1644431
1644685
|
const workspace = {
|
|
1644686
|
+
ai: ai6,
|
|
1644432
1644687
|
apis,
|
|
1644433
1644688
|
org: fernYml.data.org,
|
|
1644434
1644689
|
cliVersion,
|
|
@@ -1644446,6 +1644701,16 @@ var WorkspaceLoader = class {
|
|
|
1644446
1644701
|
workspace
|
|
1644447
1644702
|
};
|
|
1644448
1644703
|
}
|
|
1644704
|
+
convertAi({ fernYml }) {
|
|
1644705
|
+
const ai6 = fernYml.data.ai;
|
|
1644706
|
+
if (ai6 == null) {
|
|
1644707
|
+
return void 0;
|
|
1644708
|
+
}
|
|
1644709
|
+
return {
|
|
1644710
|
+
provider: ai6.provider,
|
|
1644711
|
+
model: ai6.model
|
|
1644712
|
+
};
|
|
1644713
|
+
}
|
|
1644449
1644714
|
async convertApis({ fernYml }) {
|
|
1644450
1644715
|
const apiConverter = new ApiDefinitionConverter({ cwd: this.cwd });
|
|
1644451
1644716
|
const apiResult = await apiConverter.convert({ fernYml });
|
|
@@ -1644515,44 +1644780,45 @@ var WorkspaceLoader = class {
|
|
|
1644515
1644780
|
|
|
1644516
1644781
|
// ../cli-v2/lib/commands/sdk/generate/command.js
|
|
1644517
1644782
|
function addGenerateCommand(cli) {
|
|
1644518
|
-
command2(
|
|
1644519
|
-
|
|
1644520
|
-
"generate"
|
|
1644521
|
-
|
|
1644522
|
-
|
|
1644523
|
-
|
|
1644524
|
-
|
|
1644525
|
-
|
|
1644526
|
-
|
|
1644527
|
-
|
|
1644528
|
-
|
|
1644529
|
-
|
|
1644530
|
-
|
|
1644531
|
-
|
|
1644532
|
-
|
|
1644533
|
-
|
|
1644534
|
-
|
|
1644535
|
-
|
|
1644536
|
-
|
|
1644537
|
-
|
|
1644538
|
-
|
|
1644539
|
-
|
|
1644540
|
-
|
|
1644541
|
-
|
|
1644542
|
-
|
|
1644543
|
-
|
|
1644544
|
-
|
|
1644545
|
-
|
|
1644546
|
-
|
|
1644547
|
-
|
|
1644548
|
-
|
|
1644549
|
-
|
|
1644550
|
-
)
|
|
1644783
|
+
command2(cli, "generate", "Generate SDKs configured in fern.yml", handleGenerate, (yargs) => yargs.option("target", {
|
|
1644784
|
+
type: "string",
|
|
1644785
|
+
description: "The SDK target to generate"
|
|
1644786
|
+
}).option("group", {
|
|
1644787
|
+
type: "string",
|
|
1644788
|
+
description: "The SDK group to generate"
|
|
1644789
|
+
}).option("audiences", {
|
|
1644790
|
+
type: "array",
|
|
1644791
|
+
string: true,
|
|
1644792
|
+
description: "Filter the target API(s) with the given audiences"
|
|
1644793
|
+
}).option("local", {
|
|
1644794
|
+
type: "boolean",
|
|
1644795
|
+
default: false,
|
|
1644796
|
+
description: "Run the generator locally in a container"
|
|
1644797
|
+
}).option("container-engine", {
|
|
1644798
|
+
choices: ["docker", "podman"],
|
|
1644799
|
+
description: "Choose the container engine to use for local generation"
|
|
1644800
|
+
}).option("keep-container", {
|
|
1644801
|
+
type: "boolean",
|
|
1644802
|
+
default: false,
|
|
1644803
|
+
description: "Prevent auto-deletion of any containers used for local generation"
|
|
1644804
|
+
}).option("preview", {
|
|
1644805
|
+
type: "boolean",
|
|
1644806
|
+
default: false,
|
|
1644807
|
+
description: "Generate a preview of the generated SDK in a local preview directory"
|
|
1644808
|
+
}).option("output", {
|
|
1644809
|
+
type: "string",
|
|
1644810
|
+
description: "Output directory for preview mode (requires --preview)"
|
|
1644811
|
+
}).option("force", {
|
|
1644812
|
+
type: "boolean",
|
|
1644813
|
+
default: false,
|
|
1644814
|
+
description: "Ignore prompts to confirm generation"
|
|
1644815
|
+
}).option("version", {
|
|
1644816
|
+
type: "string",
|
|
1644817
|
+
description: "The version to use for the generated packages (e.g. 1.0.0)"
|
|
1644818
|
+
}));
|
|
1644551
1644819
|
}
|
|
1644552
1644820
|
async function handleGenerate(context2, args) {
|
|
1644553
|
-
|
|
1644554
|
-
throw new Error("The --output flag can only be used with --preview");
|
|
1644555
|
-
}
|
|
1644821
|
+
validateArgs(args);
|
|
1644556
1644822
|
const fernYml = await loadFernYml({ cwd: context2.cwd });
|
|
1644557
1644823
|
const loader2 = new WorkspaceLoader({ cwd: context2.cwd, logger: context2.stderr });
|
|
1644558
1644824
|
const result = await loader2.load({ fernYml });
|
|
@@ -1644610,15 +1644876,19 @@ async function handleGenerate(context2, args) {
|
|
|
1644610
1644876
|
}
|
|
1644611
1644877
|
});
|
|
1644612
1644878
|
const result2 = await pipeline5.run({
|
|
1644879
|
+
organization: workspace.org,
|
|
1644880
|
+
ai: workspace.ai,
|
|
1644613
1644881
|
task,
|
|
1644614
1644882
|
target,
|
|
1644615
1644883
|
apiDefinition,
|
|
1644884
|
+
audiences: parseAudiences2(args.audiences),
|
|
1644616
1644885
|
runtime,
|
|
1644886
|
+
containerEngine: args["container-engine"] ?? "docker",
|
|
1644617
1644887
|
keepContainer: args["keep-container"] ?? false,
|
|
1644618
1644888
|
preview: args.preview ?? false,
|
|
1644619
1644889
|
outputPath: args.output != null ? resolve5(context2.cwd, args.output) : void 0,
|
|
1644620
|
-
|
|
1644621
|
-
|
|
1644890
|
+
token,
|
|
1644891
|
+
version: args.version
|
|
1644622
1644892
|
});
|
|
1644623
1644893
|
if (!result2.success) {
|
|
1644624
1644894
|
taskGroup.updateTask({
|
|
@@ -1644669,6 +1644939,26 @@ function filterTargetsByGroup(targets2, groupName) {
|
|
|
1644669
1644939
|
}
|
|
1644670
1644940
|
return targets2.filter((target) => target.groups?.includes(groupName));
|
|
1644671
1644941
|
}
|
|
1644942
|
+
function parseAudiences2(audiences) {
|
|
1644943
|
+
if (audiences == null || audiences.length === 0) {
|
|
1644944
|
+
return void 0;
|
|
1644945
|
+
}
|
|
1644946
|
+
return {
|
|
1644947
|
+
type: "select",
|
|
1644948
|
+
audiences
|
|
1644949
|
+
};
|
|
1644950
|
+
}
|
|
1644951
|
+
function validateArgs(args) {
|
|
1644952
|
+
if (args.output != null && !args.preview) {
|
|
1644953
|
+
throw new Error("The --output flag can only be used with --preview");
|
|
1644954
|
+
}
|
|
1644955
|
+
if (args["container-engine"] != null && !args.local) {
|
|
1644956
|
+
throw new Error("The --container-engine flag can only be used with --local");
|
|
1644957
|
+
}
|
|
1644958
|
+
if (args.group != null && args.target != null) {
|
|
1644959
|
+
throw new Error("The --group and --target flags cannot be used together");
|
|
1644960
|
+
}
|
|
1644961
|
+
}
|
|
1644672
1644962
|
function maybePluralSdks(targets2) {
|
|
1644673
1644963
|
return targets2.length === 1 ? "SDK" : "SDKs";
|
|
1644674
1644964
|
}
|
|
@@ -1644710,7 +1645000,7 @@ function createCliV2(argv) {
|
|
|
1644710
1645000
|
}
|
|
1644711
1645001
|
|
|
1644712
1645002
|
// ../init/lib/initializeAPI.js
|
|
1644713
|
-
var
|
|
1645003
|
+
var import_promises68 = require("fs/promises");
|
|
1644714
1645004
|
var import_fs_extra = __toESM(require_lib10(), 1);
|
|
1644715
1645005
|
var import_path50 = __toESM(require("path"), 1);
|
|
1644716
1645006
|
|
|
@@ -1650633,7 +1650923,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1650633
1650923
|
properties: {
|
|
1650634
1650924
|
...event,
|
|
1650635
1650925
|
...event.properties,
|
|
1650636
|
-
version: "3.52.0-
|
|
1650926
|
+
version: "3.52.0-29-gac0ea830b7b",
|
|
1650637
1650927
|
usingAccessToken: true
|
|
1650638
1650928
|
}
|
|
1650639
1650929
|
});
|
|
@@ -1650655,7 +1650945,7 @@ var NoopPosthogManager = class {
|
|
|
1650655
1650945
|
};
|
|
1650656
1650946
|
|
|
1650657
1650947
|
// ../posthog-manager/lib/UserPosthogManager.js
|
|
1650658
|
-
var
|
|
1650948
|
+
var import_promises64 = require("fs/promises");
|
|
1650659
1650949
|
var import_os5 = require("os");
|
|
1650660
1650950
|
var import_path49 = require("path");
|
|
1650661
1650951
|
var DISTINCT_ID_FILENAME = "id";
|
|
@@ -1650683,7 +1650973,7 @@ var UserPosthogManager = class {
|
|
|
1650683
1650973
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1650684
1650974
|
event: "CLI",
|
|
1650685
1650975
|
properties: {
|
|
1650686
|
-
version: "3.52.0-
|
|
1650976
|
+
version: "3.52.0-29-gac0ea830b7b",
|
|
1650687
1650977
|
...event,
|
|
1650688
1650978
|
...event.properties,
|
|
1650689
1650979
|
usingAccessToken: false,
|
|
@@ -1650722,10 +1651012,10 @@ var UserPosthogManager = class {
|
|
|
1650722
1651012
|
if (this.persistedDistinctId == null) {
|
|
1650723
1651013
|
const pathToFile = join4(AbsoluteFilePath2.of((0, import_os5.homedir)()), RelativeFilePath2.of(LOCAL_STORAGE_FOLDER3), RelativeFilePath2.of(DISTINCT_ID_FILENAME));
|
|
1650724
1651014
|
if (!await doesPathExist(pathToFile)) {
|
|
1650725
|
-
await (0,
|
|
1650726
|
-
await (0,
|
|
1651015
|
+
await (0, import_promises64.mkdir)((0, import_path49.dirname)(pathToFile), { recursive: true });
|
|
1651016
|
+
await (0, import_promises64.writeFile)(pathToFile, v4_default());
|
|
1650727
1651017
|
}
|
|
1650728
|
-
this.persistedDistinctId = (await (0,
|
|
1651018
|
+
this.persistedDistinctId = (await (0, import_promises64.readFile)(pathToFile)).toString();
|
|
1650729
1651019
|
}
|
|
1650730
1651020
|
return this.persistedDistinctId;
|
|
1650731
1651021
|
}
|
|
@@ -1651804,7 +1652094,7 @@ function constructAuth0LogoutUrl() {
|
|
|
1651804
1652094
|
}
|
|
1651805
1652095
|
|
|
1651806
1652096
|
// ../init/lib/createFernDirectoryAndOrganization.js
|
|
1651807
|
-
var
|
|
1652097
|
+
var import_promises65 = require("fs/promises");
|
|
1651808
1652098
|
var GITIGNORE_CONTENT = "**/.preview\n**/.definition\n";
|
|
1651809
1652099
|
async function createFernDirectoryAndWorkspace({ organization, taskContext, versionOfCli }) {
|
|
1651810
1652100
|
const pathToFernDirectory = join4(cwd(), RelativeFilePath2.of(FERN_DIRECTORY));
|
|
@@ -1651833,7 +1652123,7 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
|
|
|
1651833
1652123
|
}
|
|
1651834
1652124
|
}
|
|
1651835
1652125
|
}
|
|
1651836
|
-
await (0,
|
|
1652126
|
+
await (0, import_promises65.mkdir)(FERN_DIRECTORY);
|
|
1651837
1652127
|
await writeProjectConfig({
|
|
1651838
1652128
|
filepath: join4(pathToFernDirectory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)),
|
|
1651839
1652129
|
organization,
|
|
@@ -1651857,11 +1652147,11 @@ async function writeProjectConfig({ organization, filepath, versionOfCli }) {
|
|
|
1651857
1652147
|
organization,
|
|
1651858
1652148
|
version: versionOfCli
|
|
1651859
1652149
|
};
|
|
1651860
|
-
await (0,
|
|
1652150
|
+
await (0, import_promises65.writeFile)(filepath, JSON.stringify(projectConfig, void 0, 4));
|
|
1651861
1652151
|
}
|
|
1651862
1652152
|
async function writeGitignore({ absolutePathToFernDirectory }) {
|
|
1651863
1652153
|
const gitignorePath = join4(absolutePathToFernDirectory, RelativeFilePath2.of(".gitignore"));
|
|
1651864
|
-
await (0,
|
|
1652154
|
+
await (0, import_promises65.writeFile)(gitignorePath, GITIGNORE_CONTENT);
|
|
1651865
1652155
|
}
|
|
1651866
1652156
|
|
|
1651867
1652157
|
// ../fern-definition/formatter/lib/FernDefinitionFileFormatter.js
|
|
@@ -1652045,7 +1652335,7 @@ async function formatDefinitionFile({ fileContents }) {
|
|
|
1652045
1652335
|
}
|
|
1652046
1652336
|
|
|
1652047
1652337
|
// ../fern-definition/formatter/lib/formatWorkspace.js
|
|
1652048
|
-
var
|
|
1652338
|
+
var import_promises66 = require("fs/promises");
|
|
1652049
1652339
|
async function formatFernWorkspace({ workspace, context: context2, shouldFix }) {
|
|
1652050
1652340
|
for (const [relativeFilepath, file4] of entries(workspace.definition.namedDefinitionFiles)) {
|
|
1652051
1652341
|
const formatted = await formatDefinitionFile({
|
|
@@ -1652053,7 +1652343,7 @@ async function formatFernWorkspace({ workspace, context: context2, shouldFix })
|
|
|
1652053
1652343
|
});
|
|
1652054
1652344
|
if (formatted !== file4.rawContents) {
|
|
1652055
1652345
|
if (shouldFix) {
|
|
1652056
|
-
await (0,
|
|
1652346
|
+
await (0, import_promises66.writeFile)(file4.absoluteFilePath, formatted);
|
|
1652057
1652347
|
context2.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
|
|
1652058
1652348
|
} else {
|
|
1652059
1652349
|
context2.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
|
|
@@ -1652064,7 +1652354,7 @@ async function formatFernWorkspace({ workspace, context: context2, shouldFix })
|
|
|
1652064
1652354
|
}
|
|
1652065
1652355
|
|
|
1652066
1652356
|
// ../init/lib/createWorkspace.js
|
|
1652067
|
-
var
|
|
1652357
|
+
var import_promises67 = require("fs/promises");
|
|
1652068
1652358
|
|
|
1652069
1652359
|
// ../init/lib/sampleImdbApi.js
|
|
1652070
1652360
|
var SAMPLE_IMDB_API = `
|
|
@@ -1652132,7 +1652422,7 @@ errors:
|
|
|
1652132
1652422
|
// ../init/lib/createWorkspace.js
|
|
1652133
1652423
|
async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context: context2 }) {
|
|
1652134
1652424
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
1652135
|
-
await (0,
|
|
1652425
|
+
await (0, import_promises67.mkdir)(directoryOfWorkspace);
|
|
1652136
1652426
|
}
|
|
1652137
1652427
|
await writeGeneratorsConfiguration({
|
|
1652138
1652428
|
filepath: join4(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -1652146,7 +1652436,7 @@ async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context:
|
|
|
1652146
1652436
|
}
|
|
1652147
1652437
|
async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, cliVersion, context: context2 }) {
|
|
1652148
1652438
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
1652149
|
-
await (0,
|
|
1652439
|
+
await (0, import_promises67.mkdir)(directoryOfWorkspace);
|
|
1652150
1652440
|
}
|
|
1652151
1652441
|
await writeGeneratorsConfiguration({
|
|
1652152
1652442
|
filepath: join4(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -1652192,7 +1652482,7 @@ async function getDefaultGeneratorsConfiguration({ cliVersion, context: context2
|
|
|
1652192
1652482
|
return config3;
|
|
1652193
1652483
|
}
|
|
1652194
1652484
|
async function writeGeneratorsConfiguration({ filepath, cliVersion, context: context2, apiConfiguration }) {
|
|
1652195
|
-
await (0,
|
|
1652485
|
+
await (0, import_promises67.writeFile)(filepath, "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(await getDefaultGeneratorsConfiguration({ cliVersion, context: context2, apiConfiguration }), {
|
|
1652196
1652486
|
sortKeys: (a10, b18) => {
|
|
1652197
1652487
|
if (a10 === "api") {
|
|
1652198
1652488
|
return -1;
|
|
@@ -1652211,10 +1652501,10 @@ var ROOT_API = {
|
|
|
1652211
1652501
|
}
|
|
1652212
1652502
|
};
|
|
1652213
1652503
|
async function writeSampleApiDefinition({ directoryOfDefinition }) {
|
|
1652214
|
-
await (0,
|
|
1652215
|
-
await (0,
|
|
1652504
|
+
await (0, import_promises67.mkdir)(directoryOfDefinition);
|
|
1652505
|
+
await (0, import_promises67.writeFile)(join4(directoryOfDefinition, RelativeFilePath2.of(ROOT_API_FILENAME)), jsYaml.dump(ROOT_API));
|
|
1652216
1652506
|
const absoluteFilepathToImdbYaml = join4(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
|
|
1652217
|
-
await (0,
|
|
1652507
|
+
await (0, import_promises67.writeFile)(absoluteFilepathToImdbYaml, await formatDefinitionFile({
|
|
1652218
1652508
|
fileContents: SAMPLE_IMDB_API
|
|
1652219
1652509
|
}));
|
|
1652220
1652510
|
}
|
|
@@ -1652260,13 +1652550,13 @@ async function getDirectoryOfNewAPIWorkspace({ absolutePathToFernDirectory, task
|
|
|
1652260
1652550
|
const apiWorkspaceDirectory = join4(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api"));
|
|
1652261
1652551
|
const inlinedDefinitionDirectory = join4(absolutePathToFernDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
1652262
1652552
|
const workspaceDefinitionDirectory = join4(apiWorkspaceDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
1652263
|
-
await (0,
|
|
1652553
|
+
await (0, import_promises68.mkdir)(apiWorkspaceDirectory, { recursive: true });
|
|
1652264
1652554
|
await import_fs_extra.default.move(inlinedDefinitionDirectory, workspaceDefinitionDirectory);
|
|
1652265
1652555
|
const inlinedGeneratorsYml = join4(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME));
|
|
1652266
1652556
|
const workspaceGeneratorsYml = join4(apiWorkspaceDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME));
|
|
1652267
1652557
|
await import_fs_extra.default.move(inlinedGeneratorsYml, workspaceGeneratorsYml);
|
|
1652268
1652558
|
const newApiDirectory = join4(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api1"));
|
|
1652269
|
-
await (0,
|
|
1652559
|
+
await (0, import_promises68.mkdir)(workspaceDefinitionDirectory, { recursive: true });
|
|
1652270
1652560
|
return newApiDirectory;
|
|
1652271
1652561
|
}
|
|
1652272
1652562
|
return absolutePathToFernDirectory;
|
|
@@ -1652281,7 +1652571,7 @@ async function hasInlinedAPIDefinitions({ absolutePathToFernDirectory }) {
|
|
|
1652281
1652571
|
}
|
|
1652282
1652572
|
|
|
1652283
1652573
|
// ../init/lib/initializeDocs.js
|
|
1652284
|
-
var
|
|
1652574
|
+
var import_promises69 = require("fs/promises");
|
|
1652285
1652575
|
|
|
1652286
1652576
|
// ../../commons/core-utils/src/titleCase.ts
|
|
1652287
1652577
|
var import_title5 = __toESM(require_lib(), 1);
|
|
@@ -1652697,7 +1652987,7 @@ async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
|
1652697
1652987
|
} else {
|
|
1652698
1652988
|
try {
|
|
1652699
1652989
|
const docsConfig = getDocsConfig(createDirectoryResponse.organization);
|
|
1652700
|
-
await (0,
|
|
1652990
|
+
await (0, import_promises69.writeFile)(docsYmlPath, jsYaml.dump(docsConfig));
|
|
1652701
1652991
|
taskContext.logger.info(source_default.green("Created docs configuration"));
|
|
1652702
1652992
|
return;
|
|
1652703
1652993
|
} catch (writeError) {
|
|
@@ -1652745,7 +1653035,7 @@ var FernDocsBuilder = class {
|
|
|
1652745
1653035
|
};
|
|
1652746
1653036
|
|
|
1652747
1653037
|
// ../docs-importers/commons/lib/FernDocsBuilderImpl.js
|
|
1652748
|
-
var
|
|
1653038
|
+
var import_promises70 = require("fs/promises");
|
|
1652749
1653039
|
var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
1652750
1653040
|
openApiSpecs = {};
|
|
1652751
1653041
|
nonTabbedNavigation = new NonTabbedNavigationBuilderImpl();
|
|
@@ -1652804,7 +1653094,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
1652804
1653094
|
}
|
|
1652805
1653095
|
async build({ outputDirectory }) {
|
|
1652806
1653096
|
const absolutePathToFernDirectory = join4(outputDirectory, RelativeFilePath2.of(FERN_DIRECTORY));
|
|
1652807
|
-
await (0,
|
|
1653097
|
+
await (0, import_promises70.mkdir)(absolutePathToFernDirectory, { recursive: true });
|
|
1652808
1653098
|
if (Object.keys(this.tabbedNavigation).length > 0) {
|
|
1652809
1653099
|
this.docsYml.tabs = Object.fromEntries(Object.entries(this.tabbedNavigation).map(([key2, value]) => {
|
|
1652810
1653100
|
return [value.tabId, value.tabConfig];
|
|
@@ -1652829,27 +1653119,27 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
1652829
1653119
|
}))
|
|
1652830
1653120
|
};
|
|
1652831
1653121
|
}
|
|
1652832
|
-
await (0,
|
|
1653122
|
+
await (0, import_promises70.writeFile)(join4(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)), jsYaml.dump(generators_yml_exports.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml)));
|
|
1652833
1653123
|
await Promise.all(Object.entries(this.openApiSpecs).map(async ([relativePath, absolutePath]) => {
|
|
1652834
1653124
|
const absolutePathToOpenAPI = join4(absolutePathToFernDirectory, RelativeFilePath2.of(relativePath));
|
|
1652835
|
-
await (0,
|
|
1652836
|
-
await (0,
|
|
1653125
|
+
await (0, import_promises70.mkdir)(dirname4(absolutePathToOpenAPI), { recursive: true });
|
|
1653126
|
+
await (0, import_promises70.cp)(absolutePath, absolutePathToOpenAPI);
|
|
1652837
1653127
|
}));
|
|
1652838
1653128
|
}
|
|
1652839
|
-
await (0,
|
|
1653129
|
+
await (0, import_promises70.writeFile)(join4(absolutePathToFernDirectory, RelativeFilePath2.of(DOCS_CONFIGURATION_FILENAME)), jsYaml.dump(docs_yml_exports.RawSchemas.Serializer.DocsConfiguration.jsonOrThrow(this.docsYml, { omitUndefined: true })));
|
|
1652840
1653130
|
await Promise.all(Object.entries(this.markdownPages).map(async ([filepath, page]) => {
|
|
1652841
1653131
|
const absoluteFilepathToMarkdownPage = join4(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
1652842
|
-
await (0,
|
|
1653132
|
+
await (0, import_promises70.mkdir)(dirname4(absoluteFilepathToMarkdownPage), { recursive: true });
|
|
1652843
1653133
|
const frontmatter = Object.keys(page.frontmatter).length > 0 ? `---
|
|
1652844
1653134
|
${jsYaml.dump(JSON.parse(JSON.stringify(page.frontmatter)))}---
|
|
1652845
1653135
|
|
|
1652846
1653136
|
` : "";
|
|
1652847
|
-
await (0,
|
|
1653137
|
+
await (0, import_promises70.writeFile)(absoluteFilepathToMarkdownPage, `${frontmatter}${page.markdown}`);
|
|
1652848
1653138
|
}));
|
|
1652849
1653139
|
await Promise.all(Object.entries(this.assets).map(async ([filepath, asset]) => {
|
|
1652850
1653140
|
const absolutePathToAsset = join4(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
1652851
|
-
await (0,
|
|
1652852
|
-
await (0,
|
|
1653141
|
+
await (0, import_promises70.mkdir)(dirname4(absolutePathToAsset), { recursive: true });
|
|
1653142
|
+
await (0, import_promises70.cp)(asset.absoluteFilePathToAsset, absolutePathToAsset);
|
|
1652853
1653143
|
}));
|
|
1652854
1653144
|
}
|
|
1652855
1653145
|
setInstance({ companyName }) {
|
|
@@ -1652881,7 +1653171,7 @@ var NonTabbedNavigationBuilderImpl = class {
|
|
|
1652881
1653171
|
};
|
|
1652882
1653172
|
|
|
1652883
1653173
|
// ../docs-importers/mintlify/lib/MintlifyImporter.js
|
|
1652884
|
-
var
|
|
1653174
|
+
var import_promises72 = require("fs/promises");
|
|
1652885
1653175
|
|
|
1652886
1653176
|
// ../docs-importers/mintlify/lib/convertColors.js
|
|
1652887
1653177
|
function convertColors(colors19) {
|
|
@@ -1652935,10 +1653225,10 @@ function convertLogo({ logo, builder, absolutePathToMintJson }) {
|
|
|
1652935
1653225
|
}
|
|
1652936
1653226
|
|
|
1652937
1653227
|
// ../docs-importers/mintlify/lib/convertMarkdown.js
|
|
1652938
|
-
var
|
|
1653228
|
+
var import_promises71 = require("fs/promises");
|
|
1652939
1653229
|
var import_gray_matter6 = __toESM(require_gray_matter(), 1);
|
|
1652940
1653230
|
async function convertMarkdown({ absolutePathToMintJson, absoluteFilepathToMarkdown, relativeFilepathFromRoot, builder }) {
|
|
1652941
|
-
const text9 = await (0,
|
|
1653231
|
+
const text9 = await (0, import_promises71.readFile)(absoluteFilepathToMarkdown, "utf-8");
|
|
1652942
1653232
|
const { data: data2, content: content5 } = parseMintlifyFrontmatter(text9);
|
|
1652943
1653233
|
const slug = relativeFilepathFromRoot.replace(/\.(md|mdx)$/, "");
|
|
1652944
1653234
|
const transformedContent = markReferencedAssets({
|
|
@@ -1653101,7 +1653391,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
1653101
1653391
|
documentationTab = void 0;
|
|
1653102
1653392
|
tabUrlToInfo = {};
|
|
1653103
1653393
|
async import({ args, builder }) {
|
|
1653104
|
-
const mintJsonContent = await (0,
|
|
1653394
|
+
const mintJsonContent = await (0, import_promises72.readFile)(args.absolutePathToMintJson, "utf-8");
|
|
1653105
1653395
|
const mint = JSON.parse(mintJsonContent);
|
|
1653106
1653396
|
builder.setTitle({ title: mint.name });
|
|
1653107
1653397
|
const relativePathToFavicon = RelativeFilePath2.of(mint.favicon.substring(1));
|
|
@@ -1653226,7 +1653516,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
1653226
1653516
|
};
|
|
1653227
1653517
|
|
|
1653228
1653518
|
// ../docs-importers/mintlify/lib/runMintlifyMigration.js
|
|
1653229
|
-
var
|
|
1653519
|
+
var import_promises73 = require("fs/promises");
|
|
1653230
1653520
|
async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskContext, versionOfCli, organization }) {
|
|
1653231
1653521
|
const mintlifyImporter = new MintlifyImporter({
|
|
1653232
1653522
|
context: taskContext
|
|
@@ -1653237,7 +1653527,7 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
|
|
|
1653237
1653527
|
builder
|
|
1653238
1653528
|
});
|
|
1653239
1653529
|
await builder.build({ outputDirectory: outputPath });
|
|
1653240
|
-
await (0,
|
|
1653530
|
+
await (0, import_promises73.writeFile)(join4(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
1653241
1653531
|
version: versionOfCli,
|
|
1653242
1653532
|
organization
|
|
1653243
1653533
|
}, void 0, 4));
|
|
@@ -1653286,7 +1653576,7 @@ function assertIsStringArray(val) {
|
|
|
1653286
1653576
|
}
|
|
1653287
1653577
|
|
|
1653288
1653578
|
// ../docs-importers/readme/lib/ReadmeImporter.js
|
|
1653289
|
-
var
|
|
1653579
|
+
var import_promises78 = require("fs/promises");
|
|
1653290
1653580
|
|
|
1653291
1653581
|
// ../docs-importers/readme/lib/extract/favicon.js
|
|
1653292
1653582
|
async function getFavicon(hast) {
|
|
@@ -1676220,7 +1676510,7 @@ init_AsyncIterableUtil();
|
|
|
1676220
1676510
|
init_disposable();
|
|
1676221
1676511
|
|
|
1676222
1676512
|
// ../../../node_modules/.pnpm/puppeteer-core@24.23.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js
|
|
1676223
|
-
var
|
|
1676513
|
+
var import_promises76 = require("fs/promises");
|
|
1676224
1676514
|
var import_node_os9 = __toESM(require("os"), 1);
|
|
1676225
1676515
|
var import_node_path27 = __toESM(require("path"), 1);
|
|
1676226
1676516
|
|
|
@@ -1677636,7 +1677926,7 @@ var TimeoutError3 = class extends Error {
|
|
|
1677636
1677926
|
var import_node_assert9 = __toESM(require("assert"), 1);
|
|
1677637
1677927
|
var import_node_child_process3 = require("child_process");
|
|
1677638
1677928
|
var import_node_fs16 = require("fs");
|
|
1677639
|
-
var
|
|
1677929
|
+
var import_promises75 = require("fs/promises");
|
|
1677640
1677930
|
var import_node_os7 = __toESM(require("os"), 1);
|
|
1677641
1677931
|
var import_node_path25 = __toESM(require("path"), 1);
|
|
1677642
1677932
|
var import_progress = __toESM(require_progress(), 1);
|
|
@@ -1677644,7 +1677934,7 @@ var import_progress = __toESM(require_progress(), 1);
|
|
|
1677644
1677934
|
// ../../../node_modules/.pnpm/@puppeteer+browsers@2.10.10/node_modules/@puppeteer/browsers/lib/esm/fileUtil.js
|
|
1677645
1677935
|
var import_node_child_process2 = require("child_process");
|
|
1677646
1677936
|
var import_node_fs15 = require("fs");
|
|
1677647
|
-
var
|
|
1677937
|
+
var import_promises74 = require("fs/promises");
|
|
1677648
1677938
|
var path58 = __toESM(require("path"), 1);
|
|
1677649
1677939
|
var import_node_stream3 = require("stream");
|
|
1677650
1677940
|
var import_debug5 = __toESM(require_src(), 1);
|
|
@@ -1678078,7 +1678368,7 @@ var ChromeLauncher = class extends BrowserLauncher {
|
|
|
1678078
1678368
|
});
|
|
1678079
1678369
|
if (userDataDirIndex < 0) {
|
|
1678080
1678370
|
isTempUserDataDir = true;
|
|
1678081
|
-
chromeArguments.push(`--user-data-dir=${await (0,
|
|
1678371
|
+
chromeArguments.push(`--user-data-dir=${await (0, import_promises76.mkdtemp)(this.getProfilePath())}`);
|
|
1678082
1678372
|
userDataDirIndex = chromeArguments.length - 1;
|
|
1678083
1678373
|
}
|
|
1678084
1678374
|
const userDataDir = chromeArguments[userDataDirIndex].split("=", 2)[1];
|
|
@@ -1678242,7 +1678532,7 @@ function removeMatchingFlags(array3, flag) {
|
|
|
1678242
1678532
|
|
|
1678243
1678533
|
// ../../../node_modules/.pnpm/puppeteer-core@24.23.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/FirefoxLauncher.js
|
|
1678244
1678534
|
var import_node_fs19 = __toESM(require("fs"), 1);
|
|
1678245
|
-
var
|
|
1678535
|
+
var import_promises77 = require("fs/promises");
|
|
1678246
1678536
|
var import_node_os10 = __toESM(require("os"), 1);
|
|
1678247
1678537
|
var import_node_path28 = __toESM(require("path"), 1);
|
|
1678248
1678538
|
init_util2();
|
|
@@ -1678295,7 +1678585,7 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
1678295
1678585
|
}
|
|
1678296
1678586
|
isTempUserDataDir = false;
|
|
1678297
1678587
|
} else {
|
|
1678298
|
-
userDataDir = await (0,
|
|
1678588
|
+
userDataDir = await (0, import_promises77.mkdtemp)(this.getProfilePath());
|
|
1678299
1678589
|
firefoxArguments.push("--profile");
|
|
1678300
1678590
|
firefoxArguments.push(userDataDir);
|
|
1678301
1678591
|
}
|
|
@@ -1678336,8 +1678626,8 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
1678336
1678626
|
const prefsBackupPath = import_node_path28.default.join(userDataDir, file4 + backupSuffix);
|
|
1678337
1678627
|
if (import_node_fs19.default.existsSync(prefsBackupPath)) {
|
|
1678338
1678628
|
const prefsPath = import_node_path28.default.join(userDataDir, file4);
|
|
1678339
|
-
await (0,
|
|
1678340
|
-
await (0,
|
|
1678629
|
+
await (0, import_promises77.unlink)(prefsPath);
|
|
1678630
|
+
await (0, import_promises77.rename)(prefsBackupPath, prefsPath);
|
|
1678341
1678631
|
}
|
|
1678342
1678632
|
}));
|
|
1678343
1678633
|
for (const result of results) {
|
|
@@ -1679369,7 +1679659,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1679369
1679659
|
if (response.ok) {
|
|
1679370
1679660
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
1679371
1679661
|
const faviconPath = join4(assetsDirectory, RelativeFilePath2.of("favicon"));
|
|
1679372
|
-
await (0,
|
|
1679662
|
+
await (0, import_promises78.writeFile)(faviconPath, new Uint8Array(imageBuffer));
|
|
1679373
1679663
|
builder.setFavicon({ favicon: relativize(this.absolutePathToFernDirectory, faviconPath) });
|
|
1679374
1679664
|
}
|
|
1679375
1679665
|
}
|
|
@@ -1679386,7 +1679676,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1679386
1679676
|
*/
|
|
1679387
1679677
|
async getAndCreateAssetsDirectory() {
|
|
1679388
1679678
|
const assetsDirectory = join4(this.absolutePathToFernDirectory, RelativeFilePath2.of("assets"));
|
|
1679389
|
-
await (0,
|
|
1679679
|
+
await (0, import_promises78.mkdir)(assetsDirectory, { recursive: true });
|
|
1679390
1679680
|
return assetsDirectory;
|
|
1679391
1679681
|
}
|
|
1679392
1679682
|
/**
|
|
@@ -1679436,7 +1679726,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1679436
1679726
|
absolutePathToOutputDirectory,
|
|
1679437
1679727
|
section
|
|
1679438
1679728
|
});
|
|
1679439
|
-
await (0,
|
|
1679729
|
+
await (0, import_promises78.mkdir)(absolutePathToOutputDirectoryForSection, { recursive: true });
|
|
1679440
1679730
|
await Promise.all(section.pages.filter((page) => page.type === "page").map(async (page) => {
|
|
1679441
1679731
|
const url3 = new URL(page.slug.toString(), this.url);
|
|
1679442
1679732
|
this.logger.debug(`Fetching page: ${url3.toString()}`);
|
|
@@ -1679451,7 +1679741,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1679451
1679741
|
absolutePathToOutputDirectoryForSection,
|
|
1679452
1679742
|
page: page.slug
|
|
1679453
1679743
|
});
|
|
1679454
|
-
await (0,
|
|
1679744
|
+
await (0, import_promises78.writeFile)(absolutePathForPage, result.data.mdx);
|
|
1679455
1679745
|
if (result.data.images.imageURLs.length > 0) {
|
|
1679456
1679746
|
this.logger.debug(`Found ${result.data.images.imageURLs.length} images to download for ${url3.toString()}`);
|
|
1679457
1679747
|
await Promise.all(Object.entries(result.data.images.imageURLToFilename).map(async ([imageUrl, filename]) => {
|
|
@@ -1679464,8 +1679754,8 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1679464
1679754
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
1679465
1679755
|
const imagePath = join4(absolutePathToOutputDirectoryForSection, RelativeFilePath2.of(filename));
|
|
1679466
1679756
|
const imageDir = dirname4(imagePath);
|
|
1679467
|
-
await (0,
|
|
1679468
|
-
await (0,
|
|
1679757
|
+
await (0, import_promises78.mkdir)(imageDir, { recursive: true });
|
|
1679758
|
+
await (0, import_promises78.writeFile)(imagePath, new Uint8Array(imageBuffer));
|
|
1679469
1679759
|
this.logger.debug(`Saved image to ${imagePath}`);
|
|
1679470
1679760
|
} catch (error49) {
|
|
1679471
1679761
|
this.logger.warn(`Error downloading image ${imageUrl}: ${error49}`);
|
|
@@ -1679547,7 +1679837,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
1679547
1679837
|
};
|
|
1679548
1679838
|
|
|
1679549
1679839
|
// ../docs-importers/readme/lib/runReadmeMigration.js
|
|
1679550
|
-
var
|
|
1679840
|
+
var import_promises79 = require("fs/promises");
|
|
1679551
1679841
|
async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionOfCli, organization }) {
|
|
1679552
1679842
|
const builder = new FernDocsBuilderImpl();
|
|
1679553
1679843
|
builder.setInstance({ companyName: organization });
|
|
@@ -1679562,7 +1679852,7 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
|
|
|
1679562
1679852
|
builder
|
|
1679563
1679853
|
});
|
|
1679564
1679854
|
await builder.build({ outputDirectory: outputPath });
|
|
1679565
|
-
await (0,
|
|
1679855
|
+
await (0, import_promises79.writeFile)(join4(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
1679566
1679856
|
version: versionOfCli,
|
|
1679567
1679857
|
organization
|
|
1679568
1679858
|
}, void 0, 4));
|
|
@@ -1681429,7 +1681719,7 @@ Yargs2.Parser = Parser7;
|
|
|
1681429
1681719
|
var yargs_default2 = Yargs2;
|
|
1681430
1681720
|
|
|
1681431
1681721
|
// ../init/src/utils/loadOpenApiFromUrl.ts
|
|
1681432
|
-
var
|
|
1681722
|
+
var import_promises80 = require("fs/promises");
|
|
1681433
1681723
|
var import_path51 = require("path");
|
|
1681434
1681724
|
var import_tmp_promise15 = __toESM(require_tmp_promise(), 1);
|
|
1681435
1681725
|
async function loadOpenAPIFromUrl({ url: url3, logger }) {
|
|
@@ -1681439,7 +1681729,7 @@ async function loadOpenAPIFromUrl({ url: url3, logger }) {
|
|
|
1681439
1681729
|
const filePath = (0, import_path51.join)(tmpDir.path, url3.endsWith(".json") ? "openapi.json" : "openapi.yaml");
|
|
1681440
1681730
|
logger.debug("tmpDir", tmpDir.path);
|
|
1681441
1681731
|
logger.debug("filePath", filePath);
|
|
1681442
|
-
await (0,
|
|
1681732
|
+
await (0, import_promises80.writeFile)(filePath, data2);
|
|
1681443
1681733
|
return {
|
|
1681444
1681734
|
status: "success" /* Success */,
|
|
1681445
1681735
|
filePath
|
|
@@ -1683825,7 +1684115,7 @@ var CliContext = class {
|
|
|
1683825
1684115
|
if (false) {
|
|
1683826
1684116
|
this.logger.error("CLI_VERSION is not defined");
|
|
1683827
1684117
|
}
|
|
1683828
|
-
return "3.52.0-
|
|
1684118
|
+
return "3.52.0-29-gac0ea830b7b";
|
|
1683829
1684119
|
}
|
|
1683830
1684120
|
getCliName() {
|
|
1683831
1684121
|
if (false) {
|
|
@@ -1684079,7 +1684369,7 @@ function wrapWorkspaceNameForPrefix(workspaceName) {
|
|
|
1684079
1684369
|
}
|
|
1684080
1684370
|
|
|
1684081
1684371
|
// ../project-loader/lib/loadProject.js
|
|
1684082
|
-
var
|
|
1684372
|
+
var import_promises81 = require("fs/promises");
|
|
1684083
1684373
|
async function loadProject({ context: context2, nameOverride, ...args }) {
|
|
1684084
1684374
|
const fernDirectory = await getFernDirectory(nameOverride);
|
|
1684085
1684375
|
if (fernDirectory == null) {
|
|
@@ -1684134,7 +1684424,7 @@ async function loadApis({ cliName, fernDirectory, context: context2, cliVersion,
|
|
|
1684134
1684424
|
const apisDirectory = join4(fernDirectory, RelativeFilePath2.of(APIS_DIRECTORY));
|
|
1684135
1684425
|
const apisDirectoryExists = await doesPathExist(apisDirectory);
|
|
1684136
1684426
|
if (apisDirectoryExists) {
|
|
1684137
|
-
const apiDirectoryContents = await (0,
|
|
1684427
|
+
const apiDirectoryContents = await (0, import_promises81.readdir)(apisDirectory, { withFileTypes: true });
|
|
1684138
1684428
|
const apiWorkspaceDirectoryNames = apiDirectoryContents.reduce((all9, item) => {
|
|
1684139
1684429
|
if (item.isDirectory()) {
|
|
1684140
1684430
|
all9.push(item.name);
|
|
@@ -1684211,10 +1684501,10 @@ async function loadProjectAndRegisterWorkspacesWithContext(cliContext, args, reg
|
|
|
1684211
1684501
|
|
|
1684212
1684502
|
// src/cliV2.ts
|
|
1684213
1684503
|
var import_generators_sdk4 = __toESM(require_generators_sdk(), 1);
|
|
1684214
|
-
var
|
|
1684504
|
+
var import_promises86 = require("fs/promises");
|
|
1684215
1684505
|
|
|
1684216
1684506
|
// src/commands/generator-list/getGeneratorList.ts
|
|
1684217
|
-
var
|
|
1684507
|
+
var import_promises82 = require("fs/promises");
|
|
1684218
1684508
|
var GenerationModeFilter = {
|
|
1684219
1684509
|
GitHub: "github",
|
|
1684220
1684510
|
Local: "local-file-system",
|
|
@@ -1684274,7 +1684564,7 @@ async function getGeneratorList({
|
|
|
1684274
1684564
|
return;
|
|
1684275
1684565
|
}
|
|
1684276
1684566
|
try {
|
|
1684277
|
-
await (0,
|
|
1684567
|
+
await (0, import_promises82.writeFile)(outputLocation, generatorsListYaml);
|
|
1684278
1684568
|
} catch (error49) {
|
|
1684279
1684569
|
cliContext.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error49);
|
|
1684280
1684570
|
}
|
|
@@ -1684340,7 +1684630,7 @@ async function getGeneratorMetadata({
|
|
|
1684340
1684630
|
}
|
|
1684341
1684631
|
|
|
1684342
1684632
|
// src/commands/organization/getOrganization.ts
|
|
1684343
|
-
var
|
|
1684633
|
+
var import_promises83 = require("fs/promises");
|
|
1684344
1684634
|
async function getOrganization({
|
|
1684345
1684635
|
project,
|
|
1684346
1684636
|
outputLocation,
|
|
@@ -1684352,20 +1684642,20 @@ async function getOrganization({
|
|
|
1684352
1684642
|
return;
|
|
1684353
1684643
|
}
|
|
1684354
1684644
|
try {
|
|
1684355
|
-
await (0,
|
|
1684645
|
+
await (0, import_promises83.writeFile)(outputLocation, org);
|
|
1684356
1684646
|
} catch (error49) {
|
|
1684357
1684647
|
context2.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error49);
|
|
1684358
1684648
|
}
|
|
1684359
1684649
|
}
|
|
1684360
1684650
|
|
|
1684361
1684651
|
// src/commands/upgrade/upgradeGenerator.ts
|
|
1684362
|
-
var
|
|
1684652
|
+
var import_promises85 = require("fs/promises");
|
|
1684363
1684653
|
var import_path53 = __toESM(require("path"), 1);
|
|
1684364
1684654
|
var import_semver9 = __toESM(require_semver2(), 1);
|
|
1684365
1684655
|
var import_yaml4 = __toESM(require_dist2(), 1);
|
|
1684366
1684656
|
|
|
1684367
1684657
|
// src/commands/upgrade/migrations/loader.ts
|
|
1684368
|
-
var
|
|
1684658
|
+
var import_promises84 = require("fs/promises");
|
|
1684369
1684659
|
var import_os6 = require("os");
|
|
1684370
1684660
|
var import_path52 = require("path");
|
|
1684371
1684661
|
var import_semver8 = __toESM(require_semver2(), 1);
|
|
@@ -1684376,7 +1684666,7 @@ function getMigrationCacheDir() {
|
|
|
1684376
1684666
|
async function loadMigrationModule(params2) {
|
|
1684377
1684667
|
const { generatorName, logger } = params2;
|
|
1684378
1684668
|
const cacheDir = getMigrationCacheDir();
|
|
1684379
|
-
await (0,
|
|
1684669
|
+
await (0, import_promises84.mkdir)(cacheDir, { recursive: true });
|
|
1684380
1684670
|
try {
|
|
1684381
1684671
|
await loggingExeca(logger, "npm", [
|
|
1684382
1684672
|
"install",
|
|
@@ -1684389,7 +1684679,7 @@ async function loadMigrationModule(params2) {
|
|
|
1684389
1684679
|
]);
|
|
1684390
1684680
|
const packageDir = (0, import_path52.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME);
|
|
1684391
1684681
|
const packageJsonPath = (0, import_path52.join)(packageDir, "package.json");
|
|
1684392
|
-
const packageJsonContent = await (0,
|
|
1684682
|
+
const packageJsonContent = await (0, import_promises84.readFile)(packageJsonPath, "utf-8");
|
|
1684393
1684683
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
1684394
1684684
|
if (packageJson2.main == null) {
|
|
1684395
1684685
|
throw new Error(`No main field found in package.json for ${MIGRATION_PACKAGE_NAME}`);
|
|
@@ -1684540,7 +1684830,7 @@ async function loadAndUpdateGenerators({
|
|
|
1684540
1684830
|
context2.logger.debug("Generators configuration file was not found, no generators to upgrade.");
|
|
1684541
1684831
|
return { updatedConfiguration: void 0, skippedMajorUpgrades: [], appliedUpgrades: [], alreadyUpToDate: [] };
|
|
1684542
1684832
|
}
|
|
1684543
|
-
const contents = await (0,
|
|
1684833
|
+
const contents = await (0, import_promises85.readFile)(filepath);
|
|
1684544
1684834
|
context2.logger.debug(`Found generators: ${contents.toString()}`);
|
|
1684545
1684835
|
const parsedDocument = import_yaml4.default.parseDocument(contents.toString());
|
|
1684546
1684836
|
const generatorGroups = parsedDocument.get("groups");
|
|
@@ -1684721,7 +1685011,7 @@ async function upgradeGenerator({
|
|
|
1684721
1685011
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
1684722
1685012
|
});
|
|
1684723
1685013
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
1684724
|
-
await (0,
|
|
1685014
|
+
await (0, import_promises85.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
1684725
1685015
|
}
|
|
1684726
1685016
|
allSkippedMajorUpgrades.push(...result.skippedMajorUpgrades);
|
|
1684727
1685017
|
if (result.appliedUpgrades.length > 0) {
|
|
@@ -1685075,7 +1685365,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
1685075
1685365
|
}
|
|
1685076
1685366
|
if (argv.output) {
|
|
1685077
1685367
|
try {
|
|
1685078
|
-
await (0,
|
|
1685368
|
+
await (0, import_promises86.writeFile)(argv.output, JSON.stringify(generatorMetadata, null, 2));
|
|
1685079
1685369
|
} catch (error49) {
|
|
1685080
1685370
|
cliContext.failAndThrow(
|
|
1685081
1685371
|
`Could not write file to the specified location: ${argv.output}`,
|
|
@@ -1685089,7 +1685379,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
1685089
1685379
|
}
|
|
1685090
1685380
|
|
|
1685091
1685381
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
1685092
|
-
var
|
|
1685382
|
+
var import_promises87 = require("fs/promises");
|
|
1685093
1685383
|
async function addGeneratorToWorkspaces({
|
|
1685094
1685384
|
project: { apiWorkspaces },
|
|
1685095
1685385
|
generatorName,
|
|
@@ -1685116,7 +1685406,7 @@ async function addGeneratorToWorkspaces({
|
|
|
1685116
1685406
|
if (absolutePathToGeneratorsConfiguration == null) {
|
|
1685117
1685407
|
return;
|
|
1685118
1685408
|
}
|
|
1685119
|
-
await (0,
|
|
1685409
|
+
await (0, import_promises87.writeFile)(
|
|
1685120
1685410
|
absolutePathToGeneratorsConfiguration,
|
|
1685121
1685411
|
"# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(newConfiguration)
|
|
1685122
1685412
|
);
|
|
@@ -1685127,7 +1685417,7 @@ async function addGeneratorToWorkspaces({
|
|
|
1685127
1685417
|
}
|
|
1685128
1685418
|
|
|
1685129
1685419
|
// src/commands/diff/diff.ts
|
|
1685130
|
-
var
|
|
1685420
|
+
var import_promises88 = require("fs/promises");
|
|
1685131
1685421
|
var import_semver10 = __toESM(require_semver2(), 1);
|
|
1685132
1685422
|
async function diff({
|
|
1685133
1685423
|
context: context2,
|
|
@@ -1685170,7 +1685460,7 @@ async function readIr({
|
|
|
1685170
1685460
|
context2.failWithoutThrowing(`File not found: ${absoluteFilepath}`);
|
|
1685171
1685461
|
throw new FernCliError();
|
|
1685172
1685462
|
}
|
|
1685173
|
-
const ir14 = await (0,
|
|
1685463
|
+
const ir14 = await (0, import_promises88.readFile)(absoluteFilepath, "utf-8");
|
|
1685174
1685464
|
const parsed = serialization_exports3.IntermediateRepresentation.parse(JSON.parse(ir14));
|
|
1685175
1685465
|
if (!parsed.ok) {
|
|
1685176
1685466
|
context2.failWithoutThrowing(`Invalid --${flagName}; expected a filepath containing a valid IR`);
|
|
@@ -1685260,7 +1685550,7 @@ function bumpFromDiff(diff2) {
|
|
|
1685260
1685550
|
// ../docs-preview/lib/runAppPreviewServer.js
|
|
1685261
1685551
|
var import_cors = __toESM(require_lib17(), 1);
|
|
1685262
1685552
|
var import_express = __toESM(require_express3(), 1);
|
|
1685263
|
-
var
|
|
1685553
|
+
var import_promises94 = require("fs/promises");
|
|
1685264
1685554
|
var import_http6 = __toESM(require("http"), 1);
|
|
1685265
1685555
|
var import_path56 = __toESM(require("path"), 1);
|
|
1685266
1685556
|
|
|
@@ -1686932,13 +1687222,13 @@ var watcher_default = Watcher;
|
|
|
1686932
1687222
|
init_wrapper();
|
|
1686933
1687223
|
|
|
1686934
1687224
|
// ../docs-preview/lib/DebugLogger.js
|
|
1686935
|
-
var
|
|
1687225
|
+
var import_promises89 = require("fs/promises");
|
|
1686936
1687226
|
var import_os7 = require("os");
|
|
1686937
1687227
|
var import_path54 = __toESM(require("path"), 1);
|
|
1686938
1687228
|
var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
1686939
1687229
|
var LOGS_FOLDER_NAME = "logs";
|
|
1686940
1687230
|
function getCliSource() {
|
|
1686941
|
-
const version7 = "3.52.0-
|
|
1687231
|
+
const version7 = "3.52.0-29-gac0ea830b7b";
|
|
1686942
1687232
|
return `cli@${version7}`;
|
|
1686943
1687233
|
}
|
|
1686944
1687234
|
var DebugLogger = class {
|
|
@@ -1686958,7 +1687248,7 @@ var DebugLogger = class {
|
|
|
1686958
1687248
|
const localStorageFolder = join4(AbsoluteFilePath2.of((0, import_os7.homedir)()), RelativeFilePath2.of(LOCAL_STORAGE_FOLDER4));
|
|
1686959
1687249
|
const logsDir = join4(localStorageFolder, RelativeFilePath2.of(LOGS_FOLDER_NAME));
|
|
1686960
1687250
|
if (!await doesPathExist(logsDir)) {
|
|
1686961
|
-
await (0,
|
|
1687251
|
+
await (0, import_promises89.mkdir)(logsDir, { recursive: true });
|
|
1686962
1687252
|
}
|
|
1686963
1687253
|
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
1686964
1687254
|
const logFileName = `${timestamp2}.debug.log`;
|
|
@@ -1686971,7 +1687261,7 @@ var DebugLogger = class {
|
|
|
1686971
1687261
|
"================================================================================",
|
|
1686972
1687262
|
""
|
|
1686973
1687263
|
].join("\n");
|
|
1686974
|
-
await (0,
|
|
1687264
|
+
await (0, import_promises89.writeFile)(this.logFilePath, header, "utf-8");
|
|
1686975
1687265
|
this.initialized = true;
|
|
1686976
1687266
|
}
|
|
1686977
1687267
|
/**
|
|
@@ -1686989,7 +1687279,7 @@ var DebugLogger = class {
|
|
|
1686989
1687279
|
}
|
|
1686990
1687280
|
const line = JSON.stringify(entry) + "\n";
|
|
1686991
1687281
|
try {
|
|
1686992
|
-
await (0,
|
|
1687282
|
+
await (0, import_promises89.appendFile)(this.logFilePath, line, "utf-8");
|
|
1686993
1687283
|
} catch (error49) {
|
|
1686994
1687284
|
}
|
|
1686995
1687285
|
}
|
|
@@ -1687113,7 +1687403,7 @@ var DebugLogger = class {
|
|
|
1687113
1687403
|
// ../docs-preview/lib/downloadLocalDocsBundle.js
|
|
1687114
1687404
|
var import_cli_progress = __toESM(require_cli_progress(), 1);
|
|
1687115
1687405
|
var import_decompress3 = __toESM(require_decompress(), 1);
|
|
1687116
|
-
var
|
|
1687406
|
+
var import_promises90 = require("fs/promises");
|
|
1687117
1687407
|
var import_os8 = require("os");
|
|
1687118
1687408
|
var import_tmp_promise16 = __toESM(require_tmp_promise(), 1);
|
|
1687119
1687409
|
var import_xml2js = __toESM(require_xml2js(), 1);
|
|
@@ -1687201,7 +1687491,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1687201
1687491
|
let currentETag = void 0;
|
|
1687202
1687492
|
if (currentETagExists) {
|
|
1687203
1687493
|
logger.debug("Reading existing ETag");
|
|
1687204
|
-
currentETag = (await (0,
|
|
1687494
|
+
currentETag = (await (0, import_promises90.readFile)(eTagFilepath)).toString();
|
|
1687205
1687495
|
}
|
|
1687206
1687496
|
if (currentETag != null && currentETag === eTag) {
|
|
1687207
1687497
|
logger.debug("ETag matches. Using already downloaded bundle");
|
|
@@ -1687265,16 +1687555,16 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1687265
1687555
|
}
|
|
1687266
1687556
|
}
|
|
1687267
1687557
|
const nodeBuffer = Buffer.concat(chunks);
|
|
1687268
|
-
await (0,
|
|
1687558
|
+
await (0, import_promises90.writeFile)(outputZipPath, new Uint8Array(nodeBuffer));
|
|
1687269
1687559
|
logger.debug(`Wrote ${tryTar ? "output.tar.gz" : "output.zip"} to ${outputZipPath}`);
|
|
1687270
1687560
|
const absolutePathToPreviewFolder = getPathToPreviewFolder({ app });
|
|
1687271
1687561
|
if (await doesPathExist(absolutePathToPreviewFolder)) {
|
|
1687272
1687562
|
logger.debug(`Removing previously cached bundle at: ${absolutePathToPreviewFolder}`);
|
|
1687273
|
-
await (0,
|
|
1687563
|
+
await (0, import_promises90.rm)(absolutePathToPreviewFolder, { recursive: true });
|
|
1687274
1687564
|
}
|
|
1687275
|
-
await (0,
|
|
1687565
|
+
await (0, import_promises90.mkdir)(absolutePathToPreviewFolder, { recursive: true });
|
|
1687276
1687566
|
const absolutePathToBundleFolder = getPathToBundleFolder({ app });
|
|
1687277
|
-
await (0,
|
|
1687567
|
+
await (0, import_promises90.mkdir)(absolutePathToBundleFolder, { recursive: true });
|
|
1687278
1687568
|
logger.debug(`Decompressing bundle from ${outputZipPath} to ${absolutePathToBundleFolder}`);
|
|
1687279
1687569
|
let unzipProgressBar;
|
|
1687280
1687570
|
let unzipInterval;
|
|
@@ -1687309,7 +1687599,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1687309
1687599
|
unzipProgressBar.stop();
|
|
1687310
1687600
|
}
|
|
1687311
1687601
|
}
|
|
1687312
|
-
await (0,
|
|
1687602
|
+
await (0, import_promises90.writeFile)(eTagFilepath, eTag);
|
|
1687313
1687603
|
logger.debug(`Downloaded bundle to ${absolutePathToBundleFolder}`);
|
|
1687314
1687604
|
if (app) {
|
|
1687315
1687605
|
logger.debug("Checking if pnpm is installed");
|
|
@@ -1687391,15 +1687681,15 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1687391
1687681
|
}
|
|
1687392
1687682
|
if (!pnpmfileExists) {
|
|
1687393
1687683
|
logger.debug(`Writing pnpmfile.cjs at ${pnpmfilePath}`);
|
|
1687394
|
-
await (0,
|
|
1687684
|
+
await (0, import_promises90.writeFile)(pnpmfilePath, PNPMFILE_CJS_CONTENTS);
|
|
1687395
1687685
|
}
|
|
1687396
1687686
|
if (!npmrcExists) {
|
|
1687397
1687687
|
logger.debug(`Writing .npmrc at ${npmrcPath}`);
|
|
1687398
|
-
await (0,
|
|
1687688
|
+
await (0, import_promises90.writeFile)(npmrcPath, NPMRC_CONTENTS);
|
|
1687399
1687689
|
}
|
|
1687400
1687690
|
if (instrumentationJsExists) {
|
|
1687401
1687691
|
logger.debug(`Removing instrumentation.js at ${absPathToInstrumentationJs}`);
|
|
1687402
|
-
await (0,
|
|
1687692
|
+
await (0, import_promises90.rm)(absPathToInstrumentationJs);
|
|
1687403
1687693
|
}
|
|
1687404
1687694
|
try {
|
|
1687405
1687695
|
logger.debug("Running pnpm install within standalone");
|
|
@@ -1687419,7 +1687709,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1687419
1687709
|
logger.error(`Error: ${error49}`);
|
|
1687420
1687710
|
const absolutePathToPreviewFolder = getPathToPreviewFolder({ app });
|
|
1687421
1687711
|
if (await doesPathExist(absolutePathToPreviewFolder)) {
|
|
1687422
|
-
await (0,
|
|
1687712
|
+
await (0, import_promises90.rm)(absolutePathToPreviewFolder, { recursive: true });
|
|
1687423
1687713
|
}
|
|
1687424
1687714
|
logger.debug(`Removing incomplete bundle: rm -rf ${absolutePathToPreviewFolder}`);
|
|
1687425
1687715
|
return {
|
|
@@ -1687429,7 +1687719,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
|
|
|
1687429
1687719
|
}
|
|
1687430
1687720
|
|
|
1687431
1687721
|
// ../docs-preview/lib/previewDocs.js
|
|
1687432
|
-
var
|
|
1687722
|
+
var import_promises93 = require("fs/promises");
|
|
1687433
1687723
|
var import_gray_matter10 = __toESM(require_gray_matter(), 1);
|
|
1687434
1687724
|
|
|
1687435
1687725
|
// ../docs-markdown-utils/src/extract-literals.ts
|
|
@@ -1688272,9 +1688562,9 @@ function replaceFrontmatterImagesforLogo2(data2, mapImage) {
|
|
|
1688272
1688562
|
}
|
|
1688273
1688563
|
|
|
1688274
1688564
|
// ../docs-markdown-utils/src/replaceReferencedCode.ts
|
|
1688275
|
-
var
|
|
1688565
|
+
var import_promises91 = require("fs/promises");
|
|
1688276
1688566
|
async function defaultFileLoader2(filepath) {
|
|
1688277
|
-
const file4 = await (0,
|
|
1688567
|
+
const file4 = await (0, import_promises91.readFile)(filepath);
|
|
1688278
1688568
|
return file4.toString();
|
|
1688279
1688569
|
}
|
|
1688280
1688570
|
function isUrl3(src) {
|
|
@@ -1688448,10 +1688738,10 @@ ${replacement}
|
|
|
1688448
1688738
|
}
|
|
1688449
1688739
|
|
|
1688450
1688740
|
// ../docs-markdown-utils/src/replaceReferencedMarkdown.ts
|
|
1688451
|
-
var
|
|
1688741
|
+
var import_promises92 = require("fs/promises");
|
|
1688452
1688742
|
var import_gray_matter9 = __toESM(require_gray_matter(), 1);
|
|
1688453
1688743
|
async function defaultMarkdownLoader2(filepath) {
|
|
1688454
|
-
const { content: content5 } = (0, import_gray_matter9.default)(await (0,
|
|
1688744
|
+
const { content: content5 } = (0, import_gray_matter9.default)(await (0, import_promises92.readFile)(filepath));
|
|
1688455
1688745
|
return content5;
|
|
1688456
1688746
|
}
|
|
1688457
1688747
|
function extractAttributes2(markdownTag) {
|
|
@@ -1688650,7 +1688940,7 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
|
|
|
1688650
1688940
|
navAffectingChange = true;
|
|
1688651
1688941
|
continue;
|
|
1688652
1688942
|
}
|
|
1688653
|
-
const markdown = (await (0,
|
|
1688943
|
+
const markdown = (await (0, import_promises93.readFile)(absoluteFilePath)).toString();
|
|
1688654
1688944
|
const isNewFile = previousValue == null;
|
|
1688655
1688945
|
if (isNewFile) {
|
|
1688656
1688946
|
navAffectingChange = true;
|
|
@@ -1689041,7 +1689331,7 @@ var SnippetDependencyTracker = class {
|
|
|
1689041
1689331
|
const markdownFiles = await this.findMarkdownFiles(docsWorkspace.absoluteFilePath);
|
|
1689042
1689332
|
for (const markdownFile of markdownFiles) {
|
|
1689043
1689333
|
try {
|
|
1689044
|
-
const content5 = await (0,
|
|
1689334
|
+
const content5 = await (0, import_promises94.readFile)(markdownFile, "utf-8");
|
|
1689045
1689335
|
const referencedFiles = this.extractReferences(content5, markdownFile, docsWorkspace.absoluteFilePath);
|
|
1689046
1689336
|
this.pageToSnippets.set(markdownFile, referencedFiles);
|
|
1689047
1689337
|
for (const referencedFile of referencedFiles) {
|
|
@@ -1689123,7 +1689413,7 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
|
|
|
1689123
1689413
|
const appPreviewFolder = getPathToPreviewFolder({ app: true });
|
|
1689124
1689414
|
if (await doesPathExist(appPreviewFolder)) {
|
|
1689125
1689415
|
context2.logger.info("Force download requested. Deleting cached bundle...");
|
|
1689126
|
-
await (0,
|
|
1689416
|
+
await (0, import_promises94.rm)(appPreviewFolder, { recursive: true });
|
|
1689127
1689417
|
}
|
|
1689128
1689418
|
}
|
|
1689129
1689419
|
if (bundlePath != null) {
|
|
@@ -1691617,7 +1691907,7 @@ async function validateVersionConfigFileSchema({ value }) {
|
|
|
1691617
1691907
|
}
|
|
1691618
1691908
|
|
|
1691619
1691909
|
// ../yaml/docs-validator/lib/docsAst/visitDocsConfigFileYamlAst.js
|
|
1691620
|
-
var
|
|
1691910
|
+
var import_promises96 = require("fs/promises");
|
|
1691621
1691911
|
|
|
1691622
1691912
|
// ../yaml/docs-validator/lib/docsAst/products-yml.schema.json
|
|
1691623
1691913
|
var products_yml_schema_exports = {};
|
|
@@ -1693468,7 +1693758,7 @@ async function visitFilepath({ absoluteFilepathToConfiguration, rawUnresolvedFil
|
|
|
1693468
1693758
|
}
|
|
1693469
1693759
|
|
|
1693470
1693760
|
// ../yaml/docs-validator/lib/docsAst/visitNavigationAst.js
|
|
1693471
|
-
var
|
|
1693761
|
+
var import_promises95 = require("fs/promises");
|
|
1693472
1693762
|
|
|
1693473
1693763
|
// ../yaml/docs-validator/lib/utils/asyncPool.js
|
|
1693474
1693764
|
async function asyncPool2(limit, items, fn4) {
|
|
@@ -1693619,13 +1693909,13 @@ async function visitNavigationItem2({ absolutePathToFernFolder, navigationItem,
|
|
|
1693619
1693909
|
if (navigationItemIsPage(navigationItem)) {
|
|
1693620
1693910
|
const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), navigationItem.path);
|
|
1693621
1693911
|
if (await doesPathExist(absoluteFilepath)) {
|
|
1693622
|
-
const fileStats = await (0,
|
|
1693912
|
+
const fileStats = await (0, import_promises95.stat)(absoluteFilepath);
|
|
1693623
1693913
|
const fileSizeMB = fileStats.size / (1024 * 1024);
|
|
1693624
1693914
|
if (fileSizeMB > 1) {
|
|
1693625
1693915
|
context2.logger.trace(`Processing large markdown file: ${navigationItem.path} (${fileSizeMB.toFixed(2)} MB)`);
|
|
1693626
1693916
|
}
|
|
1693627
1693917
|
const startTime = performance.now();
|
|
1693628
|
-
const content5 = (await (0,
|
|
1693918
|
+
const content5 = (await (0, import_promises95.readFile)(absoluteFilepath, "utf8")).toString();
|
|
1693629
1693919
|
const readTime = performance.now() - startTime;
|
|
1693630
1693920
|
if (readTime > 2e3) {
|
|
1693631
1693921
|
context2.logger.debug(`Slow file read: ${navigationItem.path} took ${readTime.toFixed(0)}ms`);
|
|
@@ -1693672,12 +1693962,12 @@ async function visitNavigationItem2({ absolutePathToFernFolder, navigationItem,
|
|
|
1693672
1693962
|
context2.logger.trace(`Starting changelog processing for directory: ${changelogDir}`);
|
|
1693673
1693963
|
if (await doesPathExist(changelogDir)) {
|
|
1693674
1693964
|
const startTime = performance.now();
|
|
1693675
|
-
const files = await (0,
|
|
1693965
|
+
const files = await (0, import_promises95.readdir)(changelogDir);
|
|
1693676
1693966
|
const markdownFiles = files.filter((file4) => file4.endsWith(".md") || file4.endsWith(".mdx"));
|
|
1693677
1693967
|
context2.logger.debug(`Processing ${markdownFiles.length} changelog files in ${changelogDir}`);
|
|
1693678
1693968
|
await asyncPool2(VALIDATION_CONCURRENCY, markdownFiles, async (file4) => {
|
|
1693679
1693969
|
const absoluteFilepath = resolve5(changelogDir, file4);
|
|
1693680
|
-
const content5 = (await (0,
|
|
1693970
|
+
const content5 = (await (0, import_promises95.readFile)(absoluteFilepath, "utf8")).toString();
|
|
1693681
1693971
|
context2.logger.trace(`Validating changelog file: ${file4}`);
|
|
1693682
1693972
|
await visitor.markdownPage?.({
|
|
1693683
1693973
|
title: file4,
|
|
@@ -1693867,7 +1694157,7 @@ async function visitDocsConfigFileYamlAst({ contents, visitor, absoluteFilepathT
|
|
|
1693867
1694157
|
willBeUploaded: false
|
|
1693868
1694158
|
});
|
|
1693869
1694159
|
const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), product.path);
|
|
1693870
|
-
const content5 = jsYaml.load((await (0,
|
|
1694160
|
+
const content5 = jsYaml.load((await (0, import_promises96.readFile)(absoluteFilepath)).toString());
|
|
1693871
1694161
|
if (await doesPathExist(absoluteFilepath)) {
|
|
1693872
1694162
|
await visitor.productFile?.({
|
|
1693873
1694163
|
path: product.path,
|
|
@@ -1693945,7 +1694235,7 @@ async function visitDocsConfigFileYamlAst({ contents, visitor, absoluteFilepathT
|
|
|
1693945
1694235
|
willBeUploaded: false
|
|
1693946
1694236
|
});
|
|
1693947
1694237
|
const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), version7.path);
|
|
1693948
|
-
const content5 = jsYaml.load((await (0,
|
|
1694238
|
+
const content5 = jsYaml.load((await (0, import_promises96.readFile)(absoluteFilepath)).toString());
|
|
1693949
1694239
|
if (await doesPathExist(absoluteFilepath)) {
|
|
1693950
1694240
|
await visitor.versionFile?.({
|
|
1693951
1694241
|
path: version7.path,
|
|
@@ -1694379,7 +1694669,7 @@ var import_web = require("stream/web");
|
|
|
1694379
1694669
|
var import_node_stream5 = require("stream");
|
|
1694380
1694670
|
|
|
1694381
1694671
|
// ../../../node_modules/.pnpm/strtok3@9.1.1/node_modules/strtok3/lib/index.js
|
|
1694382
|
-
var
|
|
1694672
|
+
var import_promises98 = require("fs/promises");
|
|
1694383
1694673
|
|
|
1694384
1694674
|
// ../../../node_modules/.pnpm/peek-readable@5.4.2/node_modules/peek-readable/lib/EndOfStreamError.js
|
|
1694385
1694675
|
var defaultMessages = "End-Of-Stream";
|
|
@@ -1694750,14 +1695040,14 @@ function fromBuffer(uint8Array, options2) {
|
|
|
1694750
1695040
|
}
|
|
1694751
1695041
|
|
|
1694752
1695042
|
// ../../../node_modules/.pnpm/strtok3@9.1.1/node_modules/strtok3/lib/FileTokenizer.js
|
|
1694753
|
-
var
|
|
1695043
|
+
var import_promises97 = require("fs/promises");
|
|
1694754
1695044
|
var FileTokenizer = class _FileTokenizer extends AbstractTokenizer {
|
|
1694755
1695045
|
/**
|
|
1694756
1695046
|
* Create tokenizer from provided file path
|
|
1694757
1695047
|
* @param sourceFilePath File path
|
|
1694758
1695048
|
*/
|
|
1694759
1695049
|
static async fromFile(sourceFilePath) {
|
|
1694760
|
-
const fileHandle = await (0,
|
|
1695050
|
+
const fileHandle = await (0, import_promises97.open)(sourceFilePath, "r");
|
|
1694761
1695051
|
const stat3 = await fileHandle.stat();
|
|
1694762
1695052
|
return new _FileTokenizer(fileHandle, { fileInfo: { path: sourceFilePath, size: stat3.size } });
|
|
1694763
1695053
|
}
|
|
@@ -1696719,7 +1697009,7 @@ var supportedExtensions = new Set(extensions);
|
|
|
1696719
1697009
|
var supportedMimeTypes = new Set(mimeTypes);
|
|
1696720
1697010
|
|
|
1696721
1697011
|
// ../yaml/docs-validator/lib/rules/valid-file-types/valid-file-types.js
|
|
1696722
|
-
var
|
|
1697012
|
+
var import_promises99 = require("fs/promises");
|
|
1696723
1697013
|
var import_path58 = __toESM(require("path"), 1);
|
|
1696724
1697014
|
var ALLOWED_FILE_TYPES = /* @__PURE__ */ new Set([
|
|
1696725
1697015
|
// image files
|
|
@@ -1696840,7 +1697130,7 @@ var ValidFileTypes = {
|
|
|
1696840
1697130
|
}
|
|
1696841
1697131
|
};
|
|
1696842
1697132
|
var getViolationsForFile = async (absoluteFilepath) => {
|
|
1696843
|
-
const file4 = new Uint8Array(await (0,
|
|
1697133
|
+
const file4 = new Uint8Array(await (0, import_promises99.readFile)(absoluteFilepath));
|
|
1696844
1697134
|
const fileType = await fileTypeFromBuffer(file4);
|
|
1696845
1697135
|
if (fileType != null) {
|
|
1696846
1697136
|
if (ALLOWED_FILE_TYPES.has(fileType.mime)) {
|
|
@@ -1696879,7 +1697169,7 @@ var getViolationsForFile = async (absoluteFilepath) => {
|
|
|
1696879
1697169
|
};
|
|
1696880
1697170
|
|
|
1696881
1697171
|
// ../yaml/docs-validator/lib/rules/valid-frontmatter/valid-frontmatter.js
|
|
1696882
|
-
var
|
|
1697172
|
+
var import_promises100 = require("fs/promises");
|
|
1696883
1697173
|
var import_gray_matter11 = __toESM(require_gray_matter(), 1);
|
|
1696884
1697174
|
var ValidFrontmatter = {
|
|
1696885
1697175
|
name: "valid-frontmatter",
|
|
@@ -1696890,7 +1697180,7 @@ var ValidFrontmatter = {
|
|
|
1696890
1697180
|
return [];
|
|
1696891
1697181
|
}
|
|
1696892
1697182
|
try {
|
|
1696893
|
-
const fileContents = await (0,
|
|
1697183
|
+
const fileContents = await (0, import_promises100.readFile)(absoluteFilepath, "utf-8");
|
|
1696894
1697184
|
(0, import_gray_matter11.default)(fileContents);
|
|
1696895
1697185
|
return [];
|
|
1696896
1697186
|
} catch (error49) {
|
|
@@ -1701766,7 +1702056,7 @@ async function parseMarkdown({ markdown, absoluteFilepath, absolutePathToFernFol
|
|
|
1701766
1702056
|
}
|
|
1701767
1702057
|
|
|
1701768
1702058
|
// ../yaml/docs-validator/lib/rules/valid-markdown-file-reference/valid-markdown-file-reference.js
|
|
1701769
|
-
var
|
|
1702059
|
+
var import_promises101 = require("fs/promises");
|
|
1701770
1702060
|
var import_gray_matter12 = __toESM(require_gray_matter(), 1);
|
|
1701771
1702061
|
var ValidMarkdownFileReferences = {
|
|
1701772
1702062
|
name: "valid-markdown-file-references",
|
|
@@ -1701777,7 +1702067,7 @@ var ValidMarkdownFileReferences = {
|
|
|
1701777
1702067
|
return [];
|
|
1701778
1702068
|
}
|
|
1701779
1702069
|
try {
|
|
1701780
|
-
const fileContents = await (0,
|
|
1702070
|
+
const fileContents = await (0, import_promises101.readFile)(absoluteFilepath, "utf-8");
|
|
1701781
1702071
|
const { content: content5 } = (0, import_gray_matter12.default)(fileContents, {});
|
|
1701782
1702072
|
const tree = parseMarkdownToTree(content5);
|
|
1701783
1702073
|
const errors4 = [];
|
|
@@ -1702454,7 +1702744,7 @@ var MDX_NODE_TYPES = [
|
|
|
1702454
1702744
|
"mdxTextExpression",
|
|
1702455
1702745
|
"mdxjsEsm"
|
|
1702456
1702746
|
];
|
|
1702457
|
-
function collectLinksAndSources({ readFile:
|
|
1702747
|
+
function collectLinksAndSources({ readFile: readFile86 = (path86) => (0, import_node_fs27.readFileSync)(path86, "utf-8"), ...opts }) {
|
|
1702458
1702748
|
const visitedAbsoluteFilepaths = /* @__PURE__ */ new Set();
|
|
1702459
1702749
|
const contentQueue = [opts];
|
|
1702460
1702750
|
const links = [];
|
|
@@ -1702492,7 +1702782,7 @@ function collectLinksAndSources({ readFile: readFile85 = (path86) => (0, import_
|
|
|
1702492
1702782
|
const resolvedImportPath = resolve5(dirname4(absoluteFilepath), importPath);
|
|
1702493
1702783
|
if (resolvedImportPath.endsWith(".mdx") || resolvedImportPath.endsWith(".md")) {
|
|
1702494
1702784
|
contentQueue.push({
|
|
1702495
|
-
content:
|
|
1702785
|
+
content: readFile86(resolvedImportPath),
|
|
1702496
1702786
|
absoluteFilepath: resolvedImportPath
|
|
1702497
1702787
|
});
|
|
1702498
1702788
|
}
|
|
@@ -1702535,7 +1702825,7 @@ function collectLinksAndSources({ readFile: readFile85 = (path86) => (0, import_
|
|
|
1702535
1702825
|
if (absoluteFilepath && typeof src === "string") {
|
|
1702536
1702826
|
const resolvedImportPath = resolve5(dirname4(absoluteFilepath), src);
|
|
1702537
1702827
|
contentQueue.push({
|
|
1702538
|
-
content:
|
|
1702828
|
+
content: readFile86(resolvedImportPath),
|
|
1702539
1702829
|
absoluteFilepath: resolvedImportPath
|
|
1702540
1702830
|
});
|
|
1702541
1702831
|
}
|
|
@@ -1702919,7 +1703209,7 @@ function createDocsConfigFileAstVisitorForRules({ relativeFilepath, allRuleVisit
|
|
|
1702919
1703209
|
}
|
|
1702920
1703210
|
|
|
1702921
1703211
|
// ../yaml/docs-validator/lib/rules/no-non-component-refs/no-non-component-refs.js
|
|
1702922
|
-
var
|
|
1703212
|
+
var import_promises102 = require("fs/promises");
|
|
1702923
1703213
|
var NoNonComponentRefsRule = {
|
|
1702924
1703214
|
name: "no-non-component-refs",
|
|
1702925
1703215
|
create: ({ ossWorkspaces, logger, workspace: docsWorkspace }) => {
|
|
@@ -1702933,7 +1703223,7 @@ var NoNonComponentRefsRule = {
|
|
|
1702933
1703223
|
if (!processedFiles.has(spec.absoluteFilepath)) {
|
|
1702934
1703224
|
processedFiles.add(spec.absoluteFilepath);
|
|
1702935
1703225
|
try {
|
|
1702936
|
-
const contents = (await (0,
|
|
1703226
|
+
const contents = (await (0, import_promises102.readFile)(spec.absoluteFilepath)).toString();
|
|
1702937
1703227
|
const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
|
|
1702938
1703228
|
const isOpenApiV2 = contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"));
|
|
1702939
1703229
|
if (isOpenApiV2) {
|
|
@@ -1702973,7 +1703263,7 @@ var NoNonComponentRefsRule = {
|
|
|
1702973
1703263
|
};
|
|
1702974
1703264
|
|
|
1702975
1703265
|
// ../yaml/docs-validator/lib/rules/no-openapi-v2-in-docs/no-openapi-v2-in-docs.js
|
|
1702976
|
-
var
|
|
1703266
|
+
var import_promises103 = require("fs/promises");
|
|
1702977
1703267
|
var NoOpenApiV2InDocsRule = {
|
|
1702978
1703268
|
name: "no-openapi-v2-in-docs",
|
|
1702979
1703269
|
create: ({ ossWorkspaces, logger, workspace: docsWorkspace }) => {
|
|
@@ -1702986,7 +1703276,7 @@ var NoOpenApiV2InDocsRule = {
|
|
|
1702986
1703276
|
if (spec.type === "openapi" && !processedFiles.has(spec.absoluteFilepath)) {
|
|
1702987
1703277
|
processedFiles.add(spec.absoluteFilepath);
|
|
1702988
1703278
|
try {
|
|
1702989
|
-
const contents = (await (0,
|
|
1703279
|
+
const contents = (await (0, import_promises103.readFile)(spec.absoluteFilepath)).toString();
|
|
1702990
1703280
|
const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
|
|
1702991
1703281
|
if (contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"))) {
|
|
1702992
1703282
|
violations.push({
|
|
@@ -1703109,7 +1703399,7 @@ var ValidInstanceUrlRule = {
|
|
|
1703109
1703399
|
};
|
|
1703110
1703400
|
|
|
1703111
1703401
|
// ../yaml/docs-validator/lib/rules/valid-local-references/valid-local-references.js
|
|
1703112
|
-
var
|
|
1703402
|
+
var import_promises104 = require("fs/promises");
|
|
1703113
1703403
|
function validateReference(ref2, spec) {
|
|
1703114
1703404
|
const pathParts = ref2.replace(/^#\//, "").split("/").map((part) => (
|
|
1703115
1703405
|
// Decode JSON Pointer escapes: ~1 -> /, ~0 -> ~
|
|
@@ -1703176,7 +1703466,7 @@ var ValidLocalReferencesRule = {
|
|
|
1703176
1703466
|
if (spec.type === "openapi" && !processedFiles.has(spec.absoluteFilepath)) {
|
|
1703177
1703467
|
processedFiles.add(spec.absoluteFilepath);
|
|
1703178
1703468
|
try {
|
|
1703179
|
-
const contents = (await (0,
|
|
1703469
|
+
const contents = (await (0, import_promises104.readFile)(spec.absoluteFilepath)).toString();
|
|
1703180
1703470
|
const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
|
|
1703181
1703471
|
const isOpenApiV2 = contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"));
|
|
1703182
1703472
|
if (isOpenApiV2) {
|
|
@@ -1703229,7 +1703519,7 @@ var ValidLocalReferencesRule = {
|
|
|
1703229
1703519
|
};
|
|
1703230
1703520
|
|
|
1703231
1703521
|
// ../yaml/docs-validator/lib/rules/valid-openapi-examples/valid-openapi-examples.js
|
|
1703232
|
-
var
|
|
1703522
|
+
var import_promises105 = require("fs/promises");
|
|
1703233
1703523
|
var ValidOpenApiExamples = {
|
|
1703234
1703524
|
name: "valid-openapi-examples",
|
|
1703235
1703525
|
create: ({ ossWorkspaces, logger, workspace: docsWorkspace }) => {
|
|
@@ -1703327,7 +1703617,7 @@ var ValidOpenApiExamples = {
|
|
|
1703327
1703617
|
};
|
|
1703328
1703618
|
async function validateOpenApiExamples({ specPath, logger }) {
|
|
1703329
1703619
|
try {
|
|
1703330
|
-
const specContent = await (0,
|
|
1703620
|
+
const specContent = await (0, import_promises105.readFile)(specPath, "utf-8");
|
|
1703331
1703621
|
let spec;
|
|
1703332
1703622
|
try {
|
|
1703333
1703623
|
spec = JSON.parse(specContent);
|
|
@@ -1704021,7 +1704311,7 @@ Found ${previewDeployments.length} preview deployment(s):
|
|
|
1704021
1704311
|
}
|
|
1704022
1704312
|
|
|
1704023
1704313
|
// src/commands/downgrade/downgrade.ts
|
|
1704024
|
-
var
|
|
1704314
|
+
var import_promises106 = require("fs/promises");
|
|
1704025
1704315
|
|
|
1704026
1704316
|
// ../../../node_modules/.pnpm/immer@10.1.3/node_modules/immer/dist/immer.mjs
|
|
1704027
1704317
|
var NOTHING = Symbol.for("immer-nothing");
|
|
@@ -1704710,12 +1705000,12 @@ async function downgrade({
|
|
|
1704710
1705000
|
const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
|
|
1704711
1705001
|
draft.version = targetVersion;
|
|
1704712
1705002
|
});
|
|
1704713
|
-
await (0,
|
|
1705003
|
+
await (0, import_promises106.writeFile)(projectConfig._absolutePath, ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2)));
|
|
1704714
1705004
|
cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
|
|
1704715
1705005
|
}
|
|
1704716
1705006
|
|
|
1704717
1705007
|
// src/commands/export/generateOpenAPIForWorkspaces.ts
|
|
1704718
|
-
var
|
|
1705008
|
+
var import_promises107 = require("fs/promises");
|
|
1704719
1705009
|
|
|
1704720
1705010
|
// src/commands/export/converters/servicesConverter.ts
|
|
1704721
1705011
|
var import_openapi_types3 = __toESM(require_dist10(), 1);
|
|
@@ -1705968,8 +1706258,8 @@ async function generateOpenAPIForWorkspaces({
|
|
|
1705968
1706258
|
ir: ir14,
|
|
1705969
1706259
|
mode: "openapi"
|
|
1705970
1706260
|
});
|
|
1705971
|
-
await (0,
|
|
1705972
|
-
await (0,
|
|
1706261
|
+
await (0, import_promises107.mkdir)(dirname4(outputPath), { recursive: true });
|
|
1706262
|
+
await (0, import_promises107.writeFile)(
|
|
1705973
1706263
|
outputPath,
|
|
1705974
1706264
|
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent3) : jsYaml.dump(openapi, { indent: indent3 })
|
|
1705975
1706265
|
);
|
|
@@ -1706008,10 +1706298,10 @@ var APPROVED_DIRECTORIES_FILENAME = "approved-output-directories";
|
|
|
1706008
1706298
|
var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
|
|
1706009
1706299
|
|
|
1706010
1706300
|
// src/commands/generate/checkOutputDirectory.ts
|
|
1706011
|
-
var
|
|
1706301
|
+
var import_promises110 = require("fs/promises");
|
|
1706012
1706302
|
|
|
1706013
1706303
|
// src/persistence/output-directories/getOutputDirectories.ts
|
|
1706014
|
-
var
|
|
1706304
|
+
var import_promises108 = require("fs/promises");
|
|
1706015
1706305
|
|
|
1706016
1706306
|
// src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
|
|
1706017
1706307
|
var import_os9 = require("os");
|
|
@@ -1706030,17 +1706320,17 @@ async function getOutputDirectories() {
|
|
|
1706030
1706320
|
if (!doesOutputDirectoriesFileExist) {
|
|
1706031
1706321
|
return [];
|
|
1706032
1706322
|
}
|
|
1706033
|
-
const outputDirectoriesFileContents = await (0,
|
|
1706323
|
+
const outputDirectoriesFileContents = await (0, import_promises108.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
|
|
1706034
1706324
|
const outputDirectories = JSON.parse(outputDirectoriesFileContents);
|
|
1706035
1706325
|
return outputDirectories;
|
|
1706036
1706326
|
}
|
|
1706037
1706327
|
|
|
1706038
1706328
|
// src/persistence/output-directories/storeOutputDirectories.ts
|
|
1706039
|
-
var
|
|
1706329
|
+
var import_promises109 = require("fs/promises");
|
|
1706040
1706330
|
var import_path60 = __toESM(require("path"), 1);
|
|
1706041
1706331
|
async function storeOutputDirectories(outputDirectories) {
|
|
1706042
|
-
await (0,
|
|
1706043
|
-
await (0,
|
|
1706332
|
+
await (0, import_promises109.mkdir)(import_path60.default.dirname(getPathToOutputDirectoriesFile()), { recursive: true });
|
|
1706333
|
+
await (0, import_promises109.writeFile)(getPathToOutputDirectoriesFile(), JSON.stringify(outputDirectories, null, 2));
|
|
1706044
1706334
|
}
|
|
1706045
1706335
|
|
|
1706046
1706336
|
// src/commands/generate/checkOutputDirectory.ts
|
|
@@ -1706062,7 +1706352,7 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
|
1706062
1706352
|
shouldProceed: true
|
|
1706063
1706353
|
};
|
|
1706064
1706354
|
}
|
|
1706065
|
-
const files = await (0,
|
|
1706355
|
+
const files = await (0, import_promises110.readdir)(outputPath);
|
|
1706066
1706356
|
if (files.length === 0) {
|
|
1706067
1706357
|
return {
|
|
1706068
1706358
|
shouldProceed: true
|
|
@@ -1711803,14 +1712093,14 @@ async function validateGeneratorsYmlFile({ contents, allRuleVisitors, cliVersion
|
|
|
1711803
1712093
|
}
|
|
1711804
1712094
|
|
|
1711805
1712095
|
// ../workspace/oss-validator/lib/rules/no-duplicate-overrides/no-duplicate-overrides.js
|
|
1711806
|
-
var
|
|
1712096
|
+
var import_promises111 = require("fs/promises");
|
|
1711807
1712097
|
var NoDuplicateOverridesRule = {
|
|
1711808
1712098
|
name: "no-duplicate-overrides",
|
|
1711809
1712099
|
run: async ({ workspace, specs, context: context2 }) => {
|
|
1711810
1712100
|
const violations = [];
|
|
1711811
1712101
|
const seenMethodsByAudience = /* @__PURE__ */ new Map();
|
|
1711812
1712102
|
for (const spec of specs) {
|
|
1711813
|
-
const contents = (await (0,
|
|
1712103
|
+
const contents = (await (0, import_promises111.readFile)(spec.absoluteFilepath)).toString();
|
|
1711814
1712104
|
if (contents.includes("openapi") || contents.includes("swagger")) {
|
|
1711815
1712105
|
const openAPI = await loadOpenAPI({
|
|
1711816
1712106
|
absolutePathToOpenAPI: spec.absoluteFilepath,
|
|
@@ -1712637,7 +1712927,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
1712637
1712927
|
}
|
|
1712638
1712928
|
|
|
1712639
1712929
|
// src/commands/generate-overrides/compareOpenAPISpecs.ts
|
|
1712640
|
-
var
|
|
1712930
|
+
var import_promises112 = require("fs/promises");
|
|
1712641
1712931
|
async function compareOpenAPISpecs({
|
|
1712642
1712932
|
originalPath,
|
|
1712643
1712933
|
modifiedPath,
|
|
@@ -1712674,12 +1712964,12 @@ async function compareOpenAPISpecs({
|
|
|
1712674
1712964
|
}
|
|
1712675
1712965
|
outputPath = join4(dirname4(originalPath), RelativeFilePath2.of(overridesFilename));
|
|
1712676
1712966
|
}
|
|
1712677
|
-
await (0,
|
|
1712967
|
+
await (0, import_promises112.writeFile)(outputPath, jsYaml.dump(overrides, { lineWidth: -1, noRefs: true }));
|
|
1712678
1712968
|
context2.logger.info(`Overrides written to ${outputPath}`);
|
|
1712679
1712969
|
});
|
|
1712680
1712970
|
}
|
|
1712681
1712971
|
async function loadSpec(filepath, context2) {
|
|
1712682
|
-
const contents = await (0,
|
|
1712972
|
+
const contents = await (0, import_promises112.readFile)(filepath, "utf8");
|
|
1712683
1712973
|
try {
|
|
1712684
1712974
|
return JSON.parse(contents);
|
|
1712685
1712975
|
} catch {
|
|
@@ -1712780,7 +1713070,7 @@ function deepEqual(a10, b18) {
|
|
|
1712780
1713070
|
}
|
|
1712781
1713071
|
|
|
1712782
1713072
|
// src/commands/generate-overrides/writeOverridesForWorkspaces.ts
|
|
1712783
|
-
var
|
|
1713073
|
+
var import_promises113 = require("fs/promises");
|
|
1712784
1713074
|
async function writeOverridesForWorkspaces({
|
|
1712785
1713075
|
project,
|
|
1712786
1713076
|
includeModels,
|
|
@@ -1712805,7 +1713095,7 @@ async function writeOverridesForWorkspaces({
|
|
|
1712805
1713095
|
async function readExistingOverrides(overridesFilepath, context2) {
|
|
1712806
1713096
|
let parsedOverrides = null;
|
|
1712807
1713097
|
try {
|
|
1712808
|
-
const contents = (await (0,
|
|
1713098
|
+
const contents = (await (0, import_promises113.readFile)(overridesFilepath, "utf8")).toString();
|
|
1712809
1713099
|
try {
|
|
1712810
1713100
|
parsedOverrides = JSON.parse(contents);
|
|
1712811
1713101
|
} catch (err) {
|
|
@@ -1712869,7 +1713159,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
1712869
1713159
|
overridesFilename = `${nameWithoutExt}-overrides${extension3}`;
|
|
1712870
1713160
|
}
|
|
1712871
1713161
|
}
|
|
1712872
|
-
await (0,
|
|
1713162
|
+
await (0, import_promises113.writeFile)(
|
|
1712873
1713163
|
join4(dirname4(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
|
|
1712874
1713164
|
jsYaml.dump({ paths, components })
|
|
1712875
1713165
|
);
|
|
@@ -1713234,7 +1713524,7 @@ function convertIRtoJsonSchema(args) {
|
|
|
1713234
1713524
|
}
|
|
1713235
1713525
|
|
|
1713236
1713526
|
// src/commands/jsonschema/generateJsonschemaForWorkspace.ts
|
|
1713237
|
-
var
|
|
1713527
|
+
var import_promises114 = require("fs/promises");
|
|
1713238
1713528
|
async function generateJsonschemaForWorkspaces({
|
|
1713239
1713529
|
typeLocator,
|
|
1713240
1713530
|
project,
|
|
@@ -1713282,9 +1713572,9 @@ async function generateJsonschemaForWorkspaces({
|
|
|
1713282
1713572
|
context: context2
|
|
1713283
1713573
|
});
|
|
1713284
1713574
|
if (!await doesPathExist(dirname4(jsonschemaFilepath))) {
|
|
1713285
|
-
await (0,
|
|
1713575
|
+
await (0, import_promises114.mkdir)(dirname4(jsonschemaFilepath), { recursive: true });
|
|
1713286
1713576
|
}
|
|
1713287
|
-
await (0,
|
|
1713577
|
+
await (0, import_promises114.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
|
|
1713288
1713578
|
context2.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
|
|
1713289
1713579
|
});
|
|
1713290
1713580
|
})
|
|
@@ -1713641,7 +1713931,7 @@ async function mockServer({
|
|
|
1713641
1713931
|
|
|
1713642
1713932
|
// src/commands/register/registerWorkspacesV1.ts
|
|
1713643
1713933
|
var import_fiddle_sdk8 = __toESM(require_fiddle_sdk(), 1);
|
|
1713644
|
-
var
|
|
1713934
|
+
var import_promises115 = require("fs/promises");
|
|
1713645
1713935
|
var import_path68 = __toESM(require("path"), 1);
|
|
1713646
1713936
|
var import_tmp_promise17 = __toESM(require_tmp_promise(), 1);
|
|
1713647
1713937
|
async function registerWorkspacesV1({
|
|
@@ -1713690,7 +1713980,7 @@ async function registerWorkspacesV1({
|
|
|
1713690
1713980
|
context2.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
1713691
1713981
|
await create2({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
|
|
1713692
1713982
|
context2.logger.info("Uploading definition...");
|
|
1713693
|
-
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
1713983
|
+
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises115.readFile)(tarPath));
|
|
1713694
1713984
|
context2.logger.info(
|
|
1713695
1713985
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
1713696
1713986
|
);
|
|
@@ -1713828,7 +1714118,7 @@ async function generateDiff({
|
|
|
1713828
1714118
|
}
|
|
1713829
1714119
|
|
|
1713830
1714120
|
// src/commands/self-update/selfUpdate.ts
|
|
1713831
|
-
var
|
|
1714121
|
+
var import_promises116 = require("fs/promises");
|
|
1713832
1714122
|
var import_path69 = require("path");
|
|
1713833
1714123
|
async function getPackageManagerBinDir(logger, pm) {
|
|
1713834
1714124
|
let command3;
|
|
@@ -1713874,7 +1714164,7 @@ async function detectInstallationMethod(logger) {
|
|
|
1713874
1714164
|
logger.debug(`Found fern at: ${fernPath}`);
|
|
1713875
1714165
|
let resolvedPath;
|
|
1713876
1714166
|
try {
|
|
1713877
|
-
resolvedPath = await (0,
|
|
1714167
|
+
resolvedPath = await (0, import_promises116.realpath)(fernPath);
|
|
1713878
1714168
|
logger.debug(`Resolved to: ${resolvedPath}`);
|
|
1713879
1714169
|
} catch (error49) {
|
|
1713880
1714170
|
logger.debug(`Failed to resolve symlink: ${error49}`);
|
|
@@ -1714155,20 +1714445,20 @@ async function generateToken({
|
|
|
1714155
1714445
|
|
|
1714156
1714446
|
// src/commands/upgrade/updateApiSpec.ts
|
|
1714157
1714447
|
var fs32 = __toESM(require("fs"), 1);
|
|
1714158
|
-
var
|
|
1714448
|
+
var import_promises117 = require("fs/promises");
|
|
1714159
1714449
|
var import_stream9 = require("stream");
|
|
1714160
|
-
var
|
|
1714450
|
+
var import_promises118 = require("stream/promises");
|
|
1714161
1714451
|
async function fetchAndWriteFile(url3, path86, logger, indent3) {
|
|
1714162
1714452
|
const resp = await fetch(url3);
|
|
1714163
1714453
|
if (resp.ok && resp.body) {
|
|
1714164
1714454
|
logger.debug("Origin successfully fetched, writing to file");
|
|
1714165
1714455
|
const fileStream = fs32.createWriteStream(path86);
|
|
1714166
|
-
await (0,
|
|
1714167
|
-
const fileContents = await (0,
|
|
1714456
|
+
await (0, import_promises118.finished)(import_stream9.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
1714457
|
+
const fileContents = await (0, import_promises117.readFile)(path86, "utf8");
|
|
1714168
1714458
|
try {
|
|
1714169
|
-
await (0,
|
|
1714459
|
+
await (0, import_promises117.writeFile)(path86, JSON.stringify(JSON.parse(fileContents), void 0, indent3), "utf8");
|
|
1714170
1714460
|
} catch (e6) {
|
|
1714171
|
-
await (0,
|
|
1714461
|
+
await (0, import_promises117.writeFile)(path86, jsYaml.dump(jsYaml.load(fileContents), { indent: indent3 }), "utf8");
|
|
1714172
1714462
|
}
|
|
1714173
1714463
|
logger.debug("File written successfully");
|
|
1714174
1714464
|
}
|
|
@@ -1714264,7 +1714554,7 @@ async function processDefinitions({
|
|
|
1714264
1714554
|
}
|
|
1714265
1714555
|
|
|
1714266
1714556
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
1714267
|
-
var
|
|
1714557
|
+
var import_promises119 = require("fs/promises");
|
|
1714268
1714558
|
|
|
1714269
1714559
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
1714270
1714560
|
var FERN_DIRECTORY2 = "fern";
|
|
@@ -1714298,7 +1714588,7 @@ var migration = {
|
|
|
1714298
1714588
|
try {
|
|
1714299
1714589
|
const fileContents = await getFileContents(yamlFilepath);
|
|
1714300
1714590
|
const newContents = addDiscriminantToFile(fileContents);
|
|
1714301
|
-
await (0,
|
|
1714591
|
+
await (0, import_promises119.writeFile)(yamlFilepath, newContents);
|
|
1714302
1714592
|
} catch (error49) {
|
|
1714303
1714593
|
context2.failAndThrow("Failed to migrate " + yamlFilepath, error49);
|
|
1714304
1714594
|
}
|
|
@@ -1714306,7 +1714596,7 @@ var migration = {
|
|
|
1714306
1714596
|
}
|
|
1714307
1714597
|
};
|
|
1714308
1714598
|
async function getFileContents(filepath) {
|
|
1714309
|
-
const buffer = await (0,
|
|
1714599
|
+
const buffer = await (0, import_promises119.readFile)(filepath);
|
|
1714310
1714600
|
return buffer.toString();
|
|
1714311
1714601
|
}
|
|
1714312
1714602
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -1714335,7 +1714625,7 @@ var versionMigrations = {
|
|
|
1714335
1714625
|
var __default = versionMigrations;
|
|
1714336
1714626
|
|
|
1714337
1714627
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
1714338
|
-
var
|
|
1714628
|
+
var import_promises120 = require("fs/promises");
|
|
1714339
1714629
|
var import_yaml6 = __toESM(require_dist2(), 1);
|
|
1714340
1714630
|
|
|
1714341
1714631
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
@@ -1714376,7 +1714666,7 @@ var migration2 = {
|
|
|
1714376
1714666
|
}
|
|
1714377
1714667
|
};
|
|
1714378
1714668
|
async function migrateFile(filepath, context2) {
|
|
1714379
|
-
const contents = await (0,
|
|
1714669
|
+
const contents = await (0, import_promises120.readFile)(filepath);
|
|
1714380
1714670
|
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
1714381
1714671
|
const types4 = parsedDocument.get("types");
|
|
1714382
1714672
|
if (types4 == null) {
|
|
@@ -1714408,7 +1714698,7 @@ async function migrateFile(filepath, context2) {
|
|
|
1714408
1714698
|
}
|
|
1714409
1714699
|
}
|
|
1714410
1714700
|
}
|
|
1714411
|
-
await (0,
|
|
1714701
|
+
await (0, import_promises120.writeFile)(filepath, parsedDocument.toString());
|
|
1714412
1714702
|
}
|
|
1714413
1714703
|
|
|
1714414
1714704
|
// ../cli-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -1714419,7 +1714709,7 @@ var versionMigrations2 = {
|
|
|
1714419
1714709
|
var __default2 = versionMigrations2;
|
|
1714420
1714710
|
|
|
1714421
1714711
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
1714422
|
-
var
|
|
1714712
|
+
var import_promises121 = require("fs/promises");
|
|
1714423
1714713
|
var import_yaml7 = __toESM(require_dist2(), 1);
|
|
1714424
1714714
|
|
|
1714425
1714715
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
@@ -1714460,7 +1714750,7 @@ var migration3 = {
|
|
|
1714460
1714750
|
}
|
|
1714461
1714751
|
};
|
|
1714462
1714752
|
async function migrateGeneratorsYml(filepath, context2) {
|
|
1714463
|
-
const contents = await (0,
|
|
1714753
|
+
const contents = await (0, import_promises121.readFile)(filepath);
|
|
1714464
1714754
|
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
1714465
1714755
|
const draftGenerators = parsedDocument.get("draft");
|
|
1714466
1714756
|
if (draftGenerators == null) {
|
|
@@ -1714487,7 +1714777,7 @@ async function migrateGeneratorsYml(filepath, context2) {
|
|
|
1714487
1714777
|
draftGenerator.set("output-path", name3.value.includes("openapi") ? "./generated-openapi" : name3.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
1714488
1714778
|
}
|
|
1714489
1714779
|
});
|
|
1714490
|
-
await (0,
|
|
1714780
|
+
await (0, import_promises121.writeFile)(filepath, parsedDocument.toString());
|
|
1714491
1714781
|
}
|
|
1714492
1714782
|
|
|
1714493
1714783
|
// ../cli-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -1714498,7 +1714788,7 @@ var versionMigrations3 = {
|
|
|
1714498
1714788
|
var __default3 = versionMigrations3;
|
|
1714499
1714789
|
|
|
1714500
1714790
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
1714501
|
-
var
|
|
1714791
|
+
var import_promises122 = require("fs/promises");
|
|
1714502
1714792
|
var import_yaml8 = __toESM(require_dist2(), 1);
|
|
1714503
1714793
|
|
|
1714504
1714794
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
@@ -1714539,7 +1714829,7 @@ var migration4 = {
|
|
|
1714539
1714829
|
}
|
|
1714540
1714830
|
};
|
|
1714541
1714831
|
async function migrateFile2(filepath, context2) {
|
|
1714542
|
-
const contents = await (0,
|
|
1714832
|
+
const contents = await (0, import_promises122.readFile)(filepath);
|
|
1714543
1714833
|
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
1714544
1714834
|
const addType = (typeName, typeDeclaration2) => {
|
|
1714545
1714835
|
const types4 = parsedDocument.get("types");
|
|
@@ -1714583,7 +1714873,7 @@ async function migrateFile2(filepath, context2) {
|
|
|
1714583
1714873
|
}
|
|
1714584
1714874
|
}
|
|
1714585
1714875
|
}
|
|
1714586
|
-
await (0,
|
|
1714876
|
+
await (0, import_promises122.writeFile)(filepath, parsedDocument.toString());
|
|
1714587
1714877
|
}
|
|
1714588
1714878
|
|
|
1714589
1714879
|
// ../cli-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -1714594,7 +1714884,7 @@ var versionMigrations4 = {
|
|
|
1714594
1714884
|
var __default4 = versionMigrations4;
|
|
1714595
1714885
|
|
|
1714596
1714886
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
1714597
|
-
var
|
|
1714887
|
+
var import_promises123 = require("fs/promises");
|
|
1714598
1714888
|
var import_yaml9 = __toESM(require_dist2(), 1);
|
|
1714599
1714889
|
|
|
1714600
1714890
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
@@ -1714635,7 +1714925,7 @@ var migration5 = {
|
|
|
1714635
1714925
|
}
|
|
1714636
1714926
|
};
|
|
1714637
1714927
|
async function migrateGeneratorsYml2(filepath, context2) {
|
|
1714638
|
-
const contents = await (0,
|
|
1714928
|
+
const contents = await (0, import_promises123.readFile)(filepath);
|
|
1714639
1714929
|
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
1714640
1714930
|
const releaseGenerators = parsedDocument.get("release");
|
|
1714641
1714931
|
if (releaseGenerators == null) {
|
|
@@ -1714673,7 +1714963,7 @@ async function migrateGeneratorsYml2(filepath, context2) {
|
|
|
1714673
1714963
|
}
|
|
1714674
1714964
|
releaseGenerator.delete("outputs");
|
|
1714675
1714965
|
});
|
|
1714676
|
-
await (0,
|
|
1714966
|
+
await (0, import_promises123.writeFile)(filepath, parsedDocument.toString());
|
|
1714677
1714967
|
}
|
|
1714678
1714968
|
|
|
1714679
1714969
|
// ../cli-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -1714684,7 +1714974,7 @@ var versionMigrations5 = {
|
|
|
1714684
1714974
|
var __default5 = versionMigrations5;
|
|
1714685
1714975
|
|
|
1714686
1714976
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
1714687
|
-
var
|
|
1714977
|
+
var import_promises124 = require("fs/promises");
|
|
1714688
1714978
|
|
|
1714689
1714979
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
1714690
1714980
|
var FERN_DIRECTORY7 = "fern";
|
|
@@ -1714715,9 +1715005,9 @@ var migration6 = {
|
|
|
1714715
1715005
|
run: async ({ context: context2 }) => {
|
|
1714716
1715006
|
const yamlFiles = await getAllYamlFiles4(context2);
|
|
1714717
1715007
|
for (const filepath of yamlFiles) {
|
|
1714718
|
-
const contents = await (0,
|
|
1715008
|
+
const contents = await (0, import_promises124.readFile)(filepath);
|
|
1714719
1715009
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
1714720
|
-
await (0,
|
|
1715010
|
+
await (0, import_promises124.writeFile)(filepath, newContents);
|
|
1714721
1715011
|
}
|
|
1714722
1715012
|
}
|
|
1714723
1715013
|
};
|
|
@@ -1714730,7 +1715020,7 @@ var versionMigrations6 = {
|
|
|
1714730
1715020
|
var __default6 = versionMigrations6;
|
|
1714731
1715021
|
|
|
1714732
1715022
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
1714733
|
-
var
|
|
1715023
|
+
var import_promises125 = require("fs/promises");
|
|
1714734
1715024
|
|
|
1714735
1715025
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
1714736
1715026
|
var FERN_DIRECTORY8 = "fern";
|
|
@@ -1714761,9 +1715051,9 @@ var migration7 = {
|
|
|
1714761
1715051
|
run: async ({ context: context2 }) => {
|
|
1714762
1715052
|
const yamlFiles = await getAllRootApiYamlFiles(context2);
|
|
1714763
1715053
|
for (const filepath of yamlFiles) {
|
|
1714764
|
-
const contents = await (0,
|
|
1715054
|
+
const contents = await (0, import_promises125.readFile)(filepath);
|
|
1714765
1715055
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
1714766
|
-
await (0,
|
|
1715056
|
+
await (0, import_promises125.writeFile)(filepath, newContents);
|
|
1714767
1715057
|
}
|
|
1714768
1715058
|
}
|
|
1714769
1715059
|
};
|
|
@@ -1714776,7 +1715066,7 @@ var versionMigrations7 = {
|
|
|
1714776
1715066
|
var __default7 = versionMigrations7;
|
|
1714777
1715067
|
|
|
1714778
1715068
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
1714779
|
-
var
|
|
1715069
|
+
var import_promises126 = require("fs/promises");
|
|
1714780
1715070
|
|
|
1714781
1715071
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
1714782
1715072
|
var FERN_DIRECTORY9 = "fern";
|
|
@@ -1714883,7 +1715173,7 @@ var migration8 = {
|
|
|
1714883
1715173
|
}
|
|
1714884
1715174
|
};
|
|
1714885
1715175
|
async function migrateGeneratorsYml3(filepath) {
|
|
1714886
|
-
const contentsStr = await (0,
|
|
1715176
|
+
const contentsStr = await (0, import_promises126.readFile)(filepath);
|
|
1714887
1715177
|
const contents = jsYaml.load(contentsStr.toString());
|
|
1714888
1715178
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
1714889
1715179
|
let newGeneratorsConfiguration = {};
|
|
@@ -1714901,7 +1715191,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
1714901
1715191
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
1714902
1715192
|
};
|
|
1714903
1715193
|
}
|
|
1714904
|
-
await (0,
|
|
1715194
|
+
await (0, import_promises126.writeFile)(filepath, jsYaml.dump(newGeneratorsConfiguration));
|
|
1714905
1715195
|
}
|
|
1714906
1715196
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
1714907
1715197
|
const newSchema = {
|
|
@@ -1714976,7 +1715266,7 @@ var versionMigrations8 = {
|
|
|
1714976
1715266
|
var __default8 = versionMigrations8;
|
|
1714977
1715267
|
|
|
1714978
1715268
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
1714979
|
-
var
|
|
1715269
|
+
var import_promises127 = require("fs/promises");
|
|
1714980
1715270
|
var import_yaml10 = __toESM(require_dist2(), 1);
|
|
1714981
1715271
|
|
|
1714982
1715272
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
@@ -1715017,7 +1715307,7 @@ var migration9 = {
|
|
|
1715017
1715307
|
}
|
|
1715018
1715308
|
};
|
|
1715019
1715309
|
async function migrateRootApiFile(filepath) {
|
|
1715020
|
-
const contents = await (0,
|
|
1715310
|
+
const contents = await (0, import_promises127.readFile)(filepath);
|
|
1715021
1715311
|
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
1715022
1715312
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
1715023
1715313
|
if (errorDiscriminant == null || !import_yaml10.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
@@ -1715028,7 +1715318,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
1715028
1715318
|
"property-name": errorDiscriminant.value
|
|
1715029
1715319
|
});
|
|
1715030
1715320
|
parsedDocument.delete("error-discriminant");
|
|
1715031
|
-
await (0,
|
|
1715321
|
+
await (0, import_promises127.writeFile)(filepath, parsedDocument.toString());
|
|
1715032
1715322
|
}
|
|
1715033
1715323
|
|
|
1715034
1715324
|
// ../cli-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -1715039,7 +1715329,7 @@ var versionMigrations9 = {
|
|
|
1715039
1715329
|
var __default9 = versionMigrations9;
|
|
1715040
1715330
|
|
|
1715041
1715331
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
1715042
|
-
var
|
|
1715332
|
+
var import_promises128 = require("fs/promises");
|
|
1715043
1715333
|
var import_yaml11 = __toESM(require_dist2(), 1);
|
|
1715044
1715334
|
|
|
1715045
1715335
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
@@ -1715080,7 +1715370,7 @@ var migration10 = {
|
|
|
1715080
1715370
|
}
|
|
1715081
1715371
|
};
|
|
1715082
1715372
|
async function migrateYamlFile(filepath, context2) {
|
|
1715083
|
-
const contents = await (0,
|
|
1715373
|
+
const contents = await (0, import_promises128.readFile)(filepath);
|
|
1715084
1715374
|
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
1715085
1715375
|
const services = parsedDocument.get("services");
|
|
1715086
1715376
|
if (services == null) {
|
|
@@ -1715120,7 +1715410,7 @@ async function migrateYamlFile(filepath, context2) {
|
|
|
1715120
1715410
|
context2.failWithoutThrowing("Failed to convert endpoint", e6);
|
|
1715121
1715411
|
}
|
|
1715122
1715412
|
}
|
|
1715123
|
-
await (0,
|
|
1715413
|
+
await (0, import_promises128.writeFile)(filepath, parsedDocument.toString());
|
|
1715124
1715414
|
}
|
|
1715125
1715415
|
}
|
|
1715126
1715416
|
function convertEndpoint21({ document: document4, endpoint: endpoint3 }) {
|
|
@@ -1715199,7 +1715489,7 @@ var versionMigrations10 = {
|
|
|
1715199
1715489
|
var __default10 = versionMigrations10;
|
|
1715200
1715490
|
|
|
1715201
1715491
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
1715202
|
-
var
|
|
1715492
|
+
var import_promises129 = require("fs/promises");
|
|
1715203
1715493
|
var import_yaml12 = __toESM(require_dist2(), 1);
|
|
1715204
1715494
|
|
|
1715205
1715495
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
@@ -1715240,7 +1715530,7 @@ var migration11 = {
|
|
|
1715240
1715530
|
}
|
|
1715241
1715531
|
};
|
|
1715242
1715532
|
async function migrateYamlFile2(filepath, context2) {
|
|
1715243
|
-
const contents = await (0,
|
|
1715533
|
+
const contents = await (0, import_promises129.readFile)(filepath);
|
|
1715244
1715534
|
const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
|
|
1715245
1715535
|
const types4 = parsedDocument.get("types");
|
|
1715246
1715536
|
if (types4 == null) {
|
|
@@ -1715266,7 +1715556,7 @@ async function migrateYamlFile2(filepath, context2) {
|
|
|
1715266
1715556
|
examples.set(i11, { value });
|
|
1715267
1715557
|
}
|
|
1715268
1715558
|
}
|
|
1715269
|
-
await (0,
|
|
1715559
|
+
await (0, import_promises129.writeFile)(filepath, parsedDocument.toString());
|
|
1715270
1715560
|
}
|
|
1715271
1715561
|
|
|
1715272
1715562
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -1715277,7 +1715567,7 @@ var versionMigrations11 = {
|
|
|
1715277
1715567
|
var __default11 = versionMigrations11;
|
|
1715278
1715568
|
|
|
1715279
1715569
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
1715280
|
-
var
|
|
1715570
|
+
var import_promises130 = require("fs/promises");
|
|
1715281
1715571
|
var import_yaml13 = __toESM(require_dist2(), 1);
|
|
1715282
1715572
|
|
|
1715283
1715573
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
@@ -1715318,7 +1715608,7 @@ var migration12 = {
|
|
|
1715318
1715608
|
}
|
|
1715319
1715609
|
};
|
|
1715320
1715610
|
async function migrateYamlFile3(filepath, context2) {
|
|
1715321
|
-
const contents = await (0,
|
|
1715611
|
+
const contents = await (0, import_promises130.readFile)(filepath);
|
|
1715322
1715612
|
const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
|
|
1715323
1715613
|
if (!import_yaml13.default.isMap(parsedDocument.contents)) {
|
|
1715324
1715614
|
return context2.failAndThrow("File is not a map");
|
|
@@ -1715348,7 +1715638,7 @@ async function migrateYamlFile3(filepath, context2) {
|
|
|
1715348
1715638
|
pair.value = firstService.value;
|
|
1715349
1715639
|
}
|
|
1715350
1715640
|
}
|
|
1715351
|
-
await (0,
|
|
1715641
|
+
await (0, import_promises130.writeFile)(filepath, parsedDocument.toString());
|
|
1715352
1715642
|
}
|
|
1715353
1715643
|
|
|
1715354
1715644
|
// ../cli-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -1715359,7 +1715649,7 @@ var versionMigrations12 = {
|
|
|
1715359
1715649
|
var __default12 = versionMigrations12;
|
|
1715360
1715650
|
|
|
1715361
1715651
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
1715362
|
-
var
|
|
1715652
|
+
var import_promises131 = require("fs/promises");
|
|
1715363
1715653
|
var import_yaml14 = __toESM(require_dist2(), 1);
|
|
1715364
1715654
|
|
|
1715365
1715655
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
@@ -1715400,7 +1715690,7 @@ var migration13 = {
|
|
|
1715400
1715690
|
}
|
|
1715401
1715691
|
};
|
|
1715402
1715692
|
async function migrateYamlFile4(filepath, context2) {
|
|
1715403
|
-
const contents = await (0,
|
|
1715693
|
+
const contents = await (0, import_promises131.readFile)(filepath);
|
|
1715404
1715694
|
const parsedDocument = import_yaml14.default.parseDocument(contents.toString());
|
|
1715405
1715695
|
if (!import_yaml14.default.isMap(parsedDocument.contents)) {
|
|
1715406
1715696
|
return context2.failAndThrow("File is not a map");
|
|
@@ -1715419,7 +1715709,7 @@ async function migrateYamlFile4(filepath, context2) {
|
|
|
1715419
1715709
|
}
|
|
1715420
1715710
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
1715421
1715711
|
parsedDocument.contents.items.unshift(docsPair);
|
|
1715422
|
-
await (0,
|
|
1715712
|
+
await (0, import_promises131.writeFile)(filepath, parsedDocument.toString());
|
|
1715423
1715713
|
}
|
|
1715424
1715714
|
|
|
1715425
1715715
|
// ../cli-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -1715430,7 +1715720,7 @@ var versionMigrations13 = {
|
|
|
1715430
1715720
|
var __default13 = versionMigrations13;
|
|
1715431
1715721
|
|
|
1715432
1715722
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
1715433
|
-
var
|
|
1715723
|
+
var import_promises132 = require("fs/promises");
|
|
1715434
1715724
|
|
|
1715435
1715725
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
1715436
1715726
|
var FERN_DIRECTORY15 = "fern";
|
|
@@ -1715470,14 +1715760,14 @@ var migration14 = {
|
|
|
1715470
1715760
|
}
|
|
1715471
1715761
|
};
|
|
1715472
1715762
|
async function migrateYamlFile5(filepath) {
|
|
1715473
|
-
const contents = await (0,
|
|
1715763
|
+
const contents = await (0, import_promises132.readFile)(filepath);
|
|
1715474
1715764
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
1715475
1715765
|
const regex5 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
1715476
1715766
|
const updatedSnapshot = contents.toString().replace(regex5, (_match, _prefix, domain3) => {
|
|
1715477
1715767
|
return `docs:
|
|
1715478
1715768
|
domain: "${domain3}.${domainSuffix}"`;
|
|
1715479
1715769
|
});
|
|
1715480
|
-
await (0,
|
|
1715770
|
+
await (0, import_promises132.writeFile)(filepath, updatedSnapshot.toString());
|
|
1715481
1715771
|
}
|
|
1715482
1715772
|
|
|
1715483
1715773
|
// ../cli-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -1715493,10 +1715783,10 @@ var import_legacy_docs_config = __toESM(require_legacy_docs_config(), 1);
|
|
|
1715493
1715783
|
var LegacyDocsSerializers = __toESM(require_serialization44(), 1);
|
|
1715494
1715784
|
|
|
1715495
1715785
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
1715496
|
-
var
|
|
1715786
|
+
var import_promises133 = require("fs/promises");
|
|
1715497
1715787
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
1715498
1715788
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1715499
|
-
const contentsStr = await (0,
|
|
1715789
|
+
const contentsStr = await (0, import_promises133.readFile)(filepath);
|
|
1715500
1715790
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
1715501
1715791
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
1715502
1715792
|
if (result.ok) {
|
|
@@ -1715514,7 +1715804,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
1715514
1715804
|
}
|
|
1715515
1715805
|
|
|
1715516
1715806
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
1715517
|
-
var
|
|
1715807
|
+
var import_promises135 = require("fs/promises");
|
|
1715518
1715808
|
|
|
1715519
1715809
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
1715520
1715810
|
function convertLegacyDocsConfig({ docsConfiguration, docsURLs, apiName }) {
|
|
@@ -1715692,10 +1715982,10 @@ __export(legacy_exports, {
|
|
|
1715692
1715982
|
});
|
|
1715693
1715983
|
|
|
1715694
1715984
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
1715695
|
-
var
|
|
1715985
|
+
var import_promises134 = require("fs/promises");
|
|
1715696
1715986
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
1715697
1715987
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
1715698
|
-
const contentsStr = await (0,
|
|
1715988
|
+
const contentsStr = await (0, import_promises134.readFile)(filepath);
|
|
1715699
1715989
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
1715700
1715990
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
1715701
1715991
|
if (result.success) {
|
|
@@ -1715725,7 +1716015,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
1715725
1716015
|
var APIS_DIRECTORY2 = "apis";
|
|
1715726
1716016
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
1715727
1716017
|
const absolutePathToApisDirectory = join4(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY2));
|
|
1715728
|
-
await (0,
|
|
1716018
|
+
await (0, import_promises135.mkdir)(absolutePathToApisDirectory);
|
|
1715729
1716019
|
for (const workspace of workspaces) {
|
|
1715730
1716020
|
const absolutePathToWorkspace = join4(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
1715731
1716021
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -1715733,11 +1716023,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
1715733
1716023
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
1715734
1716024
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
1715735
1716025
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
1715736
|
-
await (0,
|
|
1716026
|
+
await (0, import_promises135.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
1715737
1716027
|
}
|
|
1715738
1716028
|
const absolutePathToNestedWorkspace = join4(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
1715739
1716029
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
1715740
|
-
await (0,
|
|
1716030
|
+
await (0, import_promises135.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1715741
1716031
|
}
|
|
1715742
1716032
|
}
|
|
1715743
1716033
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -1715750,7 +1716040,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
1715750
1716040
|
generatorsConfiguration,
|
|
1715751
1716041
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
1715752
1716042
|
});
|
|
1715753
|
-
await (0,
|
|
1716043
|
+
await (0, import_promises135.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
1715754
1716044
|
return convertedResponse.docsURLs;
|
|
1715755
1716045
|
}
|
|
1715756
1716046
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -1715764,19 +1716054,19 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
1715764
1716054
|
apiName
|
|
1715765
1716055
|
});
|
|
1715766
1716056
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1715767
|
-
await (0,
|
|
1716057
|
+
await (0, import_promises135.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
1715768
1716058
|
}
|
|
1715769
1716059
|
|
|
1715770
1716060
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
1715771
|
-
var
|
|
1716061
|
+
var import_promises136 = require("fs/promises");
|
|
1715772
1716062
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
1715773
1716063
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
1715774
1716064
|
await migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs });
|
|
1715775
1716065
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
1715776
1716066
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
1715777
1716067
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
1715778
|
-
await (0,
|
|
1715779
|
-
await (0,
|
|
1716068
|
+
await (0, import_promises136.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
1716069
|
+
await (0, import_promises136.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1715780
1716070
|
}
|
|
1715781
1716071
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
1715782
1716072
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1715789,7 +1716079,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
1715789
1716079
|
apiName: void 0
|
|
1715790
1716080
|
});
|
|
1715791
1716081
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
1715792
|
-
await (0,
|
|
1716082
|
+
await (0, import_promises136.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
1715793
1716083
|
}
|
|
1715794
1716084
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
1715795
1716085
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1715801,22 +1716091,22 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
1715801
1716091
|
generatorsConfiguration,
|
|
1715802
1716092
|
pathModificationStrategy: "MoveUp"
|
|
1715803
1716093
|
});
|
|
1715804
|
-
await (0,
|
|
1716094
|
+
await (0, import_promises136.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
1715805
1716095
|
return convertedResponse.docsURLs;
|
|
1715806
1716096
|
}
|
|
1715807
1716097
|
|
|
1715808
1716098
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
1715809
|
-
var
|
|
1716099
|
+
var import_promises137 = require("fs/promises");
|
|
1715810
1716100
|
var APIS_DIRECTORY3 = "apis";
|
|
1715811
1716101
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
1715812
1716102
|
const absolutePathToApisDirectory = join4(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY3));
|
|
1715813
|
-
await (0,
|
|
1716103
|
+
await (0, import_promises137.mkdir)(absolutePathToApisDirectory);
|
|
1715814
1716104
|
for (const workspace of workspaces) {
|
|
1715815
1716105
|
const absolutePathToWorkspace = join4(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
1715816
1716106
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
1715817
1716107
|
const absolutePathToNestedWorkspace = join4(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
1715818
1716108
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
1715819
|
-
await (0,
|
|
1716109
|
+
await (0, import_promises137.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1715820
1716110
|
}
|
|
1715821
1716111
|
}
|
|
1715822
1716112
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -1715829,15 +1716119,15 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
1715829
1716119
|
generatorsConfiguration,
|
|
1715830
1716120
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
1715831
1716121
|
});
|
|
1715832
|
-
await (0,
|
|
1716122
|
+
await (0, import_promises137.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
1715833
1716123
|
}
|
|
1715834
1716124
|
|
|
1715835
1716125
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
1715836
|
-
var
|
|
1716126
|
+
var import_promises138 = require("fs/promises");
|
|
1715837
1716127
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
1715838
1716128
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
1715839
1716129
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
1715840
|
-
await (0,
|
|
1716130
|
+
await (0, import_promises138.rm)(absolutePathToWorkspace, { recursive: true });
|
|
1715841
1716131
|
}
|
|
1715842
1716132
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
1715843
1716133
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -1715849,7 +1716139,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
1715849
1716139
|
generatorsConfiguration,
|
|
1715850
1716140
|
pathModificationStrategy: "MoveUp"
|
|
1715851
1716141
|
});
|
|
1715852
|
-
await (0,
|
|
1716142
|
+
await (0, import_promises138.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
1715853
1716143
|
}
|
|
1715854
1716144
|
|
|
1715855
1716145
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -1715926,7 +1716216,7 @@ var versionMigrations15 = {
|
|
|
1715926
1716216
|
var __default15 = versionMigrations15;
|
|
1715927
1716217
|
|
|
1715928
1716218
|
// ../cli-migrations/lib/migrations/0.41.0-rc0/require-generators-yml/migration.js
|
|
1715929
|
-
var
|
|
1716219
|
+
var import_promises139 = require("fs/promises");
|
|
1715930
1716220
|
var import_yaml15 = __toESM(require_dist2(), 1);
|
|
1715931
1716221
|
var migration16 = {
|
|
1715932
1716222
|
name: "require-generators-yml",
|
|
@@ -1715969,7 +1716259,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
1715969
1716259
|
if (existingGeneratorsYml == null) {
|
|
1715970
1716260
|
if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
1715971
1716261
|
const absolutePathToGeneratorsYml = join4(absoluteFilepathToWorkspace, RelativeFilePath2.of("generators.yml"));
|
|
1715972
|
-
await (0,
|
|
1716262
|
+
await (0, import_promises139.writeFile)(absolutePathToGeneratorsYml, jsYaml.dump({
|
|
1715973
1716263
|
api: {
|
|
1715974
1716264
|
path: join4(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
1715975
1716265
|
}
|
|
@@ -1715984,7 +1716274,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
1715984
1716274
|
parsedDocument.set("api", {
|
|
1715985
1716275
|
path: join4(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
1715986
1716276
|
});
|
|
1715987
|
-
await (0,
|
|
1716277
|
+
await (0, import_promises139.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
|
|
1715988
1716278
|
context2.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
|
|
1715989
1716279
|
}
|
|
1715990
1716280
|
}
|
|
@@ -1716011,7 +1716301,7 @@ var versionMigrations16 = {
|
|
|
1716011
1716301
|
var __default16 = versionMigrations16;
|
|
1716012
1716302
|
|
|
1716013
1716303
|
// ../cli-migrations/lib/migrations/0.54.0-rc0/use-generators-yml-specs/migration.js
|
|
1716014
|
-
var
|
|
1716304
|
+
var import_promises140 = require("fs/promises");
|
|
1716015
1716305
|
var import_yaml16 = __toESM(require_dist2(), 1);
|
|
1716016
1716306
|
var migration17 = {
|
|
1716017
1716307
|
name: "generators-yml-use-api-specs",
|
|
@@ -1716191,7 +1716481,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
|
|
|
1716191
1716481
|
if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
|
|
1716192
1716482
|
documentToWrite = `${schemaComment}${documentToWrite}`;
|
|
1716193
1716483
|
}
|
|
1716194
|
-
await (0,
|
|
1716484
|
+
await (0, import_promises140.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1716195
1716485
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1716196
1716486
|
}
|
|
1716197
1716487
|
async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, directories, context: context2, namespace }) {
|
|
@@ -1716238,7 +1716528,7 @@ async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, direc
|
|
|
1716238
1716528
|
}
|
|
1716239
1716529
|
let specContent;
|
|
1716240
1716530
|
try {
|
|
1716241
|
-
const fileContents = await (0,
|
|
1716531
|
+
const fileContents = await (0, import_promises140.readFile)(absoluteSpecPath, { encoding: "utf-8" });
|
|
1716242
1716532
|
specContent = jsYaml.load(fileContents);
|
|
1716243
1716533
|
} catch (e6) {
|
|
1716244
1716534
|
context2.logger.warn(`Failed to read API spec file ${spec.path}. Error: ${e6}. Skipping...`);
|
|
@@ -1716341,7 +1716631,7 @@ var versionMigrations17 = {
|
|
|
1716341
1716631
|
var __default17 = versionMigrations17;
|
|
1716342
1716632
|
|
|
1716343
1716633
|
// ../cli-migrations/lib/migrations/0.82.1/add-path-parameter-order-setting/migration.js
|
|
1716344
|
-
var
|
|
1716634
|
+
var import_promises141 = require("fs/promises");
|
|
1716345
1716635
|
var migration18 = {
|
|
1716346
1716636
|
name: "add-path-parameter-order-setting",
|
|
1716347
1716637
|
summary: `Adds the 'path-parameter-order' setting to existing API configurations to maintain backwards compatibility.
|
|
@@ -1716429,7 +1716719,7 @@ async function updateGeneratorsYml({ context: context2, files }) {
|
|
|
1716429
1716719
|
documentToWrite = `${schemaComment}
|
|
1716430
1716720
|
${documentToWrite}`;
|
|
1716431
1716721
|
}
|
|
1716432
|
-
await (0,
|
|
1716722
|
+
await (0, import_promises141.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1716433
1716723
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1716434
1716724
|
}
|
|
1716435
1716725
|
async function getFilesAndDirectories3(absoluteFilepath) {
|
|
@@ -1716465,7 +1716755,7 @@ var versionMigrations18 = {
|
|
|
1716465
1716755
|
var __default18 = versionMigrations18;
|
|
1716466
1716756
|
|
|
1716467
1716757
|
// ../cli-migrations/lib/migrations/1.0.0/update-settings-defaults/migration.js
|
|
1716468
|
-
var
|
|
1716758
|
+
var import_promises142 = require("fs/promises");
|
|
1716469
1716759
|
var migration19 = {
|
|
1716470
1716760
|
name: "update-1_0_0-defaults",
|
|
1716471
1716761
|
summary: `The defaults of the API spec settings have changed.
|
|
@@ -1716640,7 +1716930,7 @@ async function updateGeneratorsYml2({ context: context2, files }) {
|
|
|
1716640
1716930
|
documentToWrite = `${schemaComment}
|
|
1716641
1716931
|
${documentToWrite}`;
|
|
1716642
1716932
|
}
|
|
1716643
|
-
await (0,
|
|
1716933
|
+
await (0, import_promises142.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1716644
1716934
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1716645
1716935
|
}
|
|
1716646
1716936
|
async function getFilesAndDirectories4(absoluteFilepath) {
|
|
@@ -1716709,7 +1716999,7 @@ var versionMigrations19 = {
|
|
|
1716709
1716999
|
var __default19 = versionMigrations19;
|
|
1716710
1717000
|
|
|
1716711
1717001
|
// ../cli-migrations/lib/migrations/2.0.0-rc0/update-settings-defaults/migration.js
|
|
1716712
|
-
var
|
|
1717002
|
+
var import_promises143 = require("fs/promises");
|
|
1716713
1717003
|
var migration20 = {
|
|
1716714
1717004
|
name: "update-2_0_0-defaults",
|
|
1716715
1717005
|
summary: `The default of 'coerce-enums-to-literals' has changed from true to false.
|
|
@@ -1716884,7 +1717174,7 @@ async function updateGeneratorsYml3({ context: context2, files }) {
|
|
|
1716884
1717174
|
documentToWrite = `${schemaComment}
|
|
1716885
1717175
|
${documentToWrite}`;
|
|
1716886
1717176
|
}
|
|
1716887
|
-
await (0,
|
|
1717177
|
+
await (0, import_promises143.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1716888
1717178
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1716889
1717179
|
}
|
|
1716890
1717180
|
async function getFilesAndDirectories5(absoluteFilepath) {
|
|
@@ -1716930,7 +1717220,7 @@ var versionMigrations20 = {
|
|
|
1716930
1717220
|
var __default20 = versionMigrations20;
|
|
1716931
1717221
|
|
|
1716932
1717222
|
// ../cli-migrations/lib/migrations/2.13.0/migrate-deprecated-generator-api-settings/migration.js
|
|
1716933
|
-
var
|
|
1717223
|
+
var import_promises144 = require("fs/promises");
|
|
1716934
1717224
|
var migration21 = {
|
|
1716935
1717225
|
name: "migrate-deprecated-generator-api-settings",
|
|
1716936
1717226
|
summary: `Migrates deprecated generator-level API settings keys to their new equivalents:
|
|
@@ -1717021,7 +1717311,7 @@ async function updateGeneratorsYml4({ context: context2, files }) {
|
|
|
1717021
1717311
|
documentToWrite = `${schemaComment}
|
|
1717022
1717312
|
${documentToWrite}`;
|
|
1717023
1717313
|
}
|
|
1717024
|
-
await (0,
|
|
1717314
|
+
await (0, import_promises144.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1717025
1717315
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1717026
1717316
|
}
|
|
1717027
1717317
|
function migrateDeprecatedSettings(settings, context2) {
|
|
@@ -1717067,7 +1717357,7 @@ var versionMigrations21 = {
|
|
|
1717067
1717357
|
var __default21 = versionMigrations21;
|
|
1717068
1717358
|
|
|
1717069
1717359
|
// ../cli-migrations/lib/migrations/3.0.0/enable-smart-casing/migration.js
|
|
1717070
|
-
var
|
|
1717360
|
+
var import_promises145 = require("fs/promises");
|
|
1717071
1717361
|
var migration22 = {
|
|
1717072
1717362
|
name: "enable-smart-casing",
|
|
1717073
1717363
|
summary: `Sets 'smart-casing: false' for existing generators to preserve backwards compatibility.
|
|
@@ -1717151,7 +1717441,7 @@ async function updateGeneratorsYml5({ context: context2, files }) {
|
|
|
1717151
1717441
|
documentToWrite = `${schemaComment}
|
|
1717152
1717442
|
${documentToWrite}`;
|
|
1717153
1717443
|
}
|
|
1717154
|
-
await (0,
|
|
1717444
|
+
await (0, import_promises145.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
1717155
1717445
|
context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
1717156
1717446
|
}
|
|
1717157
1717447
|
function setSmartCasingFalseIfNotConfigured(generator, context2) {
|
|
@@ -1717292,7 +1717582,7 @@ ${source_default.dim(migration23.summary)}`
|
|
|
1717292
1717582
|
}
|
|
1717293
1717583
|
|
|
1717294
1717584
|
// src/commands/upgrade/upgrade.ts
|
|
1717295
|
-
var
|
|
1717585
|
+
var import_promises146 = require("fs/promises");
|
|
1717296
1717586
|
|
|
1717297
1717587
|
// src/cwd.ts
|
|
1717298
1717588
|
var FERN_CWD_ENV_VAR = "FERN_CWD";
|
|
@@ -1717609,7 +1717899,7 @@ async function upgrade({
|
|
|
1717609
1717899
|
const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
|
|
1717610
1717900
|
draft.version = resolvedTargetVersion;
|
|
1717611
1717901
|
});
|
|
1717612
|
-
await (0,
|
|
1717902
|
+
await (0, import_promises146.writeFile)(
|
|
1717613
1717903
|
projectConfig2._absolutePath,
|
|
1717614
1717904
|
ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2))
|
|
1717615
1717905
|
);
|
|
@@ -1718035,7 +1718325,7 @@ async function validateWorkspaces({
|
|
|
1718035
1718325
|
}
|
|
1718036
1718326
|
|
|
1718037
1718327
|
// src/commands/write-definition/writeDefinitionForWorkspaces.ts
|
|
1718038
|
-
var
|
|
1718328
|
+
var import_promises147 = require("fs/promises");
|
|
1718039
1718329
|
var import_path70 = __toESM(require("path"), 1);
|
|
1718040
1718330
|
async function writeDefinitionForWorkspaces({
|
|
1718041
1718331
|
project,
|
|
@@ -1718116,27 +1718406,27 @@ async function writeFernDefinition({
|
|
|
1718116
1718406
|
return a10.localeCompare(b18);
|
|
1718117
1718407
|
};
|
|
1718118
1718408
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
1718119
|
-
await (0,
|
|
1718409
|
+
await (0, import_promises147.rm)(absolutePathToOutputDirectory, { recursive: true });
|
|
1718120
1718410
|
}
|
|
1718121
|
-
await (0,
|
|
1718122
|
-
await (0,
|
|
1718411
|
+
await (0, import_promises147.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
1718412
|
+
await (0, import_promises147.writeFile)(
|
|
1718123
1718413
|
join4(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
|
|
1718124
1718414
|
jsYaml.dump(definition3.rootApiFile.contents, { sortKeys })
|
|
1718125
1718415
|
);
|
|
1718126
1718416
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
1718127
1718417
|
const absoluteFilepath = join4(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
1718128
|
-
await (0,
|
|
1718129
|
-
await (0,
|
|
1718418
|
+
await (0, import_promises147.mkdir)(dirname4(absoluteFilepath), { recursive: true });
|
|
1718419
|
+
await (0, import_promises147.writeFile)(absoluteFilepath, jsYaml.dump(packageMarker.contents, { sortKeys }));
|
|
1718130
1718420
|
}
|
|
1718131
1718421
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
1718132
1718422
|
const absoluteFilepath = join4(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
1718133
|
-
await (0,
|
|
1718134
|
-
await (0,
|
|
1718423
|
+
await (0, import_promises147.mkdir)(dirname4(absoluteFilepath), { recursive: true });
|
|
1718424
|
+
await (0, import_promises147.writeFile)(absoluteFilepath, jsYaml.dump(definitionFile.contents, { sortKeys }));
|
|
1718135
1718425
|
}
|
|
1718136
1718426
|
}
|
|
1718137
1718427
|
|
|
1718138
1718428
|
// src/commands/write-docs-definition/writeDocsDefinitionForProject.ts
|
|
1718139
|
-
var
|
|
1718429
|
+
var import_promises148 = require("fs/promises");
|
|
1718140
1718430
|
async function writeDocsDefinitionForProject({
|
|
1718141
1718431
|
project,
|
|
1718142
1718432
|
outputPath,
|
|
@@ -1718168,7 +1718458,7 @@ async function writeDocsDefinitionForProject({
|
|
|
1718168
1718458
|
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
|
|
1718169
1718459
|
});
|
|
1718170
1718460
|
const docsDefinition = await docsResolver.resolve();
|
|
1718171
|
-
await (0,
|
|
1718461
|
+
await (0, import_promises148.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
|
|
1718172
1718462
|
context2.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
|
|
1718173
1718463
|
});
|
|
1718174
1718464
|
}
|
|
@@ -1718176,7 +1718466,7 @@ async function writeDocsDefinitionForProject({
|
|
|
1718176
1718466
|
// src/commands/write-translation/writeTranslationForProject.ts
|
|
1718177
1718467
|
var import_cli_progress2 = __toESM(require_cli_progress(), 1);
|
|
1718178
1718468
|
var import_fs26 = require("fs");
|
|
1718179
|
-
var
|
|
1718469
|
+
var import_promises152 = require("fs/promises");
|
|
1718180
1718470
|
var import_is_ci2 = __toESM(require_is_ci(), 1);
|
|
1718181
1718471
|
var import_path73 = __toESM(require("path"), 1);
|
|
1718182
1718472
|
|
|
@@ -1718661,7 +1718951,7 @@ function shouldProcessFile(filePath, stub) {
|
|
|
1718661
1718951
|
}
|
|
1718662
1718952
|
|
|
1718663
1718953
|
// src/commands/write-translation/docs-config-utils.ts
|
|
1718664
|
-
var
|
|
1718954
|
+
var import_promises149 = require("fs/promises");
|
|
1718665
1718955
|
|
|
1718666
1718956
|
// src/commands/write-translation/url-utils.ts
|
|
1718667
1718957
|
function addLanguageSuffixToUrl(url3, language) {
|
|
@@ -1718818,7 +1719108,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
1718818
1719108
|
stub = false
|
|
1718819
1719109
|
}) {
|
|
1718820
1719110
|
try {
|
|
1718821
|
-
const originalConfigContent = await (0,
|
|
1719111
|
+
const originalConfigContent = await (0, import_promises149.readFile)(originalDocsConfigPath, "utf-8");
|
|
1718822
1719112
|
const transformation = {
|
|
1718823
1719113
|
filePath: DOCS_CONFIGURATION_FILENAME,
|
|
1718824
1719114
|
language,
|
|
@@ -1718832,7 +1719122,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
1718832
1719122
|
const modifiedConfigContent = jsYaml.dump(modifiedConfig, {
|
|
1718833
1719123
|
sortKeys: false
|
|
1718834
1719124
|
});
|
|
1718835
|
-
await (0,
|
|
1719125
|
+
await (0, import_promises149.writeFile)(modifiedConfigPath, modifiedConfigContent, "utf-8");
|
|
1718836
1719126
|
context2.logger.debug(`Created language-specific docs config: ${modifiedConfigPath}`);
|
|
1718837
1719127
|
} catch (error49) {
|
|
1718838
1719128
|
if (error49 instanceof Error && error49.message.includes("403")) {
|
|
@@ -1718844,11 +1719134,11 @@ async function createLanguageSpecificDocsConfig({
|
|
|
1718844
1719134
|
|
|
1718845
1719135
|
// src/commands/write-translation/file-collection-utils.ts
|
|
1718846
1719136
|
var import_fs24 = require("fs");
|
|
1718847
|
-
var
|
|
1719137
|
+
var import_promises150 = require("fs/promises");
|
|
1718848
1719138
|
var import_path71 = __toESM(require("path"), 1);
|
|
1718849
1719139
|
async function collectFiles(baseDirectory, relativeBase) {
|
|
1718850
1719140
|
const discoveredFiles = {};
|
|
1718851
|
-
const entries10 = await (0,
|
|
1719141
|
+
const entries10 = await (0, import_promises150.readdir)(baseDirectory);
|
|
1718852
1719142
|
for (const entry of entries10) {
|
|
1718853
1719143
|
if (entry === "translations") {
|
|
1718854
1719144
|
continue;
|
|
@@ -1718871,7 +1719161,7 @@ async function collectFiles(baseDirectory, relativeBase) {
|
|
|
1718871
1719161
|
// src/commands/write-translation/hash-utils.ts
|
|
1718872
1719162
|
var import_crypto10 = require("crypto");
|
|
1718873
1719163
|
var import_fs25 = require("fs");
|
|
1718874
|
-
var
|
|
1719164
|
+
var import_promises151 = require("fs/promises");
|
|
1718875
1719165
|
var import_path72 = __toESM(require("path"), 1);
|
|
1718876
1719166
|
function calculateContentHash(content5) {
|
|
1718877
1719167
|
return (0, import_crypto10.createHash)("sha256").update(content5, "utf-8").digest("hex");
|
|
@@ -1718882,7 +1719172,7 @@ async function loadHashMappings(translationsDirectory) {
|
|
|
1718882
1719172
|
return {};
|
|
1718883
1719173
|
}
|
|
1718884
1719174
|
try {
|
|
1718885
|
-
const hashesContent = await (0,
|
|
1719175
|
+
const hashesContent = await (0, import_promises151.readFile)(hashesFilePath, "utf-8");
|
|
1718886
1719176
|
const parsed = JSON.parse(hashesContent);
|
|
1718887
1719177
|
const { _comment, ...hashMappings } = parsed;
|
|
1718888
1719178
|
return hashMappings;
|
|
@@ -1718903,11 +1719193,11 @@ async function saveHashMappings(translationsDirectory, hashMappings) {
|
|
|
1718903
1719193
|
_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.",
|
|
1718904
1719194
|
...sortedMappings
|
|
1718905
1719195
|
};
|
|
1718906
|
-
await (0,
|
|
1719196
|
+
await (0, import_promises151.writeFile)(hashesFilePath, JSON.stringify(fileContent, null, 2), "utf-8");
|
|
1718907
1719197
|
}
|
|
1718908
1719198
|
async function hasFileChanged(filePath, relativePath, previousHashes) {
|
|
1718909
1719199
|
try {
|
|
1718910
|
-
const content5 = await (0,
|
|
1719200
|
+
const content5 = await (0, import_promises151.readFile)(filePath, "utf-8");
|
|
1718911
1719201
|
const currentHash = calculateContentHash(content5);
|
|
1718912
1719202
|
const previousHash = previousHashes[relativePath];
|
|
1718913
1719203
|
return currentHash !== previousHash;
|
|
@@ -1718960,7 +1719250,7 @@ async function writeTranslationForProject({
|
|
|
1718960
1719250
|
}
|
|
1718961
1719251
|
if (!(0, import_fs26.existsSync)(translationsDirectory)) {
|
|
1718962
1719252
|
context2.logger.debug(`Creating translations directory at: ${translationsDirectory}`);
|
|
1718963
|
-
await (0,
|
|
1719253
|
+
await (0, import_promises152.mkdir)(translationsDirectory, { recursive: true });
|
|
1718964
1719254
|
}
|
|
1718965
1719255
|
const languageStats = {};
|
|
1718966
1719256
|
const targetLanguages = languages.filter((lang) => lang !== sourceLanguage);
|
|
@@ -1718973,7 +1719263,7 @@ async function writeTranslationForProject({
|
|
|
1718973
1719263
|
RelativeFilePath2.of("fern")
|
|
1718974
1719264
|
);
|
|
1718975
1719265
|
if (!(0, import_fs26.existsSync)(languageDirectory)) {
|
|
1718976
|
-
await (0,
|
|
1719266
|
+
await (0, import_promises152.mkdir)(languageDirectory, { recursive: true });
|
|
1718977
1719267
|
}
|
|
1718978
1719268
|
languageStats[language] = {
|
|
1718979
1719269
|
filesProcessed: 0,
|
|
@@ -1719075,7 +1719365,7 @@ async function writeTranslationForProject({
|
|
|
1719075
1719365
|
`[COMPLETED] ${DOCS_CONFIGURATION_FILENAME} -> ${language}/${DOCS_CONFIGURATION_FILENAME}`
|
|
1719076
1719366
|
);
|
|
1719077
1719367
|
}
|
|
1719078
|
-
const originalConfigContent = await (0,
|
|
1719368
|
+
const originalConfigContent = await (0, import_promises152.readFile)(originalDocsConfigPath, "utf-8");
|
|
1719079
1719369
|
await updateAndSaveHashForFile(
|
|
1719080
1719370
|
translationsDirectory,
|
|
1719081
1719371
|
hashMappings,
|
|
@@ -1719120,7 +1719410,7 @@ async function writeTranslationForProject({
|
|
|
1719120
1719410
|
continue;
|
|
1719121
1719411
|
}
|
|
1719122
1719412
|
cliContext.logger.debug(`[PROCESSING] ${relativePath} (detected changes)`);
|
|
1719123
|
-
const originalContent = await (0,
|
|
1719413
|
+
const originalContent = await (0, import_promises152.readFile)(filePath, "utf-8");
|
|
1719124
1719414
|
await updateAndSaveHashForFile(translationsDirectory, hashMappings, relativePath, originalContent);
|
|
1719125
1719415
|
const sourceStats = languageStats[sourceLanguage];
|
|
1719126
1719416
|
if (sourceStats) {
|
|
@@ -1719145,7 +1719435,7 @@ async function writeTranslationForProject({
|
|
|
1719145
1719435
|
const destPath = join4(languageDirectory, relativePath);
|
|
1719146
1719436
|
const destDir = import_path73.default.dirname(destPath);
|
|
1719147
1719437
|
if (!(0, import_fs26.existsSync)(destDir)) {
|
|
1719148
|
-
await (0,
|
|
1719438
|
+
await (0, import_promises152.mkdir)(destDir, { recursive: true });
|
|
1719149
1719439
|
}
|
|
1719150
1719440
|
const transformation = {
|
|
1719151
1719441
|
filePath: relativePath,
|
|
@@ -1719158,7 +1719448,7 @@ async function writeTranslationForProject({
|
|
|
1719158
1719448
|
cliContext,
|
|
1719159
1719449
|
stub
|
|
1719160
1719450
|
});
|
|
1719161
|
-
await (0,
|
|
1719451
|
+
await (0, import_promises152.writeFile)(destPath, transformedContent, "utf-8");
|
|
1719162
1719452
|
const languageStatsForLang = languageStats[language];
|
|
1719163
1719453
|
if (languageStatsForLang) {
|
|
1719164
1719454
|
languageStatsForLang.filesProcessed++;
|
|
@@ -1719189,9 +1719479,9 @@ async function writeTranslationForProject({
|
|
|
1719189
1719479
|
const destPath = join4(languageDirectory, relativePath);
|
|
1719190
1719480
|
const destDir = import_path73.default.dirname(destPath);
|
|
1719191
1719481
|
if (!(0, import_fs26.existsSync)(destDir)) {
|
|
1719192
|
-
await (0,
|
|
1719482
|
+
await (0, import_promises152.mkdir)(destDir, { recursive: true });
|
|
1719193
1719483
|
}
|
|
1719194
|
-
await (0,
|
|
1719484
|
+
await (0, import_promises152.copyFile)(filePath, destPath);
|
|
1719195
1719485
|
assetsCopied++;
|
|
1719196
1719486
|
cliContext.logger.debug(`[ASSET COPIED] ${relativePath} -> ${language}/${relativePath}`);
|
|
1719197
1719487
|
}
|