
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
browserify transform that exposes globals added via a script tag as modules so they can be required.
browserify transform that exposes globals added via a script tag as modules so they can be required.
<!-- index.html -->
<head>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/three.js/r61/three.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
[..]
// main.js
var $ = require('jquery')
, THREE = require('three')
console.log('THREE revision: ', THREE.REVISION);
console.log('jquery version: ', $().jquery);
var browserify = require('browserify');
// configure what we want to expose
var exposeConfig = { expose: { jquery: '$', three: 'THREE' } };
browserify()
.require(require.resolve('./main'), { entry: true })
.transform('exposify', exposeConfig)
.bundle({ debug: true })
.pipe(fs.createWriteStream(path.join(__dirname, 'bundle.js'), 'utf8'))
Using the EXPOSIFY_CONFIG
environment variable:
EXPOSIFY_CONFIG='{ "jquery": "$", "three": "THREE" }' browserify --debug -t exposify main.js > bundle.js
Or using a Browserify transform option:
browserify --debug -t [ exposify --expose [ --jquery $ --three THREE ] ] main.js > bundle.js
Or use browserify-shim which can configure exposify in package.json
among other features.
npm install exposify
The config which is used by exposify to determine which require statemtents to replace and how.
You need to set this or provide it via the EXPOSIFY_CONFIG
environment variable.
var b = browserify();
// setting via transform argument
b.transform('exposify', { expose: { jquery: '$', three: 'THREE' } });
// setting from javascript
exposify.config = { jquery: '$', three: 'THREE' };
# setting from command line
EXPOSIFY_CONFIG='{ "jquery": "$", "three": "THREE" }' browserify -t exposify ...
Exposes the expose function that operates on a string
Regex pattern of files whose content is exposified
browserify transform which exposes globals as modules that can be required.
Name | Type | Argument | Description |
---|---|---|---|
file | string | file whose content is to be transformed | |
opts | Object |
<optional> | (exposify config), defaults to exposify.config or $EXPOSIFY_CONFIG |
transform that replaces require statements found in the code with global assigments
generated with docme
MIT
FAQs
browserify transform that exposes globals added via a script tag as modules so they can be required.
We found that exposify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.