umberto 7.0.2 → 8.0.1
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/CHANGELOG.md +29 -1798
- package/LICENSE.md +44 -5
- package/README.md +194 -9
- package/package.json +4 -8
- package/scripts/filter/after-post-render/gloria/append-copy-heading-buttons.js +90 -0
- package/scripts/filter/after-post-render/gloria/apply-design-doc-classes.js +145 -0
- package/scripts/filter/after-post-render/gloria/wrap-table-into-wrappers.js +30 -0
- package/scripts/filter/after-post-render/img-linker.js +1 -1
- package/scripts/filter/after-post-render/insert-error-codes.js +1 -1
- package/scripts/filter/after-post-render/linker.js +1 -1
- package/scripts/filter/after-post-render/parseicontag.js +1 -1
- package/scripts/filter/after-post-render/snippets.js +5 -1
- package/scripts/filter/after-render/gloria/inline-svg.js +14 -0
- package/scripts/filter/after-render/gloria/spritesheet-svg.js +14 -0
- package/scripts/filter/before-post-render/add-project-info-to-page.js +1 -1
- package/scripts/filter/before-post-render/code-switcher.js +4 -0
- package/scripts/filter/before-post-render/execute-and-insert-function-results.js +3 -1
- package/scripts/filter/before-post-render/gloria/add-breadcrumbs-data-to-page.js +276 -0
- package/scripts/filter/before-post-render/gloria/prerender-admonitions.js +27 -0
- package/scripts/filter/before-post-render/gloria/prerender-xml-pug-components.js +352 -0
- package/scripts/filter/before-post-render/gloria/render-post-render-pug-components.js +102 -0
- package/scripts/filter/before-post-render/set-layout.js +4 -2
- package/scripts/helper/parse-href.js +28 -0
- package/scripts/helper/u-capitalize.js +13 -0
- package/scripts/helper/u-extract-and-cache-title.js +36 -0
- package/scripts/helper/u-random-id.js +16 -0
- package/scripts/helper/u-remove-indentation.js +13 -0
- package/scripts/helper/u-toc.js +2 -63
- package/scripts/utils/add-indention.js +16 -0
- package/scripts/utils/capitalize.js +17 -0
- package/scripts/utils/concat-url-parts.js +19 -0
- package/scripts/utils/decode-html-entities.js +25 -0
- package/scripts/utils/drop-init-slash.js +14 -0
- package/scripts/utils/drop-trailing-slash.js +14 -0
- package/scripts/utils/drop-url-protocol.js +10 -0
- package/scripts/utils/inline-svg.js +152 -0
- package/scripts/utils/measure-call.js +16 -0
- package/scripts/utils/parse-href.js +37 -0
- package/scripts/utils/parseicontag.js +1 -1
- package/scripts/utils/parselinks.js +27 -6
- package/scripts/utils/parser-cursor.js +280 -0
- package/scripts/utils/pipe.js +17 -0
- package/scripts/utils/pug-renderer/create-prerender-pug-template.js +185 -0
- package/scripts/utils/pug-renderer/render-pug-component.js +73 -0
- package/scripts/utils/pug-to-xml-binding/parser/walk-xml-tree.js +150 -0
- package/scripts/utils/pug-to-xml-binding/parser/xml-components-parser.js +414 -0
- package/scripts/utils/pug-to-xml-binding/render-xml-pug-components-in-markdown.js +193 -0
- package/scripts/utils/pug-to-xml-binding/transform-xml-tree-to-pug.js +144 -0
- package/scripts/utils/random-id.js +75 -0
- package/scripts/utils/remove-indentation.js +48 -0
- package/scripts/utils/spritesheet-svg.js +183 -0
- package/scripts/utils/toc.js +71 -0
- package/scripts/utils/transform-markdown-admonitions.js +98 -0
- package/scripts/utils/uniq-by-last.js +32 -0
- package/src/api-builder/api-builder.js +49 -18
- package/src/api-builder/classes/description-parser.js +61 -10
- package/src/api-builder/classes/doc-data-factory.js +2 -2
- package/src/helpers/github-url.js +1 -1
- package/src/helpers/templates/scripts/default.js +1 -1
- package/src/helpers/templates/scripts/group.js +1 -1
- package/src/hexo/filter/project-locals.js +12 -0
- package/src/hexo/get-repo-urls.js +1 -1
- package/src/hexo/project-globals.js +4 -0
- package/src/hexo-manager.js +7 -2
- package/src/sdk-builder/sdk-builder.js +4 -4
- package/src/tasks/build-api-docs.js +6 -6
- package/src/tasks/build-documentation.js +57 -24
- package/src/tasks/cache-files.js +2 -2
- package/src/tasks/compile-sass.js +12 -0
- package/src/tasks/copy-assets.js +4 -0
- package/src/tasks/copy-project-icons.js +1 -1
- package/src/tasks/get-extra-files.js +1 -1
- package/src/tasks/get-project-config.js +1 -1
- package/src/tasks/overwrite-api-guides.js +1 -1
- package/src/tasks/validate-links.js +211 -39
- package/themes/umberto/layout/gloria/404.pug +25 -16
- package/themes/umberto/layout/gloria/_api-docs/_header/_style.scss +31 -0
- package/themes/umberto/layout/gloria/_api-docs/_header/index.pug +50 -0
- package/themes/umberto/layout/gloria/_api-docs/_mixin/_api-see-source.pug +1 -4
- package/themes/umberto/layout/gloria/_api-docs/_mixin/_api-tree-item.pug +42 -26
- package/themes/umberto/layout/gloria/_api-docs/_mixin/_class-item.pug +20 -13
- package/themes/umberto/layout/gloria/_api-docs/_mixin/_dev-names.pug +1 -1
- package/themes/umberto/layout/gloria/_api-docs/_mixin/_error.pug +10 -5
- package/themes/umberto/layout/gloria/_api-docs/_mixin/_hierarchy-list.pug +1 -1
- package/themes/umberto/layout/gloria/_api-docs/_mixin/_link-or-text.pug +1 -1
- package/themes/umberto/layout/gloria/_api-docs/_mixin/_method.pug +45 -39
- package/themes/umberto/layout/gloria/_api-docs/_mixin/_property.pug +26 -20
- package/themes/umberto/layout/gloria/_api-docs/_mixin/_related.pug +1 -1
- package/themes/umberto/layout/gloria/_api-docs/_mixin/_toc-list-item.pug +11 -0
- package/themes/umberto/layout/gloria/_api-docs/_partial/api-subheader.pug +0 -11
- package/themes/umberto/layout/gloria/_api-docs/_partial/api-toc.pug +33 -0
- package/themes/umberto/layout/gloria/_api-docs/_partial/classes.pug +5 -4
- package/themes/umberto/layout/gloria/_api-docs/_partial/config-options.pug +5 -4
- package/themes/umberto/layout/gloria/_api-docs/_partial/constants.pug +1 -1
- package/themes/umberto/layout/gloria/_api-docs/_partial/description.pug +2 -2
- package/themes/umberto/layout/gloria/_api-docs/_partial/events.pug +5 -4
- package/themes/umberto/layout/gloria/_api-docs/_partial/functions.pug +5 -4
- package/themes/umberto/layout/gloria/_api-docs/_partial/interfaces.pug +1 -1
- package/themes/umberto/layout/gloria/_api-docs/_partial/methods.pug +14 -13
- package/themes/umberto/layout/gloria/_api-docs/_partial/namespaces.pug +1 -1
- package/themes/umberto/layout/gloria/_api-docs/_partial/navtree.pug +4 -11
- package/themes/umberto/layout/gloria/_api-docs/_partial/properties.pug +14 -13
- package/themes/umberto/layout/gloria/_api-docs/_partial/type-parameters.pug +15 -12
- package/themes/umberto/layout/gloria/_api-docs/_partial/typedefs.pug +5 -4
- package/themes/umberto/layout/gloria/_api-docs/_subheader/_style.scss +5 -0
- package/themes/umberto/layout/gloria/_api-docs/_subheader/index.pug +10 -0
- package/themes/umberto/layout/gloria/_api-docs/_toc/_style.scss +229 -0
- package/themes/umberto/layout/gloria/_api-docs/_toc/index.pug +11 -0
- package/themes/umberto/layout/gloria/_api-docs/api-base.pug +24 -24
- package/themes/umberto/layout/gloria/_api-docs/class.pug +4 -4
- package/themes/umberto/layout/gloria/_api-docs/errors.pug +3 -3
- package/themes/umberto/layout/gloria/_api-docs/index.pug +3 -0
- package/themes/umberto/layout/gloria/_api-docs/interface.pug +4 -4
- package/themes/umberto/layout/gloria/_api-docs/mixin.pug +4 -4
- package/themes/umberto/layout/gloria/_api-docs/module.pug +4 -4
- package/themes/umberto/layout/gloria/_api-docs/namespace.pug +4 -4
- package/themes/umberto/layout/gloria/_api-docs/typedef.pug +22 -22
- package/themes/umberto/layout/gloria/_components/badge/_style.scss +27 -0
- package/themes/umberto/layout/gloria/_components/badge/index.pug +30 -0
- package/themes/umberto/layout/gloria/_components/banner/_style.scss +133 -0
- package/themes/umberto/layout/gloria/_components/banner/index.pug +3 -0
- package/themes/umberto/layout/gloria/_components/button/_style.scss +183 -0
- package/themes/umberto/layout/gloria/_components/button/index.pug +140 -0
- package/themes/umberto/layout/gloria/_components/callout/_style.scss +56 -0
- package/themes/umberto/layout/gloria/_components/callout/index.pug +87 -0
- package/themes/umberto/layout/gloria/_components/card/_style.scss +101 -0
- package/themes/umberto/layout/gloria/_components/card/index.pug +131 -0
- package/themes/umberto/layout/gloria/_components/card-learn-more-links/_style.scss +9 -0
- package/themes/umberto/layout/gloria/_components/card-learn-more-links/index.pug +56 -0
- package/themes/umberto/layout/gloria/_components/checkbox/_style.scss +117 -0
- package/themes/umberto/layout/gloria/_components/checkbox/index.pug +35 -0
- package/themes/umberto/layout/gloria/_components/cke5-code-switcher/index.pug +39 -0
- package/themes/umberto/layout/gloria/_components/code-block/_style.scss +111 -0
- package/themes/umberto/layout/gloria/_components/code-block/index.pug +75 -0
- package/themes/umberto/layout/gloria/_components/code-switcher/_style.scss +36 -0
- package/themes/umberto/layout/gloria/_components/code-switcher/index.pug +31 -0
- package/themes/umberto/layout/gloria/_components/columns/_style.scss +54 -0
- package/themes/umberto/layout/gloria/_components/columns/index.pug +30 -0
- package/themes/umberto/layout/gloria/_components/divider/_style.scss +6 -0
- package/themes/umberto/layout/gloria/_components/divider/index.pug +13 -0
- package/themes/umberto/layout/gloria/_components/dropdown/_style.scss +88 -0
- package/themes/umberto/layout/gloria/_components/dropdown/index.pug +77 -0
- package/themes/umberto/layout/gloria/_components/fake-devtools/_style.scss +233 -0
- package/themes/umberto/layout/gloria/_components/fake-devtools/index.pug +27 -0
- package/themes/umberto/layout/gloria/_components/heading-badge/index.pug +17 -0
- package/themes/umberto/layout/gloria/_components/heading-link/_style.scss +47 -0
- package/themes/umberto/layout/gloria/_components/heading-link/index.pug +26 -0
- package/themes/umberto/layout/gloria/_components/icon/_style.scss +12 -0
- package/themes/umberto/layout/gloria/_components/icon/index.pug +75 -0
- package/themes/umberto/layout/gloria/_components/icon-message/_style.scss +13 -0
- package/themes/umberto/layout/gloria/_components/icon-message/index.pug +17 -0
- package/themes/umberto/layout/gloria/_components/iframe/_style.scss +10 -0
- package/themes/umberto/layout/gloria/_components/iframe/index.pug +22 -0
- package/themes/umberto/layout/gloria/_components/img/index.pug +17 -0
- package/themes/umberto/layout/gloria/_components/index.pug +32 -0
- package/themes/umberto/layout/gloria/_components/input/_style.scss +82 -0
- package/themes/umberto/layout/gloria/_components/input/index.pug +34 -0
- package/themes/umberto/layout/gloria/_components/json-ld/index.pug +3 -0
- package/themes/umberto/layout/gloria/_components/keyboard-shortcut/_style.scss +49 -0
- package/themes/umberto/layout/gloria/_components/keyboard-shortcut/index.pug +23 -0
- package/themes/umberto/layout/gloria/_components/menu-dropdown/_style.scss +27 -0
- package/themes/umberto/layout/gloria/_components/menu-dropdown/index.pug +40 -0
- package/themes/umberto/layout/gloria/_components/mobile-overlay/_style.scss +70 -0
- package/themes/umberto/layout/gloria/_components/mobile-overlay/index.pug +37 -0
- package/themes/umberto/layout/gloria/_components/nav-tree/_style.scss +104 -0
- package/themes/umberto/layout/gloria/_components/nav-tree/index.pug +6 -0
- package/themes/umberto/layout/gloria/_components/nav-tree/nav-tree-item.pug +27 -0
- package/themes/umberto/layout/gloria/_components/nav-tree/nav-tree-level.pug +58 -0
- package/themes/umberto/layout/gloria/_components/skeleton/_style.scss +22 -0
- package/themes/umberto/layout/gloria/_components/skeleton/index.pug +16 -0
- package/themes/umberto/layout/gloria/_components/snippet-footer/_style.scss +26 -0
- package/themes/umberto/layout/gloria/_components/snippet-footer/index.pug +10 -0
- package/themes/umberto/layout/gloria/_components/spacer/_style.scss +9 -0
- package/themes/umberto/layout/gloria/_components/spacer/index.pug +19 -0
- package/themes/umberto/layout/gloria/_components/svg/index.pug +70 -0
- package/themes/umberto/layout/gloria/_components/tabs/_style.scss +80 -0
- package/themes/umberto/layout/gloria/_components/tabs/index.pug +81 -0
- package/themes/umberto/layout/gloria/_components/tag/_style.scss +79 -0
- package/themes/umberto/layout/gloria/_components/tag/index.pug +17 -0
- package/themes/umberto/layout/gloria/_components/tooltip-popover/_style.scss +194 -0
- package/themes/umberto/layout/gloria/_components/tooltip-popover/index.pug +38 -0
- package/themes/umberto/layout/gloria/_head/head-preloads.pug +32 -0
- package/themes/umberto/layout/gloria/{_partial → _head}/head.pug +8 -4
- package/themes/umberto/layout/gloria/_head/index.pug +1 -0
- package/themes/umberto/layout/gloria/_modules/algolia-search/_style.scss +202 -0
- package/themes/umberto/layout/gloria/_modules/algolia-search/_third-party.scss +1 -0
- package/themes/umberto/layout/gloria/_modules/algolia-search/index.pug +39 -0
- package/themes/umberto/layout/gloria/_modules/breadcrumbs/_style.scss +68 -0
- package/themes/umberto/layout/gloria/_modules/breadcrumbs/index.pug +18 -0
- package/themes/umberto/layout/gloria/_modules/footer/_style.scss +40 -0
- package/themes/umberto/layout/gloria/_modules/footer/index.pug +87 -0
- package/themes/umberto/layout/gloria/_modules/header/_style.scss +181 -0
- package/themes/umberto/layout/gloria/_modules/header/index.pug +70 -0
- package/themes/umberto/layout/gloria/_modules/header/nav-link.pug +19 -0
- package/themes/umberto/layout/gloria/_modules/header/nav-links.pug +11 -0
- package/themes/umberto/layout/gloria/_modules/header/nav-project-select-dropdown.pug +16 -0
- package/themes/umberto/layout/gloria/_modules/header/nav-suffix-links.pug +20 -0
- package/themes/umberto/layout/gloria/_modules/header-bar/_style.scss +56 -0
- package/themes/umberto/layout/gloria/_modules/header-bar/index.pug +40 -0
- package/themes/umberto/layout/gloria/_modules/header-legacy-warning/index.pug +11 -0
- package/themes/umberto/layout/gloria/_modules/header-nightly-info/index.pug +21 -0
- package/themes/umberto/layout/gloria/_modules/header-promobar/index.pug +18 -0
- package/themes/umberto/layout/gloria/_modules/index.pug +14 -0
- package/themes/umberto/layout/gloria/_modules/main/_style.scss +54 -0
- package/themes/umberto/layout/gloria/_modules/main/index.pug +10 -0
- package/themes/umberto/layout/gloria/_modules/mobile-nav/_style.scss +106 -0
- package/themes/umberto/layout/gloria/_modules/mobile-nav/index.pug +121 -0
- package/themes/umberto/layout/gloria/_modules/mobile-nav/slide-parts.pug +67 -0
- package/themes/umberto/layout/gloria/_modules/not-found/_style.scss +38 -0
- package/themes/umberto/layout/gloria/_modules/not-found/index.pug +16 -0
- package/themes/umberto/layout/gloria/_modules/sidebar/_style.scss +147 -0
- package/themes/umberto/layout/gloria/_modules/sidebar/index.pug +24 -0
- package/themes/umberto/layout/gloria/_modules/sidebar-api/_style.scss +2 -0
- package/themes/umberto/layout/gloria/_modules/sidebar-api/index.pug +6 -0
- package/themes/umberto/layout/gloria/_modules/toc/_style.scss +201 -0
- package/themes/umberto/layout/gloria/_modules/toc/index.pug +10 -0
- package/themes/umberto/layout/gloria/_trackers/google-tag-manager.pug +14 -0
- package/themes/umberto/layout/gloria/_trackers/index.pug +2 -0
- package/themes/umberto/layout/gloria/api.pug +42 -20
- package/themes/umberto/layout/gloria/base.pug +23 -32
- package/themes/umberto/layout/gloria/index.pug +19 -13
- package/themes/umberto/layout/gloria/page.pug +30 -11
- package/themes/umberto/layout/gloria/sdk.pug +1 -1
- package/themes/umberto/layout/gloria/theme.pug +304 -0
- package/themes/umberto/layout/umberto/404.pug +0 -1
- package/themes/umberto/layout/umberto/_partial/report-issue-widget.pug +0 -3
- package/themes/umberto/source/gloria/assets/_fonts/Lato/Lato-Bold.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Lato/Lato-Bold.woff2 +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Lato/Lato-BoldItalic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Lato/Lato-BoldItalic.woff2 +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Lato/Lato-Italic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Lato/Lato-Italic.woff2 +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Lato/Lato-Regular.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Lato/Lato-Regular.woff2 +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Menlo/Menlo-Regular.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Menlo/Menlo-Regular.woff +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/Mulish-Italic-VariableFont_wght.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/Mulish-Italic-VariableFont_wght.woff2 +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/Mulish-VariableFont_wght.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/Mulish-VariableFont_wght.woff2 +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/static/Mulish-Black.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/static/Mulish-BlackItalic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/static/Mulish-Bold.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/static/Mulish-BoldItalic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/static/Mulish-ExtraBold.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/static/Mulish-ExtraBoldItalic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/static/Mulish-ExtraLight.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/static/Mulish-ExtraLightItalic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/static/Mulish-Italic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/static/Mulish-Light.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/static/Mulish-LightItalic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/static/Mulish-Medium.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/static/Mulish-MediumItalic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/static/Mulish-Regular.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/static/Mulish-SemiBold.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Mulish/static/Mulish-SemiBoldItalic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/PublicSans-Italic-VariableFont_wght.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/PublicSans-Italic-VariableFont_wght.woff2 +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/PublicSans-VariableFont_wght.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/PublicSans-VariableFont_wght.woff2 +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-Black.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-BlackItalic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-Bold.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-BoldItalic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-ExtraBold.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-ExtraBoldItalic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-ExtraLight.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-ExtraLightItalic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-Italic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-Light.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-LightItalic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-Medium.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-MediumItalic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-Regular.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-SemiBold.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-SemiBoldItalic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-Thin.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_fonts/Public_Sans/static/PublicSans-ThinItalic.ttf +0 -0
- package/themes/umberto/source/gloria/assets/_img/404-billboard.svg +181 -0
- package/themes/umberto/source/gloria/assets/_img/ckeditor-logo.svg +15 -0
- package/themes/umberto/source/gloria/assets/_img/hex-bg-2.svg +10 -0
- package/themes/umberto/source/gloria/assets/_img/hex-bg.svg +10 -0
- package/themes/umberto/source/gloria/assets/_img/icons/api-class.svg +10 -0
- package/themes/umberto/source/gloria/assets/_img/icons/api-folder.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/api-interface.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/api-module.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/api-package.svg +4 -0
- package/themes/umberto/source/gloria/assets/_img/icons/api-typedef.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/bulb.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/check-circle.svg +4 -0
- package/themes/umberto/source/gloria/assets/_img/icons/check.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/chevron-down.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/chevron-right.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/close-circle.svg +4 -0
- package/themes/umberto/source/gloria/assets/_img/icons/close.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/copy.svg +10 -0
- package/themes/umberto/source/gloria/assets/_img/icons/dislike.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/download.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/edit.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/exclamation-circle.svg +4 -0
- package/themes/umberto/source/gloria/assets/_img/icons/experiment.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/export.svg +4 -0
- package/themes/umberto/source/gloria/assets/_img/icons/eye.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/filter.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/github.svg +10 -0
- package/themes/umberto/source/gloria/assets/_img/icons/info-circle.svg +4 -0
- package/themes/umberto/source/gloria/assets/_img/icons/like.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/link.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/lock.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/menu-fold.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/menu-list.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/menu.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/more.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/notification.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/number.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/premium.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/right.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/search.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/sparkles.svg +1 -0
- package/themes/umberto/source/gloria/assets/_img/icons/status.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/trash.svg +3 -0
- package/themes/umberto/source/gloria/assets/_img/icons/unordered-list.svg +5 -0
- package/themes/umberto/source/gloria/assets/_img/icons/warning.svg +10 -0
- package/themes/umberto/src/gloria/css/_fonts.scss +90 -0
- package/themes/umberto/src/gloria/css/_layers.scss +1 -0
- package/themes/umberto/src/gloria/css/_normalize.scss +118 -0
- package/themes/umberto/src/gloria/css/a11y/_focusable.scss +7 -0
- package/themes/umberto/src/gloria/css/a11y/_index.scss +4 -0
- package/themes/umberto/src/gloria/css/a11y/_mixins.scss +32 -0
- package/themes/umberto/src/gloria/css/a11y/_reduce-motion.scss +9 -0
- package/themes/umberto/src/gloria/css/a11y/_screen-reader.scss +15 -0
- package/themes/umberto/src/gloria/css/base/_buttons.scss +13 -0
- package/themes/umberto/src/gloria/css/base/_descriptions-list.scss +33 -0
- package/themes/umberto/src/gloria/css/base/_details.scss +7 -0
- package/themes/umberto/src/gloria/css/base/_headings.scss +111 -0
- package/themes/umberto/src/gloria/css/base/_iframes.scss +7 -0
- package/themes/umberto/src/gloria/css/base/_index.scss +12 -0
- package/themes/umberto/src/gloria/css/base/_inline-code.scss +16 -0
- package/themes/umberto/src/gloria/css/base/_links.scss +31 -0
- package/themes/umberto/src/gloria/css/base/_lists.scss +58 -0
- package/themes/umberto/src/gloria/css/base/_mixins.scss +3 -0
- package/themes/umberto/src/gloria/css/base/_paragraphs.scss +15 -0
- package/themes/umberto/src/gloria/css/base/_tables.scss +64 -0
- package/themes/umberto/src/gloria/css/base/_typography.scss +62 -0
- package/themes/umberto/src/gloria/css/components/_api-collapsing-list.scss +152 -0
- package/themes/umberto/src/gloria/css/components/_api-filter-dropdown.scss +17 -0
- package/themes/umberto/src/gloria/css/components/_api-item-heading.scss +58 -0
- package/themes/umberto/src/gloria/css/components/_api-tree.scss +202 -0
- package/themes/umberto/src/gloria/css/components/_hierarchy-list.scss +35 -0
- package/themes/umberto/src/gloria/css/components/_image-zoom.scss +13 -0
- package/themes/umberto/src/gloria/css/components/_index.scss +56 -0
- package/themes/umberto/src/gloria/css/components/_notification.scss +36 -0
- package/themes/umberto/src/gloria/css/components/_utils.scss +5 -0
- package/themes/umberto/src/gloria/css/doc/_details.scss +11 -0
- package/themes/umberto/src/gloria/css/doc/_editor-icons.scss +21 -0
- package/themes/umberto/src/gloria/css/doc/_images.scss +9 -0
- package/themes/umberto/src/gloria/css/doc/_index.scss +5 -0
- package/themes/umberto/src/gloria/css/doc/_snippets.scss +127 -0
- package/themes/umberto/src/gloria/css/doc/_typography.scss +5 -0
- package/themes/umberto/src/gloria/css/layout/_base.scss +17 -0
- package/themes/umberto/src/gloria/css/layout/_breakpoints.scss +88 -0
- package/themes/umberto/src/gloria/css/layout/_container.scss +38 -0
- package/themes/umberto/src/gloria/css/layout/_index.scss +6 -0
- package/themes/umberto/src/gloria/css/layout/_layout.scss +64 -0
- package/themes/umberto/src/gloria/css/layout/_mixins.scss +34 -0
- package/themes/umberto/src/gloria/css/layout/_zindex.scss +12 -0
- package/themes/umberto/src/gloria/css/modules/_index.scss +29 -0
- package/themes/umberto/src/gloria/css/modules/_utils.scss +7 -0
- package/themes/umberto/src/gloria/css/styles.scss +11 -117
- package/themes/umberto/src/gloria/css/theme/_light.scss +344 -0
- package/themes/umberto/src/gloria/css/utilities/_animation.scss +32 -0
- package/themes/umberto/src/gloria/css/utilities/_colors.scss +14 -0
- package/themes/umberto/src/gloria/css/utilities/_display.scss +13 -0
- package/themes/umberto/src/gloria/css/utilities/_flex.scss +33 -0
- package/themes/umberto/src/gloria/css/utilities/_gap.scss +8 -0
- package/themes/umberto/src/gloria/css/utilities/_index.scss +11 -0
- package/themes/umberto/src/gloria/css/utilities/_radius.scss +21 -0
- package/themes/umberto/src/gloria/css/utilities/_rotation.scss +8 -0
- package/themes/umberto/src/gloria/css/utilities/_shadows.scss +13 -0
- package/themes/umberto/src/gloria/css/utilities/_spacing.scss +97 -0
- package/themes/umberto/src/gloria/css/utilities/_stop-scrolling.scss +9 -0
- package/themes/umberto/src/gloria/css/utilities/_text.scss +42 -0
- package/themes/umberto/src/gloria/js/app.js +92 -54
- package/themes/umberto/src/gloria/js/components/api-nav-tree.js +171 -0
- package/themes/umberto/src/gloria/js/components/api-toggle.js +92 -0
- package/themes/umberto/src/gloria/js/components/base-component.js +41 -0
- package/themes/umberto/src/gloria/js/components/breadcrumbs.js +115 -0
- package/themes/umberto/src/gloria/js/components/code-block.js +229 -0
- package/themes/umberto/src/gloria/js/components/code-switcher.js +177 -0
- package/themes/umberto/src/gloria/js/components/dropdown.js +516 -0
- package/themes/umberto/src/gloria/js/components/expandable.js +79 -0
- package/themes/umberto/src/gloria/js/components/fake-devtools.js +722 -0
- package/themes/umberto/src/gloria/js/components/hash-link.js +60 -0
- package/themes/umberto/src/gloria/js/components/heading-link.js +135 -0
- package/themes/umberto/src/gloria/js/components/iframe.js +158 -0
- package/themes/umberto/src/gloria/js/{_imageModal.js → components/image-zoom.js} +1 -1
- package/themes/umberto/src/gloria/js/components/mobile-overlay.js +315 -0
- package/themes/umberto/src/gloria/js/components/nav-tree.js +164 -0
- package/themes/umberto/src/gloria/js/components/tabs.js +284 -0
- package/themes/umberto/src/gloria/js/components/tooltip-popover.js +576 -0
- package/themes/umberto/src/gloria/js/helpers/after-dom-ready.js +16 -0
- package/themes/umberto/src/gloria/js/helpers/animate-element.js +78 -0
- package/themes/umberto/src/gloria/js/helpers/body-scroll.js +22 -0
- package/themes/umberto/src/gloria/js/helpers/clamp.js +16 -0
- package/themes/umberto/src/gloria/js/helpers/classnames.js +64 -0
- package/themes/umberto/src/gloria/js/helpers/copy-to-clipboard.js +19 -0
- package/themes/umberto/src/gloria/js/helpers/create-anchor-positioning-watcher.js +46 -0
- package/themes/umberto/src/gloria/js/helpers/create-cleanup-registry.js +88 -0
- package/themes/umberto/src/gloria/js/helpers/create-hover-manager.js +93 -0
- package/themes/umberto/src/gloria/js/helpers/create-keyboard-blur-watcher.js +90 -0
- package/themes/umberto/src/gloria/js/helpers/create-keyboard-focus-cycler.js +251 -0
- package/themes/umberto/src/gloria/js/helpers/create-mutation-observer.js +49 -0
- package/themes/umberto/src/gloria/js/helpers/create-outside-click-watcher.js +39 -0
- package/themes/umberto/src/gloria/js/helpers/cubic-bezier.js +55 -0
- package/themes/umberto/src/gloria/js/helpers/date-time.js +21 -0
- package/themes/umberto/src/gloria/js/helpers/decode-html-entities.js +23 -0
- package/themes/umberto/src/gloria/js/helpers/escape-handler.js +59 -0
- package/themes/umberto/src/gloria/js/helpers/fetch-stylesheet.js +25 -0
- package/themes/umberto/src/gloria/js/helpers/find-code-lang.js +85 -0
- package/themes/umberto/src/gloria/js/helpers/focus-first-interactive.js +50 -0
- package/themes/umberto/src/gloria/js/helpers/format-html.js +181 -0
- package/themes/umberto/src/gloria/js/helpers/get-all-scrollable-parents.js +34 -0
- package/themes/umberto/src/gloria/js/helpers/get-parents-until.js +26 -0
- package/themes/umberto/src/gloria/js/helpers/highlight-code.js +18 -0
- package/themes/umberto/src/gloria/js/helpers/html-builder.js +69 -0
- package/themes/umberto/src/gloria/js/helpers/identity.js +8 -0
- package/themes/umberto/src/gloria/js/helpers/inject-resource-preload.js +51 -0
- package/themes/umberto/src/gloria/js/helpers/inject-script.js +79 -0
- package/themes/umberto/src/gloria/js/helpers/inject-stylesheet.js +108 -0
- package/themes/umberto/src/gloria/js/helpers/is-element-attached.js +28 -0
- package/themes/umberto/src/gloria/js/helpers/is-focusable.js +14 -0
- package/themes/umberto/src/gloria/js/helpers/is-hidden-element.js +8 -0
- package/themes/umberto/src/gloria/js/helpers/is-mobile.js +8 -0
- package/themes/umberto/src/gloria/js/helpers/is-unsafe-key.js +14 -0
- package/themes/umberto/src/gloria/js/helpers/lerp.js +27 -0
- package/themes/umberto/src/gloria/js/helpers/local-storage-helper.js +133 -0
- package/themes/umberto/src/gloria/js/helpers/pipe.js +8 -0
- package/themes/umberto/src/gloria/js/helpers/prefers-reduced-motion.js +13 -0
- package/themes/umberto/src/gloria/js/helpers/random-id.js +51 -0
- package/themes/umberto/src/gloria/js/helpers/sanitize-text.js +27 -0
- package/themes/umberto/src/gloria/js/helpers/scroll-to-hash.js +31 -0
- package/themes/umberto/src/gloria/js/helpers/take-last.js +19 -0
- package/themes/umberto/src/gloria/js/helpers/tap.js +11 -0
- package/themes/umberto/src/gloria/js/helpers/throttle.js +46 -0
- package/themes/umberto/src/gloria/js/helpers/timeout.js +14 -0
- package/themes/umberto/src/gloria/js/helpers/toggle-height.js +46 -0
- package/themes/umberto/src/gloria/js/helpers/tween.js +100 -0
- package/themes/umberto/src/gloria/js/helpers/wrap-around.js +39 -0
- package/themes/umberto/src/gloria/js/modules/algolia-search.js +168 -0
- package/themes/umberto/src/gloria/js/modules/api-filter.js +189 -0
- package/themes/umberto/src/gloria/js/modules/header-bar.js +154 -0
- package/themes/umberto/src/gloria/js/modules/header.js +242 -0
- package/themes/umberto/src/gloria/js/modules/links-prefetch.js +196 -0
- package/themes/umberto/src/gloria/js/modules/mobile-nav.js +327 -0
- package/themes/umberto/src/gloria/js/modules/sidebar.js +114 -0
- package/themes/umberto/src/gloria/js/modules/table-of-contents-api.js +214 -0
- package/themes/umberto/src/gloria/js/modules/table-of-contents.js +287 -0
- package/themes/umberto/src/gloria/js/public-api.js +75 -0
- package/themes/umberto/src/gloria/js/web-components/svg-icon.js +117 -0
- package/themes/umberto/src/umberto/js/_codeswitcherbuttons.js +1 -1
- package/themes/umberto/layout/gloria/_api-docs/_mixin/_api-title.pug +0 -17
- package/themes/umberto/layout/gloria/_mixin/nav-tree-item.pug +0 -13
- package/themes/umberto/layout/gloria/_mixin/nav-tree-level.pug +0 -38
- package/themes/umberto/layout/gloria/_partial/docsearch.pug +0 -21
- package/themes/umberto/layout/gloria/_partial/dropdown.pug +0 -12
- package/themes/umberto/layout/gloria/_partial/feedback-widget.pug +0 -20
- package/themes/umberto/layout/gloria/_partial/footer.pug +0 -6
- package/themes/umberto/layout/gloria/_partial/gh-contribute.pug +0 -8
- package/themes/umberto/layout/gloria/_partial/google-tag-manager.pug +0 -18
- package/themes/umberto/layout/gloria/_partial/header.pug +0 -64
- package/themes/umberto/layout/gloria/_partial/nav-tree.pug +0 -9
- package/themes/umberto/layout/gloria/_partial/report-issue-widget.pug +0 -26
- package/themes/umberto/layout/gloria/_partial/rwd-breadcrumbs.pug +0 -13
- package/themes/umberto/layout/gloria/_partial/search-box.pug +0 -6
- package/themes/umberto/layout/gloria/_partial/vwo.pug +0 -11
- package/themes/umberto/source/gloria/assets/_img/arrows.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/book.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/box-brown.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/box-orange.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/box-red.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/bulb.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/clipboard.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/cog.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/data.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/documentation.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/download.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/edit.svg +0 -2
- package/themes/umberto/source/gloria/assets/_img/exclamation-circle.svg +0 -2
- package/themes/umberto/source/gloria/assets/_img/eye.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/filter.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/filtering.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/folder.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/github.svg +0 -6
- package/themes/umberto/source/gloria/assets/_img/header-info-configs.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/header-info-events.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/header-info-methods.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/header-info-properties.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/heart.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/info-circle.svg +0 -4
- package/themes/umberto/source/gloria/assets/_img/info.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/list-nest.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/loupe.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/menu.svg +0 -4
- package/themes/umberto/source/gloria/assets/_img/plug.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/star-in-circle.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/tick.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/triangle-down.svg +0 -1
- package/themes/umberto/source/gloria/assets/_img/triangle-right.svg +0 -1
- package/themes/umberto/src/gloria/css/_api-content.scss +0 -32
- package/themes/umberto/src/gloria/css/_api-info-box.scss +0 -86
- package/themes/umberto/src/gloria/css/_api-props-filter.scss +0 -106
- package/themes/umberto/src/gloria/css/_api-see-source.scss +0 -35
- package/themes/umberto/src/gloria/css/_api-subheader.scss +0 -167
- package/themes/umberto/src/gloria/css/_api-tree.scss +0 -121
- package/themes/umberto/src/gloria/css/_badge.scss +0 -74
- package/themes/umberto/src/gloria/css/_code-switcher.scss +0 -61
- package/themes/umberto/src/gloria/css/_collapsinglist.scss +0 -262
- package/themes/umberto/src/gloria/css/_content.scss +0 -236
- package/themes/umberto/src/gloria/css/_docsearch.scss +0 -109
- package/themes/umberto/src/gloria/css/_dropdown.scss +0 -63
- package/themes/umberto/src/gloria/css/_editor-icon.scss +0 -26
- package/themes/umberto/src/gloria/css/_feedback-widget.scss +0 -11
- package/themes/umberto/src/gloria/css/_font-external.scss +0 -8
- package/themes/umberto/src/gloria/css/_footer.scss +0 -40
- package/themes/umberto/src/gloria/css/_formatted.scss +0 -285
- package/themes/umberto/src/gloria/css/_guide-content.scss +0 -37
- package/themes/umberto/src/gloria/css/_guide-sdk-tree.scss +0 -14
- package/themes/umberto/src/gloria/css/_loading-spinner.scss +0 -33
- package/themes/umberto/src/gloria/css/_main.scss +0 -59
- package/themes/umberto/src/gloria/css/_navigation.scss +0 -35
- package/themes/umberto/src/gloria/css/_notice.scss +0 -116
- package/themes/umberto/src/gloria/css/_print.scss +0 -20
- package/themes/umberto/src/gloria/css/_prism.scss +0 -223
- package/themes/umberto/src/gloria/css/_rwd-breadcrumbs.scss +0 -28
- package/themes/umberto/src/gloria/css/_rwd-menu.scss +0 -89
- package/themes/umberto/src/gloria/css/_secondary-navigation.scss +0 -152
- package/themes/umberto/src/gloria/css/_theme-dark.scss +0 -175
- package/themes/umberto/src/gloria/css/_toggler.scss +0 -46
- package/themes/umberto/src/gloria/css/_top.scss +0 -350
- package/themes/umberto/src/gloria/css/_tree.scss +0 -218
- package/themes/umberto/src/gloria/css/_warning-banner.scss +0 -46
- package/themes/umberto/src/gloria/css/components/_lightbox.scss +0 -12
- package/themes/umberto/src/gloria/css/helpers/_color.scss +0 -49
- package/themes/umberto/src/gloria/css/helpers/_font.scss +0 -60
- package/themes/umberto/src/gloria/css/helpers/_globals.scss +0 -129
- package/themes/umberto/src/gloria/css/helpers/_reset.scss +0 -52
- package/themes/umberto/src/gloria/css/helpers/_spacing.scss +0 -21
- package/themes/umberto/src/gloria/css/pages/_sdk.scss +0 -111
- package/themes/umberto/src/gloria/js/_anchors.js +0 -57
- package/themes/umberto/src/gloria/js/_apisearch.js +0 -126
- package/themes/umberto/src/gloria/js/_apitree.js +0 -67
- package/themes/umberto/src/gloria/js/_attachpermalinklistener.js +0 -50
- package/themes/umberto/src/gloria/js/_codeswitcherbuttons.js +0 -146
- package/themes/umberto/src/gloria/js/_collapsables.js +0 -135
- package/themes/umberto/src/gloria/js/_copymobileapinavigation.js +0 -26
- package/themes/umberto/src/gloria/js/_devnames.js +0 -37
- package/themes/umberto/src/gloria/js/_dropdowns.js +0 -55
- package/themes/umberto/src/gloria/js/_filtering.js +0 -139
- package/themes/umberto/src/gloria/js/_pagenavigation.js +0 -93
- package/themes/umberto/src/gloria/js/_prism.js +0 -104
- package/themes/umberto/src/gloria/js/_rwdmenu.js +0 -15
- package/themes/umberto/src/gloria/js/_samplecode.js +0 -23
- package/themes/umberto/src/gloria/js/_sidenavigation.js +0 -59
- package/themes/umberto/src/gloria/js/_toc.js +0 -93
- package/themes/umberto/src/gloria/js/_tooltips.js +0 -39
- package/themes/umberto/src/gloria/js/_warningbanner.js +0 -18
- package/themes/umberto/src/gloria/js/vendor/prism.js +0 -45
- /package/themes/umberto/layout/gloria/_api-docs/_partial/{api-info-box.pug → api-hierarchy.pug} +0 -0
- /package/themes/umberto/layout/gloria/{_partial → _trackers}/google-analytics.pug +0 -0
|
@@ -28,7 +28,7 @@ const copyProjectIcons = require( './copy-project-icons' );
|
|
|
28
28
|
const executeHooks = require( './execute-hooks' );
|
|
29
29
|
const umbertoVersion = require( '../../package.json' ).version;
|
|
30
30
|
|
|
31
|
-
const
|
|
31
|
+
const { parseLinks } = require( '../../scripts/utils/parselinks' );
|
|
32
32
|
const getFilePatternsToProcess = require( '../helpers/get-file-patterns-to-process' );
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -141,6 +141,8 @@ module.exports = options => {
|
|
|
141
141
|
googleoptimize: mainConfig.googleoptimize,
|
|
142
142
|
googletagmanager: mainConfig.googletagmanager,
|
|
143
143
|
googleanalytics: mainConfig.googleanalytics,
|
|
144
|
+
promobar: mainConfig.promobar,
|
|
145
|
+
sitemap: mainConfig.sitemap,
|
|
144
146
|
vwo: mainConfig.vwo,
|
|
145
147
|
feedbackWidget: mainConfig.feedbackWidget,
|
|
146
148
|
extraStyles,
|
|
@@ -149,11 +151,19 @@ module.exports = options => {
|
|
|
149
151
|
additionalDocumentation: mainConfig.additionalDocumentation,
|
|
150
152
|
canonicalUrlBeginning: mainConfig.canonicalUrlBeginning,
|
|
151
153
|
macrosVariables: mainConfig.variables,
|
|
154
|
+
quickNavigationProjects: mainConfig.quickNavigationProjects || [
|
|
155
|
+
{ name: 'CKEditor 5', slug: 'ckeditor5' },
|
|
156
|
+
{ name: 'Cloud Services', slug: 'cs' },
|
|
157
|
+
{ name: 'CKBox', slug: 'ckbox' }
|
|
158
|
+
],
|
|
152
159
|
guides,
|
|
153
160
|
skipGuides
|
|
154
161
|
} );
|
|
155
162
|
} )
|
|
156
|
-
.then( () => hexoManager.generate( {
|
|
163
|
+
.then( () => hexoManager.generate( {
|
|
164
|
+
watch,
|
|
165
|
+
concurrency: 80
|
|
166
|
+
} ) )
|
|
157
167
|
.then( () => buildSnippets( hexoManager.hexo.projectGlobals ) )
|
|
158
168
|
.then( () => copyProjectIcons( hexoManager.hexo.projectGlobals, hexoManager.getPublicDir() ) )
|
|
159
169
|
// A workaround for API guides when API generation is skipped.
|
|
@@ -252,7 +262,7 @@ async function buildProjects( rootPath, projectPaths, options = {} ) {
|
|
|
252
262
|
|
|
253
263
|
// If the `guides` (non-empty array) or `skipGuides` options are specified, disable the `{@link...}` validator.
|
|
254
264
|
if ( options.guides.length || options.skipGuides ) {
|
|
255
|
-
hexoManager.hexo.projectGlobals.common._disabledFilters.add(
|
|
265
|
+
hexoManager.hexo.projectGlobals.common._disabledFilters.add( parseLinks.name );
|
|
256
266
|
}
|
|
257
267
|
|
|
258
268
|
if ( !options.skipApi ) {
|
|
@@ -265,11 +275,14 @@ async function buildProjects( rootPath, projectPaths, options = {} ) {
|
|
|
265
275
|
googleoptimize: options.googleoptimize,
|
|
266
276
|
googletagmanager: options.googletagmanager,
|
|
267
277
|
googleanalytics: options.googleanalytics,
|
|
278
|
+
promobar: options.promobar,
|
|
279
|
+
sitemap: options.sitemap,
|
|
268
280
|
vwo: options.vwo,
|
|
269
281
|
feedbackWidget: options.feedbackWidget,
|
|
270
282
|
og: options.og,
|
|
271
283
|
canonicalUrlBeginning: options.canonicalUrlBeginning,
|
|
272
|
-
macrosVariables: options.macrosVariables
|
|
284
|
+
macrosVariables: options.macrosVariables,
|
|
285
|
+
quickNavigationProjects: options.quickNavigationProjects
|
|
273
286
|
} )
|
|
274
287
|
);
|
|
275
288
|
}
|
|
@@ -284,11 +297,14 @@ async function buildProjects( rootPath, projectPaths, options = {} ) {
|
|
|
284
297
|
googleoptimize: options.googleoptimize,
|
|
285
298
|
googletagmanager: options.googletagmanager,
|
|
286
299
|
googleanalytics: options.googleanalytics,
|
|
300
|
+
promobar: options.promobar,
|
|
301
|
+
sitemap: options.sitemap,
|
|
287
302
|
vwo: options.vwo,
|
|
288
303
|
feedbackWidget: options.feedbackWidget,
|
|
289
304
|
og: options.og,
|
|
290
305
|
canonicalUrlBeginning: options.canonicalUrlBeginning,
|
|
291
|
-
macrosVariables: options.macrosVariables
|
|
306
|
+
macrosVariables: options.macrosVariables,
|
|
307
|
+
quickNavigationProjects: options.quickNavigationProjects
|
|
292
308
|
} ) );
|
|
293
309
|
}
|
|
294
310
|
|
|
@@ -337,6 +353,8 @@ async function buildProjects( rootPath, projectPaths, options = {} ) {
|
|
|
337
353
|
googleoptimize: options.googleoptimize,
|
|
338
354
|
googletagmanager: options.googletagmanager,
|
|
339
355
|
googleanalytics: options.googleanalytics,
|
|
356
|
+
promobar: options.promobar,
|
|
357
|
+
quickNavigationProjects: options.quickNavigationProjects,
|
|
340
358
|
vwo: options.vwo,
|
|
341
359
|
feedbackWidget: options.feedbackWidget,
|
|
342
360
|
extraStylePaths: extraStyles,
|
|
@@ -390,15 +408,16 @@ async function getProjectConfigs( rootPath, projectPaths, options = {} ) {
|
|
|
390
408
|
}
|
|
391
409
|
|
|
392
410
|
// Renders API docs HTML. API docs are rendered separate from hexo so hexo filters and helpers are not available.
|
|
393
|
-
function buildApis( projectConfigs, options = {} ) {
|
|
411
|
+
async function buildApis( projectConfigs, options = {} ) {
|
|
394
412
|
// Basic project info like name and BASE_PATH required by templates.
|
|
395
413
|
const basicProjectsData = getBasicProjectsData( projectConfigs );
|
|
396
414
|
const promises = [];
|
|
415
|
+
const outputDir = upath.relative( process.cwd(), hexoManager.getPublicDir() );
|
|
397
416
|
|
|
398
|
-
|
|
417
|
+
for ( const config of projectConfigs ) {
|
|
399
418
|
// If umberto.json doesn't have a config for API docs, we can skip here.
|
|
400
419
|
if ( !config.groups || !config.groups.find( group => group.id === 'api-reference' ) ) {
|
|
401
|
-
|
|
420
|
+
continue;
|
|
402
421
|
}
|
|
403
422
|
|
|
404
423
|
const apiConfig = config.groups.find( group => group.id === 'api-reference' );
|
|
@@ -418,18 +437,20 @@ function buildApis( projectConfigs, options = {} ) {
|
|
|
418
437
|
throw new Error( `Not enough api-reference data in umberto.json, project: ${ config.name }` );
|
|
419
438
|
}
|
|
420
439
|
|
|
421
|
-
const
|
|
440
|
+
const apiDocsPromise = buildApi( {
|
|
422
441
|
src: upath.join( config.projectRootPath, config.path, apiConfig.sourceDir ),
|
|
423
442
|
projectDst: upath.join( BASE_PATH, apiConfig.slug ),
|
|
424
|
-
outputDir
|
|
443
|
+
outputDir,
|
|
425
444
|
themePath: hexoManager.getThemePath(),
|
|
426
445
|
BASE_PATH,
|
|
427
446
|
docSearch: options.docSearch,
|
|
428
447
|
macrosVariables: options.macrosVariables,
|
|
429
448
|
templateLocals: {
|
|
430
449
|
projectsData: basicProjectsData,
|
|
450
|
+
quickNavigationProjects: options.quickNavigationProjects,
|
|
431
451
|
extraStylePaths: options.extraStyles,
|
|
432
452
|
extraScriptsPaths: options.extraScripts,
|
|
453
|
+
sitemap: config.sitemap || options.sitemap,
|
|
433
454
|
umbertoVersion,
|
|
434
455
|
projectLocals: {
|
|
435
456
|
extraStylePaths: extraStyles,
|
|
@@ -444,25 +465,33 @@ function buildApis( projectConfigs, options = {} ) {
|
|
|
444
465
|
googleoptimize: options.googleoptimize,
|
|
445
466
|
googletagmanager: options.googletagmanager,
|
|
446
467
|
googleanalytics: options.googleanalytics,
|
|
468
|
+
promobar: options.promobar,
|
|
447
469
|
vwo: options.vwo,
|
|
448
470
|
feedbackWidget: options.feedbackWidget,
|
|
449
471
|
pathJoin: upath.join,
|
|
450
|
-
mainOg: options.og || {}
|
|
472
|
+
mainOg: options.og || {},
|
|
473
|
+
isLegacy: false,
|
|
474
|
+
isNightly: options.docSearch?.indexName?.includes( 'nightly' ) || false
|
|
451
475
|
},
|
|
452
476
|
projectConfig: config,
|
|
453
477
|
canonicalUrlBeginning: getCanonicalBeginning( { config, options, hexoManager } )
|
|
478
|
+
} ).then( apiDocs => {
|
|
479
|
+
// API docs navigation tree is rendered once and reused as HTML.
|
|
480
|
+
config.navTree = apiDocs.getNavTree();
|
|
481
|
+
// API errors documentation is stored here so that it's available in guides (and hexo filters).
|
|
482
|
+
config.errorsHtml = apiDocs.getErrors();
|
|
483
|
+
hexoManager.addProjectGlobalData( config.slug, 'doclets', apiDocs.getDataCollection() );
|
|
484
|
+
|
|
485
|
+
bindProjectGlobals( hexoManager.hexo, {
|
|
486
|
+
rootPath: config.projectRootPath,
|
|
487
|
+
basePath: BASE_PATH,
|
|
488
|
+
config,
|
|
489
|
+
errorsHtml: config.errorsHtml
|
|
490
|
+
} );
|
|
454
491
|
} );
|
|
455
492
|
|
|
456
|
-
promises.push(
|
|
457
|
-
|
|
458
|
-
);
|
|
459
|
-
|
|
460
|
-
// API docs navigation tree is rendered once and reused as HTML.
|
|
461
|
-
config.navTree = apiDocs.getNavTree();
|
|
462
|
-
// API errors documentation is stored here so that it's available in guides (and hexo filters).
|
|
463
|
-
config.errorsHtml = apiDocs.getErrors();
|
|
464
|
-
hexoManager.addProjectGlobalData( config.slug, 'doclets', apiDocs.getDataCollection() );
|
|
465
|
-
} );
|
|
493
|
+
promises.push( apiDocsPromise );
|
|
494
|
+
}
|
|
466
495
|
|
|
467
496
|
return Promise.all( promises );
|
|
468
497
|
}
|
|
@@ -470,6 +499,7 @@ function buildApis( projectConfigs, options = {} ) {
|
|
|
470
499
|
function buildSdks( projectConfigs, options = {} ) {
|
|
471
500
|
const promises = [];
|
|
472
501
|
const basicProjectsData = getBasicProjectsData( projectConfigs );
|
|
502
|
+
const outputDir = upath.relative( process.cwd(), hexoManager.getPublicDir() );
|
|
473
503
|
|
|
474
504
|
projectConfigs.forEach( config => {
|
|
475
505
|
const sdkGroup = config.groups && config.groups.find( group => group.id === 'sdk' );
|
|
@@ -491,7 +521,7 @@ function buildSdks( projectConfigs, options = {} ) {
|
|
|
491
521
|
);
|
|
492
522
|
|
|
493
523
|
const sdk = buildSdk( {
|
|
494
|
-
outputDir
|
|
524
|
+
outputDir,
|
|
495
525
|
srcPath: sdkGroup.sourceDir,
|
|
496
526
|
projectRootPath: config.projectRootPath,
|
|
497
527
|
projectPath: config.path,
|
|
@@ -503,6 +533,7 @@ function buildSdks( projectConfigs, options = {} ) {
|
|
|
503
533
|
umbertoVersion,
|
|
504
534
|
extraStylePaths: options.extraStyles,
|
|
505
535
|
extraScriptsPaths: options.extraScripts,
|
|
536
|
+
sitemap: config.sitemap || options.sitemap,
|
|
506
537
|
projectLocals: {
|
|
507
538
|
disableSearch: config.docsearch === false,
|
|
508
539
|
extraStylePaths: extraStyles,
|
|
@@ -513,6 +544,8 @@ function buildSdks( projectConfigs, options = {} ) {
|
|
|
513
544
|
googleoptimize: options.googleoptimize,
|
|
514
545
|
googletagmanager: options.googletagmanager,
|
|
515
546
|
googleanalytics: options.googleanalytics,
|
|
547
|
+
quickNavigationProjects: options.quickNavigationProjects,
|
|
548
|
+
promobar: options.promobar,
|
|
516
549
|
vwo: options.vwo,
|
|
517
550
|
feedbackWidget: options.feedbackWidget,
|
|
518
551
|
pathJoin: upath.join,
|
|
@@ -529,13 +562,13 @@ function buildSdks( projectConfigs, options = {} ) {
|
|
|
529
562
|
// Copy assets
|
|
530
563
|
copyFiles(
|
|
531
564
|
upath.join( config.projectRootPath, config.path, sdkGroup.sourceDir, 'assets' ),
|
|
532
|
-
upath.join( '.',
|
|
565
|
+
upath.join( '.', outputDir, BASE_PATH, sdkGroup.slug, 'assets' )
|
|
533
566
|
);
|
|
534
567
|
|
|
535
568
|
// Copy CKEditor from presets
|
|
536
569
|
copyFiles(
|
|
537
570
|
upath.join( config.projectRootPath, config.path, sdkGroup.sourceDir, 'vendors' ),
|
|
538
|
-
upath.join( '.',
|
|
571
|
+
upath.join( '.', outputDir, 'vendors', config.version )
|
|
539
572
|
);
|
|
540
573
|
|
|
541
574
|
config.sdkNavTree = sdk.navigationHtml;
|
package/src/tasks/cache-files.js
CHANGED
|
@@ -27,7 +27,7 @@ module.exports = ( src, dst ) => {
|
|
|
27
27
|
if ( !fs.existsSync( cachePath ) ) {
|
|
28
28
|
try {
|
|
29
29
|
fs.copySync( p, cachePath );
|
|
30
|
-
} catch
|
|
30
|
+
} catch {
|
|
31
31
|
console.error( `Error when caching file ${ p } to ${ cachePath }` );
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -40,7 +40,7 @@ module.exports = ( src, dst ) => {
|
|
|
40
40
|
if ( currentStats.size !== cachedStats.size || currentStats.mtime > cachedStats.mtime ) {
|
|
41
41
|
try {
|
|
42
42
|
fs.copySync( p, cachePath );
|
|
43
|
-
} catch
|
|
43
|
+
} catch {
|
|
44
44
|
console.error( `Error when caching file ${ p } to ${ cachePath }` );
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -15,6 +15,18 @@ module.exports = ( src, dst ) => {
|
|
|
15
15
|
file: src,
|
|
16
16
|
outputStyle: 'compressed',
|
|
17
17
|
importer( url, file, done ) {
|
|
18
|
+
// In case of import from the `themes/umberto/src` directory.
|
|
19
|
+
const themeMatch = url && url.match( /@([^/]+)\/(.+)/ );
|
|
20
|
+
|
|
21
|
+
if ( themeMatch ) {
|
|
22
|
+
const [ , theme, remainingPath ] = themeMatch;
|
|
23
|
+
const filePath = upath.join( __dirname, '../../themes/umberto/src', theme, 'css', remainingPath );
|
|
24
|
+
|
|
25
|
+
if ( fs.existsSync( filePath ) ) {
|
|
26
|
+
return done( { file: filePath } );
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
18
30
|
// In case of an import from the `node_modules` directory.
|
|
19
31
|
if ( url.startsWith( '~' ) ) {
|
|
20
32
|
// Resolve the path regarding the current working directory.
|
package/src/tasks/copy-assets.js
CHANGED
|
@@ -17,6 +17,10 @@ const copyFiles = require( './copy-files' );
|
|
|
17
17
|
*/
|
|
18
18
|
module.exports = ( themeDir, outputPath ) => {
|
|
19
19
|
return Promise.all( [
|
|
20
|
+
copyFiles(
|
|
21
|
+
upath.join( themeDir, 'assets', '_fonts' ),
|
|
22
|
+
upath.join( outputPath, 'fonts' )
|
|
23
|
+
),
|
|
20
24
|
copyFiles(
|
|
21
25
|
upath.join( themeDir, 'assets', '_img' ),
|
|
22
26
|
upath.join( outputPath, 'img' )
|
|
@@ -24,7 +24,7 @@ module.exports = async function copyProjectIcons( projectGlobals, buildDirectory
|
|
|
24
24
|
|
|
25
25
|
try {
|
|
26
26
|
await fs.copy( fullSourcePath, fullDestinationPath );
|
|
27
|
-
} catch
|
|
27
|
+
} catch {
|
|
28
28
|
console.warn(
|
|
29
29
|
`⚠️ The "${ sourceFile }" icon cannot be copied because it does not exist in "${ fullSourcePath }".`
|
|
30
30
|
);
|
|
@@ -5,42 +5,51 @@
|
|
|
5
5
|
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Script for validating links in generated HTML files.
|
|
10
|
+
* Uses multiple threads (worker_threads) for parallel analysis, significantly speeding up the build process,
|
|
11
|
+
* especially for API documentation where the number of links can reach thousands.
|
|
12
|
+
*/
|
|
13
|
+
|
|
8
14
|
const { styleText } = require( 'util' );
|
|
9
15
|
const upath = require( 'upath' );
|
|
10
16
|
const fs = require( 'fs-extra' );
|
|
17
|
+
const os = require( 'os' );
|
|
18
|
+
const { Worker, isMainThread, parentPort, workerData } = require( 'worker_threads' );
|
|
11
19
|
const { globSync } = require( 'glob' );
|
|
12
20
|
const { parseDocument } = require( 'htmlparser2' );
|
|
21
|
+
const { isMaskedID } = require( '../../scripts/utils/random-id' );
|
|
13
22
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Collects all links from the provided HTML files.
|
|
25
|
+
* Skips files from the vendors directory and (optionally) api.
|
|
26
|
+
* Adds links to files and their fragments (#id).
|
|
27
|
+
*
|
|
28
|
+
* @param {string[]} pathsToFiles Array of file paths to process.
|
|
29
|
+
* @param {Object} options Options for filtering files.
|
|
30
|
+
* @returns {{links: Set<string>, pathsToFiles: string[]}}
|
|
31
|
+
*/
|
|
32
|
+
function collectLinks( pathsToFiles, options ) {
|
|
18
33
|
const links = new Set();
|
|
19
|
-
|
|
20
34
|
pathsToFiles = pathsToFiles.filter( p => {
|
|
21
35
|
if ( p.includes( '/vendors/' ) ) {
|
|
22
36
|
return false;
|
|
23
37
|
}
|
|
24
38
|
|
|
25
|
-
if ( options.skipApi &&
|
|
39
|
+
if ( options.skipApi && p.includes( '/api/' ) ) {
|
|
26
40
|
return false;
|
|
27
41
|
}
|
|
28
42
|
|
|
29
43
|
if ( !p.endsWith( '.html' ) ) {
|
|
30
|
-
// Add assets like .png, .xlsx, .docx as valid links.
|
|
31
44
|
const resolvePath = upath.resolve( p );
|
|
32
|
-
|
|
33
45
|
if ( fs.statSync( resolvePath ).isFile() ) {
|
|
34
46
|
links.add( upath.resolve( resolvePath ) );
|
|
35
47
|
}
|
|
36
|
-
|
|
37
48
|
return false;
|
|
38
49
|
}
|
|
39
|
-
|
|
40
50
|
return true;
|
|
41
51
|
} );
|
|
42
52
|
|
|
43
|
-
// Obtain every possible hash
|
|
44
53
|
for ( const filePath of pathsToFiles ) {
|
|
45
54
|
links.add( upath.resolve( filePath ) );
|
|
46
55
|
links.add( upath.resolve( filePath + '#' ) );
|
|
@@ -49,27 +58,40 @@ module.exports = ( buildPath, options = {} ) => {
|
|
|
49
58
|
const ids = ( content.match( /id="[^"]+"/g ) || [] ).map( el => el.replace( /^id="/, '' ).replace( /"$/, '' ) );
|
|
50
59
|
|
|
51
60
|
for ( const id of ids ) {
|
|
52
|
-
|
|
61
|
+
if ( !isMaskedID( id ) && !ids.includes( 'icons-' ) ) {
|
|
62
|
+
links.add( upath.resolve( `${ filePath }#${ id }` ) );
|
|
63
|
+
}
|
|
53
64
|
}
|
|
54
65
|
}
|
|
55
66
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
67
|
+
return {
|
|
68
|
+
links: Array.from( links ),
|
|
69
|
+
pathsToFiles
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Validates links in the given chunk of files.
|
|
75
|
+
* Checks if links point to existing files or fragments.
|
|
76
|
+
* Returns a list of invalid links.
|
|
77
|
+
*
|
|
78
|
+
* @param {Object} params
|
|
79
|
+
* @param {string[]} params.chunk Array of file paths to validate.
|
|
80
|
+
* @param {Set<string>} params.links Set of valid links.
|
|
81
|
+
* @param {Object} params.options Validation options.
|
|
82
|
+
* @returns {Array<Object>}
|
|
83
|
+
*/
|
|
84
|
+
function validateChunk( { chunk, links, options } ) {
|
|
85
|
+
const errors = [];
|
|
86
|
+
|
|
87
|
+
for ( const filePath of chunk ) {
|
|
88
|
+
const invalidHrefs = [];
|
|
59
89
|
const content = fs.readFileSync( filePath, 'utf-8' );
|
|
60
90
|
const linkElements = [];
|
|
61
91
|
|
|
62
92
|
processNode( parseDocument( content ), linkElements );
|
|
63
93
|
|
|
64
|
-
for ( let { href, text
|
|
65
|
-
if (
|
|
66
|
-
href.match( /[a-z:]*\/\// ) ||
|
|
67
|
-
href.match( /mailto:/ ) ||
|
|
68
|
-
skipValidation
|
|
69
|
-
) {
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
|
|
94
|
+
for ( let { href, text } of linkElements ) {
|
|
73
95
|
if ( href.endsWith( '/' ) && !href.includes( '#' ) ) {
|
|
74
96
|
href += 'index.html';
|
|
75
97
|
}
|
|
@@ -77,8 +99,6 @@ module.exports = ( buildPath, options = {} ) => {
|
|
|
77
99
|
let resolvedPath = getResolvedPath( href, filePath, { publicDir: options.publicDir } );
|
|
78
100
|
|
|
79
101
|
if ( options.skipApi && resolvedPath.includes( '/api/' ) ) {
|
|
80
|
-
// Sometimes api url are obtained after resolving entire URL.
|
|
81
|
-
|
|
82
102
|
continue;
|
|
83
103
|
}
|
|
84
104
|
|
|
@@ -87,7 +107,6 @@ module.exports = ( buildPath, options = {} ) => {
|
|
|
87
107
|
options.projectsInfo.find( i => resolvedPath.includes( `/${ i.slug }/` ) ) :
|
|
88
108
|
null;
|
|
89
109
|
const projectVersion = projectInfo ? projectInfo.version : 'latest';
|
|
90
|
-
|
|
91
110
|
resolvedPath = resolvedPath.replace( 'latest', projectVersion );
|
|
92
111
|
}
|
|
93
112
|
|
|
@@ -100,32 +119,140 @@ module.exports = ( buildPath, options = {} ) => {
|
|
|
100
119
|
continue;
|
|
101
120
|
}
|
|
102
121
|
}
|
|
103
|
-
|
|
104
122
|
if ( !links.has( resolvedPath ) ) {
|
|
105
|
-
invalidHrefs.
|
|
123
|
+
invalidHrefs.push( { href, text, filePath } );
|
|
106
124
|
}
|
|
107
125
|
}
|
|
108
126
|
|
|
109
|
-
if ( invalidHrefs.
|
|
110
|
-
|
|
127
|
+
if ( invalidHrefs.length ) {
|
|
128
|
+
errors.push( { filePath, invalidHrefs } );
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return errors;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Main function executed in the main thread.
|
|
137
|
+
* Splits files into chunks and runs worker threads for each chunk.
|
|
138
|
+
* Collects results and prints errors.
|
|
139
|
+
*
|
|
140
|
+
* @param {string} buildPath Path to the build directory.
|
|
141
|
+
* @param {Object} [options={}] Validation options.
|
|
142
|
+
*/
|
|
143
|
+
if ( isMainThread ) {
|
|
144
|
+
const validateLinks = ( buildPath, options = {} ) => {
|
|
145
|
+
const pattern = upath.join( buildPath, '**', '*' );
|
|
146
|
+
const pathsToFiles = globSync( pattern ).map( path => upath.normalize( path ) );
|
|
147
|
+
|
|
148
|
+
console.info( `Validating links in ${ styleText( 'magenta', buildPath ) }...` );
|
|
149
|
+
|
|
150
|
+
const start = Date.now();
|
|
151
|
+
const { links, pathsToFiles: filteredPaths } = collectLinks( pathsToFiles, options );
|
|
152
|
+
|
|
153
|
+
const cpuCount = Math.max( 1, os.cpus().length );
|
|
154
|
+
const maxWorkers = 8;
|
|
155
|
+
const workerCount = Math.min( cpuCount, maxWorkers );
|
|
156
|
+
const chunks = chunkBasedOnMemory( workerCount, filteredPaths );
|
|
157
|
+
|
|
158
|
+
let finished = 0;
|
|
159
|
+
let allErrors = [];
|
|
160
|
+
let nextChunkIdx = 0;
|
|
161
|
+
const totalChunks = chunks.length;
|
|
162
|
+
|
|
163
|
+
return new Promise( ( resolve, reject ) => {
|
|
164
|
+
const workers = [];
|
|
165
|
+
|
|
166
|
+
function startWorker( workerId ) {
|
|
167
|
+
if ( nextChunkIdx >= totalChunks ) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const chunkIdx = nextChunkIdx++;
|
|
171
|
+
const worker = new Worker( __filename, {
|
|
172
|
+
workerData: {
|
|
173
|
+
chunk: chunks[ chunkIdx ],
|
|
174
|
+
links,
|
|
175
|
+
buildPath,
|
|
176
|
+
options
|
|
177
|
+
}
|
|
178
|
+
} );
|
|
179
|
+
|
|
180
|
+
worker.on( 'message', errors => {
|
|
181
|
+
allErrors = allErrors.concat( errors );
|
|
182
|
+
finished++;
|
|
183
|
+
console.info( `Processed ${ finished } of ${ totalChunks } links chunks.` );
|
|
184
|
+
|
|
185
|
+
if ( nextChunkIdx < totalChunks ) {
|
|
186
|
+
startWorker( workerId ); // Start next chunk on this worker
|
|
187
|
+
} else if ( finished === totalChunks ) {
|
|
188
|
+
printErrors( allErrors, buildPath );
|
|
189
|
+
console.info( `Links validation finished in ${ styleText( 'green', ( Date.now() - start ) + 'ms' ) }.` );
|
|
190
|
+
|
|
191
|
+
if ( allErrors.length ) {
|
|
192
|
+
reject( new Error( `Found ${ allErrors.length } invalid links.` ) );
|
|
193
|
+
} else {
|
|
194
|
+
resolve();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
} );
|
|
198
|
+
|
|
199
|
+
worker.on( 'error', err => {
|
|
200
|
+
finished++;
|
|
201
|
+
console.error( styleText( 'red', `Worker error: ${ err }` ) );
|
|
202
|
+
if ( nextChunkIdx < totalChunks ) {
|
|
203
|
+
startWorker( workerId );
|
|
204
|
+
} else if ( finished === totalChunks ) {
|
|
205
|
+
reject( new Error( `Worker error: ${ err }` ) );
|
|
206
|
+
}
|
|
207
|
+
} );
|
|
208
|
+
workers[ workerId ] = worker;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const numWorkers = Math.min( workerCount, totalChunks );
|
|
212
|
+
for ( let i = 0; i < numWorkers; i++ ) {
|
|
213
|
+
startWorker( i );
|
|
214
|
+
}
|
|
215
|
+
} );
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
module.exports = validateLinks;
|
|
219
|
+
} else {
|
|
220
|
+
const { chunk, links, options } = workerData;
|
|
221
|
+
const errors = validateChunk( { chunk, links: new Set( links ), options } );
|
|
222
|
+
|
|
223
|
+
parentPort.postMessage( errors );
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Prints errors found during link validation.
|
|
228
|
+
* Sets exit code to 1 if errors occurred.
|
|
229
|
+
*
|
|
230
|
+
* @param {Array<Object>} allErrors
|
|
231
|
+
* @param {string} buildPath
|
|
232
|
+
*/
|
|
233
|
+
function printErrors( allErrors, buildPath ) {
|
|
234
|
+
if ( allErrors.length ) {
|
|
235
|
+
process.exitCode = 1;
|
|
236
|
+
for ( const { filePath, invalidHrefs } of allErrors ) {
|
|
111
237
|
console.log(
|
|
112
238
|
styleText( 'red', 'Error: ' ) +
|
|
113
239
|
`Invalid internal links in ${ styleText( 'magenta', filePath.replace( buildPath, '' ) ) }:`
|
|
114
240
|
);
|
|
115
|
-
|
|
116
241
|
for ( const url of invalidHrefs ) {
|
|
117
242
|
console.log( styleText( 'gray', ` * '${ url.href }' - ${ url.text.replace( /\s+/g, ' ' ) }` ) );
|
|
118
243
|
}
|
|
119
244
|
}
|
|
120
245
|
}
|
|
121
|
-
}
|
|
246
|
+
}
|
|
122
247
|
|
|
123
248
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
249
|
+
* Resolves the target path for the given href relative to the file and public directory.
|
|
250
|
+
*
|
|
251
|
+
* @param {string} href
|
|
252
|
+
* @param {string} filePath
|
|
126
253
|
* @param {Object} options
|
|
127
|
-
* @param {
|
|
128
|
-
* @
|
|
254
|
+
* @param {string} options.publicDir
|
|
255
|
+
* @returns {string}
|
|
129
256
|
*/
|
|
130
257
|
function getResolvedPath( href, filePath, options ) {
|
|
131
258
|
if ( href.startsWith( '#' ) ) {
|
|
@@ -146,14 +273,20 @@ function getResolvedPath( href, filePath, options ) {
|
|
|
146
273
|
return upath.resolve( filePath, '..', href );
|
|
147
274
|
}
|
|
148
275
|
|
|
276
|
+
/**
|
|
277
|
+
* Recursively processes the DOM tree, collecting <a> elements with href.
|
|
278
|
+
*
|
|
279
|
+
* @param {Object} node
|
|
280
|
+
* @param {Array<Object>} linkElements
|
|
281
|
+
*/
|
|
149
282
|
function processNode( node, linkElements ) {
|
|
150
283
|
if ( node.type === 'tag' && node.name === 'a' ) {
|
|
151
284
|
const text = node.children.find( child => child.type === 'text' )?.data;
|
|
152
285
|
const href = node.attribs?.href;
|
|
153
286
|
const skipValidation = node.attribs?.[ 'data-skip-validation' ] !== undefined;
|
|
154
287
|
|
|
155
|
-
if ( text && href ) {
|
|
156
|
-
linkElements.push( { href, text
|
|
288
|
+
if ( !skipValidation && text && href && !href.match( /[a-z:]*\/\// ) && !href.match( /mailto:/ ) ) {
|
|
289
|
+
linkElements.push( { href, text } );
|
|
157
290
|
}
|
|
158
291
|
}
|
|
159
292
|
|
|
@@ -165,3 +298,42 @@ function processNode( node, linkElements ) {
|
|
|
165
298
|
processNode( childNode, linkElements );
|
|
166
299
|
}
|
|
167
300
|
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Calculates the optimal chunk count for splitting files based on available system memory.
|
|
304
|
+
* Tries to keep each chunk small enough to avoid OOM, but not too small for efficiency.
|
|
305
|
+
*/
|
|
306
|
+
function chunkBasedOnMemory( maxWorkers, array ) {
|
|
307
|
+
const totalMem = os.totalmem();
|
|
308
|
+
const freeMem = os.freemem();
|
|
309
|
+
|
|
310
|
+
// Assume each file may take up to 8MB in memory (parsing, DOM, etc.)
|
|
311
|
+
const perFileEstimate = 8 * 1024 * 1024;
|
|
312
|
+
|
|
313
|
+
// Use only a portion of free memory to be safe (e.g., 60%)
|
|
314
|
+
const usableMem = Math.max( freeMem, totalMem * 0.2 ) * 0.6;
|
|
315
|
+
const maxFilesPerChunk = Math.max( 1, Math.floor( usableMem / perFileEstimate ) );
|
|
316
|
+
|
|
317
|
+
// Try to keep chunks small, but not less than maxWorkers
|
|
318
|
+
const chunkCount = Math.max( maxWorkers, Math.ceil( array.length / maxFilesPerChunk ) );
|
|
319
|
+
|
|
320
|
+
return chunkArray( array, chunkCount );
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Splits an array into chunkCount fragments of similar size.
|
|
325
|
+
*
|
|
326
|
+
* @param {Array} array
|
|
327
|
+
* @param {number} chunkCount
|
|
328
|
+
* @returns {Array<Array>}
|
|
329
|
+
*/
|
|
330
|
+
function chunkArray( array, chunkCount ) {
|
|
331
|
+
const chunks = [];
|
|
332
|
+
const chunkSize = Math.ceil( array.length / chunkCount );
|
|
333
|
+
|
|
334
|
+
for ( let i = 0; i < array.length; i += chunkSize ) {
|
|
335
|
+
chunks.push( array.slice( i, i + chunkSize ) );
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
return chunks;
|
|
339
|
+
}
|