docusaurus-plugin-openapi-docs 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -259,7 +259,7 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
259
259
  }
260
260
  async function cleanApiDocs(options) {
261
261
  const { outputDir } = options;
262
- const apiDir = path_1.default.join(siteDir, outputDir);
262
+ const apiDir = (0, utils_1.posixPath)(path_1.default.join(siteDir, outputDir));
263
263
  const apiMdxFiles = await (0, utils_1.Globby)(["*.api.mdx", "*.info.mdx", "*.tag.mdx"], {
264
264
  cwd: path_1.default.resolve(apiDir),
265
265
  deep: 1,
@@ -251,7 +251,7 @@ async function readOpenapiFiles(openapiPath, options) {
251
251
  const sources = allFiles.filter((x) => !x.includes("_category_")); // todo: regex exclude?
252
252
  return Promise.all(sources.map(async (source) => {
253
253
  // TODO: make a function for this
254
- const fullPath = path_1.default.join(openapiPath, source);
254
+ const fullPath = (0, utils_1.posixPath)(path_1.default.join(openapiPath, source));
255
255
  const data = (await (0, loadAndResolveSpec_1.loadAndResolveSpec)(fullPath));
256
256
  return {
257
257
  source: fullPath,
@@ -10,12 +10,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const path_1 = __importDefault(require("path"));
13
+ const utils_1 = require("@docusaurus/utils");
13
14
  const _1 = require(".");
14
15
  // npx jest packages/docusaurus-plugin-openapi/src/openapi/openapi.test.ts --watch
15
16
  describe("openapi", () => {
16
17
  describe("readOpenapiFiles", () => {
17
18
  it("readOpenapiFiles", async () => {
18
- const results = await (0, _1.readOpenapiFiles)(path_1.default.join(__dirname, "__fixtures__/examples"), { specPath: "./", outputDir: "./" });
19
+ const results = await (0, _1.readOpenapiFiles)((0, utils_1.posixPath)(path_1.default.join(__dirname, "__fixtures__/examples")), { specPath: "./", outputDir: "./" });
19
20
  const categoryMeta = results.find((x) => x.source.endsWith("_category_.json"));
20
21
  expect(categoryMeta).toBeFalsy();
21
22
  // console.log(results);
@@ -10,6 +10,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const path_1 = __importDefault(require("path"));
13
+ const utils_1 = require("@docusaurus/utils");
13
14
  const clsx_1 = __importDefault(require("clsx"));
14
15
  const lodash_1 = require("lodash");
15
16
  const uniq_1 = __importDefault(require("lodash/uniq"));
@@ -106,8 +107,8 @@ function groupByTags(items, sidebarOptions, options, tags, docPath) {
106
107
  type: "generated-index",
107
108
  title: tag,
108
109
  slug: label
109
- ? path_1.default.join("/category", basePath, (0, lodash_1.kebabCase)(label), (0, lodash_1.kebabCase)(tag))
110
- : path_1.default.join("/category", basePath, (0, lodash_1.kebabCase)(tag)),
110
+ ? (0, utils_1.posixPath)(path_1.default.join("/category", basePath, (0, lodash_1.kebabCase)(label), (0, lodash_1.kebabCase)(tag)))
111
+ : (0, utils_1.posixPath)(path_1.default.join("/category", basePath, (0, lodash_1.kebabCase)(tag))),
111
112
  };
112
113
  }
113
114
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docusaurus-plugin-openapi-docs",
3
3
  "description": "OpenAPI plugin for Docusaurus.",
4
- "version": "1.4.2",
4
+ "version": "1.4.3",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -68,5 +68,5 @@
68
68
  "engines": {
69
69
  "node": ">=14"
70
70
  },
71
- "gitHead": "e5337f7fecf3b082c0781f798a479b2a63237432"
71
+ "gitHead": "277586102253008f831bedbb990fb9854658a190"
72
72
  }
package/src/index.ts CHANGED
@@ -9,7 +9,7 @@ import fs from "fs";
9
9
  import path from "path";
10
10
 
11
11
  import type { LoadContext, Plugin } from "@docusaurus/types";
12
- import { Globby } from "@docusaurus/utils";
12
+ import { Globby, posixPath } from "@docusaurus/utils";
13
13
  import chalk from "chalk";
14
14
  import { render } from "mustache";
15
15
 
@@ -338,7 +338,7 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
338
338
 
339
339
  async function cleanApiDocs(options: APIOptions) {
340
340
  const { outputDir } = options;
341
- const apiDir = path.join(siteDir, outputDir);
341
+ const apiDir = posixPath(path.join(siteDir, outputDir));
342
342
  const apiMdxFiles = await Globby(["*.api.mdx", "*.info.mdx", "*.tag.mdx"], {
343
343
  cwd: path.resolve(apiDir),
344
344
  deep: 1,
@@ -7,6 +7,8 @@
7
7
 
8
8
  import path from "path";
9
9
 
10
+ import { posixPath } from "@docusaurus/utils";
11
+
10
12
  import { readOpenapiFiles } from ".";
11
13
 
12
14
  // npx jest packages/docusaurus-plugin-openapi/src/openapi/openapi.test.ts --watch
@@ -15,7 +17,7 @@ describe("openapi", () => {
15
17
  describe("readOpenapiFiles", () => {
16
18
  it("readOpenapiFiles", async () => {
17
19
  const results = await readOpenapiFiles(
18
- path.join(__dirname, "__fixtures__/examples"),
20
+ posixPath(path.join(__dirname, "__fixtures__/examples")),
19
21
  { specPath: "./", outputDir: "./" }
20
22
  );
21
23
  const categoryMeta = results.find((x) =>
@@ -7,7 +7,7 @@
7
7
 
8
8
  import path from "path";
9
9
 
10
- import { Globby, GlobExcludeDefault } from "@docusaurus/utils";
10
+ import { Globby, GlobExcludeDefault, posixPath } from "@docusaurus/utils";
11
11
  import Converter from "@paloaltonetworks/openapi-to-postmanv2";
12
12
  import sdk from "@paloaltonetworks/postman-collection";
13
13
  import Collection from "@paloaltonetworks/postman-collection";
@@ -320,7 +320,7 @@ export async function readOpenapiFiles(
320
320
  return Promise.all(
321
321
  sources.map(async (source) => {
322
322
  // TODO: make a function for this
323
- const fullPath = path.join(openapiPath, source);
323
+ const fullPath = posixPath(path.join(openapiPath, source));
324
324
  const data = (await loadAndResolveSpec(
325
325
  fullPath
326
326
  )) as unknown as OpenApiObject;
@@ -13,6 +13,7 @@ import {
13
13
  SidebarItemCategoryLinkConfig,
14
14
  SidebarItemDoc,
15
15
  } from "@docusaurus/plugin-content-docs/src/sidebars/types";
16
+ import { posixPath } from "@docusaurus/utils";
16
17
  import clsx from "clsx";
17
18
  import { kebabCase } from "lodash";
18
19
  import uniq from "lodash/uniq";
@@ -148,8 +149,15 @@ function groupByTags(
148
149
  type: "generated-index" as "generated-index",
149
150
  title: tag,
150
151
  slug: label
151
- ? path.join("/category", basePath, kebabCase(label), kebabCase(tag))
152
- : path.join("/category", basePath, kebabCase(tag)),
152
+ ? posixPath(
153
+ path.join(
154
+ "/category",
155
+ basePath,
156
+ kebabCase(label),
157
+ kebabCase(tag)
158
+ )
159
+ )
160
+ : posixPath(path.join("/category", basePath, kebabCase(tag))),
153
161
  } as SidebarItemCategoryLinkConfig;
154
162
  }
155
163