@gmb/bitmark-parser 6.1.2 → 6.1.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.
@@ -394,83 +394,101 @@ module.exports.convert = function(input, input_format_sel, output_format_sel, mo
394
394
 
395
395
  /**
396
396
  * Re-emit input in its own format at optimized mode (omit natural defaults).
397
+ *
398
+ * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | any config
399
+ * mapping id (`html`, `xml`, …). The output is re-emitted in this same format.
397
400
  * @param {string} input
401
+ * @param {string} input_format_sel
398
402
  * @param {boolean} pretty
399
403
  * @param {number} indent
400
404
  * @returns {string}
401
405
  */
402
- module.exports.optimize = function(input, pretty, indent) {
403
- let deferred2_0;
404
- let deferred2_1;
406
+ module.exports.optimize = function(input, input_format_sel, pretty, indent) {
407
+ let deferred3_0;
408
+ let deferred3_1;
405
409
  try {
406
410
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
407
411
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
408
412
  const len0 = WASM_VECTOR_LEN;
409
- wasm.optimize(retptr, ptr0, len0, pretty, indent);
413
+ const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
414
+ const len1 = WASM_VECTOR_LEN;
415
+ wasm.optimize(retptr, ptr0, len0, ptr1, len1, pretty, indent);
410
416
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
411
417
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
412
- deferred2_0 = r0;
413
- deferred2_1 = r1;
418
+ deferred3_0 = r0;
419
+ deferred3_1 = r1;
414
420
  return getStringFromWasm0(r0, r1);
415
421
  } finally {
416
422
  wasm.__wbindgen_add_to_stack_pointer(16);
417
- wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
423
+ wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
418
424
  }
419
425
  };
420
426
 
421
427
  /**
422
428
  * Re-emit input in its own format at full mode (all keys).
429
+ *
430
+ * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | any config
431
+ * mapping id (`html`, `xml`, …). The output is re-emitted in this same format.
423
432
  * @param {string} input
433
+ * @param {string} input_format_sel
424
434
  * @param {boolean} pretty
425
435
  * @param {number} indent
426
436
  * @returns {string}
427
437
  */
428
- module.exports.fullize = function(input, pretty, indent) {
429
- let deferred2_0;
430
- let deferred2_1;
438
+ module.exports.fullize = function(input, input_format_sel, pretty, indent) {
439
+ let deferred3_0;
440
+ let deferred3_1;
431
441
  try {
432
442
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
433
443
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
434
444
  const len0 = WASM_VECTOR_LEN;
435
- wasm.fullize(retptr, ptr0, len0, pretty, indent);
445
+ const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
446
+ const len1 = WASM_VECTOR_LEN;
447
+ wasm.fullize(retptr, ptr0, len0, ptr1, len1, pretty, indent);
436
448
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
437
449
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
438
- deferred2_0 = r0;
439
- deferred2_1 = r1;
450
+ deferred3_0 = r0;
451
+ deferred3_1 = r1;
440
452
  return getStringFromWasm0(r0, r1);
441
453
  } finally {
442
454
  wasm.__wbindgen_add_to_stack_pointer(16);
443
- wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
455
+ wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
444
456
  }
445
457
  };
446
458
 
447
459
  /**
448
460
  * Re-emit input in its own format in canonical form at `mode`.
461
+ *
462
+ * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | any config
463
+ * mapping id (`html`, `xml`, …). The output is re-emitted in this same format.
449
464
  * @param {string} input
465
+ * @param {string} input_format_sel
450
466
  * @param {string} mode
451
467
  * @param {boolean} pretty
452
468
  * @param {number} indent
453
469
  * @param {number} spaces_around_values
454
470
  * @returns {string}
455
471
  */
456
- module.exports.canonicalize = function(input, mode, pretty, indent, spaces_around_values) {
457
- let deferred3_0;
458
- let deferred3_1;
472
+ module.exports.canonicalize = function(input, input_format_sel, mode, pretty, indent, spaces_around_values) {
473
+ let deferred4_0;
474
+ let deferred4_1;
459
475
  try {
460
476
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
461
477
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
462
478
  const len0 = WASM_VECTOR_LEN;
463
- const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
479
+ const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
464
480
  const len1 = WASM_VECTOR_LEN;
465
- wasm.canonicalize(retptr, ptr0, len0, ptr1, len1, pretty, indent, spaces_around_values);
481
+ const ptr2 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
482
+ const len2 = WASM_VECTOR_LEN;
483
+ wasm.canonicalize(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, spaces_around_values);
466
484
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
467
485
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
468
- deferred3_0 = r0;
469
- deferred3_1 = r1;
486
+ deferred4_0 = r0;
487
+ deferred4_1 = r1;
470
488
  return getStringFromWasm0(r0, r1);
471
489
  } finally {
472
490
  wasm.__wbindgen_add_to_stack_pointer(16);
473
- wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
491
+ wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
474
492
  }
475
493
  };
476
494
 
Binary file
@@ -2,14 +2,14 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const breakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
5
- export const canonicalize: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
5
+ export const canonicalize: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
6
6
  export const convert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
7
7
  export const count_bits: (a: number, b: number, c: number) => void;
8
- export const fullize: (a: number, b: number, c: number, d: number, e: number) => void;
8
+ export const fullize: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
9
9
  export const info: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
10
10
  export const is_bitmark: (a: number, b: number) => number;
11
11
  export const lex: (a: number, b: number, c: number, d: number, e: number) => void;
12
- export const optimize: (a: number, b: number, c: number, d: number, e: number) => void;
12
+ export const optimize: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
13
13
  export const parse: (a: number, b: number, c: number, d: number, e: number) => void;
14
14
  export const prettify: (a: number, b: number, c: number, d: number) => void;
15
15
  export const split_bits: (a: number, b: number, c: number) => void;
package/wasm/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "Get More Brain Ltd <info@getmorebrain.com>"
5
5
  ],
6
6
  "description": "WebAssembly bindings for the bitmark parser",
7
- "version": "6.1.2",
7
+ "version": "6.1.3",
8
8
  "license": "ISC",
9
9
  "repository": {
10
10
  "type": "git",
@@ -1,25 +0,0 @@
1
- #!/usr/bin/env node
2
- // @zen-component: NCLI-Launcher
3
-
4
- // Thin launcher: resolve the prebuilt native `bitmark` binary for this platform
5
- // and run it, forwarding arguments, stdio, and the exit code. PLAN-111 T1.
6
-
7
- import { spawnSync } from "node:child_process";
8
- import { resolveBinary } from "../lib/binary.js";
9
-
10
- let binary;
11
- try {
12
- binary = resolveBinary(process.platform, process.arch);
13
- } catch (err) {
14
- process.stderr.write(`${err.message}\n`);
15
- process.exit(1);
16
- }
17
-
18
- const result = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" });
19
-
20
- if (result.error) {
21
- process.stderr.write(`failed to run bitmark: ${result.error.message}\n`);
22
- process.exit(1);
23
- }
24
-
25
- process.exit(result.status === null ? 1 : result.status);
package/lib/binary.js DELETED
@@ -1,61 +0,0 @@
1
- // @zen-component: NCLI-Launcher
2
-
3
- // Maps the host platform to its prebuilt-binary package and resolves the binary
4
- // path. Logic is dependency-injected (platform, arch, requireResolve) so it is
5
- // unit-testable without the platform packages actually being installed.
6
- // PLAN-111 T1.
7
-
8
- import { createRequire } from "node:module";
9
-
10
- const require = createRequire(import.meta.url);
11
-
12
- /** Host `${process.platform} ${process.arch}` → optional-dependency package. */
13
- const PACKAGES = {
14
- "linux x64": "@gmb/bitmark-parser-linux-x64",
15
- "linux arm64": "@gmb/bitmark-parser-linux-arm64",
16
- "darwin x64": "@gmb/bitmark-parser-darwin-x64",
17
- "darwin arm64": "@gmb/bitmark-parser-darwin-arm64",
18
- "win32 x64": "@gmb/bitmark-parser-win32-x64",
19
- };
20
-
21
- const SUPPORTED = Object.keys(PACKAGES)
22
- .map((k) => k.replace(" ", "-"))
23
- .join(", ");
24
-
25
- /** The platform package name for a platform/arch, or null if unsupported. */
26
- function selectPackage(platform, arch) {
27
- return PACKAGES[`${platform} ${arch}`] || null;
28
- }
29
-
30
- /** The binary file name inside a platform package (`.exe` only on Windows). */
31
- function binaryName(platform) {
32
- return platform === "win32" ? "bitmark.exe" : "bitmark";
33
- }
34
-
35
- /**
36
- * Resolve the absolute path to the prebuilt binary for the given platform/arch.
37
- * Throws a clear, actionable error when the platform is unsupported or the
38
- * platform package was not installed. `requireResolve` defaults to the real
39
- * ESM `require.resolve` (via `createRequire`).
40
- */
41
- function resolveBinary(platform, arch, requireResolve = require.resolve) {
42
- const pkg = selectPackage(platform, arch);
43
- if (!pkg) {
44
- throw new Error(
45
- `No prebuilt bitmark binary for ${platform}-${arch}.\n` +
46
- `Supported platforms: ${SUPPORTED}.\n` +
47
- `Install from source instead: cargo install bitmark`,
48
- );
49
- }
50
- try {
51
- return requireResolve(`${pkg}/bin/${binaryName(platform)}`);
52
- } catch {
53
- throw new Error(
54
- `The bitmark platform package "${pkg}" is not installed.\n` +
55
- `This usually means an npm install issue (optional dependencies were skipped).\n` +
56
- `Try reinstalling, or install from source: cargo install bitmark`,
57
- );
58
- }
59
- }
60
-
61
- export { selectPackage, binaryName, resolveBinary, PACKAGES, SUPPORTED };