native-ext-loader
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -0,10 +1,14 @@ | ||
# 2.1.0 | ||
- Handle the relative "current directory" path when using `rewritePath` | ||
# 2.0.0 | ||
* Remove `loader-utils` dependency. (5156da688769f861cf657ee5f7087310f7ec6819) | ||
* Remove configurable `name` option. (5156da688769f861cf657ee5f7087310f7ec6819) | ||
* Assume that custom options are a valid hash object. (5156da688769f861cf657ee5f7087310f7ec6819) | ||
- 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 by @matsnow) | ||
- Add a support for Webpack 4.0.x. (#1 by @matsnow) | ||
@@ -11,0 +15,0 @@ # 1.0.0 |
32
index.js
var path = require("path"); | ||
module.exports = function (content) { | ||
module.exports = function(content) { | ||
const defaultConfig = { | ||
@@ -15,15 +15,31 @@ rewritePath: undefined | ||
} else { | ||
throw new Error('emitFile function is not available'); | ||
throw new Error("emitFile function is not available"); | ||
} | ||
if (config.rewritePath) { | ||
const filePath = JSON.stringify(path.join(config.rewritePath, fileName)); | ||
let filePath; | ||
return "try { global.process.dlopen(module, " + filePath + "); } " + | ||
"catch(exception) { throw new Error('Cannot open ' + " + filePath + " + ': ' + exception); };"; | ||
if (config.rewritePath === "./" || config.rewritePath === ".\\") { | ||
filePath = JSON.stringify(config.rewritePath + fileName); | ||
} else { | ||
filePath = JSON.stringify(path.join(config.rewritePath, fileName)); | ||
} | ||
return ( | ||
"try { global.process.dlopen(module, " + | ||
filePath + | ||
"); } " + | ||
"catch(exception) { throw new Error('Cannot open ' + " + | ||
filePath + | ||
" + ': ' + exception); };" | ||
); | ||
} else { | ||
return "const path = require('path');" + | ||
"const filePath = path.resolve(__dirname, " + JSON.stringify(fileName) + ");" + | ||
return ( | ||
"const path = require('path');" + | ||
"const filePath = path.resolve(__dirname, " + | ||
JSON.stringify(fileName) + | ||
");" + | ||
"try { global.process.dlopen(module, filePath); } " + | ||
"catch(exception) { throw new Error('Cannot open ' + filePath + ': ' + exception); };"; | ||
"catch(exception) { throw new Error('Cannot open ' + filePath + ': ' + exception); };" | ||
); | ||
} | ||
@@ -30,0 +46,0 @@ }; |
@@ -17,3 +17,3 @@ { | ||
"scripts": {}, | ||
"version": "2.0.0" | ||
"version": "2.1.0" | ||
} |
@@ -21,8 +21,10 @@ # Node Native Loader | ||
```javascript | ||
```js | ||
module: { | ||
rules: [ | ||
test: /\.node$/, | ||
loader: 'native-ext-loader' | ||
] | ||
{ | ||
test: /\.node$/, | ||
loader: "native-ext-loader" | ||
} | ||
]; | ||
} | ||
@@ -35,11 +37,13 @@ ``` | ||
```javascript | ||
```js | ||
module: { | ||
rules: [ | ||
test: /\.node$/, | ||
loader: 'native-ext-loader', | ||
options: { | ||
rewritePath: path.resolve(__dirname, 'dist') | ||
{ | ||
test: /\.node$/, | ||
loader: "native-ext-loader", | ||
options: { | ||
rewritePath: path.resolve(__dirname, "dist") | ||
} | ||
} | ||
] | ||
]; | ||
} | ||
@@ -53,1 +57,10 @@ ``` | ||
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. | ||
## Releasing a new version | ||
1. Bump version number in the `package.json` and `CHANGELOG.md` files. | ||
1. Run `npm install` to update `package-lock.json` file. | ||
1. Commit changes (include changes) | ||
1. Add a new tag (use `-a` and include changes) | ||
1. Push commits and tag | ||
1. Run `npm publish` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3124134
102
64549
64
27
1