# Changelog

All notable changes to this project will be documented in this file.

## [Unreleased]

## v2.0.0 - 2026-11-13

### Breaking changes

- drop support for Node.js < 22, `engines` now requires `>=22`
- remove the CommonJS build, the package is ESM only and the CLI runs `src/` as is. `require('texample')` loads the ES module and needs Node.js 22.12 or later
- CLI takes several markdown files as separate arguments, `texample ./README.md ./docs/API.md`, where only the last file argument ran before. The comma separated list is gone, a comma is now part of the file name

### Features

- support import attributes in examples, e.g. `import data from './data.json' with { type: 'json' }`, for both static and dynamic imports

## v1.1.0 - 2026-09-20

- CLI file arguments accept glob patterns, expanded with Node's own `fs.glob`, see the CLI section of the README
- a file listed or matched more than once runs once
- symlinks are silently ignored, list the target instead
- generate the README table of contents with [@0dep/toc](https://www.npmjs.com/package/@0dep/toc)
- bump dev dependencies

## v1.0.2 - 2026-05-02

- support dynamic import in examples

## v1.0.1 - 2026-05-01

Labour day release.

- make package Windows friendly

## v1.0.0 - 2026-04-26

Let Claude in and fix stuff.

### Breaking changes

- CLI vm context defaults to `globalThis`; `-g` is now a silent no-op (`fetch`, `EventTarget`, `performance`, etc. available out of the box).
- `ExampleEvaluator`'s 4th constructor param renamed `sandbox` → `vmContext` and now defaults to `globalThis` when omitted.
- Config `require` entries are forwarded as `-r` setup files (run inside the vm context) instead of via Node's `--import` (host process).
- No auto-discovered config; `bin/texample.cjs` reads a config only when `-c <path>` is passed explicitly.
- `bin/texample.cjs` propagates the child's exit code (previously always 0).

### Features

- `-r <path>` CLI flag (repeatable): loads ESM setup files inside the example's vm context before the example runs; `lineOffset` stays relative to the markdown source.
- `-c <path>` CLI flag: JSON config with `require` (forwarded as `-r`, bare specifiers resolved via `node_modules`) and `node-option` (appended to the always-on `--experimental-vm-modules --no-warnings` defaults).
- `-?` CLI flag prints usage.
- `ExampleEvaluator` accepts a 5th param `setupFiles: string[]`.

## v0.1.0 - 2025-11-13

- package provenance release

## v0.0.8 - 2025-04-29

- update readme

## v0.0.7 - 2025-02-10

- bump some dev deps and some readme

## v0.0.6 - 2024-07-13

- introduce `-g` cli flag to work with modules with side effects

## v0.0.5 - 2024-05-19

- refactor script-linker to work with imported commonjs modules

## v0.0.4 - 2024-05-17

- forgot to update cli with new signature, and its not only script linker that got new signature but also the example evaluator

## v0.0.3 - 2024-05-17

- honor package.json exports
- change script linker signature to take entire package json instead of name and module
- change file cache to be a promised file cache
