New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rejoice

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rejoice - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

test/example/preConnections.js

10

lib/index.js

@@ -92,4 +92,10 @@ 'use strict';

let options = {};
const options = {};
options.preConnections = manifest.preConnections;
options.preRegister = manifest.preRegister;
delete manifest.preConnections;
delete manifest.preRegister;
if (!args.p) {

@@ -105,3 +111,3 @@ return callback(null, options);

options = { relativeTo: path };
options.relativeTo = path;
callback(null, options);

@@ -108,0 +114,0 @@ });

2

package.json
{
"name": "rejoice",
"description": "hapi.js CLI",
"version": "3.0.0",
"version": "3.1.0",
"repository": "git://github.com/hapijs/rejoice",

@@ -6,0 +6,0 @@ "main": "lib/index.js",

@@ -57,5 +57,5 @@ #rejoice

{
plugin: {
register: "good",
options: {
"plugin": {
"register": "good",
"options": {
"opsInterval": 5000,

@@ -81,5 +81,5 @@ "requestHeaders": true,

{
plugin: "lout"
"plugin": "lout"
}
}
]
}

@@ -107,17 +107,45 @@ ```

],
"plugins": {
"good": {
"opsInterval": 5000,
"requestHeaders": true,
"reporters": [{
"reporter": "good-console",
"events": { "response": "*", "ops": "*", "log": "*", "error": "*" }
}],
"registrations": [
{
"plugin": {
"register": "good",
"options": {
"opsInterval": 5000,
"requestHeaders": true,
"reporters": [{
"reporter": "good-console",
"events": { "response": "*", "ops": "*", "log": "*", "error": "*" }
}]
}
}
},
"lout": {},
"./myplugin": {}
}
{
"plugin": "lout"
},
{
"plugin": "./myplugin"
}
]
}
```
When using regular JS file, you may add `preConnections` or `preRegister` callbacks. See the example below.
```javascript
module.exports = {
connections: [ '...' ],
registrations: [ '...' ],
preConnections: function(server, next) {
// your preConnections logic goes here
next();
},
preRegister: function(server, next) {
// your preRegister logic goes here
next();
}
};
```
For more information about these options, see [Glue's API](https://github.com/hapijs/glue/blob/master/API.md).
If you need a module required before your application is loaded you can use the `-r` flag.

@@ -124,0 +152,0 @@

@@ -135,2 +135,55 @@ 'use strict';

it('composes server with preConnections callback', (done) => {
const manifest = Fs.readFileSync(Path.join(__dirname, 'example', 'preConnections.js'), 'utf8');
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'js');
const rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
Fs.writeFileSync(configPath, manifest, 'utf8');
const hapi = ChildProcess.spawn('node', [rejoice, '-c', configPath]);
hapi.stdout.on('data', (data) => {
expect(data.toString()).to.include('preConnections');
hapi.kill();
Fs.unlinkSync(configPath);
done();
});
hapi.stderr.on('data', (data) => {
expect(data.toString()).to.not.exist();
});
});
it('composes server with preRegister callback', (done) => {
const manifest = Fs.readFileSync(Path.join(__dirname, 'example', 'preRegister.js'), 'utf8');
const configPath = Hoek.uniqueFilename(Os.tmpDir(), 'js');
const rejoice = Path.join(__dirname, '..', 'bin', 'rejoice');
const modulePath = Path.join(__dirname, 'plugins');
Fs.writeFileSync(configPath, manifest, 'utf8');
const hapi = ChildProcess.spawn('node', [rejoice, '-c', configPath, '-p', modulePath]);
hapi.stdout.on('data', (data) => {
expect(data.toString()).to.include('preRegister');
hapi.kill();
Fs.unlinkSync(configPath);
done();
});
hapi.stderr.on('data', (data) => {
expect(data.toString()).to.not.exist();
});
});
it('fails when path cannot be resolved', (done) => {

@@ -137,0 +190,0 @@

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