v1.5.1: don't cause ursa-optional to install due to error messages

This commit is contained in:
AJ ONeal 2018-07-13 04:33:17 -06:00
parent 023b0b7948
commit aae4ad4e3f
4 changed files with 27 additions and 6 deletions

View File

@ -23,6 +23,13 @@ node.js
npm install --save rsa-compat npm install --save rsa-compat
``` ```
For **more efficient** RSA key generation:
<small>(I dropped `ursa` as an "optional dependency" because the non-fatal error messages on unsupported platforms and node versions were confusing people, but I still recommend installing it)</small>
```bash
npm install --save ursa
```
**Node &lt; v6** support: **Node &lt; v6** support:
```bash ```bash

View File

@ -1,6 +1,16 @@
'use strict'; 'use strict';
var ursa = require('ursa-optional'); var ursa;
try {
ursa = require('ursa');
} catch(e) {
try {
ursa = require('ursa-optional');
} catch(e2) {
throw e;
}
}
function notToJson() { function notToJson() {
return undefined; return undefined;

View File

@ -24,9 +24,13 @@ function create(deps) {
deps.RSA = RSA; deps.RSA = RSA;
try { try {
RSA._URSA = require('ursa-optional'); RSA._URSA = require('ursa');
} catch(e) { } catch(e) {
// ignore try {
RSA._URSA = require('ursa-optional');
} catch(e) {
// ignore
}
} }
RSA.utils = require('./lib/key-utils.js'); RSA.utils = require('./lib/key-utils.js');

View File

@ -1,6 +1,6 @@
{ {
"name": "rsa-compat", "name": "rsa-compat",
"version": "1.5.0", "version": "1.5.1",
"description": "RSA utils that work on Windows, Mac, and Linux with or without C compiler", "description": "RSA utils that work on Windows, Mac, and Linux with or without C compiler",
"main": "node.js", "main": "node.js",
"bin": { "bin": {
@ -42,10 +42,10 @@
"node-forge": "^0.6.41" "node-forge": "^0.6.41"
}, },
"optionalDependencies": { "optionalDependencies": {
"ursa-optional": "^0.9.4"
}, },
"trulyOptionalDependencies": { "trulyOptionalDependencies": {
"buffer-v6-polyfill": "^1.0.3", "buffer-v6-polyfill": "^1.0.3",
"ursa": "^0.9.4" "ursa": "^0.9.4",
"ursa-optional": "^0.9.4"
} }
} }