Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Released under the terms of the MIT License.
BravoJS began life as a reference implementation of an unratified proposed draft for CommonJS Modules/2.0. Note that the CommonJS working group itself is now defacto defunct, meaning that Modules/2.0 will never become a standard. Other implementations referencing this draft include NobleJS and PINF. The current draft specification this code is based on has been included in the references directory.
BravoJS is an extensible CommonJS module system for the web browser, similar in principle to CommonJS Transport/C (e.g. RequireJS and AMD), but maintaining complete backwards compatibility with CommonJS Modules/1.1.1 modules, including lazy initialization and correct support for dependency graphs with cycles.
The extensibility of this module system makes it possible to write plug-ins to add features like
We intend to release both Web Worker and NodeJS plugins for BravoJS in the summer of 2019; they will appear in future versions of this package.
As the CommonJS Modules/2.0 specification is no longer being developed we have taken some liberties with BravoJS and are now targeting NodeJS modules and NPM packages in our development efforts. So far, we have
module.exports
(although we recommend not using it for new code - dragons)module.declare
)Wes Garland wes@kingsds.network
It is anticipated that core BravoJS continues to work with all browsers, going back as far as Internet Explorer 6, however, we are not testing on obsolete platforms at this time.
module.declare(["list", "of", "dependencies"], function (require, exports, modules) {
exports.clickyClick = function(element) {
console.log('You clicked', element.id)
}
})
<html>
<head>
<script id="bravojs" src="/path/to/bravo.js"></script>
<style type="text/css">
BODY[uiState="loading"] * {
pointer-events: none;
}
BODY[uiState="loading"], BODY[uiState="loading"] * {
opacity: 0.5;
cursor: wait !important;
}
</style>
</head>
<body uiState="loading">
<form onsubmit="return module.main.validate(this)">
Click This:
<input type="checkbox" id="veryNiceCheckbox"
onclick="require('./sampleModule').clickyClick(this)"><br>
Type Here:
<input type="text" name="typing">
<input type="submit" value="OK">
</form>
</body>
<script>
/** Main module */
module.declare(["./sampleModule"], function(require, exports, module) {
document.body.setAttribute('uiState', 'ready')
exports.validate = function(form) {
console.log("You typed", form.elements['typing'].value)
return false; /* prevent form from submitting */
}
})
</script>
</html>
Filename | Description |
---|---|
bravo.js | The CommonJS Modules/2.0 environment with default loader |
reference/CommonJS Modules-2.0-draft-8.pdf | The CommonJS Modules/2.0-draft 8 specification |
plugins/wonkoll | A module loader plug-in implemented with LazyLoad.js |
plugins/fastload | A module loader plug-in which implements a multi-module transport. Includes server-side component for GPSEE. |
plugins/jquery-loader | A module loader plug-in which loads modules over JQuery's version of XHR |
demos/area | A web app which calculates the area of a rectangle |
demos/iojs_tests | An environment to exercise the Modules/1.0 test suite |
demos/readme | A sample module and web app (see below) |
utility/cjs2-node.js | A shim to run CommonJS Modules/2.0 modules in NodeJS |
FAQs
Implementation of CommonJS Modules/2.0
We found that bravojs 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.