
Company News
Andrew Becherer Joins Socket as Chief Information Security Officer
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.
@dtkdtk/jsnut
Advanced tools
What is "JSNut"? JSNut is a NodeJS NUTive module build tool. It is very easy to use: npx -- @dtkdtk/jsnut build -f ./src/module.cc -o ./dist/ --onlymod will compile module.cc file into a native NodeJS addon (module.node), which you can import into your JS code using require("./module.node")
jsnutpackage.json and binding.gyp filessort_includes tool [experimental]Type npx @dtkdtk/jsnut help to get command help.
Type npx -- @dtkdtk/jsnut build <-f filename> <-o outdir> [-n modname] [--clean|--onlymod] to compile C++ file
[!IMPORTANT]
using namespace STH;in any file causes compilation errors. Please use STH::... instead.
src/module.cc
#include <nan.h>
#include <iostream>
#include "otherfile.hh"
#define MODULE_NAME some_code
void do_nothing(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
std::cout << "nothing and "
<< otherfile_function()
<< std::endl;
}
void MODULE_INIT(v8::Local<v8::Object> exports)
{
auto context = exports->GetCreationContextChecked();
exports->Set(
context,
Nan::New("do_nothing").ToLocalChecked(),
Nan::New<v8::FunctionTemplate>(do_nothing)->GetFunction(context).ToLocalChecked()
);
}
NODE_MODULE(MODULE_NAME, MODULE_INIT)
src/otherfile.hh
int otherfile_function();
src/otherfile.cc
#include "otherfile.hh"
int otherfile_function()
{
return 7;
}
./build-native-addons.bash
#!/usr/bin/env bash
#Warning: it calculates the path to the files from package.json
npx -- @dtkdtk/jsnut build \
-f "./src/module.cc" \
-f "./src/otherfile.hh" \
-f "./src/otherfile.cc" \
-o "./dist" \
--clean;
sleep 10s
Result: (file tree)
src/otherfile.ccotherfile.hhmodule.ccdist/module.node (first specified source file name)module.slnmodule.vcxproj[!WARNING]
This feature is experimental and uncompleted (and so unperfect). Use at your own risk
To sort, use the jsnut sort_includes <...src_dirs> command
#include directives are sorted as follows:
"ui/app.h")/ or .) (<node.h>)[!NOTE]
Standard C headers are into this category
"lib/api.h").h extension) (<iostream>)
There is an empty line between categories.
The order was borrowed from Google, but with some changes.[!WARNING]
The tool will remove any not-multiline comments in the '#include's block. Please put them rather (or later) than '#include' directives
FAQs
What is "JSNut"? JSNut is a NodeJS NUTive module build tool`
We found that @dtkdtk/jsnut 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.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.

Company News
Replit is integrating Socket Firewall into its AI-powered development experience to help protect builders from malicious open source packages.

Security News
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.