Unlock custom brushes, natural fill effects and intuitive hatching in p5.js
feat: add package exports field for p5 and standalone subpaths
acamposuribe85891382b1df
diff --git a/README.md b/README.mdindex ef86bc9..37e4c57 100644--- a/README.md+++ b/README.md@@ -69,16 +69,20 @@ Alternatively, you can link to a `p5.brush.js` file hosted online. All versions### Install with NPM and other modular-based apps-Install the npm package. p5.brush requires p5.js as a peer dependency.+Install the npm package. p5.brush requires p5.js as a peer dependency for the p5 build.```npm install p5.brush --save```-After that, import p5.brush functions to your sketch:+The package exposes two subpaths — pick the one that matches your build:-```+```js+// p5 build (default) — requires p5.js 2.ximport * as brush from 'p5.brush'++// Standalone build — no p5.js required+import * as brush from 'p5.brush/standalone'```If you are using p5 and p5.brush as modules, you will need to use instance mode. Read below.diff --git a/docs/standalone.md b/docs/standalone.mdindex a04506e..131c8b2 100644--- a/docs/standalone.md+++ b/docs/standalone.md@@ -29,7 +29,14 @@ Download `dist/brush.js` from this repository and include it in your HTML. It ex<script src="path_to/brush.js"></script>```-### ESM module+### ESM module via npm++```js+// After: npm install p5.brush+import * as brush from 'p5.brush/standalone';+```++### ESM module via local file```jsimport * as brush from './dist/brush.esm.js';diff --git a/llms.txt b/llms.txtindex 62df833..2c70cb5 100644--- a/llms.txt+++ b/llms.txt@@ -34,8 +34,11 @@ p5.brush ships in **two completely different builds**. Before generating any cod``````js-// ESM+// ESM — p5 build (default)import * as brush from 'p5.brush'++// ESM — standalone build (no p5.js required)+import * as brush from 'p5.brush/standalone'```### Setup@@ -114,7 +117,10 @@ image(fb, 20, 240)``````js-// ESM+// ESM — via npm+import * as brush from 'p5.brush/standalone'++// ESM — local fileimport * as brush from './dist/brush.esm.js'```diff --git a/package.json b/package.jsonindex 9a1e971..8b79b37 100644--- a/package.json+++ b/package.json@@ -2,9 +2,19 @@"name": "p5.brush","version": "2.1.1-beta","description": "Unlock custom brushes, natural fill effects and intuitive hatching in p5.js",- "main": "src/index.p5.js",- "module": "src/index.p5.js",+ "main": "dist/p5.brush.js",+ "module": "dist/p5.brush.esm.js","browser": "dist/p5.brush.js",+ "exports": {+ ".": {+ "import": "./dist/p5.brush.esm.js",+ "require": "./dist/p5.brush.js"+ },+ "./standalone": {+ "import": "./dist/brush.esm.js",+ "require": "./dist/brush.js"+ }+ },"scripts": {"test": "vitest run","test:watch": "vitest",