Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@node-rs/helper

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@node-rs/helper - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

1

lib/index.js

@@ -6,2 +6,1 @@ "use strict";

Object.defineProperty(exports, "loadBinding", { enumerable: true, get: function () { return loader_1.loadBinding; } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsbUNBQXNDO0FBQTdCLHFHQUFBLFdBQVcsT0FBQSJ9

14

lib/loader.js

@@ -11,3 +11,3 @@ "use strict";

function loadBinding(dirname, filename = 'index', packageName) {
var _a;
var _a, _b;
const triples = triples_1.platformArchTriples[PlatformName][ArchName];

@@ -26,3 +26,3 @@ let additionalErrorMsg = '';

}
catch (_b) { }
catch (_c) { }
}

@@ -33,3 +33,8 @@ }

if (fs_1.existsSync(localFilePath)) {
return require(localFilePath);
try {
return require(localFilePath);
}
catch (e) {
additionalErrorMsg += `file: ${localFilePath} existed but error occurred while require it: ${(_b = e.message) !== null && _b !== void 0 ? _b : e} \n`;
}
}

@@ -45,3 +50,3 @@ }

}
catch (_c) { }
catch (_d) { }
}

@@ -52,2 +57,1 @@ const errorMsg = `Can not load bindings${additionalErrorMsg ? ', ' + additionalErrorMsg : '\n'}${packageList ? 'Installed packages: [' + packageList + ']' : ''}`;

exports.loadBinding = loadBinding;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2xvYWRlci50cyJdLCJuYW1lcyI6W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dUJBQXVCLEdBQUcsV0FBVyxHQUFHLEdBQUcsQ0FBQyxDQUFDLENBQUMsRUFDOUQsRUFBRSxDQUFBO0lBRUYsTUFBTSxJQUFJLEtBQUssQ0FBQyxRQUFRLENBQUMsQ0FBQTtBQUMzQixDQUFDO0FBM0NELGtDQTJDQyJ9
{
"name": "@node-rs/helper",
"version": "1.2.0",
"version": "1.2.1",
"description": "Helper library for node-rs",

@@ -35,6 +35,5 @@ "keywords": [

"dependencies": {
"@napi-rs/triples": "^1.0.2",
"tslib": "^2.2.0"
"@napi-rs/triples": "^1.0.3"
},
"gitHead": "00be3388f6505ef99e78526a4afe54cd6d4e976b"
"gitHead": "e50b1a09a2eeb2682ef492d567230fff669ab196"
}
# `@node-rs/helper`
> Helper library for node-rs
[![install size](https://packagephobia.com/badge?p=@node-rs/helper)](https://packagephobia.com/result?p=@node-rs/helper)
[![Downloads](https://img.shields.io/npm/dm/@node-rs/helper.svg?sanitize=true)](https://npmcharts.com/compare/@node-rs/helper?minimal=true)
> Helper library for load native package.
## Usage

@@ -12,12 +15,15 @@

```ts
locateBinding(dirname: string): string
loadBinding(dirname: string, filename?: string = 'index', packageName?: string): string
```
- `dirname`, dirname which the **.node** binding file located
- return the full path of the binding file, throw if file not existed or platform not supported
- `filename`, the `napi.name` filed in you `package.json`
- `packageName`, the `name` filed in your `package.json`, `@swc/core` for example.
- return native module
```ts
const { locateBinding } = require('@node-rs/helper')
const { loadBinding } = require('@node-rs/helper')
module.exports = require(locateBinding(__dirname))
module.exports = loadBinding(__dirname, 'swc', '@swc/core')
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc