@docusaurus/mdx-loader 0.0.0-4685 → 0.0.0-4687

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
@@ -80,7 +80,7 @@ function createAssetsExportCode(assets) {
80
80
  async function mdxLoader(fileString) {
81
81
  const callback = this.async();
82
82
  const filePath = this.resourcePath;
83
- const reqOptions = this.getOptions() || {};
83
+ const reqOptions = this.getOptions() ?? {};
84
84
  const { frontMatter, content: contentWithTitle } = (0, utils_1.parseFrontMatter)(fileString);
85
85
  const { content, contentTitle } = (0, utils_1.parseMarkdownContentTitle)(contentWithTitle, {
86
86
  removeContentTitle: reqOptions.removeContentTitle,
@@ -89,7 +89,7 @@ async function mdxLoader(fileString) {
89
89
  const options = {
90
90
  ...reqOptions,
91
91
  remarkPlugins: [
92
- ...(reqOptions.beforeDefaultRemarkPlugins || []),
92
+ ...(reqOptions.beforeDefaultRemarkPlugins ?? []),
93
93
  ...DEFAULT_OPTIONS.remarkPlugins,
94
94
  [
95
95
  transformImage_1.default,
@@ -105,12 +105,12 @@ async function mdxLoader(fileString) {
105
105
  siteDir: reqOptions.siteDir,
106
106
  },
107
107
  ],
108
- ...(reqOptions.remarkPlugins || []),
108
+ ...(reqOptions.remarkPlugins ?? []),
109
109
  ],
110
110
  rehypePlugins: [
111
- ...(reqOptions.beforeDefaultRehypePlugins || []),
111
+ ...(reqOptions.beforeDefaultRehypePlugins ?? []),
112
112
  ...DEFAULT_OPTIONS.rehypePlugins,
113
- ...(reqOptions.rehypePlugins || []),
113
+ ...(reqOptions.rehypePlugins ?? []),
114
114
  ],
115
115
  filepath: filePath,
116
116
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/mdx-loader",
3
- "version": "0.0.0-4685",
3
+ "version": "0.0.0-4687",
4
4
  "description": "Docusaurus Loader for MDX",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/mdx-loader.d.ts",
@@ -20,8 +20,8 @@
20
20
  "dependencies": {
21
21
  "@babel/parser": "^7.17.3",
22
22
  "@babel/traverse": "^7.17.3",
23
- "@docusaurus/logger": "0.0.0-4685",
24
- "@docusaurus/utils": "0.0.0-4685",
23
+ "@docusaurus/logger": "0.0.0-4687",
24
+ "@docusaurus/utils": "0.0.0-4687",
25
25
  "@mdx-js/mdx": "^1.6.22",
26
26
  "escape-html": "^1.0.3",
27
27
  "file-loader": "^6.2.0",
@@ -36,7 +36,7 @@
36
36
  "webpack": "^5.69.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@docusaurus/types": "0.0.0-4685",
39
+ "@docusaurus/types": "0.0.0-4687",
40
40
  "@types/escape-html": "^1.0.1",
41
41
  "@types/mdast": "^3.0.7",
42
42
  "@types/stringify-object": "^3.3.1",
@@ -54,5 +54,5 @@
54
54
  "engines": {
55
55
  "node": ">=14"
56
56
  },
57
- "gitHead": "3a492428ff3bf2051bc6b660803a735d67c8ae66"
57
+ "gitHead": "07732e16aa86d21c9c5713e03c7159201c2457de"
58
58
  }
package/src/index.ts CHANGED
@@ -114,7 +114,7 @@ export default async function mdxLoader(
114
114
  ): Promise<void> {
115
115
  const callback = this.async();
116
116
  const filePath = this.resourcePath;
117
- const reqOptions = this.getOptions() || {};
117
+ const reqOptions = this.getOptions() ?? {};
118
118
 
119
119
  const {frontMatter, content: contentWithTitle} = parseFrontMatter(fileString);
120
120
 
@@ -127,7 +127,7 @@ export default async function mdxLoader(
127
127
  const options: Options = {
128
128
  ...reqOptions,
129
129
  remarkPlugins: [
130
- ...(reqOptions.beforeDefaultRemarkPlugins || []),
130
+ ...(reqOptions.beforeDefaultRemarkPlugins ?? []),
131
131
  ...DEFAULT_OPTIONS.remarkPlugins,
132
132
  [
133
133
  transformImage,
@@ -143,12 +143,12 @@ export default async function mdxLoader(
143
143
  siteDir: reqOptions.siteDir,
144
144
  },
145
145
  ],
146
- ...(reqOptions.remarkPlugins || []),
146
+ ...(reqOptions.remarkPlugins ?? []),
147
147
  ],
148
148
  rehypePlugins: [
149
- ...(reqOptions.beforeDefaultRehypePlugins || []),
149
+ ...(reqOptions.beforeDefaultRehypePlugins ?? []),
150
150
  ...DEFAULT_OPTIONS.rehypePlugins,
151
- ...(reqOptions.rehypePlugins || []),
151
+ ...(reqOptions.rehypePlugins ?? []),
152
152
  ],
153
153
  filepath: filePath,
154
154
  };