
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
TypeScript to C++ compiler.
Giving a TypeScript project, it can translate the code to C++, and produce native executables and Node.js modules.
This project does not plan to support every TypeScript feature - doing so would
make it downgrade to a JavaScript interpreter - it only translates code that can
be effiently represented in C++. Code relying on JavaScript's dynamic natures,
for example prototype and any, will be rejected.
Currently it is still very early days, and it fails to translate most existing TypeScript projects, but it is capable of turning some performance-critical code into native Node.js modules.
There is currently no documentation on which TypeScript syntax and features are supported.
Install:
npm install -g compilets
Help:
βββ Compilets - 0.0.1-dev βββββββββββββββββββββββββββββββββββββββββββββ
$ compilets <command>
βββ General commands ββββββββββββββββββββββββββββββββββββββββββββββββββ
compilets build [--config #0] [--target #0] ...
Build C++ project.
compilets gen [--root #0] [--config #0] [--target #0]
Generate a C++ project from TypeScript project.
compilets gn-gen [--config #0] <--target #0>
Run "gn gen" for the C++ project.
Example:
mkdir example
cd example
echo 'console.log("Hello World!")' > main.ts
compilets gen
compilets build
./cpp-project/out/Debug/example
tsconfig.json and package.jsonWhen compiling a project, the tsconfig.json file under the root directory is
used for initializing the TypeScript compiler. If such file is not present,
following compilerOptions will be used:
{
noEmit: true,
noImplicitAny: true,
strictNullChecks: true,
allowImportingTsExtensions: true
}
In this case the .ts files under the root directory will be used for
compilation, and the files are searched non-recursively.
Also, the compilerOptions.strictNullChecks field must be true when a
tsconfig.json file is provided.
When a package.json file is found in the root directory, following rules are
applied:
name field is used as the project's name.compilets.main field is a .ts file, a native module will be
created.compilets.bin field is an object with values of .ts files,
executables will be created for each entry of the object.An example package.json file:
{
"name": "download",
"compilets": {
"main": "lib.ts",
"bin": {
"download": "cli.ts"
}
}
}
If there is no package.json file, the root directory must contain only one
.ts file and it will be compiled into executable.
The documentations of Oilpan GC (cppgc) can be found at:
You can get familiar with TypeScript's compiler APIs with following articles:
Tools below will help developement of this project:
About GN, the build system used for building C++ code:
This project is published under GPLv3, the C++ code (/cpp/runtime) has a an
extra linking exception.
In plain words, distributing the compiled executable files does not require you to open source, only including the source code of this project requires so.
I'll change the license to a permissive one if this project gets enough funding.
By sending a pull request, you hereby grant to owners and users of this project a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute your contributions and such derivative works.
The owners of the this project will also be granted the right to relicense the contributed source code and its derivative works to a more permissive license.
FAQs
Compile TypeScript to C++ Executables
The npm package compilets receives a total of 2 weekly downloads. As such, compilets popularity was classified as not popular.
We found that compilets demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Β It has 0 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
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: whatβs affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.