@mermanjs/node 0.8.0-alpha.5 → 0.8.0-alpha.7
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 +27 -1
- package/README.md +91 -8
- package/THIRD_PARTY_LICENSES/non-layered-tidy-tree-layout/LICENSE +21 -0
- package/THIRD_PARTY_LICENSES/rust-cargo-dependencies.json +115 -78
- package/THIRD_PARTY_LICENSES/tree-sitter/LICENSE +21 -0
- package/THIRD_PARTY_LICENSES/tree-sitter-mermaid-monaqa/LICENSE +21 -0
- package/THIRD_PARTY_LICENSES/tree-sitter-mermaid-pappasam/LICENSE +21 -0
- package/THIRD_PARTY_LICENSES/tree-sitter-mermaid-singularity/LICENSE +22 -0
- package/THIRD_PARTY_NOTICES.md +181 -41
- package/dist/bounded-executor.mjs +3 -0
- package/dist/candidates/native.mjs +1 -0
- package/dist/candidates/wrap-engine.mjs +11 -3
- package/dist/engine.mjs +120 -30
- package/dist/errors.mjs +125 -6
- package/dist/generated/binding-contract.mjs +168 -8
- package/dist/generated/capability-surface.mjs +1 -1
- package/dist/generated/node-wire-contract.json +1 -1
- package/dist/index.d.ts +49 -4
- package/dist/index.mjs +1 -0
- package/dist/native-loader.mjs +13 -0
- package/package.json +6 -6
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Source: capabilities/feature-surface-v1.json. Do not edit directly.
|
|
3
3
|
|
|
4
4
|
export const CAPABILITY_DESCRIPTOR_SCHEMA_VERSION = 1;
|
|
5
|
-
export const CAPABILITY_DESCRIPTOR_DIGEST = "sha256:
|
|
5
|
+
export const CAPABILITY_DESCRIPTOR_DIGEST = "sha256:f36a4518be6e5ad041629d3e5b117f2931703ac29b50c5de1e12c066620586ed";
|
|
6
6
|
|
|
7
7
|
export const NODE_BINDING_OPERATIONS = [
|
|
8
8
|
{
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,10 @@ export type MermanResourceProfile =
|
|
|
7
7
|
export interface MermanBindingOptions {
|
|
8
8
|
version?: 2;
|
|
9
9
|
runtime_policy?: "deterministic";
|
|
10
|
+
environment?: {
|
|
11
|
+
text_measurement?: "deterministic";
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
};
|
|
10
14
|
resources?: {
|
|
11
15
|
profile?: MermanResourceProfile;
|
|
12
16
|
limits?: Record<string, number>;
|
|
@@ -22,10 +26,17 @@ export interface CreateNodeEngineOptions {
|
|
|
22
26
|
|
|
23
27
|
export interface RenderSvgOptions {
|
|
24
28
|
/**
|
|
25
|
-
* Cancels
|
|
26
|
-
*
|
|
29
|
+
* Cancels queued work immediately and requests cooperative cancellation after Rust work starts.
|
|
30
|
+
* A queued request rejects with AbortError; a started request rejects with MermanOperationError
|
|
31
|
+
* carrying canonical cancellation details once transport admission or a renderer checkpoint
|
|
32
|
+
* observes the request.
|
|
27
33
|
*/
|
|
28
34
|
signal?: AbortSignal;
|
|
35
|
+
/**
|
|
36
|
+
* Relative monotonic deadline in milliseconds, starting when the Rust transport admits the
|
|
37
|
+
* operation. Values must be integers from 0 through 4,294,967,295.
|
|
38
|
+
*/
|
|
39
|
+
timeoutMs?: number;
|
|
29
40
|
/** Raw per-request options JSON merged by the shared binding contract. */
|
|
30
41
|
optionsJson?: string;
|
|
31
42
|
}
|
|
@@ -149,6 +160,7 @@ export interface MermanRuntimeCatalog {
|
|
|
149
160
|
output_contracts: MermanRuntimeOutputContract[];
|
|
150
161
|
registry: {
|
|
151
162
|
diagram_family_count: number;
|
|
163
|
+
diagram_families: string[];
|
|
152
164
|
[key: string]: unknown;
|
|
153
165
|
};
|
|
154
166
|
resources: {
|
|
@@ -184,9 +196,12 @@ export declare class MermanEngine {
|
|
|
184
196
|
metadataJson(id: string): string;
|
|
185
197
|
executeOperation(
|
|
186
198
|
request: MermanOperationRequest,
|
|
187
|
-
options?: Pick<RenderSvgOptions, "signal">,
|
|
199
|
+
options?: Pick<RenderSvgOptions, "signal" | "timeoutMs">,
|
|
188
200
|
): Promise<MermanOperationResult>;
|
|
189
|
-
executeOperationSync(
|
|
201
|
+
executeOperationSync(
|
|
202
|
+
request: MermanOperationRequest,
|
|
203
|
+
options?: Pick<RenderSvgOptions, "timeoutMs">,
|
|
204
|
+
): MermanOperationResult;
|
|
190
205
|
dispose(): Promise<void>;
|
|
191
206
|
}
|
|
192
207
|
|
|
@@ -213,12 +228,38 @@ export interface MermanResourceErrorDetails {
|
|
|
213
228
|
readonly profile: string;
|
|
214
229
|
}
|
|
215
230
|
|
|
231
|
+
export interface MermanDiagnosticSpan {
|
|
232
|
+
readonly start: number;
|
|
233
|
+
readonly end: number;
|
|
234
|
+
readonly kind: "exact" | "insertion-point" | "fallback" | string;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export interface MermanDiagnosticErrorDetails {
|
|
238
|
+
readonly code: string;
|
|
239
|
+
readonly span: MermanDiagnosticSpan | null;
|
|
240
|
+
readonly field: string | null;
|
|
241
|
+
readonly diagram_type: string | null;
|
|
242
|
+
readonly requested_max_width?: number | null;
|
|
243
|
+
readonly actual_width?: number | null;
|
|
244
|
+
readonly width_profile?: string | null;
|
|
245
|
+
readonly fallback_reason?: string | null;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export interface MermanCancellationErrorDetails {
|
|
249
|
+
readonly reason: "requested" | "deadline_exceeded";
|
|
250
|
+
/** Renderer phase identifier; new Merman versions may add phases. */
|
|
251
|
+
readonly phase: string;
|
|
252
|
+
readonly [key: string]: unknown;
|
|
253
|
+
}
|
|
254
|
+
|
|
216
255
|
export declare class MermanOperationError extends MermanError {
|
|
217
256
|
readonly status: number | null;
|
|
218
257
|
readonly codeName: string | null;
|
|
219
258
|
readonly kind: "generic" | "unknown-operation" | "missing-capability" | string;
|
|
220
259
|
readonly capabilityId: string | null;
|
|
221
260
|
readonly resourceDetails: MermanResourceErrorDetails | null;
|
|
261
|
+
readonly diagnosticDetails: MermanDiagnosticErrorDetails | null;
|
|
262
|
+
readonly cancellationDetails: MermanCancellationErrorDetails | null;
|
|
222
263
|
}
|
|
223
264
|
|
|
224
265
|
export declare class MermanQueueSaturatedError extends MermanError {
|
|
@@ -232,6 +273,10 @@ export declare class MermanMissingPlatformPackageError extends MermanError {
|
|
|
232
273
|
readonly packageName: string;
|
|
233
274
|
readonly target: string;
|
|
234
275
|
}
|
|
276
|
+
export declare class MermanNativeLoadError extends MermanError {
|
|
277
|
+
readonly packageName: string;
|
|
278
|
+
readonly target: string;
|
|
279
|
+
}
|
|
235
280
|
export declare class MermanUnsupportedTargetError extends MermanError {
|
|
236
281
|
readonly platform: string;
|
|
237
282
|
readonly arch: string;
|
package/dist/index.mjs
CHANGED
package/dist/native-loader.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { createRequire } from "node:module";
|
|
|
3
3
|
import {
|
|
4
4
|
MermanInvalidTransportError,
|
|
5
5
|
MermanMissingPlatformPackageError,
|
|
6
|
+
MermanNativeLoadError,
|
|
6
7
|
MermanUnsupportedTargetError,
|
|
7
8
|
parseRuntimeCatalogJsonText,
|
|
8
9
|
} from "./errors.mjs";
|
|
@@ -79,6 +80,9 @@ export function loadNativeBinding({
|
|
|
79
80
|
if (isMissingModule(cause)) {
|
|
80
81
|
throw new MermanMissingPlatformPackageError({ packageName, target, cause });
|
|
81
82
|
}
|
|
83
|
+
if (isNativeLoadFailure(cause)) {
|
|
84
|
+
throw new MermanNativeLoadError({ packageName, target, cause });
|
|
85
|
+
}
|
|
82
86
|
throw cause;
|
|
83
87
|
}
|
|
84
88
|
}
|
|
@@ -110,3 +114,12 @@ function isMissingModule(error) {
|
|
|
110
114
|
(error.code === "MODULE_NOT_FOUND" || error.code === "ERR_MODULE_NOT_FOUND"),
|
|
111
115
|
);
|
|
112
116
|
}
|
|
117
|
+
|
|
118
|
+
function isNativeLoadFailure(error) {
|
|
119
|
+
if (!error || typeof error !== "object") return false;
|
|
120
|
+
if (error.code === "ERR_DLOPEN_FAILED") return true;
|
|
121
|
+
return typeof error.message === "string" &&
|
|
122
|
+
/(?:GLIBC(?:XX)?_|CXXABI_|invalid ELF|wrong ELF|shared object file|not a valid Win32|mach-?o)/i.test(
|
|
123
|
+
error.message,
|
|
124
|
+
);
|
|
125
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mermanjs/node",
|
|
3
|
-
"version": "0.8.0-alpha.
|
|
3
|
+
"version": "0.8.0-alpha.7",
|
|
4
4
|
"description": "Experimental native Node.js and static-site rendering bindings for Merman.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
],
|
|
42
42
|
"license": "MIT OR Apache-2.0",
|
|
43
43
|
"optionalDependencies": {
|
|
44
|
-
"@mermanjs/node-darwin-arm64": "0.8.0-alpha.
|
|
45
|
-
"@mermanjs/node-darwin-x64": "0.8.0-alpha.
|
|
46
|
-
"@mermanjs/node-linux-x64-gnu": "0.8.0-alpha.
|
|
47
|
-
"@mermanjs/node-linux-x64-musl": "0.8.0-alpha.
|
|
48
|
-
"@mermanjs/node-win32-x64-msvc": "0.8.0-alpha.
|
|
44
|
+
"@mermanjs/node-darwin-arm64": "0.8.0-alpha.7",
|
|
45
|
+
"@mermanjs/node-darwin-x64": "0.8.0-alpha.7",
|
|
46
|
+
"@mermanjs/node-linux-x64-gnu": "0.8.0-alpha.7",
|
|
47
|
+
"@mermanjs/node-linux-x64-musl": "0.8.0-alpha.7",
|
|
48
|
+
"@mermanjs/node-win32-x64-msvc": "0.8.0-alpha.7"
|
|
49
49
|
}
|
|
50
50
|
}
|