# setil

> node.js SEA utility

Latest version **0.0.1-a** (published 2023-09-26) · 0 weekly downloads

## Install

```sh
npm install setil
pnpm add setil
yarn add setil
bun add setil
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1-a |
| Published | 2023-09-26 |
| First published | 2023-09-26 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 22.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Angelo II |
| Maintainers | angelocore |

## Links

- npm: https://www.npmjs.com/package/setil
- Repository: https://github.com/AngeloCore/setil
- Homepage: https://github.com/AngeloCore/setil#readme
- Issues: hhttps://github.com/AngeloCore/setil/issues
- npm.io page: https://npm.io/package/setil

## Dependencies (4)

- [smob](https://npm.io/package/smob.md) ^1.4.1
- [fs-extra](https://npm.io/package/fs-extra.md) ^11.1.1
- [postject](https://npm.io/package/postject.md) 1.0.0-alpha.6
- [portable-executable-signature](https://npm.io/package/portable-executable-signature.md) ^2.0.0

## Recent versions

- 0.0.1-a (latest) — 2023-09-26

## README

## Setil - single executable applications utility

> The goal of this package is to help you build node.js [SEA](https://nodejs.org/api/single-executable-applications.html) with ease.

### CLI Example

CLI usage is not implemented yet.

### Code Example

```mjs
import { compile } from "setil";
import { readFileSync } from "node:fs";
import { resolve } from "nod:path";

const input = readFileSync("src/index.js", "utf-8");
const output = `./app.exe`;

await setil.compile(input, output);

// Enjoy!
```

### Usage

`compile(input: string, rawOutput: string, rawOptions?: Partial<Options>): Promise<Result>`

- input - The input code, as SEA doesn't accept imports after compilation, you can use rollup to bundle your project into a single file. You can also check [rollup-plugin-jsative](https://github.com/AngeloCore/rollup-plugin-jsative) if you use native modules.
- output (rawOutput) - The output path of your application, e.g. `./program.exe`.
- options (rawOptions) - Any additional customization, checkout [Options](#options)

#### **`Options`**

| Property            | Type                                  | Default             | Description                                                                                                                        |
| ------------------- | ------------------------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `logLevel`          | [LogLevel](#loglevel)                 | "warn"              | Specifies the desired log level for the application.                                                                               |
| `disableSeaWarning` | boolean                               | false               | Disables `(node:16104) ExperimentalWarning: Single executable application is an experimental feature and might change at any time` |
| `useSnapshot`       | boolean                               | false               | [Startup Snapshots](https://nodejs.org/api/single-executable-applications.html#startup-snapshot-support)                           |
| `useCodeCache`      | boolean                               | false               | [V8 Code Cache](https://nodejs.org/api/single-executable-applications.html#v8-code-cache-support)                                  |
| `nodeExePath`       | string \| undefined                   | process.execPath    | The path where the blob should be injected into (Optional)                                                                         |
| `noSign`            | boolean                               | true                | Controls whether to remove the original Node.JS signature.                                                                         |
| `preInject`         | (path: string) => any \| Promise<any> | Noop (no operation) | A hook executed just before the blob is injected into the application can be used to modify the nodeExePath file.                  |

#### Types

#### **`Result`**

| Property      | Type   | Description                   |
| ------------- | ------ | ----------------------------- |
| `input`       | string | The input code used.          |
| `outputPath`  | string | The output path of the SEA.   |
| `nodeExePath` | string | The `nodeExePath` used.       |
| `tempDir`     | string | The temporary directory used. |

#### **`LogLevel`**

One of `debug`, `warn` or `silent`

- debug - Show debug logs
- warn - Show warnings only (default)
- silent - Don't print anything

### Resources

- [Github](https://github.com/AngeloCore/setil)
- [Node.js SEA](https://nodejs.org/api/single-executable-applications.html)
- [Rollup](https://rollupjs.org/v)
- [@rollup/plugin-commonjs](https://www.npmjs.com/package/@rollup/plugin-commonjs)
- [@rollup/plugin-node-resolve](https://www.npmjs.com/package/@rollup/plugin-node-resolve)
- [rollup-plugin-jsative](https://github.com/AngeloCore/rollup-plugin-jsative)

---
_Source: https://npm.io/package/setil · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
