mirror of
https://github.com/abrendan/MicDropMessages.git
synced 2025-08-25 05:52:02 +02:00
Initial commit
This commit is contained in:
147
node_modules/hbs/HISTORY.md
generated
vendored
Normal file
147
node_modules/hbs/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
4.1.1 / 2020-04-03
|
||||
==================
|
||||
|
||||
* deps: handlebars@4.7.6
|
||||
|
||||
4.1.0 / 2020-01-14
|
||||
==================
|
||||
|
||||
* deps: handlebars@4.5.3
|
||||
- Add `handlebars.parseWithoutProcessing`
|
||||
- Add support for iterable objects in `#each` helper
|
||||
- Block access to non-enumerable special properties on objects
|
||||
- Fix error when helper defined with array properties
|
||||
- Fix parsing of empty raw blocks
|
||||
- Fix work-around for `constructor` blocking
|
||||
- Validate arguments to `#if`, `#unless` and `#with` helpers
|
||||
|
||||
4.0.6 / 2019-10-09
|
||||
==================
|
||||
|
||||
* deps: handlebars@4.3.5
|
||||
- Fix error object inheritance
|
||||
- Fix work-around for `constructor` blocking
|
||||
|
||||
4.0.5 / 2019-09-27
|
||||
==================
|
||||
|
||||
* Fix async helpers not working when cache enabled
|
||||
* Fix handling of exceptions from layout
|
||||
* Fix handling of exceptions when cache enabled
|
||||
* deps: handlebars@4.3.3
|
||||
- Block calling `helperMissing` and `blockHelperMissing` from templates
|
||||
- Fix work-around for `constructor` blocking
|
||||
* deps: walk@2.3.14
|
||||
|
||||
4.0.4 / 2019-04-14
|
||||
==================
|
||||
|
||||
* deps: handlebars@4.0.14
|
||||
- Block `constructor` property using `lookup`
|
||||
|
||||
4.0.3 / 2019-03-01
|
||||
==================
|
||||
|
||||
* Fix path for partials multiple dirs deep on Windows
|
||||
|
||||
4.0.2 / 2019-02-18
|
||||
==================
|
||||
|
||||
* deps: handlebars@4.0.13
|
||||
|
||||
4.0.1 / 2016-09-18
|
||||
==================
|
||||
|
||||
* Support params for async helper
|
||||
* deps: handlebars@4.0.5
|
||||
* deps: walk@2.3.9
|
||||
|
||||
4.0.0 / 2015-11-02
|
||||
==================
|
||||
|
||||
* Fix caching of non default filename layouts
|
||||
* deps: handlebars@4.0.3
|
||||
|
||||
3.1.1 / 2015-09-11
|
||||
==================
|
||||
|
||||
* Fix `localsAsTemplateData` when cache is enabled
|
||||
|
||||
3.1.0 / 2015-06-10
|
||||
==================
|
||||
|
||||
* Make `@data` available to layouts
|
||||
|
||||
3.0.1 / 2015-03-12
|
||||
==================
|
||||
|
||||
* Fix using custom extensions when using view engine layouts
|
||||
|
||||
3.0.0 / 2015-03-09
|
||||
==================
|
||||
|
||||
* deps: handlebars@3.0.0
|
||||
|
||||
2.9.0 / 2015-03-06
|
||||
==================
|
||||
|
||||
* Scope internal async tracker to per middleware
|
||||
* Support multiple view folders from Express
|
||||
|
||||
2.8.0 / 2014-12-26
|
||||
==================
|
||||
|
||||
* Scope internal async tracker to per hbs instance
|
||||
* deps: handlebars@2.0.0
|
||||
|
||||
2.7.0 / 2014-06-02
|
||||
==================
|
||||
|
||||
* Fix registering directories of partials on Windows
|
||||
* Add API to expose locals as template data
|
||||
|
||||
2.6.0 / 2014-04-06
|
||||
==================
|
||||
|
||||
* Fix support for custom handlebars instance
|
||||
|
||||
2.5.0 / 2014-02-19
|
||||
==================
|
||||
|
||||
* deps: handlebars@1.3.0
|
||||
|
||||
2.4.0 / 2013-09-13
|
||||
==================
|
||||
|
||||
* Add support for multi-level partial paths
|
||||
|
||||
2.3.1 / 2013-08-01
|
||||
==================
|
||||
|
||||
* deps: after@0.8.1
|
||||
* deps: handlebars@1.0.12
|
||||
|
||||
2.3.0 / 2013-05-30
|
||||
==================
|
||||
|
||||
* Add `registerPartials`
|
||||
|
||||
2.1.0 / 2013-03-19
|
||||
==================
|
||||
|
||||
* Add `create` for multiple instances
|
||||
|
||||
2.0.2 / 2013-02-21
|
||||
==================
|
||||
|
||||
* deps: handlebars@1.0.9
|
||||
|
||||
2.0.1 / 2012-11-30
|
||||
==================
|
||||
|
||||
* Ignore layout error when not using layout
|
||||
|
||||
2.0.0 / 2012-11-21
|
||||
==================
|
||||
|
||||
* deps: handlebars@1.0.7
|
22
node_modules/hbs/LICENSE
generated
vendored
Normal file
22
node_modules/hbs/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011 Don Park <donpark@docuverse.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
141
node_modules/hbs/README.md
generated
vendored
Normal file
141
node_modules/hbs/README.md
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
# hbs
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Linux Build][travis-image]][travis-url]
|
||||
[![Windows Build][appveyor-image]][appveyor-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
[Express.js](https://expressjs.com/) view engine for
|
||||
[handlebars.js](https://handlebarsjs.com/)
|
||||
|
||||
## Install ##
|
||||
|
||||
```
|
||||
npm install hbs
|
||||
```
|
||||
|
||||
## Use ##
|
||||
|
||||
Using *hbs* as the default view engine requires just one line of code in your app setup. This will render `.hbs` files when `res.render` is called.
|
||||
|
||||
```javascript
|
||||
app.set('view engine', 'hbs');
|
||||
```
|
||||
|
||||
To use a different extension (i.e. html) for your template files:
|
||||
|
||||
```javascript
|
||||
app.set('view engine', 'html');
|
||||
app.engine('html', require('hbs').__express);
|
||||
```
|
||||
|
||||
## Helpers and Partials ##
|
||||
|
||||
hbs exposes the `registerHelper` and `registerPartial` method from handlebars.
|
||||
|
||||
```javascript
|
||||
var hbs = require('hbs');
|
||||
|
||||
hbs.registerHelper('helper_name', function (options) { return 'helper value'; });
|
||||
hbs.registerPartial('partial_name', 'partial value');
|
||||
```
|
||||
|
||||
For convenience, `registerPartials` provides a quick way to load all partials from a specific directory:
|
||||
|
||||
```javascript
|
||||
var hbs = require('hbs');
|
||||
|
||||
hbs.registerPartials(__dirname + '/views/partials', function (err) {});
|
||||
```
|
||||
|
||||
Partials that are loaded from a directory are named based on their filename, where spaces and hyphens are replaced with an underscore character:
|
||||
|
||||
```
|
||||
template.html -> {{> template}}
|
||||
template 2.html -> {{> template_2}}
|
||||
login view.hbs -> {{> login_view}}
|
||||
template-file.html -> {{> template_file}}
|
||||
```
|
||||
|
||||
See the [handlebars.js documentation](https://handlebarsjs.com/) for more
|
||||
information.
|
||||
|
||||
**Note:** This method is async; meaning that the directory is walked in a non-blocking manner to app startup.
|
||||
|
||||
## Exposing locals as template data ##
|
||||
|
||||
hbs has the ability to expose the application and request locals within any context inside a view. To enable this functionality, simply call the `localsAsTemplateData` method and pass in your Express application instance.
|
||||
|
||||
```javascript
|
||||
var hbs = require('hbs');
|
||||
var express = require('express');
|
||||
|
||||
var app = express();
|
||||
hbs.localsAsTemplateData(app);
|
||||
|
||||
app.locals.foo = "bar";
|
||||
```
|
||||
|
||||
The local data can then be accessed using the `@property` syntax:
|
||||
|
||||
```
|
||||
top level: {{@foo}}
|
||||
{{#each items}}
|
||||
{{label}}: {{@foo}}
|
||||
{{/each}}
|
||||
```
|
||||
Note: In partials and templates, local data can be accessed without using `@` prefix.
|
||||
|
||||
## handlebars ##
|
||||
|
||||
The handlebars require used by hbs can be accessed via the `handlebars` property on the `hbs` module.
|
||||
|
||||
If you wish to use handlebars methods like `SafeString` please do so on this property. Do not register helpers or partials in this way.
|
||||
|
||||
```
|
||||
// hbs.handlebars is the handlebars module
|
||||
hbs.handlebars === require('handlebars');
|
||||
```
|
||||
|
||||
## Recipes ##
|
||||
|
||||
### more than one instance ###
|
||||
You can create isolated instances of hbs using the `create()` function on the module object.
|
||||
|
||||
```
|
||||
var hbs = require('hbs');
|
||||
|
||||
var instance1 = hbs.create();
|
||||
var instance2 = hbs.create();
|
||||
|
||||
app.engine('html', instance1.__express);
|
||||
app.engine('hbs', instance2.__express);
|
||||
```
|
||||
|
||||
Each instance has the same methods/properties as the `hbs` module object. The module object is actually just an instance created for you automatically.
|
||||
|
||||
### extra scripts or styles ##
|
||||
Sometimes it is useful to have custom scripts or stylesheets on your pages. Handlebars does not provide a way to import or extend a template, but through the use of helpers you can create a similar result.
|
||||
|
||||
We can take advantage of the fact that our body template is processed before the layout template. Knowing this, we can create two helpers `block` and `extend` which can be used to 'inject' custom stylesheets or scripts into the layout template. The `block` helper will act as a placeholder for values specified in earlier `extend` helpers.
|
||||
|
||||
See examples/extend for a working example. Note how the index.hbs file defines extra stylesheets and scripts to be injected into the layout. They are put into the head section and at the end of the body respectively. If this was not done, the stylesheet would be in the body and the script would print `foo bar` too soon.
|
||||
|
||||
## Helpful Modules ##
|
||||
|
||||
- **[hbs-utils](https://www.npmjs.com/package/hbs-utils)**: A small utility
|
||||
library that provides helpers for registering and compiling partials
|
||||
including automatic updates when partials are changed.
|
||||
|
||||
[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/nodejs-hbs/master?label=windows
|
||||
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/nodejs-hbs
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/pillarjs/hbs/master
|
||||
[coveralls-url]: https://coveralls.io/r/pillarjs/hbs?branch=master
|
||||
[node-image]: https://badgen.net/npm/node/hbs
|
||||
[node-url]: https://nodejs.org/en/download/
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/hbs
|
||||
[npm-url]: https://npmjs.org/package/hbs
|
||||
[npm-version-image]: https://badgen.net/npm/v/hbs
|
||||
[travis-image]: https://badgen.net/travis/pillarjs/hbs/master?label=linux
|
||||
[travis-url]: https://travis-ci.org/pillarjs/hbs
|
107
node_modules/hbs/lib/async.js
generated
vendored
Normal file
107
node_modules/hbs/lib/async.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
/// provides the async helper functionality
|
||||
|
||||
function Waiter() {
|
||||
if (!(this instanceof Waiter)) {
|
||||
return new Waiter();
|
||||
}
|
||||
|
||||
var self = this;
|
||||
|
||||
// found values
|
||||
self.values = {};
|
||||
|
||||
// callback when done
|
||||
self.callback = null;
|
||||
|
||||
self.resolved = false;
|
||||
|
||||
self.count = 0;
|
||||
};
|
||||
|
||||
Waiter.prototype.wait = function() {
|
||||
var self = this;
|
||||
++self.count;
|
||||
};
|
||||
|
||||
// resolve the promise
|
||||
Waiter.prototype.resolve = function(name, val) {
|
||||
var self = this;
|
||||
|
||||
self.values[name] = val;
|
||||
|
||||
// done with all items
|
||||
if (--self.count === 0) {
|
||||
self.resolved = true;
|
||||
|
||||
// we may not have a done callback yet
|
||||
if (self.callback) {
|
||||
self.callback(self.values);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// sets the done callback for the waiter
|
||||
// notifies when the promise is complete
|
||||
Waiter.prototype.done = function(fn) {
|
||||
var self = this;
|
||||
|
||||
self.callback = fn;
|
||||
if (self.resolved) {
|
||||
fn(self.values);
|
||||
}
|
||||
};
|
||||
|
||||
var alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_';
|
||||
|
||||
var gen_id = function() {
|
||||
var res = '';
|
||||
for (var i=0 ; i<8 ; ++i) {
|
||||
res += alphabet[Math.floor(Math.random() * alphabet.length)];
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
module.exports = function() {
|
||||
// baton which contains the current
|
||||
// set of deferreds
|
||||
var waiter;
|
||||
|
||||
var obj = Object.create(null);
|
||||
obj.done = function done(fn) {
|
||||
// no async things called
|
||||
if (!waiter) {
|
||||
return fn({});
|
||||
}
|
||||
|
||||
waiter.done(fn);
|
||||
|
||||
// clear the waiter for the next template
|
||||
waiter = undefined;
|
||||
};
|
||||
|
||||
obj.resolve = function resolve(fn, args) {
|
||||
// we want to do async things, need a waiter for that
|
||||
if (!waiter) {
|
||||
waiter = new Waiter();
|
||||
}
|
||||
|
||||
var id = '__' + gen_id() + '__';
|
||||
|
||||
var cur_waiter = waiter;
|
||||
waiter.wait();
|
||||
|
||||
args = [].slice.call(args);
|
||||
args.push(function(res) {
|
||||
cur_waiter.resolve(id, res);
|
||||
})
|
||||
|
||||
fn.apply(null, args);
|
||||
|
||||
// return the id placeholder
|
||||
// this will be replaced later
|
||||
return id;
|
||||
};
|
||||
|
||||
return obj;
|
||||
};
|
286
node_modules/hbs/lib/hbs.js
generated
vendored
Normal file
286
node_modules/hbs/lib/hbs.js
generated
vendored
Normal file
@@ -0,0 +1,286 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var walk = require('walk').walk;
|
||||
|
||||
var async = require('./async');
|
||||
|
||||
function Instance(handlebars) {
|
||||
if (!(this instanceof Instance)) {
|
||||
return new Instance(handlebars);
|
||||
}
|
||||
|
||||
// expose handlebars, allows users to use their versions
|
||||
// by overriding this early in their apps
|
||||
var self = this;
|
||||
|
||||
self.handlebars = handlebars || require('handlebars').create();
|
||||
|
||||
// cache for templates, express 3.x doesn't do this for us
|
||||
self.cache = {};
|
||||
|
||||
self.__express = middleware.bind(this);
|
||||
|
||||
// DEPRECATED, kept for backwards compatibility
|
||||
self.SafeString = this.handlebars.SafeString;
|
||||
self.Utils = this.handlebars.Utils;
|
||||
};
|
||||
|
||||
// express 3.x template engine compliance
|
||||
function middleware(filename, options, cb) {
|
||||
var self = this;
|
||||
var cache = self.cache;
|
||||
var handlebars = self.handlebars;
|
||||
|
||||
self.async = async();
|
||||
|
||||
// grab extension from filename
|
||||
// if we need a layout, we will look for one matching out extension
|
||||
var extension = path.extname(filename);
|
||||
|
||||
// Default handlebars runtime options
|
||||
var handlebarsOpts = {
|
||||
allowProtoMethodsByDefault: true,
|
||||
allowProtoPropertiesByDefault: true
|
||||
}
|
||||
|
||||
// If passing the locals as data, create the handlebars options object now
|
||||
if (self.__localsAsData) {
|
||||
handlebarsOpts.data = options._locals
|
||||
}
|
||||
|
||||
// render the original file
|
||||
// cb(err, str)
|
||||
function render_file(locals, cb) {
|
||||
// cached?
|
||||
var template = cache[filename];
|
||||
if (template) {
|
||||
try {
|
||||
var res = template(locals, handlebarsOpts)
|
||||
self.async.done(function (values) {
|
||||
Object.keys(values).forEach(function (id) {
|
||||
res = res.replace(id, values[id])
|
||||
})
|
||||
|
||||
cb(null, res)
|
||||
})
|
||||
} catch (err) {
|
||||
cb(prependFilenameToError(filename, err))
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
fs.readFile(filename, 'utf8', function(err, str){
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
var template = handlebars.compile(str);
|
||||
if (locals.cache) {
|
||||
cache[filename] = template;
|
||||
}
|
||||
|
||||
try {
|
||||
var res = template(locals, handlebarsOpts);
|
||||
self.async.done(function(values) {
|
||||
Object.keys(values).forEach(function(id) {
|
||||
res = res.replace(id, values[id]);
|
||||
});
|
||||
|
||||
cb(null, res);
|
||||
});
|
||||
} catch (err) {
|
||||
cb(prependFilenameToError(filename, err))
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// render with a layout
|
||||
function render_with_layout (filename, template, locals, cb) {
|
||||
render_file(locals, function(err, str) {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
locals.body = str;
|
||||
|
||||
try {
|
||||
var res = template(locals, handlebarsOpts)
|
||||
self.async.done(function (values) {
|
||||
Object.keys(values).forEach(function (id) {
|
||||
res = res.replace(id, values[id])
|
||||
})
|
||||
|
||||
cb(null, res)
|
||||
})
|
||||
} catch (err) {
|
||||
cb(prependFilenameToError(filename, err))
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var layout = options.layout;
|
||||
|
||||
// user did not specify a layout in the locals
|
||||
// check global layout state
|
||||
if (layout === undefined && options.settings && options.settings['view options']) {
|
||||
layout = options.settings['view options'].layout;
|
||||
}
|
||||
|
||||
// user explicitly request no layout
|
||||
// either by specifying false for layout: false in locals
|
||||
// or by settings the false view options
|
||||
if (layout !== undefined && !layout) {
|
||||
return render_file(options, cb);
|
||||
}
|
||||
|
||||
var view_dirs = options.settings.views;
|
||||
|
||||
var layout_filename = [].concat(view_dirs).map(function (view_dir) {
|
||||
var view_path = path.join(view_dir, layout || 'layout');
|
||||
|
||||
if (!path.extname(view_path)) {
|
||||
view_path += extension;
|
||||
}
|
||||
|
||||
return view_path;
|
||||
});
|
||||
|
||||
for (var i = 0; i < layout_filename.length; i++) {
|
||||
var layout_template = cache[layout_filename[i]]
|
||||
|
||||
if (layout_template) {
|
||||
return render_with_layout(layout_filename[i], layout_template, options, cb)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO check if layout path has .hbs extension
|
||||
|
||||
function prependFilenameToError (filename, err) {
|
||||
// prepend to the message
|
||||
if (typeof err.message === 'string') {
|
||||
err.message = filename + ': ' + err.message
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
function cacheAndCompile(filename, str) {
|
||||
var layout_template = handlebars.compile(str);
|
||||
if (options.cache) {
|
||||
cache[filename] = layout_template;
|
||||
}
|
||||
|
||||
render_with_layout(filename, layout_template, options, cb)
|
||||
}
|
||||
|
||||
function tryReadFileAndCache(templates) {
|
||||
var template = templates.shift();
|
||||
|
||||
fs.readFile(template, 'utf8', function(err, str) {
|
||||
if (err) {
|
||||
if (layout && templates.length === 0) {
|
||||
// Only return error if user explicitly asked for layout.
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
if (templates.length > 0) {
|
||||
return tryReadFileAndCache(templates);
|
||||
}
|
||||
|
||||
return render_file(options, cb);
|
||||
}
|
||||
|
||||
cacheAndCompile(template, str);
|
||||
});
|
||||
}
|
||||
|
||||
tryReadFileAndCache(layout_filename);
|
||||
}
|
||||
|
||||
// express 2.x template engine compliance
|
||||
Instance.prototype.compile = function (str) {
|
||||
if (typeof str !== 'string') {
|
||||
return str;
|
||||
}
|
||||
|
||||
var template = this.handlebars.compile(str);
|
||||
return function (locals) {
|
||||
return template(locals, {
|
||||
helpers: locals.blockHelpers,
|
||||
partials: null,
|
||||
data: null
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
Instance.prototype.registerHelper = function () {
|
||||
this.handlebars.registerHelper.apply(this.handlebars, arguments);
|
||||
};
|
||||
|
||||
Instance.prototype.registerPartial = function () {
|
||||
this.handlebars.registerPartial.apply(this.handlebars, arguments);
|
||||
};
|
||||
|
||||
Instance.prototype.registerPartials = function (directory, done) {
|
||||
var handlebars = this.handlebars;
|
||||
|
||||
var register = function(filepath, done) {
|
||||
var isValidTemplate = /\.(html|hbs)$/.test(filepath);
|
||||
|
||||
if (!isValidTemplate) {
|
||||
return done(null);
|
||||
}
|
||||
|
||||
fs.readFile(filepath, 'utf8', function(err, data) {
|
||||
if (!err) {
|
||||
var ext = path.extname(filepath);
|
||||
var templateName = path.relative(directory, filepath)
|
||||
.slice(0, -(ext.length)).replace(/[ -]/g, '_')
|
||||
.replace(/\\/g, '/')
|
||||
handlebars.registerPartial(templateName, data);
|
||||
}
|
||||
|
||||
done(err);
|
||||
});
|
||||
};
|
||||
|
||||
walk(directory).on('file', function(root, stat, next) {
|
||||
register(path.join(root, stat.name), next);
|
||||
}).on('end', done || function() {});
|
||||
|
||||
};
|
||||
|
||||
Instance.prototype.registerAsyncHelper = function(name, fn) {
|
||||
var self = this;
|
||||
self.handlebars.registerHelper(name, function() {
|
||||
return self.async.resolve(fn, arguments);
|
||||
});
|
||||
};
|
||||
|
||||
Instance.prototype.localsAsTemplateData = function(app) {
|
||||
// Set a flag to indicate we should pass locals as data
|
||||
this.__localsAsData = true;
|
||||
|
||||
app.render = (function(render) {
|
||||
return function(view, options, callback) {
|
||||
if (typeof options === "function") {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
|
||||
// Mix response.locals (options._locals) with app.locals (this.locals)
|
||||
options._locals = options._locals || {};
|
||||
for (var key in this.locals) {
|
||||
options._locals[key] = this.locals[key];
|
||||
}
|
||||
|
||||
return render.call(this, view, options, callback);
|
||||
};
|
||||
})(app.render);
|
||||
};
|
||||
|
||||
module.exports = new Instance();
|
||||
module.exports.create = function(handlebars) {
|
||||
return new Instance(handlebars);
|
||||
};
|
78
node_modules/hbs/package.json
generated
vendored
Normal file
78
node_modules/hbs/package.json
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"_from": "hbs@^4.1.0",
|
||||
"_id": "hbs@4.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-6QsbB4RwbpL4cb4DNyjEEPF+suwp+3yZqFVlhILEn92ScC0U4cDCR+FDX53jkfKJPhutcqhAvs+rOLZw5sQrDA==",
|
||||
"_location": "/hbs",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "hbs@^4.1.0",
|
||||
"name": "hbs",
|
||||
"escapedName": "hbs",
|
||||
"rawSpec": "^4.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/server"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/hbs/-/hbs-4.1.1.tgz",
|
||||
"_shasum": "8aab17ca6ae70f9aaa225278bed7af31011254b7",
|
||||
"_spec": "hbs@^4.1.0",
|
||||
"_where": "/home/runner/Socketio-Chat-Template/node_modules/server",
|
||||
"author": {
|
||||
"name": "Don Park",
|
||||
"email": "donpark@docuverse.com",
|
||||
"url": "http://blog.docuverse.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/pillarjs/hbs/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Roman Shtylman",
|
||||
"email": "shtylman@gmail.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"handlebars": "4.7.6",
|
||||
"walk": "2.3.14"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Express.js template engine plugin for Handlebars",
|
||||
"devDependencies": {
|
||||
"eslint": "6.8.0",
|
||||
"eslint-plugin-markdown": "1.0.2",
|
||||
"mocha": "7.1.1",
|
||||
"nyc": "15.0.0",
|
||||
"rimraf": "2.7.1",
|
||||
"supertest": "4.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8",
|
||||
"npm": "1.2.8000 || >= 1.4.16"
|
||||
},
|
||||
"files": [
|
||||
"lib/",
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"homepage": "https://github.com/pillarjs/hbs#readme",
|
||||
"license": "MIT",
|
||||
"main": "lib/hbs.js",
|
||||
"name": "hbs",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/pillarjs/hbs.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --plugin markdown --ext js,md .",
|
||||
"test": "mocha --reporter spec --ui qunit --bail test/*/index.js",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
||||
},
|
||||
"version": "4.1.1"
|
||||
}
|
Reference in New Issue
Block a user