@redpanda-data/docs-extensions-and-macros 4.6.7 → 4.6.9

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/bin/doc-tools.js CHANGED
@@ -234,20 +234,83 @@ For more details, visit: https://github.com/norwoodj/helm-docs
234
234
  /**
235
235
  * Ensures all dependencies required for generating property documentation are installed.
236
236
  *
237
- * Checks for the presence of `make`, Python 3.10 or newer, and at least one C++ compiler (`gcc` or `clang`). Exits the process with an error message if any dependency is missing.
237
+ * Checks for the presence of `make`, Python 3.10 or newer, C++ compiler, and C++ standard library headers.
238
+ * Exits the process with an error message if any dependency is missing.
238
239
  */
239
240
  function verifyPropertyDependencies() {
240
241
  requireCmd('make', 'Your OS package manager');
241
242
  requirePython();
243
+
244
+ // Check for C++ compiler
245
+ let cppCompiler = null;
242
246
  try {
243
247
  execSync('gcc --version', { stdio: 'ignore' });
248
+ cppCompiler = 'gcc';
244
249
  } catch {
245
250
  try {
246
251
  execSync('clang --version', { stdio: 'ignore' });
252
+ cppCompiler = 'clang';
247
253
  } catch {
248
- fail('A C++ compiler (gcc or clang) is required.');
254
+ fail(`A C++ compiler (gcc or clang) is required for tree-sitter compilation.
255
+
256
+ On macOS, install Xcode Command Line Tools:
257
+ xcode-select --install
258
+
259
+ On Linux (Ubuntu/Debian):
260
+ sudo apt update && sudo apt install build-essential
261
+
262
+ On Linux (CentOS/RHEL/Fedora):
263
+ sudo yum groupinstall "Development Tools"
264
+ # or on newer versions:
265
+ sudo dnf groupinstall "Development Tools"
266
+
267
+ After installation, verify with:
268
+ gcc --version
269
+ # or
270
+ clang --version`);
249
271
  }
250
272
  }
273
+
274
+ // Check for C++ standard library headers (critical for tree-sitter compilation)
275
+ let tempDir = null;
276
+ try {
277
+ const testProgram = '#include <functional>\nint main() { return 0; }';
278
+ tempDir = require('fs').mkdtempSync(require('path').join(require('os').tmpdir(), 'cpp-test-'));
279
+ const tempFile = require('path').join(tempDir, 'test.cpp');
280
+ require('fs').writeFileSync(tempFile, testProgram);
281
+
282
+ const compileCmd = cppCompiler === 'gcc' ? 'gcc' : 'clang++';
283
+ execSync(`${compileCmd} -x c++ -fsyntax-only "${tempFile}"`, { stdio: 'ignore' });
284
+ require('fs').rmSync(tempDir, { recursive: true, force: true });
285
+ } catch {
286
+ // Clean up temp directory if it was created
287
+ if (tempDir) {
288
+ try {
289
+ require('fs').rmSync(tempDir, { recursive: true, force: true });
290
+ } catch {
291
+ // Ignore cleanup errors
292
+ }
293
+ }
294
+ fail(`C++ standard library headers are missing or incomplete.
295
+
296
+ This error typically means:
297
+ 1. No C++ compiler is installed, OR
298
+ 2. Xcode Command Line Tools are missing/incomplete
299
+
300
+ To fix this on macOS:
301
+ 1. Install Xcode Command Line Tools:
302
+ xcode-select --install
303
+
304
+ 2. If already installed, reset the developer path:
305
+ sudo xcode-select --reset
306
+
307
+ 3. For Xcode users, ensure correct path:
308
+ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
309
+
310
+ 4. Verify the fix:
311
+ echo '#include <functional>' | \${cppCompiler || 'clang++'} -x c++ -fsyntax-only -
312
+ `);
313
+ }
251
314
  }
252
315
 
253
316
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redpanda-data/docs-extensions-and-macros",
3
- "version": "4.6.7",
3
+ "version": "4.6.9",
4
4
  "description": "Antora extensions and macros developed for Redpanda documentation.",
5
5
  "keywords": [
6
6
  "antora",
@@ -77,6 +77,10 @@ treesitter:
77
77
  @if [ ! -d "$(TREESITTER_DIR)" ]; then \
78
78
  git clone https://github.com/tree-sitter/tree-sitter-cpp.git "$(TREESITTER_DIR)"; \
79
79
  fi
80
+ @echo "🔄 Ensuring tree-sitter-cpp is at compatible version v0.20.5…"
81
+ @cd "$(TREESITTER_DIR)" && \
82
+ git fetch --tags -q && \
83
+ git checkout -q v0.20.5
80
84
  @echo "🔧 Generating parser in $(TREESITTER_DIR)…"
81
85
  @cd "$(TREESITTER_DIR)" && npm install --silent && $(TREE_SITTER) generate
82
86