docusaurus-theme-openapi-docs 0.0.0-beta.635 → 0.0.0-beta.637

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 (3) hide show
  1. package/lib/index.js +15 -11
  2. package/package.json +3 -3
  3. package/src/index.ts +22 -18
package/lib/index.js CHANGED
@@ -28,16 +28,17 @@ function docusaurusThemeOpenAPI() {
28
28
  },
29
29
  configureWebpack(_, isServer, utils) {
30
30
  const rules = _.module?.rules ?? [];
31
- const sassLoader = rules.filter((r) => {
31
+ const sassLoaderRule = rules.filter((r) => {
32
32
  return String(r.test) === String(/\.s[ca]ss$/);
33
33
  });
34
34
  const { getStyleLoaders } = utils;
35
- return {
36
- plugins: [new NodePolyfillPlugin()],
37
- module: {
38
- rules: [
39
- !sassLoader
40
- ? {
35
+ // Avoid conflicts with docusaurus-plugin-sass
36
+ if (sassLoaderRule.length === 0) {
37
+ return {
38
+ plugins: [new NodePolyfillPlugin()],
39
+ module: {
40
+ rules: [
41
+ {
41
42
  test: /\.s[ac]ss$/,
42
43
  include: path_1.default.resolve(__dirname, "..", "lib", "theme"),
43
44
  use: [
@@ -47,10 +48,13 @@ function docusaurusThemeOpenAPI() {
47
48
  options: {},
48
49
  },
49
50
  ],
50
- }
51
- : {},
52
- ],
53
- },
51
+ },
52
+ ],
53
+ },
54
+ };
55
+ }
56
+ return {
57
+ plugins: [new NodePolyfillPlugin()],
54
58
  };
55
59
  },
56
60
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docusaurus-theme-openapi-docs",
3
3
  "description": "OpenAPI theme for Docusaurus.",
4
- "version": "0.0.0-beta.635",
4
+ "version": "0.0.0-beta.637",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -48,7 +48,7 @@
48
48
  "buffer": "^6.0.3",
49
49
  "clsx": "^1.1.1",
50
50
  "crypto-js": "^4.1.1",
51
- "docusaurus-plugin-openapi-docs": "0.0.0-beta.635",
51
+ "docusaurus-plugin-openapi-docs": "0.0.0-beta.637",
52
52
  "docusaurus-plugin-sass": "^0.2.3",
53
53
  "file-saver": "^2.0.5",
54
54
  "immer": "^9.0.7",
@@ -73,5 +73,5 @@
73
73
  "engines": {
74
74
  "node": ">=14"
75
75
  },
76
- "gitHead": "583c1848e0a46cf6cebde5b9c3e42ca0bdb98d33"
76
+ "gitHead": "6e5a00abbff39c66f1d321de0d6cfae0631ba41f"
77
77
  }
package/src/index.ts CHANGED
@@ -34,29 +34,33 @@ export default function docusaurusThemeOpenAPI(): Plugin<void> {
34
34
 
35
35
  configureWebpack(_, isServer, utils) {
36
36
  const rules: any = _.module?.rules ?? [];
37
- const sassLoader = rules.filter((r: any) => {
37
+ const sassLoaderRule = rules.filter((r: any) => {
38
38
  return String(r.test) === String(/\.s[ca]ss$/);
39
39
  });
40
40
  const { getStyleLoaders } = utils;
41
+ // Avoid conflicts with docusaurus-plugin-sass
42
+ if (sassLoaderRule.length === 0) {
43
+ return {
44
+ plugins: [new NodePolyfillPlugin()],
45
+ module: {
46
+ rules: [
47
+ {
48
+ test: /\.s[ac]ss$/,
49
+ include: path.resolve(__dirname, "..", "lib", "theme"),
50
+ use: [
51
+ ...getStyleLoaders(isServer, {}),
52
+ {
53
+ loader: require.resolve("sass-loader"),
54
+ options: {},
55
+ },
56
+ ],
57
+ },
58
+ ],
59
+ },
60
+ };
61
+ }
41
62
  return {
42
63
  plugins: [new NodePolyfillPlugin()],
43
- module: {
44
- rules: [
45
- !sassLoader
46
- ? {
47
- test: /\.s[ac]ss$/,
48
- include: path.resolve(__dirname, "..", "lib", "theme"),
49
- use: [
50
- ...getStyleLoaders(isServer, {}),
51
- {
52
- loader: require.resolve("sass-loader"),
53
- options: {},
54
- },
55
- ],
56
- }
57
- : {},
58
- ],
59
- },
60
64
  };
61
65
  },
62
66
  };