@docusaurus/utils-validation 0.0.0-4619 → 0.0.0-4622

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.d.ts CHANGED
@@ -6,6 +6,6 @@
6
6
  */
7
7
  export { default as Joi } from './Joi';
8
8
  export { JoiFrontMatter } from './JoiFrontMatter';
9
- export { isValidationDisabledEscapeHatch, logValidationBugReportHint, printWarning, normalizePluginOptions, normalizeThemeConfig, validateFrontMatter, } from './validationUtils';
9
+ export { printWarning, normalizePluginOptions, normalizeThemeConfig, validateFrontMatter, } from './validationUtils';
10
10
  export { PluginIdSchema, RemarkPluginsSchema, RehypePluginsSchema, AdmonitionsSchema, URISchema, PathnameSchema, FrontMatterTagsSchema, FrontMatterTOCHeadingLevels, } from './validationSchemas';
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,OAAO,IAAI,GAAG,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EACL,+BAA+B,EAC/B,0BAA0B,EAC1B,YAAY,EACZ,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,OAAO,IAAI,GAAG,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC"}
package/lib/index.js CHANGED
@@ -6,15 +6,13 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.FrontMatterTOCHeadingLevels = exports.FrontMatterTagsSchema = exports.PathnameSchema = exports.URISchema = exports.AdmonitionsSchema = exports.RehypePluginsSchema = exports.RemarkPluginsSchema = exports.PluginIdSchema = exports.validateFrontMatter = exports.normalizeThemeConfig = exports.normalizePluginOptions = exports.printWarning = exports.logValidationBugReportHint = exports.isValidationDisabledEscapeHatch = exports.JoiFrontMatter = exports.Joi = void 0;
9
+ exports.FrontMatterTOCHeadingLevels = exports.FrontMatterTagsSchema = exports.PathnameSchema = exports.URISchema = exports.AdmonitionsSchema = exports.RehypePluginsSchema = exports.RemarkPluginsSchema = exports.PluginIdSchema = exports.validateFrontMatter = exports.normalizeThemeConfig = exports.normalizePluginOptions = exports.printWarning = exports.JoiFrontMatter = exports.Joi = void 0;
10
10
  // /!\ don't remove this export, as we recommend plugin authors to use it
11
11
  var Joi_1 = require("./Joi");
12
12
  Object.defineProperty(exports, "Joi", { enumerable: true, get: function () { return __importDefault(Joi_1).default; } });
13
13
  var JoiFrontMatter_1 = require("./JoiFrontMatter");
14
14
  Object.defineProperty(exports, "JoiFrontMatter", { enumerable: true, get: function () { return JoiFrontMatter_1.JoiFrontMatter; } });
15
15
  var validationUtils_1 = require("./validationUtils");
16
- Object.defineProperty(exports, "isValidationDisabledEscapeHatch", { enumerable: true, get: function () { return validationUtils_1.isValidationDisabledEscapeHatch; } });
17
- Object.defineProperty(exports, "logValidationBugReportHint", { enumerable: true, get: function () { return validationUtils_1.logValidationBugReportHint; } });
18
16
  Object.defineProperty(exports, "printWarning", { enumerable: true, get: function () { return validationUtils_1.printWarning; } });
19
17
  Object.defineProperty(exports, "normalizePluginOptions", { enumerable: true, get: function () { return validationUtils_1.normalizePluginOptions; } });
20
18
  Object.defineProperty(exports, "normalizeThemeConfig", { enumerable: true, get: function () { return validationUtils_1.normalizeThemeConfig; } });
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,yEAAyE;AACzE,6BAAqC;AAA7B,2GAAA,OAAO,OAAO;AACtB,mDAAgD;AAAxC,gHAAA,cAAc,OAAA;AAEtB,qDAO2B;AANzB,kIAAA,+BAA+B,OAAA;AAC/B,6HAAA,0BAA0B,OAAA;AAC1B,+GAAA,YAAY,OAAA;AACZ,yHAAA,sBAAsB,OAAA;AACtB,uHAAA,oBAAoB,OAAA;AACpB,sHAAA,mBAAmB,OAAA;AAErB,yDAS6B;AAR3B,mHAAA,cAAc,OAAA;AACd,wHAAA,mBAAmB,OAAA;AACnB,wHAAA,mBAAmB,OAAA;AACnB,sHAAA,iBAAiB,OAAA;AACjB,8GAAA,SAAS,OAAA;AACT,mHAAA,cAAc,OAAA;AACd,0HAAA,qBAAqB,OAAA;AACrB,gIAAA,2BAA2B,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,yEAAyE;AACzE,6BAAqC;AAA7B,2GAAA,OAAO,OAAO;AACtB,mDAAgD;AAAxC,gHAAA,cAAc,OAAA;AAEtB,qDAK2B;AAJzB,+GAAA,YAAY,OAAA;AACZ,yHAAA,sBAAsB,OAAA;AACtB,uHAAA,oBAAoB,OAAA;AACpB,sHAAA,mBAAmB,OAAA;AAErB,yDAS6B;AAR3B,mHAAA,cAAc,OAAA;AACd,wHAAA,mBAAmB,OAAA;AACnB,wHAAA,mBAAmB,OAAA;AACnB,sHAAA,iBAAiB,OAAA;AACjB,8GAAA,SAAS,OAAA;AACT,mHAAA,cAAc,OAAA;AACd,0HAAA,qBAAqB,OAAA;AACrB,gIAAA,2BAA2B,OAAA"}
@@ -5,8 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type Joi from './Joi';
8
- export declare const isValidationDisabledEscapeHatch: boolean;
9
- export declare const logValidationBugReportHint: () => void;
10
8
  export declare function printWarning(warning?: Joi.ValidationError): void;
11
9
  export declare function normalizePluginOptions<T extends {
12
10
  id?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"validationUtils.d.ts","sourceRoot":"","sources":["../src/validationUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAU7B,eAAO,MAAM,+BAA+B,SACU,CAAC;AAMvD,eAAO,MAAM,0BAA0B,QAAO,IAK7C,CAAC;AAEF,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,eAAe,GAAG,IAAI,CAOhE;AAED,wBAAgB,sBAAsB,CAAC,CAAC,SAAS;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAC,EAC5D,MAAM,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAC3B,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAClB,CAAC,CAsBH;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,MAAM,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAC3B,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,GACtB,CAAC,CAqBH;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,MAAM,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,GAC1B,CAAC,CAyBH"}
1
+ {"version":3,"file":"validationUtils.d.ts","sourceRoot":"","sources":["../src/validationUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAI7B,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,eAAe,GAAG,IAAI,CAOhE;AAED,wBAAgB,sBAAsB,CAAC,CAAC,SAAS;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAC,EAC5D,MAAM,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAC3B,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAClB,CAAC,CAiBH;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,MAAM,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAC3B,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,GACtB,CAAC,CAgBH;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,MAAM,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,GAC1B,CAAC,CAuBH"}
@@ -6,27 +6,10 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.validateFrontMatter = exports.normalizeThemeConfig = exports.normalizePluginOptions = exports.printWarning = exports.logValidationBugReportHint = exports.isValidationDisabledEscapeHatch = void 0;
9
+ exports.validateFrontMatter = exports.normalizeThemeConfig = exports.normalizePluginOptions = exports.printWarning = void 0;
10
10
  const tslib_1 = require("tslib");
11
11
  const logger_1 = (0, tslib_1.__importDefault)(require("@docusaurus/logger"));
12
12
  const validationSchemas_1 = require("./validationSchemas");
13
- // TODO temporary escape hatch for alpha-60: to be removed soon
14
- // Our validation schemas might be buggy at first
15
- // will permit users to bypass validation until we fix all validation errors
16
- // see for example: https://github.com/facebook/docusaurus/pull/3120
17
- // Undocumented on purpose, as we don't want users to keep using it over time
18
- // Maybe we'll make this escape hatch official some day, with a better api?
19
- exports.isValidationDisabledEscapeHatch = process.env.DISABLE_DOCUSAURUS_VALIDATION === 'true';
20
- if (exports.isValidationDisabledEscapeHatch) {
21
- logger_1.default.error `You should avoid using code=${'DISABLE_DOCUSAURUS_VALIDATION'} escape hatch, this will be removed.`;
22
- }
23
- const logValidationBugReportHint = () => {
24
- logger_1.default.error('A validation error occurred.');
25
- logger_1.default.info(`The validation system was added recently to Docusaurus as an attempt to avoid user configuration errors.
26
- We may have made some mistakes.
27
- If you think your configuration is valid and should keep working, please open a bug report.`);
28
- };
29
- exports.logValidationBugReportHint = logValidationBugReportHint;
30
13
  function printWarning(warning) {
31
14
  if (warning) {
32
15
  const warningMessages = warning.details
@@ -47,11 +30,6 @@ function normalizePluginOptions(schema, options) {
47
30
  });
48
31
  printWarning(warning);
49
32
  if (error) {
50
- (0, exports.logValidationBugReportHint)();
51
- if (exports.isValidationDisabledEscapeHatch) {
52
- logger_1.default.error(error);
53
- return options;
54
- }
55
33
  throw error;
56
34
  }
57
35
  return value; // TODO remove this ! in TS 4.6, see https://twitter.com/sebastienlorber/status/1481950042277793793
@@ -67,11 +45,6 @@ function normalizeThemeConfig(schema, themeConfig) {
67
45
  });
68
46
  printWarning(warning);
69
47
  if (error) {
70
- (0, exports.logValidationBugReportHint)();
71
- if (exports.isValidationDisabledEscapeHatch) {
72
- logger_1.default.error(error);
73
- return themeConfig;
74
- }
75
48
  throw error;
76
49
  }
77
50
  return value; // TODO remove this ! in TS 4.6
@@ -88,7 +61,6 @@ function validateFrontMatter(frontMatter, schema) {
88
61
  const frontMatterString = JSON.stringify(frontMatter, null, 2);
89
62
  const errorDetails = error.details;
90
63
  const invalidFields = errorDetails.map(({ path }) => path).join(', ');
91
- (0, exports.logValidationBugReportHint)();
92
64
  logger_1.default.error `The following front matter:
93
65
  ${logger_1.default.yellow(frontMatterString)}
94
66
  contains invalid values for field(s): ${logger_1.default.yellow(invalidFields)}.
@@ -1 +1 @@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CACM,gBAAM,CAAC,MAAM,CAAC,aAAa,CAAC;EAClE,YAAY,CAAC,GAAG,CAAC,CAAC,EAAC,OAAO,EAAC,EAAE,EAAE,CAAC,OAAO,CAAC;CACzC,CAAC;QACE,MAAM,KAAK,CAAC;KACb;IAED,OAAO,KAAM,CAAC,CAAC,+BAA+B;AAChD,CAAC;AA1BD,kDA0BC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/utils-validation",
3
- "version": "0.0.0-4619",
3
+ "version": "0.0.0-4622",
4
4
  "description": "Node validation utility functions for Docusaurus packages.",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -18,13 +18,13 @@
18
18
  },
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@docusaurus/logger": "0.0.0-4619",
22
- "@docusaurus/utils": "0.0.0-4619",
21
+ "@docusaurus/logger": "0.0.0-4622",
22
+ "@docusaurus/utils": "0.0.0-4622",
23
23
  "joi": "^17.6.0",
24
24
  "tslib": "^2.3.1"
25
25
  },
26
26
  "engines": {
27
27
  "node": ">=14"
28
28
  },
29
- "gitHead": "ec771a43284544899f7dd4ef59a8b794c51f2399"
29
+ "gitHead": "88fa597b10a32d3f2e3cff963af8337e66f89a13"
30
30
  }
package/src/index.ts CHANGED
@@ -10,8 +10,6 @@ export {default as Joi} from './Joi';
10
10
  export {JoiFrontMatter} from './JoiFrontMatter';
11
11
 
12
12
  export {
13
- isValidationDisabledEscapeHatch,
14
- logValidationBugReportHint,
15
13
  printWarning,
16
14
  normalizePluginOptions,
17
15
  normalizeThemeConfig,
@@ -9,26 +9,6 @@ import type Joi from './Joi';
9
9
  import logger from '@docusaurus/logger';
10
10
  import {PluginIdSchema} from './validationSchemas';
11
11
 
12
- // TODO temporary escape hatch for alpha-60: to be removed soon
13
- // Our validation schemas might be buggy at first
14
- // will permit users to bypass validation until we fix all validation errors
15
- // see for example: https://github.com/facebook/docusaurus/pull/3120
16
- // Undocumented on purpose, as we don't want users to keep using it over time
17
- // Maybe we'll make this escape hatch official some day, with a better api?
18
- export const isValidationDisabledEscapeHatch =
19
- process.env.DISABLE_DOCUSAURUS_VALIDATION === 'true';
20
-
21
- if (isValidationDisabledEscapeHatch) {
22
- logger.error`You should avoid using code=${'DISABLE_DOCUSAURUS_VALIDATION'} escape hatch, this will be removed.`;
23
- }
24
-
25
- export const logValidationBugReportHint = (): void => {
26
- logger.error('A validation error occurred.');
27
- logger.info(`The validation system was added recently to Docusaurus as an attempt to avoid user configuration errors.
28
- We may have made some mistakes.
29
- If you think your configuration is valid and should keep working, please open a bug report.`);
30
- };
31
-
32
12
  export function printWarning(warning?: Joi.ValidationError): void {
33
13
  if (warning) {
34
14
  const warningMessages = warning.details
@@ -54,11 +34,6 @@ export function normalizePluginOptions<T extends {id?: string}>(
54
34
  printWarning(warning);
55
35
 
56
36
  if (error) {
57
- logValidationBugReportHint();
58
- if (isValidationDisabledEscapeHatch) {
59
- logger.error(error);
60
- return options as T;
61
- }
62
37
  throw error;
63
38
  }
64
39
 
@@ -81,11 +56,6 @@ export function normalizeThemeConfig<T>(
81
56
  printWarning(warning);
82
57
 
83
58
  if (error) {
84
- logValidationBugReportHint();
85
- if (isValidationDisabledEscapeHatch) {
86
- logger.error(error);
87
- return themeConfig as T;
88
- }
89
59
  throw error;
90
60
  }
91
61
  return value!; // TODO remove this ! in TS 4.6
@@ -108,8 +78,6 @@ export function validateFrontMatter<T>(
108
78
  const errorDetails = error.details;
109
79
  const invalidFields = errorDetails.map(({path}) => path).join(', ');
110
80
 
111
- logValidationBugReportHint();
112
-
113
81
  logger.error`The following front matter:
114
82
  ${logger.yellow(frontMatterString)}
115
83
  contains invalid values for field(s): ${logger.yellow(invalidFields)}.