fern-api 0.31.24 → 0.31.25-rc1

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.
Files changed (2) hide show
  1. package/bundle.cjs +58 -37
  2. package/package.json +1 -1
package/bundle.cjs CHANGED
@@ -49893,7 +49893,7 @@ var require_extract = __commonJS({
49893
49893
  return size2 && 512 - size2;
49894
49894
  };
49895
49895
  var emptyStream = function(self2, offset2) {
49896
- var s2 = new Source(self2, offset2);
49896
+ var s2 = new Source2(self2, offset2);
49897
49897
  s2.end();
49898
49898
  return s2;
49899
49899
  };
@@ -49907,13 +49907,13 @@ var require_extract = __commonJS({
49907
49907
  header.pax = pax;
49908
49908
  return header;
49909
49909
  };
49910
- var Source = function(self2, offset2) {
49910
+ var Source2 = function(self2, offset2) {
49911
49911
  this._parent = self2;
49912
49912
  this.offset = offset2;
49913
49913
  PassThrough2.call(this, { autoDestroy: false });
49914
49914
  };
49915
- util2.inherits(Source, PassThrough2);
49916
- Source.prototype.destroy = function(err) {
49915
+ util2.inherits(Source2, PassThrough2);
49916
+ Source2.prototype.destroy = function(err) {
49917
49917
  this._parent.destroy(err);
49918
49918
  };
49919
49919
  var Extract = function(opts) {
@@ -50041,7 +50041,7 @@ var require_extract = __commonJS({
50041
50041
  self2.emit("entry", header, emptyStream(self2, offset2), onunlock);
50042
50042
  return;
50043
50043
  }
50044
- self2._stream = new Source(self2, offset2);
50044
+ self2._stream = new Source2(self2, offset2);
50045
50045
  self2.emit("entry", header, self2._stream, onunlock);
50046
50046
  self2._parse(header.size, onstreamend);
50047
50047
  oncontinue();
@@ -405155,7 +405155,7 @@ var require_resolve3 = __commonJS({
405155
405155
  var ref_utils_1 = require_ref_utils();
405156
405156
  var types_1 = require_types22();
405157
405157
  var utils_1 = require_utils15();
405158
- var Source = class {
405158
+ var Source2 = class {
405159
405159
  constructor(absoluteRef, body, mimeType) {
405160
405160
  this.absoluteRef = absoluteRef;
405161
405161
  this.body = body;
@@ -405179,7 +405179,7 @@ var require_resolve3 = __commonJS({
405179
405179
  return this._lines;
405180
405180
  }
405181
405181
  };
405182
- exports2.Source = Source;
405182
+ exports2.Source = Source2;
405183
405183
  var ResolveError = class extends Error {
405184
405184
  constructor(originalError) {
405185
405185
  super(originalError.message);
@@ -405206,7 +405206,7 @@ var require_resolve3 = __commonJS({
405206
405206
  }
405207
405207
  exports2.makeRefId = makeRefId;
405208
405208
  function makeDocumentFromString(sourceString, absoluteRef) {
405209
- const source = new Source(absoluteRef, sourceString);
405209
+ const source = new Source2(absoluteRef, sourceString);
405210
405210
  try {
405211
405211
  return {
405212
405212
  source,
@@ -405239,13 +405239,13 @@ var require_resolve3 = __commonJS({
405239
405239
  try {
405240
405240
  if ((0, ref_utils_1.isAbsoluteUrl)(absoluteRef)) {
405241
405241
  const { body, mimeType } = yield (0, utils_1.readFileFromUrl)(absoluteRef, this.config.http);
405242
- return new Source(absoluteRef, body, mimeType);
405242
+ return new Source2(absoluteRef, body, mimeType);
405243
405243
  } else {
405244
405244
  if (fs10.lstatSync(absoluteRef).isDirectory()) {
405245
405245
  throw new Error(`Expected a file but received a folder at ${absoluteRef}`);
405246
405246
  }
405247
405247
  const content5 = yield fs10.promises.readFile(absoluteRef, "utf-8");
405248
- return new Source(absoluteRef, content5.replace(/\r\n/g, "\n"));
405248
+ return new Source2(absoluteRef, content5.replace(/\r\n/g, "\n"));
405249
405249
  }
405250
405250
  } catch (error) {
405251
405251
  error.message = error.message.replace(", lstat", "");
@@ -451844,7 +451844,7 @@ var require_extract3 = __commonJS({
451844
451844
  return size2 && 512 - size2;
451845
451845
  };
451846
451846
  var emptyStream = function(self2, offset2) {
451847
- var s2 = new Source(self2, offset2);
451847
+ var s2 = new Source2(self2, offset2);
451848
451848
  s2.end();
451849
451849
  return s2;
451850
451850
  };
@@ -451858,13 +451858,13 @@ var require_extract3 = __commonJS({
451858
451858
  header.pax = pax;
451859
451859
  return header;
451860
451860
  };
451861
- var Source = function(self2, offset2) {
451861
+ var Source2 = function(self2, offset2) {
451862
451862
  this._parent = self2;
451863
451863
  this.offset = offset2;
451864
451864
  PassThrough2.call(this);
451865
451865
  };
451866
- util2.inherits(Source, PassThrough2);
451867
- Source.prototype.destroy = function(err) {
451866
+ util2.inherits(Source2, PassThrough2);
451867
+ Source2.prototype.destroy = function(err) {
451868
451868
  this._parent.destroy(err);
451869
451869
  };
451870
451870
  var Extract = function(opts) {
@@ -451992,7 +451992,7 @@ var require_extract3 = __commonJS({
451992
451992
  self2.emit("entry", header, emptyStream(self2, offset2), onunlock);
451993
451993
  return;
451994
451994
  }
451995
- self2._stream = new Source(self2, offset2);
451995
+ self2._stream = new Source2(self2, offset2);
451996
451996
  self2.emit("entry", header, self2._stream, onunlock);
451997
451997
  self2._parse(header.size, onstreamend);
451998
451998
  oncontinue();
@@ -1122319,7 +1122319,7 @@ var AccessTokenPosthogManager = class {
1122319
1122319
  properties: {
1122320
1122320
  ...event,
1122321
1122321
  ...event.properties,
1122322
- version: "0.31.24",
1122322
+ version: "0.31.25-rc1",
1122323
1122323
  usingAccessToken: true
1122324
1122324
  }
1122325
1122325
  });
@@ -1122381,7 +1122381,7 @@ var UserPosthogManager = class {
1122381
1122381
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
1122382
1122382
  event: "CLI",
1122383
1122383
  properties: {
1122384
- version: "0.31.24",
1122384
+ version: "0.31.25-rc1",
1122385
1122385
  ...event,
1122386
1122386
  ...event.properties
1122387
1122387
  }
@@ -1134469,7 +1134469,7 @@ function parseImagePaths(markdown, metadata) {
1134469
1134469
  return { filepaths: [...filepaths], markdown: import_gray_matter.default.stringify(replacedContent, data2) };
1134470
1134470
  }
1134471
1134471
  function resolvePath(pathToImage, { absolutePathToFernFolder, absolutePathToMdx }) {
1134472
- if (pathToImage == null || isExternalUrl(pathToImage)) {
1134472
+ if (pathToImage == null || isExternalUrl(pathToImage) || isDataUrl(pathToImage)) {
1134473
1134473
  return void 0;
1134474
1134474
  }
1134475
1134475
  const filepath = resolve(pathToImage.startsWith("/") ? absolutePathToFernFolder : dirname(absolutePathToMdx), RelativeFilePath.of(pathToImage.replace(/^\//, "")));
@@ -1134478,6 +1134478,9 @@ function resolvePath(pathToImage, { absolutePathToFernFolder, absolutePathToMdx
1134478
1134478
  function isExternalUrl(url) {
1134479
1134479
  return /^(https?:)?\/\//.test(url);
1134480
1134480
  }
1134481
+ function isDataUrl(url) {
1134482
+ return /^data:/.test(url);
1134483
+ }
1134481
1134484
  function replaceImagePathsAndUrls(markdown, fileIdsMap, markdownFilesToPathName, metadata, context) {
1134482
1134485
  const { content: content5, data: data2 } = (0, import_gray_matter.default)(markdown);
1134483
1134486
  let replacedContent = content5;
@@ -1134494,7 +1134497,7 @@ function replaceImagePathsAndUrls(markdown, fileIdsMap, markdownFilesToPathName,
1134494
1134497
  const original = replacedContent.slice(start4 + offset2, start4 + offset2 + length);
1134495
1134498
  let replaced = original;
1134496
1134499
  function replaceSrc(src) {
1134497
- if (src != null && !isExternalUrl(src)) {
1134500
+ if (src != null && !isExternalUrl(src) && !isDataUrl(src)) {
1134498
1134501
  try {
1134499
1134502
  const fileId = fileIdsMap.get(AbsoluteFilePath.of(src));
1134500
1134503
  if (fileId != null) {
@@ -1141693,22 +1141696,9 @@ var FERN_TYPE_EXTENSIONS = {
1141693
1141696
  }
1141694
1141697
  };
1141695
1141698
  async function loadOpenAPI({ absolutePathToOpenAPI, absolutePathToOpenAPIOverrides, context }) {
1141696
- const result2 = await (0, import_openapi_core.bundle)({
1141697
- config: new import_openapi_core.Config({
1141698
- apis: {},
1141699
- styleguide: {
1141700
- plugins: [FERN_TYPE_EXTENSIONS],
1141701
- rules: {
1141702
- spec: "warn"
1141703
- }
1141704
- }
1141705
- }, void 0),
1141706
- ref: absolutePathToOpenAPI,
1141707
- dereference: false,
1141708
- removeUnusedComponents: false,
1141709
- keepUrlRefs: true
1141699
+ const parsed = await parseOpenAPI({
1141700
+ absolutePathToOpenAPI
1141710
1141701
  });
1141711
- const parsed = await import_swagger_parser.default.parse(result2.bundle.parsed);
1141712
1141702
  let overridesFilepath = void 0;
1141713
1141703
  if (absolutePathToOpenAPIOverrides != null) {
1141714
1141704
  overridesFilepath = absolutePathToOpenAPIOverrides;
@@ -1141719,14 +1141709,45 @@ async function loadOpenAPI({ absolutePathToOpenAPI, absolutePathToOpenAPIOverrid
1141719
1141709
  );
1141720
1141710
  }
1141721
1141711
  if (overridesFilepath != null) {
1141722
- return await mergeWithOverrides({
1141712
+ const merged = await mergeWithOverrides({
1141723
1141713
  absoluteFilepathToOverrides: overridesFilepath,
1141724
1141714
  context,
1141725
1141715
  data: parsed
1141726
1141716
  });
1141717
+ return await parseOpenAPI({
1141718
+ absolutePathToOpenAPI,
1141719
+ parsed: merged
1141720
+ });
1141727
1141721
  }
1141728
1141722
  return parsed;
1141729
1141723
  }
1141724
+ async function parseOpenAPI({ absolutePathToOpenAPI, parsed }) {
1141725
+ const options2 = {
1141726
+ config: new import_openapi_core.Config({
1141727
+ apis: {},
1141728
+ styleguide: {
1141729
+ plugins: [FERN_TYPE_EXTENSIONS],
1141730
+ rules: {
1141731
+ spec: "warn"
1141732
+ }
1141733
+ }
1141734
+ }, void 0),
1141735
+ dereference: false,
1141736
+ removeUnusedComponents: false,
1141737
+ keepUrlRefs: true
1141738
+ };
1141739
+ const result2 = parsed != null ? await (0, import_openapi_core.bundle)({
1141740
+ ...options2,
1141741
+ doc: {
1141742
+ source: new import_openapi_core.Source(absolutePathToOpenAPI, "<openapi>"),
1141743
+ parsed
1141744
+ }
1141745
+ }) : await (0, import_openapi_core.bundle)({
1141746
+ ...options2,
1141747
+ ref: absolutePathToOpenAPI
1141748
+ });
1141749
+ return await import_swagger_parser.default.parse(result2.bundle.parsed);
1141750
+ }
1141730
1141751
 
1141731
1141752
  // pnp:/home/runner/work/fern/fern/packages/cli/openapi-parser/lib/openapi/v2/generateIr.js
1141732
1141753
  var import_swagger2openapi = __toESM(require_swagger2openapi());
@@ -1149981,10 +1150002,10 @@ var CliContext = class {
1149981
1150002
  return "fern-api";
1149982
1150003
  }
1149983
1150004
  getPackageVersion() {
1149984
- if ("0.31.24" == null) {
1150005
+ if ("0.31.25-rc1" == null) {
1149985
1150006
  this.logger.error("CLI_VERSION is not defined");
1149986
1150007
  }
1149987
- return "0.31.24";
1150008
+ return "0.31.25-rc1";
1149988
1150009
  }
1149989
1150010
  getCliName() {
1149990
1150011
  if ("fern" == null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.31.24",
3
+ "version": "0.31.25-rc1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",