@fern-api/fern-api-dev 3.65.0 → 3.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +175 -47
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -1427240,7 +1427240,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1427240
1427240
|
properties: {
|
|
1427241
1427241
|
...event,
|
|
1427242
1427242
|
...event.properties,
|
|
1427243
|
-
version: "3.
|
|
1427243
|
+
version: "3.66.0",
|
|
1427244
1427244
|
usingAccessToken: true
|
|
1427245
1427245
|
}
|
|
1427246
1427246
|
});
|
|
@@ -1427339,7 +1427339,7 @@ var UserPosthogManager = class {
|
|
|
1427339
1427339
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1427340
1427340
|
event: "CLI",
|
|
1427341
1427341
|
properties: {
|
|
1427342
|
-
version: "3.
|
|
1427342
|
+
version: "3.66.0",
|
|
1427343
1427343
|
...event,
|
|
1427344
1427344
|
...event.properties,
|
|
1427345
1427345
|
usingAccessToken: false,
|
|
@@ -1455823,11 +1455823,6 @@ __export(environments_exports3, {
|
|
|
1455823
1455823
|
WithEnvironmentsSchema: () => WithEnvironmentsSchema
|
|
1455824
1455824
|
});
|
|
1455825
1455825
|
|
|
1455826
|
-
// ../fern-definition/schema/lib/schemas/serialization/resources/environments/types/MultipleBaseUrlsEnvironmentSchema.js
|
|
1455827
|
-
var MultipleBaseUrlsEnvironmentSchema2 = schemas_exports5.object({
|
|
1455828
|
-
urls: schemas_exports5.record(schemas_exports5.string(), schemas_exports5.string())
|
|
1455829
|
-
}).extend(WithAudiences).extend(WithDocsSchema);
|
|
1455830
|
-
|
|
1455831
1455826
|
// ../fern-definition/schema/lib/schemas/serialization/resources/environments/types/ServerVariableSchema.js
|
|
1455832
1455827
|
var ServerVariableSchema = schemas_exports5.object({
|
|
1455833
1455828
|
id: schemas_exports5.string(),
|
|
@@ -1455835,6 +1455830,14 @@ var ServerVariableSchema = schemas_exports5.object({
|
|
|
1455835
1455830
|
values: schemas_exports5.list(schemas_exports5.string()).optional()
|
|
1455836
1455831
|
});
|
|
1455837
1455832
|
|
|
1455833
|
+
// ../fern-definition/schema/lib/schemas/serialization/resources/environments/types/MultipleBaseUrlsEnvironmentSchema.js
|
|
1455834
|
+
var MultipleBaseUrlsEnvironmentSchema2 = schemas_exports5.object({
|
|
1455835
|
+
urls: schemas_exports5.record(schemas_exports5.string(), schemas_exports5.string()),
|
|
1455836
|
+
"url-templates": schemas_exports5.record(schemas_exports5.string(), schemas_exports5.string()).optional(),
|
|
1455837
|
+
"default-urls": schemas_exports5.record(schemas_exports5.string(), schemas_exports5.string()).optional(),
|
|
1455838
|
+
variables: schemas_exports5.record(schemas_exports5.string(), schemas_exports5.list(ServerVariableSchema)).optional()
|
|
1455839
|
+
}).extend(WithAudiences).extend(WithDocsSchema);
|
|
1455840
|
+
|
|
1455838
1455841
|
// ../fern-definition/schema/lib/schemas/serialization/resources/environments/types/SingleBaseUrlEnvironmentSchema.js
|
|
1455839
1455842
|
var SingleBaseUrlEnvironmentSchema2 = schemas_exports5.object({
|
|
1455840
1455843
|
url: schemas_exports5.string(),
|
|
@@ -1486123,11 +1486126,6 @@ __export(environments_exports5, {
|
|
|
1486123
1486126
|
WithEnvironmentsSchema: () => WithEnvironmentsSchema2
|
|
1486124
1486127
|
});
|
|
1486125
1486128
|
|
|
1486126
|
-
// ../configuration/lib/generators-yml/schemas/serialization/resources/fernDefinition/resources/environments/types/MultipleBaseUrlsEnvironmentSchema.js
|
|
1486127
|
-
var MultipleBaseUrlsEnvironmentSchema3 = schemas_exports10.object({
|
|
1486128
|
-
urls: schemas_exports10.record(schemas_exports10.string(), schemas_exports10.string())
|
|
1486129
|
-
}).extend(WithAudiences2).extend(WithDocsSchema2);
|
|
1486130
|
-
|
|
1486131
1486129
|
// ../configuration/lib/generators-yml/schemas/serialization/resources/fernDefinition/resources/environments/types/ServerVariableSchema.js
|
|
1486132
1486130
|
var ServerVariableSchema2 = schemas_exports10.object({
|
|
1486133
1486131
|
id: schemas_exports10.string(),
|
|
@@ -1486135,6 +1486133,14 @@ var ServerVariableSchema2 = schemas_exports10.object({
|
|
|
1486135
1486133
|
values: schemas_exports10.list(schemas_exports10.string()).optional()
|
|
1486136
1486134
|
});
|
|
1486137
1486135
|
|
|
1486136
|
+
// ../configuration/lib/generators-yml/schemas/serialization/resources/fernDefinition/resources/environments/types/MultipleBaseUrlsEnvironmentSchema.js
|
|
1486137
|
+
var MultipleBaseUrlsEnvironmentSchema3 = schemas_exports10.object({
|
|
1486138
|
+
urls: schemas_exports10.record(schemas_exports10.string(), schemas_exports10.string()),
|
|
1486139
|
+
"url-templates": schemas_exports10.record(schemas_exports10.string(), schemas_exports10.string()).optional(),
|
|
1486140
|
+
"default-urls": schemas_exports10.record(schemas_exports10.string(), schemas_exports10.string()).optional(),
|
|
1486141
|
+
variables: schemas_exports10.record(schemas_exports10.string(), schemas_exports10.list(ServerVariableSchema2)).optional()
|
|
1486142
|
+
}).extend(WithAudiences2).extend(WithDocsSchema2);
|
|
1486143
|
+
|
|
1486138
1486144
|
// ../configuration/lib/generators-yml/schemas/serialization/resources/fernDefinition/resources/environments/types/SingleBaseUrlEnvironmentSchema.js
|
|
1486139
1486145
|
var SingleBaseUrlEnvironmentSchema3 = schemas_exports10.object({
|
|
1486140
1486146
|
url: schemas_exports10.string(),
|
|
@@ -1494731,6 +1494737,9 @@ function buildEnvironments(context2) {
|
|
|
1494731
1494737
|
const endpointLevelServersByName = {};
|
|
1494732
1494738
|
const endpointLevelServersWithName = {};
|
|
1494733
1494739
|
const endpointLevelSkippedServers = [];
|
|
1494740
|
+
const endpointLevelUrlTemplates = {};
|
|
1494741
|
+
const endpointLevelDefaultUrls = {};
|
|
1494742
|
+
const endpointLevelVariables = {};
|
|
1494734
1494743
|
for (const endpoint3 of context2.ir.endpoints) {
|
|
1494735
1494744
|
for (const server of endpoint3.servers) {
|
|
1494736
1494745
|
if (server.url == null && server.name != null) {
|
|
@@ -1494742,10 +1494751,15 @@ function buildEnvironments(context2) {
|
|
|
1494742
1494751
|
if (server.url == null) {
|
|
1494743
1494752
|
continue;
|
|
1494744
1494753
|
}
|
|
1494754
|
+
const serverRecord = server;
|
|
1494755
|
+
const serverDefaultUrl = "defaultUrl" in server && typeof serverRecord["defaultUrl"] === "string" ? serverRecord["defaultUrl"] : void 0;
|
|
1494756
|
+
const serverUrlTemplate = "urlTemplate" in server && typeof serverRecord["urlTemplate"] === "string" ? serverRecord["urlTemplate"] : void 0;
|
|
1494757
|
+
const serverVariables = "variables" in server && Array.isArray(serverRecord["variables"]) ? serverRecord["variables"] : void 0;
|
|
1494758
|
+
const serverUrl = serverDefaultUrl ?? server.url;
|
|
1494745
1494759
|
const environmentSchema2 = server.audiences ? {
|
|
1494746
|
-
url:
|
|
1494760
|
+
url: serverUrl,
|
|
1494747
1494761
|
audiences: server.audiences
|
|
1494748
|
-
} :
|
|
1494762
|
+
} : serverUrl;
|
|
1494749
1494763
|
if (server.name == null) {
|
|
1494750
1494764
|
endpointLevelSkippedServers.push(environmentSchema2);
|
|
1494751
1494765
|
continue;
|
|
@@ -1494754,10 +1494768,19 @@ function buildEnvironments(context2) {
|
|
|
1494754
1494768
|
endpointLevelServersByName[server.name] = [];
|
|
1494755
1494769
|
}
|
|
1494756
1494770
|
endpointLevelServersByName[server.name]?.push({
|
|
1494757
|
-
url:
|
|
1494771
|
+
url: serverUrl,
|
|
1494758
1494772
|
audiences: server.audiences
|
|
1494759
1494773
|
});
|
|
1494760
1494774
|
endpointLevelServersWithName[server.name] = environmentSchema2;
|
|
1494775
|
+
if (serverUrlTemplate && server.name) {
|
|
1494776
|
+
endpointLevelUrlTemplates[server.name] = serverUrlTemplate;
|
|
1494777
|
+
}
|
|
1494778
|
+
if (serverDefaultUrl && server.name) {
|
|
1494779
|
+
endpointLevelDefaultUrls[server.name] = serverDefaultUrl;
|
|
1494780
|
+
}
|
|
1494781
|
+
if (serverVariables && serverVariables.length > 0 && server.name) {
|
|
1494782
|
+
endpointLevelVariables[server.name] = serverVariables;
|
|
1494783
|
+
}
|
|
1494761
1494784
|
}
|
|
1494762
1494785
|
}
|
|
1494763
1494786
|
const websocketServersWithName = {};
|
|
@@ -1494934,7 +1494957,7 @@ function buildEnvironments(context2) {
|
|
|
1494934
1494957
|
for (const [name3, schema2] of Object.entries(topLevelServersWithName)) {
|
|
1494935
1494958
|
if (firstEnvironment) {
|
|
1494936
1494959
|
if (hasWebsocketServersWithName) {
|
|
1494937
|
-
const baseUrl = typeof schema2 === "string" ? schema2 : isRawMultipleBaseUrlsEnvironment(schema2) ? Object.values(schema2.urls)[0] : schema2.url;
|
|
1494960
|
+
const baseUrl = typeof schema2 === "string" ? schema2 : isRawMultipleBaseUrlsEnvironment(schema2) ? Object.values(schema2.urls)[0] : schema2["default-url"] ?? schema2.url;
|
|
1494938
1494961
|
context2.builder.addEnvironment({
|
|
1494939
1494962
|
name: name3,
|
|
1494940
1494963
|
schema: {
|
|
@@ -1494954,7 +1494977,7 @@ function buildEnvironments(context2) {
|
|
|
1494954
1494977
|
firstEnvironment = false;
|
|
1494955
1494978
|
} else {
|
|
1494956
1494979
|
if (hasWebsocketServersWithName) {
|
|
1494957
|
-
const baseUrl = typeof schema2 === "string" ? schema2 : isRawMultipleBaseUrlsEnvironment(schema2) ? Object.values(schema2.urls)[0] : schema2.url;
|
|
1494980
|
+
const baseUrl = typeof schema2 === "string" ? schema2 : isRawMultipleBaseUrlsEnvironment(schema2) ? Object.values(schema2.urls)[0] : schema2["default-url"] ?? schema2.url;
|
|
1494958
1494981
|
context2.builder.addEnvironment({
|
|
1494959
1494982
|
name: name3,
|
|
1494960
1494983
|
schema: {
|
|
@@ -1494979,16 +1495002,40 @@ function buildEnvironments(context2) {
|
|
|
1494979
1495002
|
if (numTopLevelServersWithName === 1) {
|
|
1494980
1495003
|
const environmentName = Object.keys(topLevelServersWithName)[0];
|
|
1494981
1495004
|
const topLevelServerSchema = Object.values(topLevelServersWithName)[0];
|
|
1494982
|
-
const topLevelServerUrl = typeof topLevelServerSchema === "string" ? topLevelServerSchema : isRawMultipleBaseUrlsEnvironment(topLevelServerSchema) ? Object.values(topLevelServerSchema.urls)[0] : topLevelServerSchema.url;
|
|
1495005
|
+
const topLevelServerUrl = typeof topLevelServerSchema === "string" ? topLevelServerSchema : isRawMultipleBaseUrlsEnvironment(topLevelServerSchema) ? Object.values(topLevelServerSchema.urls)[0] : topLevelServerSchema["default-url"] ?? topLevelServerSchema.url;
|
|
1495006
|
+
const multiUrlTemplates = {};
|
|
1495007
|
+
const multiDefaultUrls = {};
|
|
1495008
|
+
const multiVariables = {};
|
|
1495009
|
+
if (typeof topLevelServerSchema !== "string" && !isRawMultipleBaseUrlsEnvironment(topLevelServerSchema)) {
|
|
1495010
|
+
if (topLevelServerSchema["url-template"]) {
|
|
1495011
|
+
multiUrlTemplates[DEFAULT_URL_NAME] = topLevelServerSchema["url-template"];
|
|
1495012
|
+
}
|
|
1495013
|
+
if (topLevelServerSchema["default-url"]) {
|
|
1495014
|
+
multiDefaultUrls[DEFAULT_URL_NAME] = topLevelServerSchema["default-url"];
|
|
1495015
|
+
}
|
|
1495016
|
+
if (topLevelServerSchema.variables && topLevelServerSchema.variables.length > 0) {
|
|
1495017
|
+
multiVariables[DEFAULT_URL_NAME] = topLevelServerSchema.variables;
|
|
1495018
|
+
}
|
|
1495019
|
+
}
|
|
1495020
|
+
Object.assign(multiUrlTemplates, endpointLevelUrlTemplates);
|
|
1495021
|
+
Object.assign(multiDefaultUrls, endpointLevelDefaultUrls);
|
|
1495022
|
+
Object.assign(multiVariables, endpointLevelVariables);
|
|
1495023
|
+
const hasTemplateData = Object.keys(multiUrlTemplates).length > 0 || Object.keys(multiVariables).length > 0;
|
|
1495024
|
+
const multiUrlSchema = {
|
|
1495025
|
+
urls: {
|
|
1495026
|
+
...{ [DEFAULT_URL_NAME]: topLevelServerUrl ?? "" },
|
|
1495027
|
+
...extractUrlsFromEnvironmentSchema(endpointLevelServersWithName),
|
|
1495028
|
+
...extractUrlsFromEnvironmentSchema(websocketServersWithName)
|
|
1495029
|
+
},
|
|
1495030
|
+
...hasTemplateData ? {
|
|
1495031
|
+
"url-templates": multiUrlTemplates,
|
|
1495032
|
+
"default-urls": multiDefaultUrls,
|
|
1495033
|
+
variables: multiVariables
|
|
1495034
|
+
} : {}
|
|
1495035
|
+
};
|
|
1494983
1495036
|
context2.builder.addEnvironment({
|
|
1494984
1495037
|
name: environmentName,
|
|
1494985
|
-
schema:
|
|
1494986
|
-
urls: {
|
|
1494987
|
-
...{ [DEFAULT_URL_NAME]: topLevelServerUrl ?? "" },
|
|
1494988
|
-
...extractUrlsFromEnvironmentSchema(endpointLevelServersWithName),
|
|
1494989
|
-
...extractUrlsFromEnvironmentSchema(websocketServersWithName)
|
|
1494990
|
-
}
|
|
1494991
|
-
}
|
|
1495038
|
+
schema: multiUrlSchema
|
|
1494992
1495039
|
});
|
|
1494993
1495040
|
context2.builder.setDefaultEnvironment(environmentName);
|
|
1494994
1495041
|
context2.builder.setDefaultUrl(DEFAULT_URL_NAME);
|
|
@@ -1495011,7 +1495058,7 @@ function buildEnvironments(context2) {
|
|
|
1495011
1495058
|
if (apiToUrls.size > 0) {
|
|
1495012
1495059
|
let firstEnvironment = true;
|
|
1495013
1495060
|
for (const [envName, envSchema] of Object.entries(topLevelServersWithName)) {
|
|
1495014
|
-
const baseUrl = typeof envSchema === "string" ? envSchema : isRawMultipleBaseUrlsEnvironment(envSchema) ? Object.values(envSchema.urls)[0] : envSchema.url;
|
|
1495061
|
+
const baseUrl = typeof envSchema === "string" ? envSchema : isRawMultipleBaseUrlsEnvironment(envSchema) ? Object.values(envSchema.urls)[0] : envSchema["default-url"] ?? envSchema.url;
|
|
1495015
1495062
|
if (!baseUrl) {
|
|
1495016
1495063
|
continue;
|
|
1495017
1495064
|
}
|
|
@@ -1495051,7 +1495098,7 @@ function buildEnvironments(context2) {
|
|
|
1495051
1495098
|
let firstEnvironment = true;
|
|
1495052
1495099
|
for (const [name3, schema2] of Object.entries(topLevelServersWithName)) {
|
|
1495053
1495100
|
if (hasWebsocketServersWithName || Object.keys(endpointLevelServersWithName).length > 0) {
|
|
1495054
|
-
const baseUrl = typeof schema2 === "string" ? schema2 : isRawMultipleBaseUrlsEnvironment(schema2) ? Object.values(schema2.urls)[0] : schema2.url;
|
|
1495101
|
+
const baseUrl = typeof schema2 === "string" ? schema2 : isRawMultipleBaseUrlsEnvironment(schema2) ? Object.values(schema2.urls)[0] : schema2["default-url"] ?? schema2.url;
|
|
1495055
1495102
|
context2.builder.addEnvironment({
|
|
1495056
1495103
|
name: name3,
|
|
1495057
1495104
|
schema: {
|
|
@@ -1516549,15 +1516596,31 @@ function convertMultipleBaseUrlEnvironments({ baseUrls, environments: environmen
|
|
|
1516549
1516596
|
name: casingsGenerator.generateName(baseUrl)
|
|
1516550
1516597
|
})),
|
|
1516551
1516598
|
environments: Object.entries(environments2).map(([environmentName, rawEnvironment]) => visitRawEnvironmentDeclaration(rawEnvironment, {
|
|
1516552
|
-
multipleBaseUrls: (multipleBaseUrlsEnvironment) =>
|
|
1516553
|
-
|
|
1516554
|
-
|
|
1516555
|
-
|
|
1516556
|
-
|
|
1516557
|
-
defaultUrls: void 0
|
|
1516558
|
-
|
|
1516559
|
-
|
|
1516560
|
-
|
|
1516599
|
+
multipleBaseUrls: (multipleBaseUrlsEnvironment) => {
|
|
1516600
|
+
const rawUrlTemplates = multipleBaseUrlsEnvironment["url-templates"];
|
|
1516601
|
+
const rawDefaultUrls = multipleBaseUrlsEnvironment["default-urls"];
|
|
1516602
|
+
const rawVariables = multipleBaseUrlsEnvironment.variables;
|
|
1516603
|
+
const urlTemplates = rawUrlTemplates && Object.keys(rawUrlTemplates).length > 0 ? rawUrlTemplates : void 0;
|
|
1516604
|
+
const defaultUrls = rawDefaultUrls && Object.keys(rawDefaultUrls).length > 0 ? mapValues_default(rawDefaultUrls, (url3) => removeTrailingSlash2(url3)) : void 0;
|
|
1516605
|
+
const urlVariables = rawVariables && Object.keys(rawVariables).length > 0 ? Object.fromEntries(Object.entries(rawVariables).map(([urlId, vars]) => [
|
|
1516606
|
+
urlId,
|
|
1516607
|
+
vars.map((v21) => ({
|
|
1516608
|
+
id: v21.id,
|
|
1516609
|
+
name: casingsGenerator.generateName(v21.id),
|
|
1516610
|
+
default: v21.default,
|
|
1516611
|
+
values: v21.values
|
|
1516612
|
+
}))
|
|
1516613
|
+
])) : void 0;
|
|
1516614
|
+
return {
|
|
1516615
|
+
docs: multipleBaseUrlsEnvironment.docs,
|
|
1516616
|
+
id: environmentName,
|
|
1516617
|
+
name: casingsGenerator.generateName(environmentName),
|
|
1516618
|
+
urls: mapValues_default(multipleBaseUrlsEnvironment.urls, (url3) => removeTrailingSlash2(url3)),
|
|
1516619
|
+
defaultUrls,
|
|
1516620
|
+
urlTemplates,
|
|
1516621
|
+
urlVariables
|
|
1516622
|
+
};
|
|
1516623
|
+
},
|
|
1516561
1516624
|
singleBaseUrl: () => {
|
|
1516562
1516625
|
throw new Error(`Environment ${environmentName} does not have multiple base URLs`);
|
|
1516563
1516626
|
}
|
|
@@ -1541711,6 +1541774,48 @@ var definitions = {
|
|
|
1541711
1541774
|
additionalProperties: {
|
|
1541712
1541775
|
type: "string"
|
|
1541713
1541776
|
}
|
|
1541777
|
+
},
|
|
1541778
|
+
"url-templates": {
|
|
1541779
|
+
oneOf: [
|
|
1541780
|
+
{
|
|
1541781
|
+
type: "object",
|
|
1541782
|
+
additionalProperties: {
|
|
1541783
|
+
type: "string"
|
|
1541784
|
+
}
|
|
1541785
|
+
},
|
|
1541786
|
+
{
|
|
1541787
|
+
type: "null"
|
|
1541788
|
+
}
|
|
1541789
|
+
]
|
|
1541790
|
+
},
|
|
1541791
|
+
"default-urls": {
|
|
1541792
|
+
oneOf: [
|
|
1541793
|
+
{
|
|
1541794
|
+
type: "object",
|
|
1541795
|
+
additionalProperties: {
|
|
1541796
|
+
type: "string"
|
|
1541797
|
+
}
|
|
1541798
|
+
},
|
|
1541799
|
+
{
|
|
1541800
|
+
type: "null"
|
|
1541801
|
+
}
|
|
1541802
|
+
]
|
|
1541803
|
+
},
|
|
1541804
|
+
variables: {
|
|
1541805
|
+
oneOf: [
|
|
1541806
|
+
{
|
|
1541807
|
+
type: "object",
|
|
1541808
|
+
additionalProperties: {
|
|
1541809
|
+
type: "array",
|
|
1541810
|
+
items: {
|
|
1541811
|
+
$ref: "#/definitions/environments.ServerVariableSchema"
|
|
1541812
|
+
}
|
|
1541813
|
+
}
|
|
1541814
|
+
},
|
|
1541815
|
+
{
|
|
1541816
|
+
type: "null"
|
|
1541817
|
+
}
|
|
1541818
|
+
]
|
|
1541714
1541819
|
}
|
|
1541715
1541820
|
},
|
|
1541716
1541821
|
required: [
|
|
@@ -1714019,7 +1714124,7 @@ var CliContext = class {
|
|
|
1714019
1714124
|
if (false) {
|
|
1714020
1714125
|
this.logger.error("CLI_VERSION is not defined");
|
|
1714021
1714126
|
}
|
|
1714022
|
-
return "3.
|
|
1714127
|
+
return "3.66.0";
|
|
1714023
1714128
|
}
|
|
1714024
1714129
|
getCliName() {
|
|
1714025
1714130
|
if (false) {
|
|
@@ -1717139,7 +1717244,7 @@ var import_path56 = __toESM(require("path"), 1);
|
|
|
1717139
1717244
|
var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
1717140
1717245
|
var LOGS_FOLDER_NAME = "logs";
|
|
1717141
1717246
|
function getCliSource() {
|
|
1717142
|
-
const version7 = "3.
|
|
1717247
|
+
const version7 = "3.66.0";
|
|
1717143
1717248
|
return `cli@${version7}`;
|
|
1717144
1717249
|
}
|
|
1717145
1717250
|
var DebugLogger = class {
|
|
@@ -1723887,25 +1723992,27 @@ async function visitNavigationItem2({ absolutePathToFernFolder, navigationItem,
|
|
|
1723887
1723992
|
orphaned: noop7,
|
|
1723888
1723993
|
availability: noop7
|
|
1723889
1723994
|
});
|
|
1723890
|
-
|
|
1723891
|
-
|
|
1723995
|
+
const markdownPath = getNavigationItemMarkdownPath(navigationItem);
|
|
1723996
|
+
if (markdownPath != null) {
|
|
1723997
|
+
const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), markdownPath);
|
|
1723892
1723998
|
if (await doesPathExist(absoluteFilepath)) {
|
|
1723893
1723999
|
const fileStats = await (0, import_promises103.stat)(absoluteFilepath);
|
|
1723894
1724000
|
const fileSizeMB = fileStats.size / (1024 * 1024);
|
|
1723895
1724001
|
if (fileSizeMB > 1) {
|
|
1723896
|
-
context2.logger.trace(`Processing large markdown file: ${
|
|
1724002
|
+
context2.logger.trace(`Processing large markdown file: ${markdownPath} (${fileSizeMB.toFixed(2)} MB)`);
|
|
1723897
1724003
|
}
|
|
1723898
1724004
|
const startTime = performance.now();
|
|
1723899
1724005
|
const content5 = (await (0, import_promises103.readFile)(absoluteFilepath, "utf8")).toString();
|
|
1723900
1724006
|
const readTime = performance.now() - startTime;
|
|
1723901
1724007
|
if (readTime > 2e3) {
|
|
1723902
|
-
context2.logger.debug(`Slow file read: ${
|
|
1724008
|
+
context2.logger.debug(`Slow file read: ${markdownPath} took ${readTime.toFixed(0)}ms`);
|
|
1723903
1724009
|
}
|
|
1724010
|
+
const title4 = getNavigationItemTitle(navigationItem);
|
|
1723904
1724011
|
await visitor.markdownPage?.({
|
|
1723905
|
-
title:
|
|
1724012
|
+
title: title4,
|
|
1723906
1724013
|
content: content5,
|
|
1723907
1724014
|
absoluteFilepath
|
|
1723908
|
-
}, [...nodePath,
|
|
1724015
|
+
}, [...nodePath, markdownPath]);
|
|
1723909
1724016
|
try {
|
|
1723910
1724017
|
const parseStart = performance.now();
|
|
1723911
1724018
|
const { filepaths } = parseImagePaths(content5, {
|
|
@@ -1723914,17 +1724021,17 @@ async function visitNavigationItem2({ absolutePathToFernFolder, navigationItem,
|
|
|
1723914
1724021
|
});
|
|
1723915
1724022
|
const parseTime = performance.now() - parseStart;
|
|
1723916
1724023
|
if (parseTime > 2e3) {
|
|
1723917
|
-
context2.logger.debug(`Slow image path parsing: ${
|
|
1724024
|
+
context2.logger.debug(`Slow image path parsing: ${markdownPath} took ${parseTime.toFixed(0)}ms`);
|
|
1723918
1724025
|
}
|
|
1723919
1724026
|
for (const filepath of filepaths) {
|
|
1723920
1724027
|
await visitor.filepath?.({
|
|
1723921
1724028
|
absoluteFilepath: filepath,
|
|
1723922
1724029
|
value: relative3(absolutePathToFernFolder, filepath),
|
|
1723923
1724030
|
willBeUploaded: true
|
|
1723924
|
-
}, [...nodePath,
|
|
1724031
|
+
}, [...nodePath, markdownPath]);
|
|
1723925
1724032
|
}
|
|
1723926
1724033
|
} catch (err) {
|
|
1723927
|
-
context2.logger.trace(`Failed to parse image paths in ${
|
|
1724034
|
+
context2.logger.trace(`Failed to parse image paths in ${markdownPath}: ${err}`);
|
|
1723928
1724035
|
}
|
|
1723929
1724036
|
}
|
|
1723930
1724037
|
}
|
|
@@ -1723969,6 +1724076,27 @@ function navigationItemIsChangelog(item) {
|
|
|
1723969
1724076
|
function navigationItemIsPage(item) {
|
|
1723970
1724077
|
return item?.page != null;
|
|
1723971
1724078
|
}
|
|
1724079
|
+
function navigationItemIsSection(item) {
|
|
1724080
|
+
return item?.section != null;
|
|
1724081
|
+
}
|
|
1724082
|
+
function getNavigationItemMarkdownPath(item) {
|
|
1724083
|
+
if (navigationItemIsPage(item)) {
|
|
1724084
|
+
return item.path;
|
|
1724085
|
+
}
|
|
1724086
|
+
if (navigationItemIsSection(item) && item.path != null) {
|
|
1724087
|
+
return item.path;
|
|
1724088
|
+
}
|
|
1724089
|
+
return void 0;
|
|
1724090
|
+
}
|
|
1724091
|
+
function getNavigationItemTitle(item) {
|
|
1724092
|
+
if (navigationItemIsPage(item)) {
|
|
1724093
|
+
return item.page;
|
|
1724094
|
+
}
|
|
1724095
|
+
if (navigationItemIsSection(item)) {
|
|
1724096
|
+
return item.section;
|
|
1724097
|
+
}
|
|
1724098
|
+
return "Unknown";
|
|
1724099
|
+
}
|
|
1723972
1724100
|
function navigationItemIsApi2(item) {
|
|
1723973
1724101
|
return item?.api != null;
|
|
1723974
1724102
|
}
|
package/package.json
CHANGED