@docusaurus/core 3.9.2-canary-6449 → 3.9.2-canary-6458

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.
@@ -4,8 +4,11 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
+ // Poor man's protocol detection
8
+ // Spec: https://datatracker.ietf.org/doc/html/rfc3986#section-3.1
9
+ // In particular: scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
7
10
  export function hasProtocol(url) {
8
- return /^(?:\w*:|\/\/)/.test(url);
11
+ return /^(?:[A-Za-z][A-Za-z\d+.-]*:|\/\/)/.test(url);
9
12
  }
10
13
  export default function isInternalUrl(url) {
11
14
  return typeof url !== 'undefined' && !hasProtocol(url);
@@ -322,9 +322,14 @@ exports.ConfigSchema = utils_validation_1.Joi.object({
322
322
  headTags: utils_validation_1.Joi.array()
323
323
  .items(utils_validation_1.Joi.object({
324
324
  tagName: utils_validation_1.Joi.string().required(),
325
- attributes: utils_validation_1.Joi.object()
326
- .pattern(/[\w-]+/, utils_validation_1.Joi.string())
327
- .required(),
325
+ attributes: utils_validation_1.Joi.object().when('customElement', {
326
+ is: utils_validation_1.Joi.valid(true),
327
+ then: utils_validation_1.Joi.optional(),
328
+ otherwise: utils_validation_1.Joi.object()
329
+ .pattern(/[\w-]+/, utils_validation_1.Joi.string())
330
+ .required(),
331
+ }),
332
+ customElement: utils_validation_1.Joi.bool().default(false),
328
333
  }).unknown())
329
334
  .messages({
330
335
  'array.includes': '{#label} is invalid. A headTag must be an object with at least a "tagName" and an "attributes" property.',
@@ -12,15 +12,18 @@ const lodash_1 = tslib_1.__importDefault(require("lodash"));
12
12
  const html_tags_1 = tslib_1.__importDefault(require("html-tags"));
13
13
  const void_1 = tslib_1.__importDefault(require("html-tags/void"));
14
14
  const escape_html_1 = tslib_1.__importDefault(require("escape-html"));
15
+ // TODO this should be done at config validation time, not here
15
16
  function assertIsHtmlTagObject(val) {
16
17
  if (typeof val !== 'object' || !val) {
17
18
  throw new Error(`"${val}" is not a valid HTML tag object.`);
18
19
  }
19
- if (typeof val.tagName !== 'string') {
20
+ const htmlTag = val;
21
+ if (typeof htmlTag.tagName !== 'string') {
20
22
  throw new Error(`${JSON.stringify(val)} is not a valid HTML tag object. "tagName" must be defined as a string.`);
21
23
  }
22
- if (!html_tags_1.default.includes(val.tagName)) {
23
- throw new Error(`Error loading ${JSON.stringify(val)}, "${val.tagName}" is not a valid HTML tag.`);
24
+ if (!htmlTag.customElement &&
25
+ !html_tags_1.default.includes(htmlTag.tagName)) {
26
+ throw new Error(`Error loading ${JSON.stringify(val)}, "${htmlTag.tagName}" is not a valid HTML tag. Either use a valid "tagName" or set "customElement: true".`);
24
27
  }
25
28
  }
26
29
  function hashRouterAbsoluteToRelativeTagAttribute(name, value) {
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": "3.9.2-canary-6449",
4
+ "version": "3.9.2-canary-6458",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -33,13 +33,13 @@
33
33
  "url": "https://github.com/facebook/docusaurus/issues"
34
34
  },
35
35
  "dependencies": {
36
- "@docusaurus/babel": "3.9.2-canary-6449",
37
- "@docusaurus/bundler": "3.9.2-canary-6449",
38
- "@docusaurus/logger": "3.9.2-canary-6449",
39
- "@docusaurus/mdx-loader": "3.9.2-canary-6449",
40
- "@docusaurus/utils": "3.9.2-canary-6449",
41
- "@docusaurus/utils-common": "3.9.2-canary-6449",
42
- "@docusaurus/utils-validation": "3.9.2-canary-6449",
36
+ "@docusaurus/babel": "3.9.2-canary-6458",
37
+ "@docusaurus/bundler": "3.9.2-canary-6458",
38
+ "@docusaurus/logger": "3.9.2-canary-6458",
39
+ "@docusaurus/mdx-loader": "3.9.2-canary-6458",
40
+ "@docusaurus/utils": "3.9.2-canary-6458",
41
+ "@docusaurus/utils-common": "3.9.2-canary-6458",
42
+ "@docusaurus/utils-validation": "3.9.2-canary-6458",
43
43
  "boxen": "^6.2.1",
44
44
  "chalk": "^4.1.2",
45
45
  "chokidar": "^3.5.3",
@@ -77,8 +77,8 @@
77
77
  "webpack-merge": "^6.0.1"
78
78
  },
79
79
  "devDependencies": {
80
- "@docusaurus/module-type-aliases": "3.9.2-canary-6449",
81
- "@docusaurus/types": "3.9.2-canary-6449",
80
+ "@docusaurus/module-type-aliases": "3.9.2-canary-6458",
81
+ "@docusaurus/types": "3.9.2-canary-6458",
82
82
  "@total-typescript/shoehorn": "^0.1.2",
83
83
  "@types/detect-port": "^1.3.3",
84
84
  "@types/react-dom": "^18.2.7",
@@ -98,5 +98,5 @@
98
98
  "engines": {
99
99
  "node": ">=20.0"
100
100
  },
101
- "gitHead": "f8950c896d31a9a325353f6636a1a68549cb2d83"
101
+ "gitHead": "52e225fa534c30a6526f17dfdd98eb4982e50fd2"
102
102
  }