
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
bun-coffeescript
Advanced tools
A simple & small plugin for [bun](https://bun.sh/) to add support for CoffeeScript.
A simple & small plugin for bun to add support for CoffeeScript.
CoffeeScript hasn't been updated in a while, so I've taken the liberty to simply add it as a direct dependency.
There's different considerations for different types of projects. When simply using bun-coffeescript as part of an application, you may add it as direct dependency with bun's built-in package manager:
$ bun add bun-coffeescript
When aiming to write (part of) your library in CoffeeScript, you likely want to build & bundle your library as pure JavaScript. Thus, add bun-coffeescript as a dev dependency using the -d
option to allow compatibility with Node and/or browsers:
$ bun add -d bun-coffeescript
Finally, make sure to preload the plugin. Either call bun's plugin
function yourself in a custom preload script, or add my register script to your bunfig.toml
or your Bun.build
call:
preload: ['bun-coffeescript/register']
Bun.build({
// ... more config
preload: [
'bun-coffeescript/register',
// ... more preload scripts
],
// ... yet more config
});
When using CoffeeScript sources in your project you won't be able to simply run bun build
, because the bunfig.toml
configuration settings are only respected for the execution of the bun build
command itself, not for the actual build process. Thus, attempting to run bun build index.coffee
will simply result in an index.js
which imports the contents of index.coffee
as raw string - ie. it is using bun's built-in file loader rather than this plugin's CoffeeScript loader.
To properly build (and by proxy bundle) your project, you must interface with the bun API directly. For example:
# build.coffee in project root
import CoffeeScriptPlugin from 'bun-coffeescript'
# Bun is an implicitly defined global in the Bun runtime
Bun.build
target: 'node'
entrypoints: ['./index.coffee']
plugins: [CoffeeScriptPlugin()]
outdir: 'build'
define:
'process.env.ENV': '"PROD"'
Specifying the process.env.ENV
(or, for compatibility, process.env.NODE_ENV
) is helpful as there are some differences between running your code directly through the bun runtime versus running bundled code. For example, the __dirname
constant is replaced (as if implicitly define
d) with the path at build time, not at runtime.
Unfortunately, bun does not currently support adding new extensions to the unit testing suite. Thus, you are not able to write your unit tests in CoffeeScript. However, you will need to preload this plugin by adding it to your bunfig.toml
:
[test]
preload = ['bun-coffeescript/register']
FAQs
A simple & small plugin for [bun](https://bun.sh/) to add support for CoffeeScript.
The npm package bun-coffeescript receives a total of 7 weekly downloads. As such, bun-coffeescript popularity was classified as not popular.
We found that bun-coffeescript 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.
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.