umberto 10.7.0 → 10.7.2

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 CHANGED
@@ -1,6 +1,24 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## [10.7.2](https://github.com/cksource/umberto/compare/v10.7.1...v10.7.2) (July 16, 2026)
5
+
6
+ ### Other changes
7
+
8
+ * Replaced webpack with Rolldown for building theme scripts. The theme bundles are now built as ES modules with code splitting and loaded via `<script type="module">`, keeping dynamically imported dependencies (such as the shiki grammars in the Gloria theme) in separate, lazily loaded chunks. The output targets ES2022 instead of the Babel-transpiled ES5, and `webpack`, `babel-loader`, `@babel/core`, and `@babel/preset-env` are no longer dependencies of the package.
9
+
10
+
11
+ ## [10.7.1](https://github.com/cksource/umberto/compare/v10.7.0...v10.7.1) (July 15, 2026)
12
+
13
+ ### Bug fixes
14
+
15
+ * Fixed source links for CKEditor 5 packages in API documentation so they now point to the public repository. Links for the latest documentation point to the `master` branch, and links for LTS documentation point to the matching `release-v*` branch.
16
+
17
+ ### Other changes
18
+
19
+ * Improved the performance of the documentation build. Pug templates of XML components used in Markdown are now compiled once and reused across pages, instead of being recompiled for every component occurrence. This shortens the page generation phase by about 20%.
20
+
21
+
4
22
  ## [10.7.0](https://github.com/cksource/umberto/compare/v10.6.1...v10.7.0) (July 2, 2026)
5
23
 
6
24
  ### Features
@@ -39,20 +57,6 @@ Changelog
39
57
 
40
58
  * Updated the GTM integration to use the new server-side setup in both Gloria and legacy Umberto themes.
41
59
 
42
-
43
- ## [10.5.1](https://github.com/cksource/umberto/compare/v10.5.0...v10.5.1) (May 14, 2026)
44
-
45
- ### Bug fixes
46
-
47
- * Changed the call for feedback title from `<h3>` to `<div>` to prevent it from appearing in the table of contents.
48
-
49
-
50
- ## [10.5.0](https://github.com/cksource/umberto/compare/v10.4.1...v10.5.0) (April 14, 2026)
51
-
52
- ### Features
53
-
54
- * Added the Call for feedback component for documentation pages.
55
-
56
60
  ---
57
61
 
58
62
  To see all releases, visit the [release page](https://github.com/cksource/umberto/releases).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umberto",
3
- "version": "10.7.0",
3
+ "version": "10.7.2",
4
4
  "description": "CKSource Documentation builder",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -15,11 +15,8 @@
15
15
  "CHANGELOG.md"
16
16
  ],
17
17
  "dependencies": {
18
- "@babel/core": "^7.18.10",
19
- "@babel/preset-env": "^7.29.5",
20
18
  "@minify-html/node": "^0.17.1",
21
19
  "@vscode/markdown-it-katex": "^1.1.2",
22
- "babel-loader": "^10.0.0",
23
20
  "chokidar": "^4.0.3",
24
21
  "css-select": "^6.0.0",
25
22
  "dom-serializer": "^2.0.0",
@@ -41,7 +38,7 @@
41
38
  "jquery": "~3.7.1",
42
39
  "js-beautify": "^1.14.4",
43
40
  "lodash": "^4.17.21",
44
- "markdown-it": "^14.1.1",
41
+ "markdown-it": "^14.2.0",
45
42
  "markdown-it-abbr": "^1.0.4",
46
43
  "markdown-it-deflist": "^2.1.0",
47
44
  "markdown-it-emoji": "^2.0.2",
@@ -55,6 +52,7 @@
55
52
  "minimatch": "^10.0.1",
56
53
  "moment": "^2.29.4",
57
54
  "pug": "^3.0.2",
55
+ "rolldown": "^1.1.5",
58
56
  "sass": "^1.54.0",
59
57
  "shiki": "^3.4.0",
60
58
  "sitemap": "^8.0.0",
@@ -62,8 +60,7 @@
62
60
  "tinypool": "^2.0.0",
63
61
  "tippy.js": "^6.3.7",
64
62
  "tree-model": "^1.0.7",
65
- "upath": "^2.0.1",
66
- "webpack": "^5.94.0"
63
+ "upath": "^2.0.1"
67
64
  },
68
65
  "engines": {
69
66
  "node": ">=24.11.0"
@@ -76,6 +73,6 @@
76
73
  ]
77
74
  },
78
75
  "hexo": {
79
- "version": "8.1.1"
76
+ "version": "8.1.2"
80
77
  }
81
78
  }
@@ -9,6 +9,39 @@ const transformXMLTreeToPug = require( './transform-xml-tree-to-pug.cjs' );
9
9
  const XMLComponentsParser = require( './parser/xml-components-parser.cjs' );
10
10
  const { walkXMLTree, TreeWalkActions } = require( './parser/walk-xml-tree.cjs' );
11
11
 
12
+ // Compiled Pug templates of component mixin calls, keyed by the generated template text.
13
+ // Compiling a template is expensive because Pug lexes and parses the whole `include` tree
14
+ // on every compilation, and the same mixin calls repeat across pages. The compiled function
15
+ // is not bound to any locals, so it can be safely reused with per-page locals.
16
+ //
17
+ // The cache lives for the whole process, like the cache in `createPrerenderPugTemplate()`,
18
+ // so changes to component Pug files require a restart in the watch mode.
19
+ const compiledTemplateCache = new Map();
20
+
21
+ /**
22
+ * Compiles a Pug template through the Hexo Pug renderer, reusing previously compiled templates.
23
+ *
24
+ * Falls back to `null` when the renderer does not support compilation, in which case the caller
25
+ * should render through `hexo.render.renderSync()`.
26
+ */
27
+ function getCompiledPugTemplate( hexo, text, path ) {
28
+ const cacheKey = `${ path }\n${ text }`;
29
+ let template = compiledTemplateCache.get( cacheKey );
30
+
31
+ if ( !template ) {
32
+ const pugRenderer = hexo.render.renderer?.get( 'pug' );
33
+
34
+ if ( !pugRenderer?.compile ) {
35
+ return null;
36
+ }
37
+
38
+ template = pugRenderer.compile( { text, path } );
39
+ compiledTemplateCache.set( cacheKey, template );
40
+ }
41
+
42
+ return template;
43
+ }
44
+
12
45
  /**
13
46
  * Slices XML components from Markdown content and transforms them to Pug format.
14
47
  *
@@ -93,14 +126,18 @@ function renderXMLPugComponentsInMarkdown( xml, options ) {
93
126
  let finalReplacement = null;
94
127
 
95
128
  try {
96
- finalReplacement = hexo.render.renderSync(
97
- {
98
- engine: 'pug',
99
- text: content,
100
- path: basePath
101
- },
102
- locals
103
- ).trim();
129
+ const template = getCompiledPugTemplate( hexo, content, basePath );
130
+
131
+ finalReplacement = template ?
132
+ template( locals ).trim() :
133
+ hexo.render.renderSync(
134
+ {
135
+ engine: 'pug',
136
+ text: content,
137
+ path: basePath
138
+ },
139
+ locals
140
+ ).trim();
104
141
  } catch ( error ) {
105
142
  console.error( error );
106
143
  console.error( `Error rendering component "${ node.name }" in file ${ sourceName }` );
@@ -19,6 +19,7 @@ import { getShortModulePath } from '../helpers/get-short-module-path.js';
19
19
  import { getDocsearchConfig as getDocSearchConfig } from '../helpers/get-docsearch-config.js';
20
20
  import { splitLongname } from '../helpers/split-longname.js';
21
21
  import { getIssueUrl, getFullGithubLink } from '../helpers/github-url.js';
22
+ import { rewritePublicSourceUrl } from '../helpers/rewrite-public-source-url.js';
22
23
  import getReportIssueWidgetUrl from '../../scripts/utils/getreportissuewidgeturl.cjs';
23
24
  import { randomId } from '../../scripts/utils/random-id.cjs';
24
25
  import parseHref from '../../scripts/utils/parse-href.cjs';
@@ -521,6 +522,7 @@ export class ApiBuilder {
521
522
  groups,
522
523
  seeSourceRepositoryUrl: this._projectConfig.github !== undefined ? this._projectConfig.github.url : realImportPath,
523
524
  getLinkToSource: getFullGithubLink.bind( this ),
525
+ rewritePublicSourceUrl: url => rewritePublicSourceUrl( url, this._projectConfig.ckeditor5SourceLinkBranch ),
524
526
  docSearchConfig: getDocSearchConfig( this._docSearch, {
525
527
  groups: this._groups,
526
528
  slug: this._projectSlug,
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @license Copyright (c) 2017-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+
6
+ /**
7
+ * Rewrites CKEditor 5 public package source links generated from the commercial repository checkout.
8
+ *
9
+ * @param {String} sourceUrl
10
+ * @param {String} sourceBranch
11
+ * @returns {String}
12
+ */
13
+ export function rewritePublicSourceUrl( sourceUrl, sourceBranch ) {
14
+ if ( !sourceUrl || !sourceBranch ) {
15
+ return sourceUrl;
16
+ }
17
+
18
+ let url;
19
+
20
+ try {
21
+ url = new URL( sourceUrl );
22
+ } catch {
23
+ return sourceUrl;
24
+ }
25
+
26
+ if ( url.hostname !== 'github.com' ) {
27
+ return sourceUrl;
28
+ }
29
+
30
+ const match = url.pathname.match( /^\/[^/]+\/ckeditor5-commercial\/blob\/[^/]+\/external\/ckeditor5\/(.+)$/ );
31
+
32
+ if ( !match ) {
33
+ return sourceUrl;
34
+ }
35
+
36
+ return [
37
+ 'https://github.com/ckeditor/ckeditor5',
38
+ 'blob',
39
+ sourceBranch,
40
+ match[ 1 ]
41
+ ].join( '/' ) + url.search + url.hash;
42
+ }
package/src/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  import { styleText } from 'node:util';
7
7
  import upath from 'upath';
8
8
  import { compileSass } from './tasks/compile-sass.js';
9
- import { runWebpack } from './tasks/run-webpack.js';
9
+ import { prepareLayoutScripts } from './tasks/prepare-layout-scripts.js';
10
10
  import { copyAssets } from './tasks/copy-assets.js';
11
11
  import { getMainConfig } from './tasks/get-main-config.js';
12
12
  import { createSymLinks } from './tasks/create-sym-links.js';
@@ -102,12 +102,12 @@ async function buildThemes( outputDir, options ) {
102
102
  const layoutThemes = [ 'umberto', 'gloria' ];
103
103
 
104
104
  for ( const theme of layoutThemes ) {
105
- await runWebpack(
105
+ await prepareLayoutScripts(
106
106
  upath.join( sourceDir, theme, 'js/app.js' ),
107
107
  upath.join( outputAssetsPath, theme, 'scripts' ),
108
108
  {
109
+ theme,
109
110
  minify: !options.dev,
110
- umbertoDir: themesDir,
111
111
  version
112
112
  }
113
113
  );
@@ -92,6 +92,7 @@ export const getProjectConfig = async ( rootPath, options = {} ) => {
92
92
  validateConfiguration( config );
93
93
 
94
94
  config.version = getProjectVersion( rootPath );
95
+ config.ckeditor5SourceLinkBranch = getCKEditor5SourceLinkBranch( rootPath, config );
95
96
 
96
97
  parseGitHubUrls( config, rootPath );
97
98
 
@@ -304,6 +305,44 @@ function getProjectVersion( rootPath ) {
304
305
  return version || 'latest';
305
306
  }
306
307
 
308
+ /**
309
+ * Returns CKEditor 5 source link branch based on LTS metadata from `package.json`.
310
+ *
311
+ * @param {String} rootPath
312
+ * @param {Object} config
313
+ * @param {String} config.slug
314
+ * @param {String} config.version
315
+ * @return {String|undefined}
316
+ */
317
+ function getCKEditor5SourceLinkBranch( rootPath, config ) {
318
+ if ( config.slug !== 'ckeditor5' ) {
319
+ return;
320
+ }
321
+
322
+ const packageJson = getPackageJson( rootPath );
323
+ const ltsVersions = packageJson ? packageJson[ 'ck-lts-versions' ] : null;
324
+ const releaseLine = getReleaseLine( config.version );
325
+ const ltsReleaseLines = Array.isArray( ltsVersions ) ? ltsVersions.map( Number ) : null;
326
+
327
+ if ( !ltsReleaseLines || releaseLine === null ) {
328
+ return;
329
+ }
330
+
331
+ const isLtsVersion = ltsReleaseLines.includes( releaseLine );
332
+
333
+ return isLtsVersion ? `release-v${ releaseLine }` : 'master';
334
+ }
335
+
336
+ /**
337
+ * @param {String} version
338
+ * @return {Number|null}
339
+ */
340
+ function getReleaseLine( version ) {
341
+ const match = version.match( /^(\d+)\./ );
342
+
343
+ return match ? Number( match[ 1 ] ) : null;
344
+ }
345
+
307
346
  /**
308
347
  * Tries to find a URL to the repository based on the value in `package.json`, under the "repository" object.
309
348
  *
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @license Copyright (c) 2017-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+
6
+ import upath from 'upath';
7
+ import { build } from 'rolldown';
8
+
9
+ export const prepareLayoutScripts = async ( sourceFile, destinationDirectory, {
10
+ theme,
11
+ minify = true,
12
+ outputFileName = 'app.js',
13
+ version,
14
+ basePath = '/docs'
15
+ } = {} ) => {
16
+ console.log( `Preparing layout scripts ("${ outputFileName }") for the "${ theme }" theme...` );
17
+
18
+ await build( {
19
+ input: upath.resolve( sourceFile ),
20
+ transform: {
21
+ target: 'es2022',
22
+ define: {
23
+ VERSION: JSON.stringify( version ),
24
+ BASE_PATH: JSON.stringify( basePath )
25
+ }
26
+ },
27
+ output: {
28
+ dir: upath.resolve( destinationDirectory ),
29
+ // The bundles are loaded via `<script type="module">`, so dynamically imported dependencies
30
+ // (e.g. the shiki grammars) are emitted as separate chunks loaded on demand instead of being
31
+ // inlined into the entry bundle.
32
+ format: 'es',
33
+ entryFileNames: outputFileName,
34
+ chunkFileNames: 'app.[hash].js',
35
+ minify,
36
+ sourcemap: !minify
37
+ }
38
+ } );
39
+ };
@@ -28,4 +28,4 @@ html(lang='en')
28
28
  .l-layout__main
29
29
  +not-found
30
30
 
31
- script(src=`/docs/assets/${umbertoVersion}/gloria/scripts/app.js`)
31
+ script(type='module', src=`/docs/assets/${umbertoVersion}/gloria/scripts/app.js`)
@@ -1,7 +1,8 @@
1
1
  mixin seeSource( item )
2
2
  //- Do not render "See source" button if the module or the parsed item (e.g. a function) has the `@skipsource` annotation
3
3
  if ( projectLocals.seeSourceRepositoryUrl && item.file && !( data.skipSource || item.skipSource ) )
4
- - const link = item.file.url || projectLocals.getLinkToSource( projectLocals.seeSourceRepositoryUrl, item.file );
4
+ - const sourceLink = item.file.url || projectLocals.getLinkToSource( projectLocals.seeSourceRepositoryUrl, item.file );
5
+ - const link = projectLocals.rewritePublicSourceUrl( sourceLink );
5
6
 
6
7
  if link
7
8
  .see-source
@@ -12,7 +12,7 @@ mixin head-preloads()
12
12
  { type: 'font', path: 'fonts/Mulish/Mulish-Italic-VariableFont_wght.woff2' },
13
13
 
14
14
  // Scripts
15
- { type: 'script', path: 'scripts/app.js' }
15
+ { type: 'module', path: 'scripts/app.js' }
16
16
  ];
17
17
 
18
18
  //- Preconnect to CDN
@@ -24,6 +24,8 @@ mixin head-preloads()
24
24
 
25
25
  if resource.type === 'font'
26
26
  link(rel='preload', href=url, as=resource.type, crossorigin='anonymous')
27
+ else if resource.type === 'module'
28
+ link(rel='modulepreload', href=url)
27
29
  else
28
30
  link(rel='preload', href=url, as=resource.type)
29
31
 
@@ -56,7 +56,16 @@ if kapa
56
56
  if sentry
57
57
  +load-sentry-script(sentry)
58
58
 
59
- script(src=relative_url(page.path, pathJoin( 'assets', umbertoVersion, 'gloria/scripts/app.js')))
59
+ //- `app.js` is a module script, so it executes only after the document is parsed. This bootstrap queue lets
60
+ //- classic scripts that run during parsing register `window.umberto.afterReady()` callbacks anyway. The full
61
+ //- public API (`src/gloria/js/public-api.js`) merges into this object once the module executes.
62
+ script.
63
+ window.umberto = {
64
+ afterReady( callback ) {
65
+ ( this._afterReadyCallbacks = this._afterReadyCallbacks || [] ).push( callback );
66
+ }
67
+ };
68
+ script(type='module', src=relative_url(page.path, pathJoin( 'assets', umbertoVersion, 'gloria/scripts/app.js')))
60
69
 
61
70
  if page.BASE_PATH
62
71
  //- When a project does not define its own assets, let's use the default ones (from a theme).
@@ -32,7 +32,7 @@ html( lang='en' )
32
32
  include _partial/footer
33
33
  include _partial/docsearch
34
34
 
35
- script( src = relative_url( page.path, pathJoin( 'assets', umbertoVersion, 'umberto/scripts/app.js' ) ) )
35
+ script( type = 'module', src = relative_url( page.path, pathJoin( 'assets', umbertoVersion, 'umberto/scripts/app.js' ) ) )
36
36
 
37
37
  if page.isSnippetPage
38
38
  //UMBERTO: SNIPPET: JS
@@ -19,8 +19,11 @@ import { injectStylesheet } from './helpers/inject-stylesheet.js';
19
19
  import { injectResourcePreload } from './helpers/inject-resource-preload.js';
20
20
  import { onDropdownSelection, selectDropdownItem } from './components/dropdown.js';
21
21
 
22
- window.umberto = {
23
- // The `VERSION` value will be replaced by the `DefinePlugin` webpack plugin.
22
+ // The `window.umberto` object may already exist: a bootstrap script in the page `<head>` creates it so that
23
+ // classic scripts executed while the document is still being parsed (before this module runs) can queue
24
+ // `afterReady()` callbacks. Merge into that object to preserve the queued callbacks.
25
+ window.umberto = Object.assign( window.umberto || {}, {
26
+ // The `VERSION` value will be replaced at build time.
24
27
  version: VERSION, // eslint-disable-line no-undef
25
28
 
26
29
  // Tooltips public API
@@ -72,4 +75,4 @@ window.umberto = {
72
75
 
73
76
  this._afterReadyCallbacks.push( callback );
74
77
  }
75
- };
78
+ } );
@@ -31,7 +31,7 @@ if ( localStorage.getItem( 'theme' ) === 'theme-dark' ) {
31
31
 
32
32
  // Set up the global variable.
33
33
  window.umberto = {
34
- // The `VERSION` value will be replaced by the `DefinePlugin` webpack plugin.
34
+ // The `VERSION` value will be replaced at build time.
35
35
  version: VERSION, // eslint-disable-line no-undef
36
36
  showWarningBanner,
37
37
  createTooltip
@@ -1,88 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2017-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md.
4
- */
5
-
6
- import upath from 'upath';
7
- import { createRequire } from 'node:module';
8
- import webpack from 'webpack';
9
-
10
- const require = createRequire( import.meta.url );
11
-
12
- export const runWebpack = ( sourceFile, destinationFile, {
13
- minify = true,
14
- outputFileName = 'app.js',
15
- umbertoDir,
16
- version,
17
- basePath = '/docs'
18
- } = {} ) => {
19
- const webpackConfig = {
20
- context: umbertoDir,
21
-
22
- mode: minify ? 'production' : 'development',
23
-
24
- entry: upath.resolve( sourceFile ),
25
-
26
- output: {
27
- filename: outputFileName,
28
- path: upath.resolve( destinationFile )
29
- },
30
-
31
- target: 'web',
32
-
33
- optimization: {
34
- minimize: minify
35
- },
36
-
37
- // Increased the size of the allowed assets two times to hide the warning in the console.
38
- performance: {
39
- hints: false,
40
- maxEntrypointSize: 500000,
41
- maxAssetSize: 500000
42
- },
43
-
44
- plugins: [
45
- new webpack.DefinePlugin( {
46
- VERSION: `"${ version }"`,
47
- BASE_PATH: JSON.stringify( basePath )
48
- } )
49
- ],
50
-
51
- module: {
52
- rules: [
53
- {
54
- test: /\.js$/,
55
- use: {
56
- loader: 'babel-loader',
57
- options: {
58
- presets: [
59
- require.resolve( '@babel/preset-env' )
60
- ]
61
-
62
- }
63
- }
64
- }
65
- ]
66
- }
67
- };
68
-
69
- if ( !minify ) {
70
- webpackConfig.devtool = 'source-map';
71
- }
72
-
73
- return new Promise( ( resolve, reject ) => {
74
- console.log( `Running webpack for "${ outputFileName }"...` );
75
-
76
- webpack( webpackConfig, ( err, stats ) => {
77
- if ( err ) {
78
- reject( err );
79
- } else if ( stats.hasErrors() ) {
80
- reject( new Error( stats.toString() ) );
81
- } else {
82
- console.log( '[Webpack]', stats.toString( 'minimal' ) );
83
-
84
- resolve();
85
- }
86
- } );
87
- } );
88
- };