@ox-content/napi 2.65.0 → 2.67.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 +4 -0
  2. package/index.js +30 -2
  3. package/package.json +6 -6
package/index.d.ts CHANGED
@@ -1109,6 +1109,7 @@ export interface JsSsgNavGroup {
1109
1109
  /** Navigation items. */
1110
1110
  items: Array<JsSsgNavItem>
1111
1111
  collapsed?: boolean
1112
+ stickyCollapsed?: boolean
1112
1113
  }
1113
1114
 
1114
1115
  /** Manual SSG navigation group supplied by user configuration. */
@@ -1134,6 +1135,7 @@ export interface JsSsgNavItem {
1134
1135
  href: string
1135
1136
  children?: Array<JsSsgNavItem>
1136
1137
  collapsed?: boolean
1138
+ stickyCollapsed?: boolean
1137
1139
  }
1138
1140
 
1139
1141
  /** Page data for SSG. */
@@ -1188,6 +1190,8 @@ export interface JsSsgSidebarItem {
1188
1190
  items?: Array<JsSsgSidebarItem>
1189
1191
  /** Whether this group is collapsed by default. */
1190
1192
  collapsed?: boolean
1193
+ /** Whether this group's open state persists across page navigations. */
1194
+ stickyCollapsed?: boolean
1191
1195
  }
1192
1196
 
1193
1197
  /** Result of [`transform_tabs_embeds`]. */
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.65.0",
3
+ "version": "2.67.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.65.0",
49
- "@ox-content/binding-darwin-arm64": "2.65.0",
50
- "@ox-content/binding-linux-x64-gnu": "2.65.0",
51
- "@ox-content/binding-linux-arm64-gnu": "2.65.0",
52
- "@ox-content/binding-win32-x64-msvc": "2.65.0"
48
+ "@ox-content/binding-darwin-x64": "2.67.0",
49
+ "@ox-content/binding-darwin-arm64": "2.67.0",
50
+ "@ox-content/binding-linux-x64-gnu": "2.67.0",
51
+ "@ox-content/binding-linux-arm64-gnu": "2.67.0",
52
+ "@ox-content/binding-win32-x64-msvc": "2.67.0"
53
53
  }
54
54
  }