fern-api 0.37.0 → 0.37.1
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/bundle.cjs +75 -16
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -1214813,7 +1214813,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1214813
1214813
|
properties: {
|
|
1214814
1214814
|
...event,
|
|
1214815
1214815
|
...event.properties,
|
|
1214816
|
-
version: "0.37.
|
|
1214816
|
+
version: "0.37.1",
|
|
1214817
1214817
|
usingAccessToken: true
|
|
1214818
1214818
|
}
|
|
1214819
1214819
|
});
|
|
@@ -1214875,7 +1214875,7 @@ var UserPosthogManager = class {
|
|
|
1214875
1214875
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1214876
1214876
|
event: "CLI",
|
|
1214877
1214877
|
properties: {
|
|
1214878
|
-
version: "0.37.
|
|
1214878
|
+
version: "0.37.1",
|
|
1214879
1214879
|
...event,
|
|
1214880
1214880
|
...event.properties
|
|
1214881
1214881
|
}
|
|
@@ -1226881,9 +1226881,18 @@ var STR_REGEX = new RegExp(`^${STR_SEGMENT}$`);
|
|
|
1226881
1226881
|
var SRC_REGEX = new RegExp(`src={?${STR_SEGMENT}(?! \\+)}?`, "g");
|
|
1226882
1226882
|
var MEDIA_NODE_NAMES = ["img", "video", "audio", "source", "embed"];
|
|
1226883
1226883
|
function parseImagePaths(markdown, metadata) {
|
|
1226884
|
-
const { content: content5, data: data2 } = (0, import_gray_matter.default)(markdown);
|
|
1226884
|
+
const { content: content5, data: data2 } = (0, import_gray_matter.default)(markdown, {});
|
|
1226885
1226885
|
let replacedContent = content5;
|
|
1226886
1226886
|
const filepaths = /* @__PURE__ */ new Set();
|
|
1226887
|
+
function mapImage(image2) {
|
|
1226888
|
+
const resolvedPath = resolvePath(image2, metadata);
|
|
1226889
|
+
if (resolvedPath != null) {
|
|
1226890
|
+
filepaths.add(resolvedPath);
|
|
1226891
|
+
return resolvedPath;
|
|
1226892
|
+
}
|
|
1226893
|
+
return;
|
|
1226894
|
+
}
|
|
1226895
|
+
visitFrontmatterImages(data2, ["image", "og:image", "og:logo", "twitter:image"], mapImage);
|
|
1226887
1226896
|
const tree = fromMarkdown(content5, {
|
|
1226888
1226897
|
extensions: [mdx()],
|
|
1226889
1226898
|
mdastExtensions: [mdxFromMarkdown()]
|
|
@@ -1226960,7 +1226969,7 @@ function parseImagePaths(markdown, metadata) {
|
|
|
1226960
1226969
|
}
|
|
1226961
1226970
|
}
|
|
1226962
1226971
|
}
|
|
1226963
|
-
if (replaced === original) {
|
|
1226972
|
+
if (replaced === original && filepaths.size === 0) {
|
|
1226964
1226973
|
return;
|
|
1226965
1226974
|
}
|
|
1226966
1226975
|
replacedContent = replacedContent.slice(0, start4 + offset2) + replaced + replacedContent.slice(start4 + offset2 + length);
|
|
@@ -1226982,13 +1226991,27 @@ function isDataUrl(url) {
|
|
|
1226982
1226991
|
return url.startsWith("data:");
|
|
1226983
1226992
|
}
|
|
1226984
1226993
|
function replaceImagePathsAndUrls(markdown, fileIdsMap, markdownFilesToPathName, metadata, context) {
|
|
1226985
|
-
const { content: content5, data: data2 } = (0, import_gray_matter.default)(markdown);
|
|
1226994
|
+
const { content: content5, data: data2 } = (0, import_gray_matter.default)(markdown, {});
|
|
1226986
1226995
|
let replacedContent = content5;
|
|
1226987
1226996
|
const tree = fromMarkdown(content5, {
|
|
1226988
1226997
|
extensions: [mdx()],
|
|
1226989
1226998
|
mdastExtensions: [mdxFromMarkdown()]
|
|
1226990
1226999
|
});
|
|
1226991
1227000
|
let offset2 = 0;
|
|
1227001
|
+
function mapImage(image2) {
|
|
1227002
|
+
if (image2 != null && !isExternalUrl(image2) && !isDataUrl(image2)) {
|
|
1227003
|
+
try {
|
|
1227004
|
+
const fileId = fileIdsMap.get(AbsoluteFilePath.of(image2));
|
|
1227005
|
+
if (fileId != null) {
|
|
1227006
|
+
return `file:${fileId}`;
|
|
1227007
|
+
}
|
|
1227008
|
+
} catch (e) {
|
|
1227009
|
+
return;
|
|
1227010
|
+
}
|
|
1227011
|
+
}
|
|
1227012
|
+
return;
|
|
1227013
|
+
}
|
|
1227014
|
+
visitFrontmatterImages(data2, ["image", "og:image", "og:logo", "twitter:image"], mapImage);
|
|
1226992
1227015
|
visit2(tree, (node3) => {
|
|
1226993
1227016
|
if (node3.position == null) {
|
|
1226994
1227017
|
return;
|
|
@@ -1226997,14 +1227020,9 @@ function replaceImagePathsAndUrls(markdown, fileIdsMap, markdownFilesToPathName,
|
|
|
1226997
1227020
|
const original = replacedContent.slice(start4 + offset2, start4 + offset2 + length);
|
|
1226998
1227021
|
let replaced = original;
|
|
1226999
1227022
|
function replaceSrc(src) {
|
|
1227000
|
-
|
|
1227001
|
-
|
|
1227002
|
-
|
|
1227003
|
-
if (fileId != null) {
|
|
1227004
|
-
replaced = replaced.replace(src, `file:${fileId}`);
|
|
1227005
|
-
}
|
|
1227006
|
-
} catch (e) {
|
|
1227007
|
-
}
|
|
1227023
|
+
const imageSrc = mapImage(src);
|
|
1227024
|
+
if (src && imageSrc) {
|
|
1227025
|
+
replaced = replaced.replace(src, imageSrc);
|
|
1227008
1227026
|
}
|
|
1227009
1227027
|
}
|
|
1227010
1227028
|
function replaceHref(href) {
|
|
@@ -1227121,6 +1227139,30 @@ function trimAnchor(text8) {
|
|
|
1227121
1227139
|
}
|
|
1227122
1227140
|
return text8.replace(/#.*$/, "");
|
|
1227123
1227141
|
}
|
|
1227142
|
+
function visitFrontmatterImages(data2, keys7, mapImage) {
|
|
1227143
|
+
for (const key2 of keys7) {
|
|
1227144
|
+
const value = data2[key2];
|
|
1227145
|
+
if (value != null) {
|
|
1227146
|
+
if (typeof value === "object") {
|
|
1227147
|
+
if (value.type === "fileId") {
|
|
1227148
|
+
data2[key2] = {
|
|
1227149
|
+
...value,
|
|
1227150
|
+
value: mapImage(value.value) ?? value.value
|
|
1227151
|
+
};
|
|
1227152
|
+
}
|
|
1227153
|
+
} else if (typeof value === "string") {
|
|
1227154
|
+
const mappedImage = mapImage(value);
|
|
1227155
|
+
data2[key2] = mappedImage ? {
|
|
1227156
|
+
type: "fileId",
|
|
1227157
|
+
value: mappedImage
|
|
1227158
|
+
} : {
|
|
1227159
|
+
type: "url",
|
|
1227160
|
+
value
|
|
1227161
|
+
};
|
|
1227162
|
+
}
|
|
1227163
|
+
}
|
|
1227164
|
+
}
|
|
1227165
|
+
}
|
|
1227124
1227166
|
|
|
1227125
1227167
|
// pnp:/home/runner/work/fern/fern/packages/cli/docs-markdown-utils/lib/replaceReferencedMarkdown.js
|
|
1227126
1227168
|
var import_promises23 = require("fs/promises");
|
|
@@ -1243214,10 +1243256,10 @@ var CliContext = class {
|
|
|
1243214
1243256
|
return "fern-api";
|
|
1243215
1243257
|
}
|
|
1243216
1243258
|
getPackageVersion() {
|
|
1243217
|
-
if ("0.37.
|
|
1243259
|
+
if ("0.37.1" == null) {
|
|
1243218
1243260
|
this.logger.error("CLI_VERSION is not defined");
|
|
1243219
1243261
|
}
|
|
1243220
|
-
return "0.37.
|
|
1243262
|
+
return "0.37.1";
|
|
1243221
1243263
|
}
|
|
1243222
1243264
|
getCliName() {
|
|
1243223
1243265
|
if ("fern" == null) {
|
|
@@ -1252604,6 +1252646,23 @@ function convertResponseErrorsV2(irResponseErrors, ir) {
|
|
|
1252604
1252646
|
}
|
|
1252605
1252647
|
function convertHttpEndpointExample({ userSpecifiedExample, autogeneratedExample, irEndpoint, ir }) {
|
|
1252606
1252648
|
var _a5, _b4, _c4;
|
|
1252649
|
+
const requiredGlobalHeaders = ir.headers.map((header) => {
|
|
1252650
|
+
const value = header.valueType.type === "container" && header.valueType.container.type === "literal" ? header.valueType.container.literal._visit({
|
|
1252651
|
+
boolean: (val) => `${val}`,
|
|
1252652
|
+
string: (val) => val,
|
|
1252653
|
+
_other: () => void 0
|
|
1252654
|
+
}) : void 0;
|
|
1252655
|
+
if (value != null) {
|
|
1252656
|
+
return {
|
|
1252657
|
+
name: header.name,
|
|
1252658
|
+
value: {
|
|
1252659
|
+
jsonExample: value,
|
|
1252660
|
+
shape: api_exports7.ExampleTypeReferenceShape.primitive(api_exports7.ExamplePrimitive.string({ original: value }))
|
|
1252661
|
+
}
|
|
1252662
|
+
};
|
|
1252663
|
+
}
|
|
1252664
|
+
return void 0;
|
|
1252665
|
+
}).filter(isNonNullish);
|
|
1252607
1252666
|
const example = userSpecifiedExample.example ?? autogeneratedExample.example;
|
|
1252608
1252667
|
const { codeSamples } = userSpecifiedExample;
|
|
1252609
1252668
|
return {
|
|
@@ -1252618,7 +1252677,7 @@ function convertHttpEndpointExample({ userSpecifiedExample, autogeneratedExample
|
|
|
1252618
1252677
|
queryParameters[irQueryParameterExample.name.wireValue] = irQueryParameterExample.value.jsonExample;
|
|
1252619
1252678
|
return queryParameters;
|
|
1252620
1252679
|
}, {}),
|
|
1252621
|
-
headers: [...example.serviceHeaders, ...example.endpointHeaders].reduce((headers, irHeaderExample) => {
|
|
1252680
|
+
headers: [...requiredGlobalHeaders, ...example.serviceHeaders, ...example.endpointHeaders].reduce((headers, irHeaderExample) => {
|
|
1252622
1252681
|
headers[irHeaderExample.name.wireValue] = irHeaderExample.value.jsonExample;
|
|
1252623
1252682
|
return headers;
|
|
1252624
1252683
|
}, {}),
|