![Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack](https://cdn.sanity.io/images/cgdhsj6q/production/6af25114feaaac7179b18127c83327568ff592d1-1024x1024.webp?w=800&fit=max&auto=format)
Security News
Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
require
Advanced tools
Readme
require
to the browserNode's require()
is the de facto javascript dependency statement.
npm
is the de facto javascript module manager.
require brings both of them to the browser.
"Just give me some code that runs"
mkdir app; cd app
echo '{ "name":"app" }' > package.json
sudo npm install require
sudo npm install raphael
curl -O https://raw.github.com/gist/975866/little_server.js
curl -O https://raw.github.com/gist/975868/little_client.js
node little_server.js
Now go to http://localhost:8080
sudo npm install -g require
Start dev server
require serve ./example --port 1234 --host localhost
In your HTML:
<script src="//localhost:1234/require/client"></script>
This is like calling require('client') from inside ./example. Read more on node's require path resolution
(You'll want to do this before you deploy to production)
require compile ./example/client.js > client.min.js
In node:
require('require/server').listen(1234)
or mount it on an http server you're already running
var server = http.createServer(function(req, res) { })
require('require/server').mount(server)
server.listen(8080, 'localhost')
or, as connect middleware
connect.createServer(
connect.static(__dirname + '/example'),
require('require/server').connect()
)
Compile programmatically:
var compiler = require('require/compiler')
console.log(compiler.compile('./example/client.js'))
console.log(compiler.compileCode('require("./example/client")'))
The compiler supports all the options of https://github.com/mishoo/UglifyJS, e.g.
compiler.compile('./example/client.js', { beautify:true, ascii_only:true })
FAQs
javascript module management! brings node's require statement to the browser
The npm package require receives a total of 13,833 weekly downloads. As such, require popularity was classified as popular.
We found that require 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
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.