@ox-content/napi 2.64.0 → 2.66.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.
Files changed (3) hide show
  1. package/index.d.ts +6 -0
  2. package/index.js +30 -2
  3. package/package.json +6 -6
package/index.d.ts CHANGED
@@ -474,6 +474,8 @@ export interface JsDocsMarkdownOptions {
474
474
  * sort strategy.
475
475
  */
476
476
  kindSortOrder?: Array<string>
477
+ /** Single-entry root handling for TypeDoc-style Markdown output. */
478
+ singleEntryRoot?: 'preserve' | 'flatten'
477
479
  }
478
480
 
479
481
  /** Ordered JSDoc tag used by generated API Markdown. */
@@ -513,6 +515,8 @@ export interface JsDocsNavOptions {
513
515
  * `groupOrder`) and the `kind` sort strategy.
514
516
  */
515
517
  kindSortOrder?: Array<string>
518
+ /** Single-entry root handling for TypeDoc-style nav. */
519
+ singleEntryRoot?: 'preserve' | 'flatten'
516
520
  }
517
521
 
518
522
  /** Options for writing generated API documentation files. */
@@ -530,6 +534,8 @@ export interface JsDocsOutputOptions {
530
534
  sortEntryPoints?: boolean
531
535
  /** TypeDoc-style kind ranking for generated nav groups. */
532
536
  kindSortOrder?: Array<string>
537
+ /** Single-entry root handling for generated nav metadata. */
538
+ singleEntryRoot?: 'preserve' | 'flatten'
533
539
  }
534
540
 
535
541
  /** Docs-as-tests extraction options. */
package/index.js CHANGED
@@ -1,7 +1,28 @@
1
1
  const { existsSync } = require("fs");
2
2
  const path = require("path");
3
3
 
4
+ function getErrorCode(error) {
5
+ if (error && typeof error === "object" && "code" in error) {
6
+ return error.code;
7
+ }
8
+ }
9
+
10
+ function getErrorMessage(error) {
11
+ if (error && typeof error === "object" && "message" in error) {
12
+ return error.message;
13
+ }
14
+ return String(error);
15
+ }
16
+
17
+ function formatLoadError(target, error) {
18
+ const code = getErrorCode(error);
19
+ const suffix = code ? ` [${code}]` : "";
20
+ return ` - ${target}${suffix}: ${getErrorMessage(error)}`;
21
+ }
22
+
4
23
  function loadBinding() {
24
+ const loadErrors = [];
25
+
5
26
  // 1. Try loading the local binary (napi build output)
6
27
  const napiOutput = path.join(__dirname, "ox-content.node");
7
28
  if (existsSync(napiOutput)) {
@@ -56,12 +77,19 @@ function loadBinding() {
56
77
  if (subPackage) {
57
78
  try {
58
79
  return require(subPackage);
59
- } catch {}
80
+ } catch (error) {
81
+ loadErrors.push(formatLoadError(subPackage, error));
82
+ }
60
83
  }
61
84
 
85
+ const details = loadErrors.length
86
+ ? `\n\nNative load attempts failed:\n${loadErrors.join("\n")}`
87
+ : "";
88
+
62
89
  throw new Error(
63
90
  `@ox-content/napi: No compatible binary found for ${platform}-${arch}. ` +
64
- `If you're working from the repository, run 'nix develop -c vp run build:napi' from the repository root.`,
91
+ `If you're working from the repository, run 'nix develop -c vp run build:napi' from the repository root.` +
92
+ details,
65
93
  );
66
94
  }
67
95
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ox-content/napi",
3
- "version": "2.64.0",
3
+ "version": "2.66.0",
4
4
  "description": "Node.js bindings for Ox Content - High-performance Markdown parser",
5
5
  "keywords": [
6
6
  "markdown",
@@ -45,10 +45,10 @@
45
45
  ]
46
46
  },
47
47
  "optionalDependencies": {
48
- "@ox-content/binding-darwin-x64": "2.64.0",
49
- "@ox-content/binding-darwin-arm64": "2.64.0",
50
- "@ox-content/binding-linux-x64-gnu": "2.64.0",
51
- "@ox-content/binding-linux-arm64-gnu": "2.64.0",
52
- "@ox-content/binding-win32-x64-msvc": "2.64.0"
48
+ "@ox-content/binding-darwin-x64": "2.66.0",
49
+ "@ox-content/binding-darwin-arm64": "2.66.0",
50
+ "@ox-content/binding-linux-x64-gnu": "2.66.0",
51
+ "@ox-content/binding-linux-arm64-gnu": "2.66.0",
52
+ "@ox-content/binding-win32-x64-msvc": "2.66.0"
53
53
  }
54
54
  }