@rel-packages/osu-beatmap-parser 1.0.6 → 1.0.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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { OsuKey, OsuInput } from "./types";
2
2
  export declare const get_property: (data: Uint8Array, key: OsuKey) => string;
3
3
  export declare const get_properties: (input: Uint8Array | OsuInput, keys: OsuKey[]) => Record<string, string>;
4
- export { OsuKey, OsuInput };
4
+ export type { OsuKey, OsuInput };
@@ -1 +1,3 @@
1
- export declare const native: any;
1
+ import { INativeExporter } from "../types";
2
+ declare const native: INativeExporter;
3
+ export { native };
@@ -1,45 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.native = void 0;
4
- const DEBUG = typeof process != "undefined" && process.env?.OSU_PARSER_DEBUG == "1";
5
- const log_debug = (...args) => {
6
- if (DEBUG) {
7
- console.log("[osu-beatmap-parser]", ...args);
8
- }
9
- };
10
- const load_native_module = () => {
11
- const fs = require("fs");
12
- const path = require("path");
13
- const platform = process.platform;
14
- const arch = process.arch;
15
- log_debug(`loading native module for ${platform}-${arch}`);
16
- log_debug(`__dirname: ${__dirname}`);
17
- const paths = [
18
- // prebuilt binaries
19
- path.join(__dirname, "..", "..", "prebuilds", `${platform}-${arch}`, "osu-beatmap-parser.node"),
20
- path.join(__dirname, "..", "prebuilds", `${platform}-${arch}`, "osu-beatmap-parser.node"),
21
- // local dev builds
22
- path.join(__dirname, "..", "..", "build", "osu-beatmap-parser.node"),
23
- path.join(__dirname, "..", "..", "build", "Release", "osu-beatmap-parser.node"),
24
- path.join(__dirname, "..", "build", "osu-beatmap-parser.node"),
25
- path.join(__dirname, "build", "osu-beatmap-parser.node"),
26
- ];
27
- for (const p of paths) {
28
- const resolved = path.resolve(p);
29
- const exists = fs.existsSync(resolved);
30
- log_debug(`checking: ${resolved} -> ${exists ? "found" : "not found"}`);
31
- if (exists) {
32
- log_debug(`loading native module from: ${resolved}`);
33
- return require(resolved);
34
- }
35
- }
36
- log_debug("no native module found in any path");
37
- return null;
38
- };
39
- exports.native = load_native_module();
40
- if (exports.native == null) {
41
- const platform = process.platform;
42
- const arch = process.arch;
43
- throw new Error(`failed to load native module for ${platform}-${arch}. ` +
44
- `Set OSU_PARSER_DEBUG=1 for more info.`);
45
- }
7
+ const node_gyp_build_1 = __importDefault(require("node-gyp-build"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const native = (0, node_gyp_build_1.default)(path_1.default.join(__dirname, "..", ".."));
10
+ exports.native = native;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rel-packages/osu-beatmap-parser",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": ".osu parser for nodejs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,7 +15,7 @@
15
15
  "compile:tsc": "tsc",
16
16
  "build": "tsx scripts/build.ts all && npm run compile:tsc",
17
17
  "example:wasm": "bun run compile:wasm && bun x http-server . -p 8080 -c-1 -o /examples/wasm/",
18
- "example:node": "bun run compile:node && bun run examples/node/index.ts"
18
+ "example:node": "bun run compile:native && bun run examples/node/index.ts"
19
19
  },
20
20
  "keywords": [
21
21
  "osu",
@@ -42,6 +42,8 @@
42
42
  "tsx": "^4.21.0",
43
43
  "typescript": "^5.9.3"
44
44
  },
45
- "dependencies": {},
45
+ "dependencies": {
46
+ "node-gyp-build": "^4.8.4"
47
+ },
46
48
  "optionalDependencies": {}
47
49
  }