diff --git a/README.fr.md b/README.fr.md index cd51ed1..bfcdce1 100644 --- a/README.fr.md +++ b/README.fr.md @@ -345,7 +345,7 @@ matchigo émet un `console.warn` **une seule fois** quand il détecte un mésusa - Reconstruire `rules` à chaque appel de `match(value, rules)` (l'anti-pattern « cold-path inline »). - Créer des milliers d'instances distinctes de `matcher()` (typiquement, le builder est dans une boucle chaude). -Les avertissements sont pilotés par `NODE_ENV` (`production`/`prod` les désactive) ou par l'override explicite `MATCHIGO_DEV=0` / `MATCHIGO_DEV=1`. La vérification se fait une fois au chargement du module, donc **production a un coût nul** — pas de lecture d'env, pas de compteur, pas de formatage de string. +Les avertissements sont pilotés par `NODE_ENV` (`production`/`prod` les désactive). La vérification se fait une fois au chargement du module, donc **production a un coût nul** — pas de lecture d'env, pas de compteur, pas de formatage de string. ```ts import { silenceWarnings } from "matchigo"; diff --git a/README.md b/README.md index a997aee..63b7b1e 100644 --- a/README.md +++ b/README.md @@ -399,7 +399,7 @@ matchigo emits a `console.warn` **once** when it detects misuse that defeats cac - Reconstructing `rules` on every `match(value, rules)` call (the "cold-path inline" anti-pattern). - Creating thousands of distinct `matcher()` instances (usually means the builder is inside a hot loop). -Warnings are controlled by `NODE_ENV` (`production`/`prod` disables them) or the explicit `MATCHIGO_DEV=0` / `MATCHIGO_DEV=1` override. The check happens once at module load, so **production has zero cost** — no env reads, no counters, no string formatting. +Warnings are controlled by `NODE_ENV` (`production`/`prod` disables them). The check happens once at module load, so **production has zero cost** — no env reads, no counters, no string formatting. ```ts import { silenceWarnings } from "matchigo"; diff --git a/package.json b/package.json index f54a9c2..a251b57 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,22 @@ "keywords": [ "pattern-matching", "match", - "rust", + "dispatch", + "compile", + "rule-engine", + "rules", "typescript", + "type-safe", "exhaustive", - "fast" + "narrowing", + "discriminated-union", + "switch", + "data-driven", + "fast", + "zero-dependency", + "rust-like", + "bun", + "node" ], "license": "MIT", "author": "SUP2Ak", @@ -24,13 +36,8 @@ }, "files": [ "dist", - "src", "README.md", "README.fr.md", - "FAQ.md", - "FAQ.fr.md", - "CONTRIBUTING.md", - "CONTRIBUTING.fr.md", "LICENSE" ], "sideEffects": false, diff --git a/src/dev.ts b/src/dev.ts index 044ae24..3934977 100644 --- a/src/dev.ts +++ b/src/dev.ts @@ -1,9 +1,8 @@ // Dev-only cold-path instrumentation. // Resolution policy (evaluated ONCE at module load → zero runtime cost): // -// 1. MATCHIGO_DEV env var wins — accepts "0"|"false" (off) or "1"|"true" (on). -// 2. Else NODE_ENV — matches "production", "prod" (case-insensitive) → off. -// 3. Else default → on (verbose dev). +// 1. NODE_ENV — matches "production", "prod" (case-insensitive) → off. +// 2. Else default → on (verbose dev). // // Programmatic override: silenceWarnings() at startup mutes everything. // No NODE_ENV at all? Dev mode is ON. The counters still cost only a few `++` @@ -12,9 +11,6 @@ const DEV: boolean = (() => { try { if (typeof process === "undefined" || !process?.env) return true; - const explicit = process.env.MATCHIGO_DEV; - if (explicit === "0" || explicit === "false") return false; - if (explicit === "1" || explicit === "true") return true; const node = (process.env.NODE_ENV ?? "").toLowerCase(); if (node === "production" || node === "prod") return false; return true; @@ -48,7 +44,7 @@ export function trackMatch(cacheHit: boolean): void { ` • Or compile once with compile():\n` + ` const dispatch = compile([...]);\n` + ` dispatch(value);\n` + - ` Silence: silenceWarnings() — or set MATCHIGO_DEV=0.`, + ` Silence: silenceWarnings() — or set NODE_ENV=production.`, ); warnedMatch = true; } @@ -65,7 +61,7 @@ export function trackMatcher(): void { ` .with(...)\n` + ` .otherwise(...); // builds + compiles once\n` + ` classify(value); // reused hot path\n` + - ` Silence: silenceWarnings() — or set MATCHIGO_DEV=0.`, + ` Silence: silenceWarnings() — or set NODE_ENV=production.`, ); warnedMatcher = true; } diff --git a/src/p.ts b/src/p.ts index eb24c6b..7b51750 100644 --- a/src/p.ts +++ b/src/p.ts @@ -236,7 +236,7 @@ export const P = { * * @example * ```ts - * { with: P.union("GET", "POST", "PUT"), then: () => "http-verb" } + * { with: P.union("GET", "POST", "PUT"), then: () => "method" } * ``` */ union: (...values: Values): PUnion => ({