Socket
Socket
Sign inDemoInstall

native-ext-loader

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

native-ext-loader - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

8

CHANGELOG.md

@@ -0,4 +1,10 @@

# 2.0.0
* Remove `loader-utils` dependency. (5156da688769f861cf657ee5f7087310f7ec6819)
* Remove configurable `name` option. (5156da688769f861cf657ee5f7087310f7ec6819)
* Assume that custom options are a valid hash object. (5156da688769f861cf657ee5f7087310f7ec6819)
# 1.1.0
* Add a support for Webpack 4.0.x. ([#1](https://github.com/smt116/node-native-ext-loader/pull/1) by [@matsnow](https://github.com/matsnow))
* Add a support for Webpack 4.0.x. (#1 by @matsnow)

@@ -5,0 +11,0 @@ # 1.0.0

13

index.js

@@ -1,18 +0,11 @@

var loaderUtils = require("loader-utils");
var path = require("path");
module.exports = function(content) {
module.exports = function (content) {
const defaultConfig = {
name: "[name].[ext]",
rewritePath: undefined
};
const config = Object.assign(defaultConfig, loaderUtils.getOptions(this));
const config = Object.assign(defaultConfig, this.query);
const fileName = path.basename(this.resourcePath);
const context = this.options ? this.options.context : this.rootContext;
const fileName = loaderUtils.interpolateName(this, config.name, {
context: context,
content: content
});
if (this.emitFile) {

@@ -19,0 +12,0 @@ this.emitFile(fileName, content, false);

{
"name": "native-ext-loader",
"version": "1.1.0",
"author": "Maciej Małecki <smt116@gmail.com>",
"dependencies": {},
"description": "Loader for Node native extensions",
"main": "index.js",
"repository": "https://github.com/smt116/node-native-loader",
"scripts": {},
"keywords": [
"electron",
"loader",
"native",
"node",
"native",
"loader"
"webpack"
],
"author": "Maciej Małecki <smt116@gmail.com>",
"license": "MIT",
"dependencies": {
"loader-utils": "^1.1.0"
}
"main": "index.js",
"name": "native-ext-loader",
"repository": "https://github.com/smt116/node-native-loader",
"scripts": {},
"version": "2.0.0"
}
# Node Native Loader
Module for loading native files in Node and Electron applications. The project is inspired by the [node-addon-loader](https://github.com/ushu/node-addon-loader). It works in the similar way but **allows to build path in the runtime**.
Package for loading native files in Node and Electron applications. The project is inspired by the [node-addon-loader](https://github.com/ushu/node-addon-loader). It works in the similar way but **allows to build path at runtime**.
## Install
Add the package to the `package.json` file:
Add the package to the development dependencies:
```bash
# using npm:
$ npm install native-ext-loader --save-dev
# using yarn:
$ yarn add --dev native-ext-loader

@@ -15,3 +19,3 @@ ```

Update `webpack.config.js` file's rules:
Update rules entry in the Webpack configuration file:

@@ -29,3 +33,3 @@ ```javascript

It is possible to adjust options:
Options are configurable using `options` hash:

@@ -38,3 +42,2 @@ ```javascript

options: {
name: '[hex].[ext]',
rewritePath: path.resolve(__dirname, 'dist')

@@ -46,8 +49,6 @@ }

### `name`
### `rewritePath` (default: `undefined`)
This option allows to change the file name in the output directory. You can use all placeholders defined in the [loader-utils](https://github.com/webpack/loader-utils/tree/v1.1.0#interpolatename) package.
It allows to set an absolute paths to native files.
### `rewritePath`
This options allows to set an absolute path. Note that it needs to remain `undefined` if you are building a package with embedded files.
Note that it needs to remain `undefined` if you are building a package with embedded files. This way, the compiled application will work no matter of its location. This is important when building Electron applications that can be placed in any directory by the end user.
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