umberto 9.3.0 → 10.0.0
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 +24 -16
- package/LICENSE.md +0 -44
- package/README.md +0 -1
- package/hexo-shim.js +2 -2
- package/package.json +2 -9
- package/scripts/filter/after-post-render/{gloria.js → gloria.cjs} +3 -3
- package/scripts/filter/after-post-render/{insert-error-codes.js → insert-error-codes.cjs} +1 -1
- package/scripts/filter/after-post-render/{linker.js → linker.cjs} +1 -1
- package/scripts/filter/after-post-render/{parseicontag.js → parseicontag.cjs} +1 -1
- package/scripts/filter/after-post-render/{snippets.js → snippets.cjs} +2 -2
- package/scripts/filter/after-render/{process-svg.js → process-svg.cjs} +3 -3
- package/scripts/filter/before-post-render/{add-project-info-to-page.js → add-project-info-to-page.cjs} +2 -2
- package/scripts/filter/before-post-render/{add-repo-url.js → add-repo-url.cjs} +4 -4
- package/scripts/filter/before-post-render/{code-switcher.js → code-switcher.cjs} +1 -1
- package/scripts/filter/before-post-render/{execute-and-insert-function-results.js → execute-and-insert-function-results.cjs} +1 -1
- package/scripts/filter/before-post-render/gloria/{add-breadcrumbs-data-to-page.js → add-breadcrumbs-data-to-page.cjs} +4 -4
- package/scripts/filter/before-post-render/gloria/{prerender-admonitions.js → prerender-admonitions.cjs} +1 -1
- package/scripts/filter/before-post-render/gloria/{prerender-xml-pug-components.js → prerender-xml-pug-components.cjs} +5 -5
- package/scripts/filter/before-post-render/gloria/{render-post-render-pug-components.js → render-post-render-pug-components.cjs} +1 -1
- package/scripts/filter/before-post-render/{has-own-favicons.js → has-own-favicons.cjs} +1 -1
- package/scripts/filter/before-post-render/{infobox.js → infobox.cjs} +1 -1
- package/scripts/filter/before-post-render/{insertchangelog.js → insertchangelog.cjs} +1 -1
- package/scripts/filter/before-post-render/{replace-macros.js → replace-macros.cjs} +1 -1
- package/scripts/helper/{find-main-category-page.js → find-main-category-page.cjs} +1 -1
- package/scripts/helper/{normalize-badges.js → normalize-badges.cjs} +1 -1
- package/scripts/helper/{parse-href.js → parse-href.cjs} +1 -1
- package/scripts/helper/{u-capitalize.js → u-capitalize.cjs} +1 -1
- package/scripts/helper/{u-random-id.js → u-random-id.cjs} +1 -1
- package/scripts/helper/{u-remove-indentation.js → u-remove-indentation.cjs} +1 -1
- package/scripts/helper/{u-toc.js → u-toc.cjs} +1 -1
- package/scripts/utils/{concat-url-parts.js → concat-url-parts.cjs} +3 -3
- package/scripts/utils/{execute-and-insert-function-results.js → execute-and-insert-function-results.cjs} +7 -0
- package/scripts/utils/gloria-after-post-render/{append-copy-heading-buttons.js → append-copy-heading-buttons.cjs} +33 -16
- package/scripts/utils/{has-own-favicons.js → has-own-favicons.cjs} +6 -0
- package/scripts/utils/{inline-svg.js → inline-svg.cjs} +2 -2
- package/scripts/utils/{logcrossprojectreference.js → logcrossprojectreference.cjs} +6 -0
- package/scripts/utils/{parse-href.js → parse-href.cjs} +1 -1
- package/scripts/utils/{parseicontag.js → parseicontag.cjs} +7 -1
- package/scripts/utils/{parselinks.js → parselinks.cjs} +14 -6
- package/scripts/utils/pug-renderer/{create-prerender-pug-template.js → create-prerender-pug-template.cjs} +3 -3
- package/scripts/utils/pug-renderer/{render-pug-component.js → render-pug-component.cjs} +4 -4
- package/scripts/utils/pug-to-xml-binding/parser/{xml-components-parser.js → xml-components-parser.cjs} +2 -2
- package/scripts/utils/pug-to-xml-binding/{render-xml-pug-components-in-markdown.js → render-xml-pug-components-in-markdown.cjs} +3 -3
- package/scripts/utils/pug-to-xml-binding/{transform-xml-tree-to-pug.js → transform-xml-tree-to-pug.cjs} +1 -1
- package/scripts/utils/{spritesheet-svg.js → spritesheet-svg.cjs} +2 -2
- package/scripts/utils/{transform-markdown-admonitions.js → transform-markdown-admonitions.cjs} +1 -1
- package/src/api-builder/api-builder.js +84 -33
- package/src/api-builder/build-page-worker.js +9 -9
- package/src/api-builder/classes/description-parser.js +12 -14
- package/src/api-builder/classes/doc-data-factory.js +3 -5
- package/src/api-builder/classes/file-name-manager.js +2 -4
- package/src/api-builder/classes/html-file.js +2 -4
- package/src/api-builder/classes/navigation-tree.js +7 -9
- package/src/api-builder/classes/tree-node.js +1 -3
- package/src/api-builder/utils/findtargetdoclet.js +1 -3
- package/src/api-builder/utils/utils.js +19 -26
- package/src/data-converter/converters/jsdoc2umberto.js +2 -4
- package/src/data-converter/converters/jsduck2umberto.js +5 -7
- package/src/data-converter/converters/typedoc/abstractparser.js +3 -5
- package/src/data-converter/converters/typedoc/accessorparser.js +3 -5
- package/src/data-converter/converters/typedoc/classparser.js +3 -5
- package/src/data-converter/converters/typedoc/computedpropertyparser.js +3 -5
- package/src/data-converter/converters/typedoc/constantparser.js +3 -5
- package/src/data-converter/converters/typedoc/constructorparser.js +3 -5
- package/src/data-converter/converters/typedoc/errorparser.js +2 -4
- package/src/data-converter/converters/typedoc/eventparser.js +2 -4
- package/src/data-converter/converters/typedoc/functionparser.js +3 -5
- package/src/data-converter/converters/typedoc/interfaceparser.js +3 -5
- package/src/data-converter/converters/typedoc/methodparser.js +3 -5
- package/src/data-converter/converters/typedoc/moduleparser.js +3 -5
- package/src/data-converter/converters/typedoc/propertyparser.js +3 -5
- package/src/data-converter/converters/typedoc/referenceparser.js +3 -5
- package/src/data-converter/converters/typedoc/reflectionkind.js +24 -26
- package/src/data-converter/converters/typedoc/typedocconverter.js +3 -7
- package/src/data-converter/converters/typedoc/typeparser.js +3 -5
- package/src/data-converter/converters/typedoc2umberto.js +17 -19
- package/src/data-converter/data-collection.js +2 -5
- package/src/data-converter/data-provider.js +6 -8
- package/src/data-converter/doclet-collection.js +1 -4
- package/src/data-converter/middlewares/relation-fixer.js +3 -5
- package/src/helpers/capitalize.js +1 -3
- package/src/helpers/create-filtering-data-attribs.js +1 -3
- package/src/helpers/doc-formats.js +1 -3
- package/src/helpers/escape-longname.js +1 -3
- package/src/helpers/extract-longname.js +1 -3
- package/src/helpers/get-api-infobox-tooltip.js +3 -5
- package/src/helpers/get-docsearch-config.js +8 -6
- package/src/helpers/get-file-patterns-to-process.js +1 -3
- package/src/helpers/get-short-module-path.js +2 -4
- package/src/helpers/github-url.js +96 -103
- package/src/helpers/glob-to-regexp.js +3 -5
- package/src/helpers/html-safe.js +1 -3
- package/src/helpers/import-module.js +3 -5
- package/src/helpers/is-non-empty-array.js +1 -3
- package/src/helpers/log-with-time.js +2 -4
- package/src/helpers/resolve-path.js +5 -3
- package/src/helpers/snippets.js +50 -56
- package/src/helpers/split-longname.js +2 -4
- package/src/helpers/umberto-version.js +10 -0
- package/src/hexo/filter/extend-config.js +1 -3
- package/src/hexo/filter/project-locals.js +80 -8
- package/src/hexo/get-repo-urls.js +5 -6
- package/src/hexo/helper/get-page-group.js +1 -3
- package/src/hexo/project-globals.js +4 -6
- package/src/hexo-manager.js +12 -13
- package/src/index.js +28 -32
- package/src/sdk-builder/get-sdk-sources.js +11 -13
- package/src/sdk-builder/sdk-builder.js +11 -11
- package/src/tasks/build-api-docs.js +7 -9
- package/src/tasks/build-documentation.js +47 -36
- package/src/tasks/build-sdk.js +5 -5
- package/src/tasks/build-snippets.js +3 -5
- package/src/tasks/cache-files.js +4 -6
- package/src/tasks/compile-sass.js +8 -9
- package/src/tasks/copy-assets.js +3 -5
- package/src/tasks/copy-files.js +5 -7
- package/src/tasks/copy-project-docs.js +5 -7
- package/src/tasks/copy-project-icons.js +5 -7
- package/src/tasks/create-redirect-page.js +3 -5
- package/src/tasks/create-sitemap-index.js +3 -3
- package/src/tasks/create-sitemap-step.js +4 -4
- package/src/tasks/create-sitemap.js +6 -8
- package/src/tasks/create-sym-links.js +5 -7
- package/src/tasks/execute-hooks.js +3 -5
- package/src/tasks/get-extra-files.js +3 -5
- package/src/tasks/get-hexo-config.js +4 -4
- package/src/tasks/get-main-config.js +3 -5
- package/src/tasks/get-project-config.js +11 -8
- package/src/tasks/macro-replacer.js +1 -3
- package/src/tasks/minify-html-worker.js +5 -5
- package/src/tasks/minify-html.js +8 -10
- package/src/tasks/overwrite-api-guides.js +4 -6
- package/src/tasks/read-doc-sources.js +5 -7
- package/src/tasks/run-webpack.js +8 -6
- package/src/tasks/validate-links-collect-worker.js +6 -6
- package/src/tasks/validate-links-worker.js +6 -6
- package/src/tasks/validate-links.js +9 -11
- package/src/tasks/watcher.js +5 -7
- package/src/tasks/write-html-files.js +3 -5
- package/src/template/template-collection.js +13 -15
- package/themes/umberto/layout/gloria/_api-docs/_mixin/_api-tree-item.pug +18 -1
- package/themes/umberto/layout/gloria/_head/head.pug +5 -0
- package/themes/umberto/layout/umberto/_partial/head.pug +5 -0
- package/themes/umberto/src/gloria/css/components/_api-tree.scss +4 -0
- package/themes/umberto/src/gloria/js/app.js +32 -32
- package/themes/umberto/src/gloria/js/components/api-nav-tree.js +5 -5
- package/themes/umberto/src/gloria/js/components/api-toggle.js +2 -2
- package/themes/umberto/src/gloria/js/components/breadcrumbs.js +1 -1
- package/themes/umberto/src/gloria/js/components/code-block.js +5 -5
- package/themes/umberto/src/gloria/js/components/code-switcher.js +2 -2
- package/themes/umberto/src/gloria/js/components/dropdown.js +5 -5
- package/themes/umberto/src/gloria/js/components/expandable.js +1 -1
- package/themes/umberto/src/gloria/js/components/fake-devtools.js +4 -4
- package/themes/umberto/src/gloria/js/components/hash-link.js +2 -2
- package/themes/umberto/src/gloria/js/components/heading-link.js +2 -2
- package/themes/umberto/src/gloria/js/components/iframe.js +2 -2
- package/themes/umberto/src/gloria/js/components/mobile-overlay.js +5 -5
- package/themes/umberto/src/gloria/js/components/nav-tree.js +3 -3
- package/themes/umberto/src/gloria/js/components/tabs.js +2 -2
- package/themes/umberto/src/gloria/js/components/tooltip-popover.js +13 -13
- package/themes/umberto/src/gloria/js/helpers/animate-element.js +2 -2
- package/themes/umberto/src/gloria/js/helpers/create-anchor-positioning-watcher.js +1 -1
- package/themes/umberto/src/gloria/js/helpers/create-keyboard-focus-cycler.js +3 -3
- package/themes/umberto/src/gloria/js/helpers/focus-first-interactive.js +2 -2
- package/themes/umberto/src/gloria/js/helpers/highlight-code.js +1 -1
- package/themes/umberto/src/gloria/js/helpers/scroll-to-hash.js +1 -1
- package/themes/umberto/src/gloria/js/helpers/tween.js +2 -2
- package/themes/umberto/src/gloria/js/modules/algolia-search.js +4 -4
- package/themes/umberto/src/gloria/js/modules/api-filter.js +1 -1
- package/themes/umberto/src/gloria/js/modules/header-bar.js +4 -4
- package/themes/umberto/src/gloria/js/modules/header.js +2 -2
- package/themes/umberto/src/gloria/js/modules/links-prefetch.js +1 -1
- package/themes/umberto/src/gloria/js/modules/mobile-nav.js +7 -7
- package/themes/umberto/src/gloria/js/modules/sidebar.js +3 -3
- package/themes/umberto/src/gloria/js/modules/table-of-contents-api.js +9 -9
- package/themes/umberto/src/gloria/js/modules/table-of-contents.js +10 -10
- package/themes/umberto/src/gloria/js/public-api.js +15 -15
- package/themes/umberto/src/gloria/js/web-components/svg-icon.js +3 -3
- package/themes/umberto/src/umberto/js/_apitree.js +1 -1
- package/themes/umberto/src/umberto/js/_attachpermalinklistener.js +1 -1
- package/themes/umberto/src/umberto/js/_copymobileapinavigation.js +1 -1
- package/themes/umberto/src/umberto/js/_imageModal.js +1 -1
- package/themes/umberto/src/umberto/js/_pagenavigation.js +1 -1
- package/themes/umberto/src/umberto/js/_prism.js +1 -1
- package/themes/umberto/src/umberto/js/_samplecode.js +1 -1
- package/themes/umberto/src/umberto/js/_sidenavigation.js +1 -1
- package/themes/umberto/src/umberto/js/_toc.js +1 -1
- package/themes/umberto/src/umberto/js/_warningbanner.js +1 -1
- package/themes/umberto/src/umberto/js/app.js +19 -19
- package/src/tasks/validate-html-w3c.js +0 -35
- /package/scripts/filter/after-post-render/{basepath-replacer.js → basepath-replacer.cjs} +0 -0
- /package/scripts/filter/after-post-render/{fix-code-samples.js → fix-code-samples.cjs} +0 -0
- /package/scripts/filter/after-post-render/{gather-guides.js → gather-guides.cjs} +0 -0
- /package/scripts/filter/after-post-render/{img-linker.js → img-linker.cjs} +0 -0
- /package/scripts/filter/after-post-render/{import-guide.js → import-guide.cjs} +0 -0
- /package/scripts/filter/after-post-render/{process-variables.js → process-variables.cjs} +0 -0
- /package/scripts/filter/after-post-render/{time-end.js → time-end.cjs} +0 -0
- /package/scripts/filter/after-post-render/{time-start.js → time-start.cjs} +0 -0
- /package/scripts/filter/after-post-render/{validate-after-render.js → validate-after-render.cjs} +0 -0
- /package/scripts/filter/before-post-render/{change-output-path.js → change-output-path.cjs} +0 -0
- /package/scripts/filter/before-post-render/{set-layout.js → set-layout.cjs} +0 -0
- /package/scripts/filter/before-post-render/{validate-page-data.js → validate-page-data.cjs} +0 -0
- /package/scripts/helper/{get-pages-for-nav-tree.js → get-pages-for-nav-tree.cjs} +0 -0
- /package/scripts/helper/{mark-empty-categories.js → mark-empty-categories.cjs} +0 -0
- /package/scripts/helper/{u-extract-and-cache-title.js → u-extract-and-cache-title.cjs} +0 -0
- /package/scripts/helper/{u-split-to-title-and-content.js → u-split-to-title-and-content.cjs} +0 -0
- /package/scripts/utils/{add-indention.js → add-indention.cjs} +0 -0
- /package/scripts/utils/{capitalize.js → capitalize.cjs} +0 -0
- /package/scripts/utils/{compose.js → compose.cjs} +0 -0
- /package/scripts/utils/{decode-html-entities.js → decode-html-entities.cjs} +0 -0
- /package/scripts/utils/{drop-init-slash.js → drop-init-slash.cjs} +0 -0
- /package/scripts/utils/{drop-trailing-slash.js → drop-trailing-slash.cjs} +0 -0
- /package/scripts/utils/{drop-url-protocol.js → drop-url-protocol.cjs} +0 -0
- /package/scripts/utils/{findmaincategorypage.js → findmaincategorypage.cjs} +0 -0
- /package/scripts/utils/{getreportissuewidgeturl.js → getreportissuewidgeturl.cjs} +0 -0
- /package/scripts/utils/gloria-after-post-render/{apply-design-doc-classes.js → apply-design-doc-classes.cjs} +0 -0
- /package/scripts/utils/gloria-after-post-render/{wrap-table-into-wrappers.js → wrap-table-into-wrappers.cjs} +0 -0
- /package/scripts/utils/{insertchangelog.js → insertchangelog.cjs} +0 -0
- /package/scripts/utils/{measure-call.js → measure-call.cjs} +0 -0
- /package/scripts/utils/{normalizebadges.js → normalizebadges.cjs} +0 -0
- /package/scripts/utils/{parser-cursor.js → parser-cursor.cjs} +0 -0
- /package/scripts/utils/pug-to-xml-binding/parser/{walk-xml-tree.js → walk-xml-tree.cjs} +0 -0
- /package/scripts/utils/{random-id.js → random-id.cjs} +0 -0
- /package/scripts/utils/{remove-indentation.js → remove-indentation.cjs} +0 -0
- /package/scripts/utils/{shoulddisplaynewindicator.js → shoulddisplaynewindicator.cjs} +0 -0
- /package/scripts/utils/{toc.js → toc.cjs} +0 -0
- /package/scripts/utils/{transformcodeswitcher.js → transformcodeswitcher.cjs} +0 -0
- /package/scripts/utils/{transforminfobox.js → transforminfobox.cjs} +0 -0
- /package/scripts/utils/{uniq-by-last.js → uniq-by-last.cjs} +0 -0
|
@@ -3,12 +3,70 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import upath from 'upath';
|
|
7
|
+
import { getPageGroup as getPageGroupHelper } from '../helper/get-page-group.js';
|
|
8
|
+
import { getDocsearchConfig as getDocSearchConfig } from '../../helpers/get-docsearch-config.js';
|
|
9
|
+
import { umbertoVersion } from '../../helpers/umberto-version.js';
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Resolves the API package name from a docs path.
|
|
13
|
+
*
|
|
14
|
+
* @param {Object} params
|
|
15
|
+
* @param {String} params.path
|
|
16
|
+
* @param {String} params.basePath
|
|
17
|
+
* @param {String|null} params.apiSlug
|
|
18
|
+
* @returns {String|null}
|
|
19
|
+
*/
|
|
20
|
+
function getApiPackageFromPath( { path, basePath, apiSlug } ) {
|
|
21
|
+
if ( !apiSlug ) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const apiBasePath = upath.join( basePath, apiSlug );
|
|
26
|
+
const normalizedPath = upath.normalize( path );
|
|
27
|
+
|
|
28
|
+
if ( normalizedPath !== apiBasePath && !normalizedPath.startsWith( `${ apiBasePath }/` ) ) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const firstSegment = normalizedPath
|
|
33
|
+
.slice( apiBasePath.length )
|
|
34
|
+
.replace( /^\/+/, '' )
|
|
35
|
+
.split( '/' )[ 0 ];
|
|
36
|
+
|
|
37
|
+
if ( !firstSegment || firstSegment === 'index.html' ) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const packageName = firstSegment.replace( /\.html$/, '' );
|
|
42
|
+
|
|
43
|
+
return packageName === 'index' ? null : packageName;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Chooses the API tree HTML based on current page context.
|
|
48
|
+
*
|
|
49
|
+
* @param {Object} params
|
|
50
|
+
* @param {String} params.path
|
|
51
|
+
* @param {String} params.basePath
|
|
52
|
+
* @param {String|null} params.apiSlug
|
|
53
|
+
* @param {String} params.navTree
|
|
54
|
+
* @param {Object} params.navTreeByPackage
|
|
55
|
+
* @returns {String}
|
|
56
|
+
*/
|
|
57
|
+
function getApiTreeHtml( { path, basePath, apiSlug, navTree, navTreeByPackage } ) {
|
|
58
|
+
if ( !navTreeByPackage || Object.keys( navTreeByPackage ).length === 0 ) {
|
|
59
|
+
return navTree;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const apiPackage = getApiPackageFromPath( { path, basePath, apiSlug } );
|
|
63
|
+
|
|
64
|
+
if ( apiPackage && navTreeByPackage[ apiPackage ] ) {
|
|
65
|
+
return navTreeByPackage[ apiPackage ];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return navTree;
|
|
69
|
+
}
|
|
12
70
|
|
|
13
71
|
/**
|
|
14
72
|
* Adds various project data as hexo locals available in templates.
|
|
@@ -27,11 +85,12 @@ const umbertoVersion = require( '../../../package.json' ).version;
|
|
|
27
85
|
* @param {Array} extraStylePaths Paths to extra external css.
|
|
28
86
|
* @param {Array} extraScriptsPaths Paths to extra external js.
|
|
29
87
|
* @param {Boolean} disableSearch Extra flag for disabling docsearch if needed.
|
|
88
|
+
* @param {Boolean} shouldInjectNoIndexMeta Whether the "do not index" header for bots should be included.
|
|
30
89
|
* @param {Array} quickNavigationProjects Projects to display in the quick navigation dropdown.
|
|
31
90
|
* @param {Boolean} navigationShowEmptyCategories If set on true, empty categories will be displayed.
|
|
32
91
|
* @param {Object} og Open Graph config.
|
|
33
92
|
*/
|
|
34
|
-
|
|
93
|
+
export const projectLocals = ( ctx, {
|
|
35
94
|
basePath,
|
|
36
95
|
docSearch = {},
|
|
37
96
|
config,
|
|
@@ -46,6 +105,7 @@ module.exports = ( ctx, {
|
|
|
46
105
|
extraStylePaths,
|
|
47
106
|
extraScriptsPaths,
|
|
48
107
|
disableSearch,
|
|
108
|
+
shouldInjectNoIndexMeta,
|
|
49
109
|
og,
|
|
50
110
|
quickNavigationProjects,
|
|
51
111
|
navigationShowEmptyCategories
|
|
@@ -63,10 +123,18 @@ module.exports = ( ctx, {
|
|
|
63
123
|
return g;
|
|
64
124
|
} );
|
|
65
125
|
|
|
126
|
+
const apiTree = getApiTreeHtml( {
|
|
127
|
+
path: locals.path,
|
|
128
|
+
basePath,
|
|
129
|
+
apiSlug: groupsModified.find( g => g.id === 'api-reference' )?.slug ?? null,
|
|
130
|
+
navTree: ctx.projectGlobals[ projectSlug ].config.navTree,
|
|
131
|
+
navTreeByPackage: ctx.projectGlobals[ projectSlug ].config.navTreeByPackage
|
|
132
|
+
} );
|
|
133
|
+
|
|
66
134
|
locals.projectLocals = {
|
|
67
135
|
groups: groupsModified,
|
|
68
136
|
getPageGroup: getPageGroupHelper( groupsModified ),
|
|
69
|
-
apiTree
|
|
137
|
+
apiTree,
|
|
70
138
|
sdkNavTree: ctx.projectGlobals[ projectSlug ].config.sdkNavTree,
|
|
71
139
|
latestBasePath: upath.join( projectSlug, 'latest' ),
|
|
72
140
|
extraStylePaths,
|
|
@@ -85,7 +153,10 @@ module.exports = ( ctx, {
|
|
|
85
153
|
};
|
|
86
154
|
}
|
|
87
155
|
|
|
88
|
-
//
|
|
156
|
+
// ⚠️ WARNING ⚠️
|
|
157
|
+
// Following locals are the same for all projects. Each project overwrites previous ones.
|
|
158
|
+
// For unique values, use`projectLocals` or `projectsData`.
|
|
159
|
+
|
|
89
160
|
if ( !locals.projectsData ) {
|
|
90
161
|
locals.projectsData = [];
|
|
91
162
|
}
|
|
@@ -94,6 +165,7 @@ module.exports = ( ctx, {
|
|
|
94
165
|
locals.projectsData.push( {
|
|
95
166
|
name: projectName,
|
|
96
167
|
slug: projectSlug,
|
|
168
|
+
shouldInjectNoIndexMeta,
|
|
97
169
|
BASE_PATH: upath.join( projectSlug, config.version ),
|
|
98
170
|
latestBasePath: upath.join( projectSlug, 'latest' ),
|
|
99
171
|
startPage: config.startPage ? '/' + config.startPage : '/index.html'
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import upath from 'upath';
|
|
8
|
+
import { globSync } from 'glob';
|
|
7
9
|
|
|
8
|
-
const
|
|
9
|
-
const { globSync } = require( 'glob' );
|
|
10
|
-
|
|
11
|
-
module.exports = ( {
|
|
10
|
+
export const getRepoUrls = ( {
|
|
12
11
|
rootPath,
|
|
13
12
|
defaultRepoUrl,
|
|
14
13
|
packages = []
|
|
@@ -54,7 +53,7 @@ function getPackageJson( srcDir ) {
|
|
|
54
53
|
let packageJson = null;
|
|
55
54
|
|
|
56
55
|
try {
|
|
57
|
-
packageJson =
|
|
56
|
+
packageJson = JSON.parse( fs.readFileSync( upath.join( srcDir, 'package.json' ), 'utf8' ) );
|
|
58
57
|
} catch {
|
|
59
58
|
console.warn( `Warning: Cannot read package.json from ${ srcDir }.` );
|
|
60
59
|
}
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const upath = require( 'upath' );
|
|
9
|
-
const getRepoUrls = require( './get-repo-urls' );
|
|
6
|
+
import upath from 'upath';
|
|
7
|
+
import { getRepoUrls } from './get-repo-urls.js';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* Adds various project data to hexo so that it can be accessed in filters.
|
|
@@ -17,7 +15,7 @@ const getRepoUrls = require( './get-repo-urls' );
|
|
|
17
15
|
* @param {Object} config Project's umberto.json config.
|
|
18
16
|
* @param {String} errorsHtml API errors HTML created by ApiBuilder.
|
|
19
17
|
*/
|
|
20
|
-
|
|
18
|
+
export const projectGlobals = ( ctx, {
|
|
21
19
|
rootPath,
|
|
22
20
|
basePath,
|
|
23
21
|
config,
|
|
@@ -42,7 +40,7 @@ module.exports = ( ctx, {
|
|
|
42
40
|
errorsHtml,
|
|
43
41
|
|
|
44
42
|
// The `_icons` collection contains files that should be copied to the project's assets.
|
|
45
|
-
// They are parsed in the `parseIconTag()` function. See `scripts/filter/after-post-render/parseicontag.
|
|
43
|
+
// They are parsed in the `parseIconTag()` function. See `scripts/filter/after-post-render/parseicontag.cjs`.
|
|
46
44
|
_icons: new Map()
|
|
47
45
|
};
|
|
48
46
|
|
package/src/hexo-manager.js
CHANGED
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import { styleText } from 'node:util';
|
|
7
|
+
import upath from 'upath';
|
|
8
|
+
import fs from 'fs-extra';
|
|
9
|
+
import { globSync } from 'glob';
|
|
10
|
+
import Hexo from '../hexo-shim.js';
|
|
11
|
+
import { getHexoConfig } from './tasks/get-hexo-config.js';
|
|
12
|
+
import { extendConfig } from './hexo/filter/extend-config.js';
|
|
7
13
|
|
|
8
|
-
const
|
|
9
|
-
const upath = require( 'upath' );
|
|
10
|
-
const fs = require( 'fs-extra' );
|
|
11
|
-
const { globSync } = require( 'glob' );
|
|
12
|
-
const Hexo = require( '../hexo-shim' );
|
|
13
|
-
|
|
14
|
-
const getHexoConfig = require( './tasks/get-hexo-config' );
|
|
15
|
-
const extendConfig = require( './hexo/filter/extend-config' );
|
|
14
|
+
const __dirname = import.meta.dirname;
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* Class used to initialize and control hexo.
|
|
@@ -198,18 +197,18 @@ class HexoManager {
|
|
|
198
197
|
|
|
199
198
|
Object.assign( this.hexo.projectGlobals.common, options, {
|
|
200
199
|
// The `_snippetsData` collection is used in `src/tasks/build-snippets.js` in order to build snippets.
|
|
201
|
-
// Required data are being added in hexo `after_post_render` filter: `scripts/filter/after-post-render/snippets.
|
|
200
|
+
// Required data are being added in hexo `after_post_render` filter: `scripts/filter/after-post-render/snippets.cjs`.
|
|
202
201
|
/** @type {Map.<String, Set.<Snippet>>} */
|
|
203
202
|
_snippetsData: new Map(),
|
|
204
203
|
|
|
205
204
|
// The `_copiedFiles` collection is being built in `src/tasks/copy-project-docs.js` in order to find the source
|
|
206
|
-
// paths of copied files while processing snippets (see: `scripts/filter/after-post-render/snippets.
|
|
205
|
+
// paths of copied files while processing snippets (see: `scripts/filter/after-post-render/snippets.cjs`).
|
|
207
206
|
/** @type {Map.<String, Map.<String, String>>} */
|
|
208
207
|
_copiedFiles: new Map(),
|
|
209
208
|
|
|
210
209
|
// The `_disabledFilters` collection contains names of filters that won't be executed.
|
|
211
210
|
// Unfortunately, the mechanism is not merged into Hexo core, so when writing a filter, you need to verify
|
|
212
|
-
// manually whether it should be executed. An example usage you can find in the `scripts/utils/parselinks.
|
|
211
|
+
// manually whether it should be executed. An example usage you can find in the `scripts/utils/parselinks.cjs` file.
|
|
213
212
|
/** @type {Set.<String>} */
|
|
214
213
|
_disabledFilters: new Set()
|
|
215
214
|
} );
|
|
@@ -237,4 +236,4 @@ class HexoManager {
|
|
|
237
236
|
}
|
|
238
237
|
}
|
|
239
238
|
|
|
240
|
-
|
|
239
|
+
export const hexoManager = new HexoManager();
|
package/src/index.js
CHANGED
|
@@ -3,23 +3,22 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
module.exports = {
|
|
6
|
+
import { styleText } from 'node:util';
|
|
7
|
+
import upath from 'upath';
|
|
8
|
+
import { compileSass } from './tasks/compile-sass.js';
|
|
9
|
+
import { runWebpack } from './tasks/run-webpack.js';
|
|
10
|
+
import { copyAssets } from './tasks/copy-assets.js';
|
|
11
|
+
import { getMainConfig } from './tasks/get-main-config.js';
|
|
12
|
+
import { createSymLinks } from './tasks/create-sym-links.js';
|
|
13
|
+
import { buildDocumentation } from './tasks/build-documentation.js';
|
|
14
|
+
import { getProjectConfig } from './tasks/get-project-config.js';
|
|
15
|
+
import { watchMd as watcher } from './tasks/watcher.js';
|
|
16
|
+
import { logWithTime } from './helpers/log-with-time.js';
|
|
17
|
+
import { umbertoVersion as version } from './helpers/umberto-version.js';
|
|
18
|
+
|
|
19
|
+
const __dirname = import.meta.dirname;
|
|
20
|
+
|
|
21
|
+
export const umberto = {
|
|
23
22
|
/**
|
|
24
23
|
* Builds documentation for a single project.
|
|
25
24
|
* Intended to use within project's task runner or along other build scripts.
|
|
@@ -70,17 +69,13 @@ module.exports = {
|
|
|
70
69
|
*/
|
|
71
70
|
async function buildAndWatch( options ) {
|
|
72
71
|
const logTime = logWithTime( 'Building documentation' );
|
|
73
|
-
const outputDir =
|
|
72
|
+
const outputDir = upath.join( process.cwd(), 'build', 'docs' );
|
|
74
73
|
const hexoManager = await buildDocumentation( options );
|
|
75
74
|
|
|
76
75
|
if ( !options.skipThemes ) {
|
|
77
76
|
await buildThemes( outputDir, options );
|
|
78
77
|
}
|
|
79
78
|
|
|
80
|
-
if ( options.validateW3C ) {
|
|
81
|
-
await validateHtml( outputDir, options );
|
|
82
|
-
}
|
|
83
|
-
|
|
84
79
|
if ( options.createSymLinks !== false ) {
|
|
85
80
|
const rootPath = process.cwd();
|
|
86
81
|
|
|
@@ -101,15 +96,15 @@ async function buildAndWatch( options ) {
|
|
|
101
96
|
}
|
|
102
97
|
|
|
103
98
|
async function buildThemes( outputDir, options ) {
|
|
104
|
-
const themesDir =
|
|
105
|
-
const sourceDir =
|
|
106
|
-
const outputAssetsPath =
|
|
99
|
+
const themesDir = upath.join( __dirname, '../themes/umberto' );
|
|
100
|
+
const sourceDir = upath.join( themesDir, 'src' );
|
|
101
|
+
const outputAssetsPath = upath.join( outputDir, 'assets', version );
|
|
107
102
|
const layoutThemes = [ 'umberto', 'gloria' ];
|
|
108
103
|
|
|
109
104
|
for ( const theme of layoutThemes ) {
|
|
110
105
|
await runWebpack(
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
upath.join( sourceDir, theme, 'js/app.js' ),
|
|
107
|
+
upath.join( outputAssetsPath, theme, 'scripts' ),
|
|
113
108
|
{
|
|
114
109
|
minify: !options.dev,
|
|
115
110
|
umbertoDir: themesDir,
|
|
@@ -118,17 +113,19 @@ async function buildThemes( outputDir, options ) {
|
|
|
118
113
|
);
|
|
119
114
|
|
|
120
115
|
await copyAssets(
|
|
121
|
-
|
|
122
|
-
|
|
116
|
+
upath.join( themesDir, 'source', theme ),
|
|
117
|
+
upath.join( outputAssetsPath, theme )
|
|
123
118
|
);
|
|
124
119
|
|
|
125
120
|
await compileSass(
|
|
126
|
-
|
|
127
|
-
|
|
121
|
+
upath.join( sourceDir, theme, 'css/styles.scss' ),
|
|
122
|
+
upath.join( outputAssetsPath, theme, 'css/styles.css' )
|
|
128
123
|
);
|
|
129
124
|
}
|
|
130
125
|
}
|
|
131
126
|
|
|
127
|
+
export default umberto;
|
|
128
|
+
|
|
132
129
|
/**
|
|
133
130
|
* @typedef {Object} Options
|
|
134
131
|
* @property {boolean} [skipApi=false] Skips rendering API docs.
|
|
@@ -139,5 +136,4 @@ async function buildThemes( outputDir, options ) {
|
|
|
139
136
|
* @property {boolean} [verbose=false] Adds more information to console during documentation building.
|
|
140
137
|
* @property {boolean} [createSymLinks=true] Add symbolic links with 'latest' to output folder.
|
|
141
138
|
* @property {boolean} [watch=false] Run Umberto with watch mode, which track changes in dm files and rebuild docs with it.
|
|
142
|
-
* @property {boolean} [validateW3C=false] Use vnu java validator to check every single output page for html syntax errors.
|
|
143
139
|
*/
|
|
@@ -3,26 +3,24 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const { selectAll, selectOne } = require( 'css-select' );
|
|
15
|
-
const {
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import upath from 'upath';
|
|
8
|
+
import { globSync } from 'glob';
|
|
9
|
+
import { parseDocument } from 'htmlparser2';
|
|
10
|
+
import { cloneNode, Text } from 'domhandler';
|
|
11
|
+
import render from 'dom-serializer';
|
|
12
|
+
import { selectAll, selectOne } from 'css-select';
|
|
13
|
+
import {
|
|
16
14
|
getAttributeValue,
|
|
17
15
|
hasAttrib,
|
|
18
16
|
textContent,
|
|
19
17
|
getName
|
|
20
|
-
}
|
|
21
|
-
|
|
18
|
+
} from 'domutils';
|
|
19
|
+
import decodeHtmlEntities from '../../scripts/utils/decode-html-entities.cjs';
|
|
22
20
|
|
|
23
21
|
const SDK_SELECTOR = 'meta[name="sdk-samples"]';
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
export const getSdkSources = sourcePath => {
|
|
26
24
|
const files = [];
|
|
27
25
|
const filePaths = globSync( upath.join( sourcePath, '*.html' ) ).map( path => upath.normalize( path ) );
|
|
28
26
|
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import { HtmlFile } from '../api-builder/classes/html-file.js';
|
|
7
|
+
import upath from 'upath';
|
|
8
|
+
import { URL, resolve as urlResolve } from 'node:url';
|
|
9
|
+
import jsBeautify from 'js-beautify';
|
|
10
|
+
import { macroReplacer } from '../tasks/macro-replacer.js';
|
|
11
|
+
import { getDocsearchConfig as getDocSearchConfig } from '../helpers/get-docsearch-config.js';
|
|
12
|
+
import { getIssueUrl, getContributeUrl } from '../helpers/github-url.js';
|
|
7
13
|
|
|
8
|
-
const
|
|
9
|
-
const upath = require( 'upath' );
|
|
10
|
-
const { URL, resolve: urlResolve } = require( 'node:url' );
|
|
11
|
-
const beautifyHtml = require( 'js-beautify' ).html;
|
|
12
|
-
const macroReplacer = require( '../tasks/macro-replacer' );
|
|
13
|
-
const getDocSearchConfig = require( '../helpers/get-docsearch-config' );
|
|
14
|
-
const githubUrlUtils = require( '../helpers/github-url' );
|
|
14
|
+
const { html: beautifyHtml } = jsBeautify;
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
export class SdkBuilder {
|
|
17
17
|
constructor( {
|
|
18
18
|
sdkCollection,
|
|
19
19
|
template,
|
|
@@ -144,8 +144,8 @@ module.exports = class SdkBuilder {
|
|
|
144
144
|
presetVersion: sdkItem.presetVersion,
|
|
145
145
|
ckeditorVersion: this.projectConfig.version,
|
|
146
146
|
sdkSamples,
|
|
147
|
-
issuesUrl:
|
|
148
|
-
contributeUrl:
|
|
147
|
+
issuesUrl: getIssueUrl( this.projectConfig ),
|
|
148
|
+
contributeUrl: getContributeUrl( this.projectConfig, sdkGroup.sourceDir, sdkItem.name ),
|
|
149
149
|
order: sdkItem && sdkItem.meta ? sdkItem.meta.order : 0,
|
|
150
150
|
canonicalUrlBeginning: this.canonicalUrlBeginning
|
|
151
151
|
};
|
|
@@ -3,14 +3,12 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const TemplateCollection = require( '../template/template-collection' );
|
|
13
|
-
const logWithTime = require( '../helpers/log-with-time' );
|
|
6
|
+
import upath from 'upath';
|
|
7
|
+
import { readDocSources } from './read-doc-sources.js';
|
|
8
|
+
import { DataProvider } from '../data-converter/data-provider.js';
|
|
9
|
+
import { ApiBuilder } from '../api-builder/api-builder.js';
|
|
10
|
+
import { TemplateCollection } from '../template/template-collection.js';
|
|
11
|
+
import { logWithTime } from '../helpers/log-with-time.js';
|
|
14
12
|
|
|
15
13
|
/**
|
|
16
14
|
* Builds API docs.
|
|
@@ -21,7 +19,7 @@ const logWithTime = require( '../helpers/log-with-time' );
|
|
|
21
19
|
* @param config
|
|
22
20
|
* @returns {Promise<ApiBuilder>}
|
|
23
21
|
*/
|
|
24
|
-
|
|
22
|
+
export const buildApiDocs = async config => {
|
|
25
23
|
const {
|
|
26
24
|
src,
|
|
27
25
|
projectDst, // e.g.: ckeditor5/latest/api
|