@redpanda-data/docs-extensions-and-macros 5.22.2 → 5.22.3

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.
@@ -60,9 +60,9 @@
60
60
  */
61
61
 
62
62
  const yaml = require('js-yaml')
63
- const chalk = require('chalk')
64
63
  const semver = require('semver')
65
64
  const { buildBadgeHtml, DEFAULT_TOOLTIPS } = require('./badge')
65
+ const logger = require('@antora/logger')('enterprise-macro')
66
66
 
67
67
  const $enterpriseRegistry = Symbol('$enterpriseRegistry')
68
68
  const $enterpriseRegistryUnreadable = Symbol('$enterpriseRegistryUnreadable')
@@ -76,7 +76,7 @@ function warnOnce (contentCatalog, key, message) {
76
76
  const seen = contentCatalog[$warned] || (contentCatalog[$warned] = new Set())
77
77
  if (seen.has(key)) return false
78
78
  seen.add(key)
79
- console.warn(chalk.yellow(message))
79
+ logger.warn(message)
80
80
  return true
81
81
  }
82
82
 
@@ -143,7 +143,7 @@ function entryStatus (entry, report) {
143
143
  // One registry typo needs one fix, so report it once per build rather
144
144
  // than once per mention of the feature.
145
145
  if (report.contentCatalog) warnOnce(report.contentCatalog, `status:${entry.name}`, message)
146
- else console.warn(chalk.yellow(message))
146
+ else logger.warn(message)
147
147
  }
148
148
  return STATUS_UNRELEASED
149
149
  }
@@ -167,9 +167,9 @@ function isPrereleasePage (config, document) {
167
167
  // Anything else is a typo. Falling through to the catalog is safer than
168
168
  // guessing, and silently treating it as "released" produced a warning that
169
169
  // told the writer their prerelease page belonged to a released version.
170
- console.warn(chalk.yellow(
170
+ logger.warn(
171
171
  `enterprise macro: page-component-version-is-prerelease is '${attribute}', which is neither true nor false, so it is ignored and the component version's own prerelease flag is used instead.`
172
- ))
172
+ )
173
173
  }
174
174
  const contentCatalog = config && config.contentCatalog
175
175
  const src = config && config.file && config.file.src
@@ -215,7 +215,7 @@ function reportUnreleasedFeature ({ feature, mode, filePath }) {
215
215
  'This page belongs to a released version, so the mention renders as plain text with no enterprise styling, tooltip, or link. ' +
216
216
  'Move the mention to the prerelease (beta) branch, or change the status once the feature ships.'
217
217
  if (mode === 'error') throw new Error(message)
218
- console.warn(chalk.yellow(message))
218
+ logger.warn(message)
219
219
  }
220
220
 
221
221
  /**
@@ -268,7 +268,7 @@ function isFeatureShippedOnPage (entry, config, report) {
268
268
  `enterprise:${entry.name}[]${where}: registry has since: '${since}', which is not a parsable version, so the since-gating check is skipped and the feature renders as already shipped. ` +
269
269
  'Fix the since value in enterprise-features.yml (e.g. "26.3"), or remove the key if the feature has always been available.'
270
270
  if (report.contentCatalog) warnOnce(report.contentCatalog, `since:${entry.name}`, message)
271
- else console.warn(chalk.yellow(message))
271
+ else logger.warn(message)
272
272
  }
273
273
  return true
274
274
  }
@@ -290,7 +290,7 @@ function reportFeatureNotYetShipped ({ feature, since, pageVersion, mode, filePa
290
290
  'The mention renders as plain text with no enterprise styling, tooltip, or link. ' +
291
291
  'Move the mention to a page whose version is at or after the since version, or remove since if the feature covers this version too.'
292
292
  if (mode === 'error') throw new Error(message)
293
- console.warn(chalk.yellow(message))
293
+ logger.warn(message)
294
294
  }
295
295
 
296
296
  /**
@@ -418,7 +418,7 @@ function warnNoRegistry (contentCatalog) {
418
418
  if (contentCatalog) return warnOnce(contentCatalog, 'noregistry', message)
419
419
  if (warnedNoRegistry) return
420
420
  warnedNoRegistry = true
421
- console.warn(chalk.yellow(message))
421
+ logger.warn(message)
422
422
  }
423
423
 
424
424
  /**
@@ -434,7 +434,7 @@ function reportUnknownFeature ({ feature, mode, registry, filePath }) {
434
434
  const where = filePath ? ` in ${filePath}` : ''
435
435
  const message = `enterprise:${feature}[] does not match any feature in the enterprise features registry${where}.${hint} Add the feature to ${REGISTRY_FILENAME} in the shared component first.`
436
436
  if (mode === 'error') throw new Error(message)
437
- console.warn(chalk.yellow(message))
437
+ logger.warn(message)
438
438
  }
439
439
 
440
440
  /**
@@ -468,7 +468,7 @@ function resolveTooltipAttribute (raw) {
468
468
  if (raw === undefined || raw === 'title') return 'title'
469
469
  if (raw === 'true') return 'data-enterprise-tooltip'
470
470
  if (raw.startsWith('data-')) return raw
471
- console.warn(`enterprise-tooltip attribute '${raw}' must be 'title', 'true', 'false', or start with 'data-'. Falling back to 'title'.`)
471
+ logger.warn(`enterprise-tooltip attribute '${raw}' must be 'title', 'true', 'false', or start with 'data-'. Falling back to 'title'.`)
472
472
  return 'title'
473
473
  }
474
474
 
@@ -690,7 +690,7 @@ function register (registry, config = {}) {
690
690
  registry.inlineMacro(enterpriseInlineMacro(config))
691
691
  if (typeof registry.blockMacro === 'function') registry.blockMacro(enterpriseFeaturesBlockMacro(config))
692
692
  } else {
693
- console.warn("no 'inlineMacro' method on alleged registry")
693
+ logger.warn("no 'inlineMacro' method on alleged registry")
694
694
  }
695
695
  return registry
696
696
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  const $glossaryContexts = Symbol('$glossaryContexts')
4
4
  const { posix: path } = require('path')
5
- const chalk = require('chalk')
5
+ const logger = require('@antora/logger')('glossary-macro')
6
6
 
7
7
  // Backtick-monospace in hover-text. The unconstrained (double-backtick) form is
8
8
  // matched first, otherwise it leaves a stray delimiter on each side.
@@ -96,7 +96,7 @@ module.exports.register = function (registry, config = {}) {
96
96
  }
97
97
 
98
98
  if (!attributes['term-name'] || !attributes['hover-text']) {
99
- console.warn(`Skipping term ${file.path} due to missing 'term-name' and/or 'hover-text attributes'.`)
99
+ logger.warn(`Skipping term ${file.path} due to missing 'term-name' and/or 'hover-text attributes'.`)
100
100
  return null
101
101
  }
102
102
 
@@ -169,7 +169,7 @@ module.exports.register = function (registry, config = {}) {
169
169
  var tooltip = document.getAttribute('glossary-tooltip')
170
170
  if (tooltip === 'true') tooltip = 'data-glossary-tooltip'
171
171
  if (tooltip && tooltip !== 'title' && !tooltipRendersHtml(tooltip)) {
172
- console.log(`glossary-tooltip attribute '${tooltip}' must be 'true', 'title', or start with 'data-`)
172
+ logger.warn(`glossary-tooltip attribute '${tooltip}' must be 'true', 'title', or start with 'data-`)
173
173
  tooltip = undefined
174
174
  }
175
175
  const logTerms = document.hasAttribute('glossary-log-terms')
@@ -188,7 +188,7 @@ module.exports.register = function (registry, config = {}) {
188
188
  definitionIsHtml = !!definition;
189
189
  }
190
190
  if (definition) {
191
- logTerms && console.log(`${term}:: ${definition}`)
191
+ logTerms && logger.info(`${term}:: ${definition}`)
192
192
  } else if (tooltip) {
193
193
  definition = `${term} not yet defined`
194
194
  }
@@ -232,7 +232,7 @@ module.exports.register = function (registry, config = {}) {
232
232
  if (typeof registry.inlineMacro === 'function') {
233
233
  registry.inlineMacro(glossaryInlineMacro())
234
234
  } else {
235
- console.warn('no \'inlineMacro\' method on alleged registry')
235
+ logger.warn('no \'inlineMacro\' method on alleged registry')
236
236
  }
237
237
  }
238
238
 
package/macros/prop.js CHANGED
@@ -90,8 +90,8 @@
90
90
  * - '@redpanda-data/docs-extensions-and-macros/macros/prop'
91
91
  */
92
92
 
93
- const chalk = require('chalk')
94
93
  const semver = require('semver')
94
+ const logger = require('@antora/logger')('prop-macro')
95
95
 
96
96
  const $propertyRegistry = Symbol('$propertyRegistry')
97
97
  // Release series a component version has no property data for, recorded at
@@ -236,7 +236,7 @@ function buildPageIndex (contentCatalog, component, properties, version) {
236
236
  return head.startsWith('<') && !head.startsWith('<<') && /^<[a-zA-Z!/]/.test(head)
237
237
  }
238
238
  if (pages.some(looksConverted)) {
239
- console.warn(chalk.yellow(`prop macro: building the property page index for ${component}@${version || 'any'} after conversion started; some pages are already HTML and their properties may not be indexed. Register '@redpanda-data/docs-extensions-and-macros/extensions/property-page-index' under antora.extensions to build the index up front.`))
239
+ logger.warn(`prop macro: building the property page index for ${component}@${version || 'any'} after conversion started; some pages are already HTML and their properties may not be indexed. Register '@redpanda-data/docs-extensions-and-macros/extensions/property-page-index' under antora.extensions to build the index up front.`)
240
240
  }
241
241
  // A page can declare that it is the reference for a named collection of
242
242
  // properties:
@@ -404,7 +404,7 @@ function warnOnce (contentCatalog, key, message) {
404
404
  const seen = contentCatalog[$warned] || (contentCatalog[$warned] = new Set())
405
405
  if (seen.has(key)) return false
406
406
  seen.add(key)
407
- console.warn(chalk.yellow(message))
407
+ logger.warn(message)
408
408
  return true
409
409
  }
410
410
 
@@ -774,7 +774,7 @@ function reportUnknownProperty ({ name, mode, registry, filePath }) {
774
774
  const message = `prop:${name}[]${where}: '${name}' is not in the property data this page validates against (${describeDataset(registry)}). ` +
775
775
  `Either the name is misspelled or the property does not exist in that release.${hint}`
776
776
  if (mode === 'error') throw new Error(message)
777
- console.warn(chalk.yellow(message))
777
+ logger.warn(message)
778
778
  }
779
779
 
780
780
  /**
@@ -799,11 +799,11 @@ function reportUnavailableProperty ({ name, component, registry, mode, filePath
799
799
  if (mode === 'off') return
800
800
  const where = filePath ? ` in ${filePath}` : ''
801
801
  const which = component || 'this'
802
- console.warn(chalk.yellow(
802
+ logger.warn(
803
803
  `prop:${name}[]${where}: '${name}' is not available in the ${which} component, so it renders as plain code -- no link, and no tooltip. ` +
804
804
  `${describeDataset(registry)} marks it cloud_supported: false, meaning Redpanda has the property but this audience cannot set it. ` +
805
805
  'If that is wrong, fix cloud_supported in the property extractor; if it is right, reword the sentence and drop the macro.'
806
- ))
806
+ )
807
807
  }
808
808
 
809
809
  /**
@@ -814,11 +814,11 @@ function reportUnavailableProperty ({ name, component, registry, mode, filePath
814
814
  function reportUnpublishedProperty ({ name, registry, mode, filePath }) {
815
815
  if (mode === 'off') return
816
816
  const where = filePath ? ` in ${filePath}` : ''
817
- console.warn(chalk.yellow(
817
+ logger.warn(
818
818
  `prop:${name}[link=true]${where}: '${name}' is in ${describeDataset(registry)} but no reference page in this component renders a heading for it, so it keeps its tooltip and renders without a link. ` +
819
819
  'Every property reference page filters out the deprecated and exclude-from-docs include tags, and some include only selected category tags -- check which tags enclose this property in the generated partial. ' +
820
820
  'If it is meant to stay unpublished, drop link=true.'
821
- ))
821
+ )
822
822
  }
823
823
 
824
824
  /**
@@ -1000,7 +1000,7 @@ function register (registry, config = {}) {
1000
1000
  } else if (typeof registry.inlineMacro === 'function') {
1001
1001
  registry.inlineMacro(propInlineMacro(config))
1002
1002
  } else {
1003
- console.warn("no 'inlineMacro' method on alleged registry")
1003
+ logger.warn("no 'inlineMacro' method on alleged registry")
1004
1004
  }
1005
1005
  return registry
1006
1006
  }
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
  const { posix: path } = require('path')
3
+ const logger = require('@antora/logger')('rp-connect-components-macro')
3
4
 
4
5
  /**
5
6
  * Registers macros for use in Redpanda Connect contexts in the Redpanda documentation.
@@ -602,7 +603,7 @@ module.exports.register = function (registry, context) {
602
603
  const showAllInfo = attributes?.all
603
604
 
604
605
  const csvData = context.config?.attributes?.csvData || null;
605
- if (!csvData) return console.error(`CSV data is not available for ${parent.getDocument().getAttributes()['page-relative-src-path']}. Make sure your playbook includes the generate-rp-connect-info extension.`)
606
+ if (!csvData) return logger.error(`CSV data is not available for ${parent.getDocument().getAttributes()['page-relative-src-path']}. Make sure your playbook includes the generate-rp-connect-info extension.`)
606
607
 
607
608
  // Get the enriched commercial names map (includes CSV + AsciiDoc names)
608
609
  const commercialNamesMap = context.config?.attributes?.commercialNamesMap || {};
@@ -1022,11 +1023,11 @@ module.exports.register = function (registry, context) {
1022
1023
  return self.createBlock(parent, 'pass', '');
1023
1024
  }
1024
1025
  const csvData = context.config?.attributes?.csvData || null;
1025
- if (!csvData) return console.error(`CSV data is not available for ${attributes['page-relative-src-path']}. Make sure your playbook includes the generate-rp-connect-info extension.`);
1026
+ if (!csvData) return logger.error(`CSV data is not available for ${attributes['page-relative-src-path']}. Make sure your playbook includes the generate-rp-connect-info extension.`);
1026
1027
  // Filter for the specific connector by name
1027
1028
  const componentRows = csvData.data.filter(row => row.connector.trim().toLowerCase() === name.trim().toLowerCase());
1028
1029
  if (componentRows.length === 0) {
1029
- console.warn(`No CSV data found for connector: ${name}. The connector may have been removed or renamed.`);
1030
+ logger.warn(`No CSV data found for connector: ${name}. The connector may have been removed or renamed.`);
1030
1031
  // Build link to release notes using content catalog for proper URL resolution
1031
1032
  const isCloud = attributes['env-cloud'] !== undefined;
1032
1033
  let whatsNewUrl = isCloud
@@ -1092,7 +1093,7 @@ module.exports.register = function (registry, context) {
1092
1093
  self.process((parent, target, attrs) => {
1093
1094
  const type = attrs.type;
1094
1095
  const categoriesData = context.config?.attributes?.connectCategoriesData || null
1095
- if (!categoriesData) return console.error (`Category data is not available for ${parent.getDocument().getAttributes()['page-relative-src-path']}. Make sure your playbook includes the generate-rp-connect-categories extension.`)
1096
+ if (!categoriesData) return logger.error(`Category data is not available for ${parent.getDocument().getAttributes()['page-relative-src-path']}. Make sure your playbook includes the generate-rp-connect-categories extension.`)
1096
1097
  const categories = categoriesData[type] || null;
1097
1098
  const currentTabsId = `tabs-${tabsCounter++}`; // Unique ID for this set of tabs
1098
1099
  if (!categories) return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redpanda-data/docs-extensions-and-macros",
3
- "version": "5.22.2",
3
+ "version": "5.22.3",
4
4
  "description": "Antora extensions and macros developed for Redpanda documentation.",
5
5
  "keywords": [
6
6
  "antora",
@@ -159,6 +159,7 @@
159
159
  "jest-junit": "^16.0.0"
160
160
  },
161
161
  "peerDependencies": {
162
- "@antora/asciidoc-loader": "^3.1.0"
162
+ "@antora/asciidoc-loader": "^3.1.0",
163
+ "@antora/logger": "^3.1.0"
163
164
  }
164
165
  }