@docusaurus/core 0.0.0-4506 → 0.0.0-4514

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/bin/docusaurus.js CHANGED
@@ -208,7 +208,7 @@ cli
208
208
  );
209
209
 
210
210
  cli
211
- .command('write-heading-ids [contentDir] [files]')
211
+ .command('write-heading-ids [siteDir] [files...]')
212
212
  .description('Generate heading ids in Markdown content.')
213
213
  .option(
214
214
  '--maintain-case',
@@ -11,5 +11,5 @@ declare type Options = {
11
11
  };
12
12
  export declare function transformMarkdownHeadingLine(line: string, slugger: Slugger, options?: Options): string;
13
13
  export declare function transformMarkdownContent(content: string, options?: Options): string;
14
- export default function writeHeadingIds(siteDir: string, files?: string, options?: Options): Promise<void>;
14
+ export default function writeHeadingIds(siteDir: string, files?: string[], options?: Options): Promise<void>;
15
15
  export {};
@@ -94,7 +94,7 @@ async function getPathsToWatch(siteDir) {
94
94
  return plugins.flatMap((plugin) => { var _a, _b; return (_b = (_a = plugin === null || plugin === void 0 ? void 0 : plugin.getPathsToWatch) === null || _a === void 0 ? void 0 : _a.call(plugin)) !== null && _b !== void 0 ? _b : []; });
95
95
  }
96
96
  async function writeHeadingIds(siteDir, files, options) {
97
- const markdownFiles = await (0, utils_2.safeGlobby)(files ? [files] : await getPathsToWatch(siteDir), {
97
+ const markdownFiles = await (0, utils_2.safeGlobby)(files !== null && files !== void 0 ? files : (await getPathsToWatch(siteDir)), {
98
98
  expandDirectories: ['**/*.{md,mdx}'],
99
99
  });
100
100
  const result = await Promise.all(markdownFiles.map((p) => transformMarkdownFile(p, options)));
@@ -32,15 +32,26 @@ exports.DEFAULT_CONFIG = {
32
32
  baseUrlIssueBanner: true,
33
33
  staticDirectories: [utils_1.STATIC_DIR_NAME],
34
34
  };
35
- const PluginSchema = utils_validation_1.Joi.alternatives()
36
- .try(utils_validation_1.Joi.function(), utils_validation_1.Joi.array().ordered(utils_validation_1.Joi.function().required(), utils_validation_1.Joi.object().required()), utils_validation_1.Joi.string(), utils_validation_1.Joi.array()
37
- .ordered(utils_validation_1.Joi.string().required(), utils_validation_1.Joi.object().required())
38
- .length(2), utils_validation_1.Joi.bool().equal(false))
39
- // @ts-expect-error: bad lib def, doesn't recognize an array of reports
40
- .error((errors) => {
41
- errors.forEach((error) => {
42
- error.message = ` => Bad Docusaurus plugin value as path [${error.path}].
43
- Example valid plugin config:
35
+ function createPluginSchema(theme = false) {
36
+ return (utils_validation_1.Joi.alternatives()
37
+ .try(utils_validation_1.Joi.function(), utils_validation_1.Joi.array().ordered(utils_validation_1.Joi.function().required(), utils_validation_1.Joi.object().required()), utils_validation_1.Joi.string(), utils_validation_1.Joi.array()
38
+ .ordered(utils_validation_1.Joi.string().required(), utils_validation_1.Joi.object().required())
39
+ .length(2), utils_validation_1.Joi.bool().equal(false))
40
+ // @ts-expect-error: bad lib def, doesn't recognize an array of reports
41
+ .error((errors) => {
42
+ errors.forEach((error) => {
43
+ const validConfigExample = theme
44
+ ? `Example valid theme config:
45
+ {
46
+ themes: [
47
+ ["@docusaurus/theme-classic",options],
48
+ "./myTheme",
49
+ ["./myTheme",{someOption: 42}],
50
+ function myTheme() { },
51
+ [function myTheme() { },options]
52
+ ],
53
+ };`
54
+ : `Example valid plugin config:
44
55
  {
45
56
  plugins: [
46
57
  ["@docusaurus/plugin-content-docs",options],
@@ -49,12 +60,16 @@ Example valid plugin config:
49
60
  function myPlugin() { },
50
61
  [function myPlugin() { },options]
51
62
  ],
52
- };
63
+ };`;
64
+ error.message = ` => Bad Docusaurus ${theme ? 'theme' : 'plugin'} value as path [${error.path}].
65
+ ${validConfigExample}
53
66
  `;
54
- });
55
- return errors;
56
- });
57
- const ThemeSchema = utils_validation_1.Joi.alternatives().try(utils_validation_1.Joi.string(), utils_validation_1.Joi.array().items(utils_validation_1.Joi.string().required(), utils_validation_1.Joi.object().required()).length(2));
67
+ });
68
+ return errors;
69
+ }));
70
+ }
71
+ const PluginSchema = createPluginSchema(false);
72
+ const ThemeSchema = createPluginSchema(true);
58
73
  const PresetSchema = utils_validation_1.Joi.alternatives().try(utils_validation_1.Joi.string(), utils_validation_1.Joi.array().items(utils_validation_1.Joi.string().required(), utils_validation_1.Joi.object().required()).length(2));
59
74
  const LocaleConfigSchema = utils_validation_1.Joi.object({
60
75
  label: utils_validation_1.Joi.string(),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@docusaurus/core",
3
3
  "description": "Easy to Maintain Open Source Documentation Websites",
4
- "version": "0.0.0-4506",
4
+ "version": "0.0.0-4514",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -41,13 +41,13 @@
41
41
  "@babel/runtime": "^7.16.3",
42
42
  "@babel/runtime-corejs3": "^7.16.3",
43
43
  "@babel/traverse": "^7.16.3",
44
- "@docusaurus/cssnano-preset": "0.0.0-4506",
45
- "@docusaurus/logger": "0.0.0-4506",
46
- "@docusaurus/mdx-loader": "0.0.0-4506",
44
+ "@docusaurus/cssnano-preset": "0.0.0-4514",
45
+ "@docusaurus/logger": "0.0.0-4514",
46
+ "@docusaurus/mdx-loader": "0.0.0-4514",
47
47
  "@docusaurus/react-loadable": "5.5.2",
48
- "@docusaurus/utils": "0.0.0-4506",
49
- "@docusaurus/utils-common": "0.0.0-4506",
50
- "@docusaurus/utils-validation": "0.0.0-4506",
48
+ "@docusaurus/utils": "0.0.0-4514",
49
+ "@docusaurus/utils-common": "0.0.0-4514",
50
+ "@docusaurus/utils-validation": "0.0.0-4514",
51
51
  "@slorber/static-site-generator-webpack-plugin": "^4.0.0",
52
52
  "@svgr/webpack": "^6.0.0",
53
53
  "autoprefixer": "^10.3.5",
@@ -105,8 +105,8 @@
105
105
  "webpackbar": "^5.0.2"
106
106
  },
107
107
  "devDependencies": {
108
- "@docusaurus/module-type-aliases": "0.0.0-4506",
109
- "@docusaurus/types": "0.0.0-4506",
108
+ "@docusaurus/module-type-aliases": "0.0.0-4514",
109
+ "@docusaurus/types": "0.0.0-4514",
110
110
  "@types/copy-webpack-plugin": "^8.0.1",
111
111
  "@types/detect-port": "^1.3.0",
112
112
  "@types/mini-css-extract-plugin": "^1.4.3",
@@ -128,5 +128,5 @@
128
128
  "engines": {
129
129
  "node": ">=14"
130
130
  },
131
- "gitHead": "4bce04386c378635e6f4c38c7a706aa02d10130c"
131
+ "gitHead": "302e4dbd8a2880b0bbbdef1c5a1808b655694e11"
132
132
  }