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

glue

Package Overview
Dependencies
Maintainers
5
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glue - npm Package Compare versions

Comparing version 5.0.0 to 6.0.0

CHANGELOG.md

95

API.md
## Interface
Glue exports a single function `compose` accepting a JSON `manifest` file specifying the hapi server options and plugin registrations and returns a hapi `server` object.
Glue exports a single function `compose` accepting a JSON `manifest` specifying the hapi server options and plugin registrations and returns a [hapi](https://hapijs.com/api) server object.
To start the server use the returned object to call `await server.start()`.

@@ -11,6 +11,6 @@

+ `manifest` - an object having:
* `server` - an object containing the options passed to [new Hapi.Server([options])](http://hapijs.com/api#new-serveroptions)
+ If `server.cache` is specified, Glue will parse the entry and replace any prototype function field (eg. `engine`) specified as string by calling `require()` with that string.
* `server` - an object containing the options passed to [hapi's](https://hapijs.com/api) `new Hapi.Server([options])`
+ If `server.cache` is specified, glue will parse the entry and replace any prototype function field (eg. `provider`) specified as string by calling `require()` with that string.
* `register` - an object containing two properties: the `plugins` to be registered and `options` to pass to `server.register`
+ `plugins` - an array of entries to register with [await server.register(plugins, [options])](http://hapijs.com/api#-await-serverregisterplugins-options).
+ `plugins` - an array of entries to register with [hapi's](https://hapijs.com/api) `await server.register(plugins, [options])`
* each entry may be one of three alternatives:

@@ -51,8 +51,8 @@ 1. A string to be `require()`d during composition.

```js
{
register: {
plugins: [ { plugin: 'myplugin', routes: { prefix: '/test/' } } ]
}
{
register: {
plugins: [ { plugin: 'myplugin', routes: { prefix: '/test/' } } ]
}
```
}
```
+ `options` - optional registration-options object passed to `server.register()`.

@@ -68,3 +68,3 @@ + `options` - an object containing the following `compose` options:

If you are developing a plugin, ensure your plugin dependencies are properly managed to guarantee that all dependencies are loaded before your plugin registration completes. See [`server.dependency(dependencies, [after])`](http://hapijs.com/api#serverdependencydependencies-after) for more information.
If you are developing a plugin, ensure your plugin dependencies are properly managed to guarantee that all dependencies are loaded before your plugin registration completes. See [hapi's](https://hapijs.com/api) `server.dependency(dependencies, [after])` for more information.

@@ -104,3 +104,6 @@ ## Usage

}
]
],
options: {
once: false
}
}

@@ -113,11 +116,15 @@ };

try {
const server = await Glue.compose(manifest, options);
await server.start();
console.log('hapi days!');
}
catch (err) {
console.error(err);
process.exit(1);
}
const startServer = async function () {
try {
const server = await Glue.compose(manifest, options);
await server.start();
console.log('hapi days!');
}
catch (err) {
console.error(err);
process.exit(1);
}
};
startServer();
```

@@ -128,28 +135,36 @@

```javascript
try {
const server = Hapi.server({ cache: [{ engine: require('redis') }], port: 8000 });
const plugins = [];
const registerOptions = {};
let pluginPath;
'use strict';
pluginPath = Path.join(__dirname, './awesome-plugin.js');
plugins.push({ plugin: require(pluginPath) });
const Hapi = require('hapi');
plugins.push({ plugin: require('myplugin'), options:{ uglify: true } });
const startServer = async function () {
try {
const server = Hapi.server({ cache: [{ provider: require('redis') }], port: 8000 });
const plugins = [];
const registerOptions = { once: false };
let pluginPath;
pluginPath = Path.join(__dirname, './ui-user');
plugins.push({ plugin: require(pluginPath) });
pluginPath = Path.join(__dirname, './awesome-plugin.js');
plugins.push({ plugin: require(pluginPath) });
pluginPath = Path.join(__dirname, './ui-admin');
plugins.push({ plugin: require(pluginPath), options: { sessiontime: 500 }, routes: { prefix: '/admin' } });
plugins.push({ plugin: require('myplugin'), options:{ uglify: true } });
await server.register(plugins, registerOptions);
pluginPath = Path.join(__dirname, './ui-user');
plugins.push({ plugin: require(pluginPath) });
await server.start();
console.log('hapi days!');
}
catch (err)
console.error(err);
process.exit(1);
}
pluginPath = Path.join(__dirname, './ui-admin');
plugins.push({ plugin: require(pluginPath), options: { sessiontime: 500 }, routes: { prefix: '/admin' } });
await server.register(plugins, registerOptions);
await server.start();
console.log('hapi days!');
}
catch (err)
console.error(err);
process.exit(1);
}
};
startServer();
```

@@ -18,3 +18,2 @@ 'use strict';

relativeTo: Joi.string(),
preConnections: Joi.func().allow(false),
preRegister: Joi.func().allow(false)

@@ -67,7 +66,7 @@ }),

if (typeof item === 'string') {
item = { engine: item };
item = { provider: item };
}
if (typeof item.engine === 'string') {
let strategy = item.engine;
if (typeof item.provider === 'string') {
let strategy = item.provider;
if (relativeTo && strategy[0] === '.') {

@@ -77,3 +76,3 @@ strategy = Path.join(relativeTo, strategy);

item.engine = require(strategy);
item.provider = require(strategy);
}

@@ -80,0 +79,0 @@

{
"name": "glue",
"description": "Server composer for hapi.js",
"version": "5.0.0",
"version": "6.0.0",
"repository": {

@@ -21,10 +21,10 @@ "type": "git",

"dependencies": {
"hapi": "17.x.x",
"hoek": "5.x.x",
"joi": "13.x.x"
"hapi": "18.x.x",
"hoek": "6.x.x",
"joi": "14.x.x"
},
"devDependencies": {
"catbox-memory": "3.x.x",
"catbox-memory": "4.x.x",
"code": "5.x.x",
"lab": "15.x.x"
"lab": "18.x.x"
},

@@ -31,0 +31,0 @@ "scripts": {

@@ -14,3 +14,3 @@ ## glue

calling each based on the configuration generated from the Glue manifest.
calling each based on the configuration generated from the glue manifest.

@@ -25,5 +25,6 @@ ### Interface

By default NPM will resolve Glue's dependency on hapi using the most recent supported version of hapi. To force a specific supported hapi version for your project, include hapi in your package dependencies along side of Glue.
By default NPM will resolve glue's dependency on hapi using the most recent supported version of hapi. To force a specific supported hapi version for your project, include hapi in your package dependencies along side of glue.
Glue version 5 currently only supports hapi **17**.
For support of hapi **11**, **12**, **13**, **14**, **15**, or **16** please use Glue@4.2.x .
Glue version 6 currently supports hapi **18**.
[glue@v5](https://github.com/hapijs/glue/tree/v5) supports hapi **17**.
[glue@v4](https://github.com/hapijs/glue/tree/v4) supports hapi **11**, **12**, **13**, **14**, **15**, or **16**.
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