Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
new Glue()
.basepath('./lib')
.include('./lib')
.replace({
'jquery': 'window.$',
'Chat': 'window.Chat'
})
.export('App')
.render(function (err, txt) {
res.setHeader('content-type', 'application/javascript');
res.end(txt);
});
new Glue()
.include('./core')
.exclude('mocha')
.replace('debug', function(name) {
console.log('name', arguments);
})
.export('Core')
.watch(function (err, txt) {
fs.writeFile('./core.js', txt);
});
.include(directory): recursively includes files in the directory
.include(file): includes a single file
.replace(module, code):
Replaces a module or global with a piece of code
Example: .replace('jquery', 'window.$') require('jquery') should return window.$
Note that you can also pass a function or object rather than a string. In that case, the function is converted to a string and JSON.stringify is applied to a object.
Example: .replace('debug', function debug() { return debug() });
.exclude(regexp): excludes a path from the build completely
.export(name): sets the export name
.render(function(err, text){ ...}): renders the result
.watch(function(err, text){ ...})
Renders the result and adds file watchers on the dependent files.
When the file changes, the callback will be called again, with the newly rendered version.
Note that this API is a bit clunky:
But it works fine for automatically rebuilding e.g. in dev.
.defaults({
reqpath: '/path/to/first/module/to/require/glue', // all relative paths are relative to this
basepath: '', // strip this string from each path (e.g. /foo/bar/baz.js with '/foo' becomes 'bar/baz.js')
main: 'index.js', // main file, preset default is index.js
export: '', // name for the variable under window to which the package is exported
replace: { 'jquery': 'window.$' } // require('jquery') should return window.$
})
Set default values.
.npm(file.json): includes a package.json
FAQs
Build CommonJS modules for the browser via a chainable API
The npm package gluejs receives a total of 267 weekly downloads. As such, gluejs popularity was classified as not popular.
We found that gluejs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.