# @nsis/parser

> Parser for NSIS scripts

Latest version **0.2.0** (published 2026-09-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nsis/parser
pnpm add @nsis/parser
yarn add @nsis/parser
bun add @nsis/parser
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2026-09-24 |
| First published | 2026-06-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=20.0.0 |
| Dependencies | 0 |
| Unpacked size | 22.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | idleberg |
| Keywords | nsis, parser, peg, grammar |

## Links

- npm: https://www.npmjs.com/package/@nsis/parser
- Repository: https://github.com/idleberg/nsis-org
- Homepage: https://github.com/idleberg/nsis-org/tree/main/packages/parser#readme
- npm.io page: https://npm.io/package/@nsis/parser

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2026-09-24
- 0.1.2 — 2026-08-15
- 0.1.1 — 2026-07-30
- 0.1.0 — 2026-06-04

## README

# @nsis/parser

> Parser for NSIS scripts

![License](https://img.shields.io/npm/l/%40nsis%2Fparser?style=for-the-badge)
[![Version](https://img.shields.io/npm/v/@nsis/parser?style=for-the-badge)](https://www.npmjs.org/package/@nsis/parser)
[![Build](https://img.shields.io/github/actions/workflow/status/idleberg/nsis-org/ci.yml?style=for-the-badge)](https://github.com/idleberg/nsis-org/actions)

## Installation

`npm install @nsis/parser`

## Usage

```ts
import { parse } from "@nsis/parser";

const nodes = parse(`
  Name "Demo"
  Section
    Nop
  SectionEnd
`);
```

Returns a flat array of CST nodes, one per logical line:

```ts
[
	{ type: "blank" },
	{ type: "instruction", keyword: "Name", args: ['"Demo"'] },
	{ type: "instruction", keyword: "Section", args: [] },
	{ type: "instruction", keyword: "Nop", args: [] },
	{ type: "instruction", keyword: "SectionEnd", args: [] },
	{ type: "blank" },
];
```

### API

#### `parse(input)`

Parses NSIS source text into a flat list of CST nodes. Handles BOM stripping and line continuations automatically.

Throws `SyntaxError` if the input cannot be parsed.

### Node Types

#### `BlankNode`

```ts
{
	type: "blank";
}
```

#### `CommentNode`

```ts
{ type: "comment", style: "hash" | "semicolon" | "block", value: string }
```

#### `InstructionNode`

```ts
{ type: "instruction", keyword: string, args: string[], comment?: Comment }
```

#### `LabelNode`

```ts
{ type: "label", name: string, comment?: Comment }
```

## Related

- [dent](https://www.npmjs.com/package/@nsis/dent)
- [dent-cli](https://www.npmjs.com/package/@nsis/dent-cli)

## License

This work is licensed under [The MIT License](LICENSE).

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