diff --git a/.claude/skills/suggest/SKILL.md b/.claude/skills/suggest/SKILL.md index f757f8a..be81651 100644 --- a/.claude/skills/suggest/SKILL.md +++ b/.claude/skills/suggest/SKILL.md @@ -36,7 +36,7 @@ Skip categories where things look fine. Don't invent problems. **Linting** — `.oxlintrc.json` rules that are stale, redundant, or missing for the code in `scripts/`, `src/`, and `test/` -**Packaging** — `package.json` `exports` conditions, `files`, and `types` that don't match what the build in `dist/` actually produces (ESM, CJS, IIFE, declarations) +**Packaging** — `package.json` `exports` conditions, `files`, and `types` that don't match what the build in `dist/` actually produces (ESM, IIFE, declarations) **Developer Experience** — missing or misleading `package.json` scripts, incomplete `.gitignore`/`.gitattributes`, missing docs or source comments diff --git a/README.md b/README.md index 3513857..d8b2552 100644 --- a/README.md +++ b/README.md @@ -22,17 +22,15 @@ To install node-diff3 as a dependency in your project: $ npm install --save node-diff3 ``` -**node-diff3** is distributed in CJS and ESM module formats for maxmimum compatibility. ([Read more about Javascript module formats](https://dev.to/iggredible/what-the-heck-are-cjs-amd-umd-and-esm-ikm)) - +**node-diff3** is written in TypeScript and distributed as an ESM module, with type declarations included. ([Read more about Javascript module formats](https://dev.to/iggredible/what-the-heck-are-cjs-amd-umd-and-esm-ikm)) ```js -const Diff3 = require('node-diff3'); // CommonJS import all -const diff3Merge = require('node-diff3').diff3Merge; // CommonJS import named -// or import * as Diff3 from 'node-diff3'; // ESM import all import { diff3Merge } from 'node-diff3'; // ESM import named ``` +CommonJS code can still `require('node-diff3')` on Node 20.19+ or 22.12+, which can load ESM modules with `require()`. + ### Use in Browsers You can also use **node-diff3** directly in a web browser. A good way to do this is to fetch the ["iife"](https://esbuild.github.io/api/#format-iife) bundle from the [jsDelivr CDN](https://www.jsdelivr.com/), which can even deliver minified versions. @@ -40,7 +38,7 @@ You can also use **node-diff3** directly in a web browser. A good way to do thi When you load this file in a ` + …