From 47906ffcdcb2f8b6732e22ec0c369ccac786e3f7 Mon Sep 17 00:00:00 2001 From: roottool Date: Tue, 3 Mar 2026 22:09:29 +0900 Subject: [PATCH 1/6] chore: add sideEffects false for better tree-shaking Co-Authored-By: Claude Sonnet 4.6 --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 9a9fec5..2ea9b92 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "dist" ], "type": "module", + "sideEffects": false, "main": "./dist/index.js", "module": "./dist/index.js", "types": "./dist/index.d.ts", From 0b5af46fee48aec7e2e47d4c7d51a169b118c14f Mon Sep 17 00:00:00 2001 From: roottool Date: Tue, 3 Mar 2026 22:45:52 +0900 Subject: [PATCH 2/6] feat(tsconfig): enable isolatedDeclarations Co-Authored-By: Claude Sonnet 4.6 --- tsconfig.examples.json | 3 ++- tsconfig.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tsconfig.examples.json b/tsconfig.examples.json index 570b9b7..89a7d07 100644 --- a/tsconfig.examples.json +++ b/tsconfig.examples.json @@ -3,7 +3,8 @@ "compilerOptions": { "noEmit": true, "declaration": false, - "declarationMap": false + "declarationMap": false, + "isolatedDeclarations": false }, "include": ["examples/**/*.ts"] } diff --git a/tsconfig.json b/tsconfig.json index 068f743..e3439f3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,6 +7,7 @@ "moduleResolution": "nodenext", "rewriteRelativeImportExtensions": true, "erasableSyntaxOnly": true, + "isolatedDeclarations": true, "verbatimModuleSyntax": true, // Emit From c26707334e0142a98482cf4236e407464e166c6b Mon Sep 17 00:00:00 2001 From: roottool Date: Tue, 3 Mar 2026 22:46:04 +0900 Subject: [PATCH 3/6] refactor(forbiddenKeys): explicit ReadonlySet annotation, simplify - Add explicit `: ReadonlySet` annotation (required by isolatedDeclarations) - Upgrade from Set to ReadonlySet to prevent accidental mutation - Remove redundant `` generic and `as const satisfies readonly string[]` Co-Authored-By: Claude Sonnet 4.6 --- src/issues/forbiddenKeys.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/issues/forbiddenKeys.ts b/src/issues/forbiddenKeys.ts index c2b1467..a228e54 100644 --- a/src/issues/forbiddenKeys.ts +++ b/src/issues/forbiddenKeys.ts @@ -14,8 +14,8 @@ * * @see {@link https://github.com/roottool/safe-formdata/blob/main/AGENTS.md#prototype-safety AGENTS.md > Security rules > Prototype safety} */ -export const FORBIDDEN_KEYS = new Set([ +export const FORBIDDEN_KEYS: ReadonlySet = new Set([ "__proto__", "prototype", "constructor", -] as const satisfies readonly string[]); +]); From 4ad32017064b59b0e5224fa910a69a62b8589ff1 Mon Sep 17 00:00:00 2001 From: roottool Date: Tue, 3 Mar 2026 23:14:27 +0900 Subject: [PATCH 4/6] refactor(tsconfig): remove redundant removeComments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The removeComments option was redundant — minifiers (terser, esbuild, oxc) strip comments from JS output regardless of this flag. Removing it lets bundlers preserve JSDoc in generated .d.ts files, improving IDE hover experience for library consumers. Co-Authored-By: Claude Sonnet 4.6 --- tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index e3439f3..2e1c930 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,7 +16,6 @@ "declarationMap": true, "sourceMap": true, "outDir": "./dist", - "removeComments": true, // Type Checking (strict mode) "strict": true, From 2d1058b1fa936bce11a8e9fa0d5bcfc67f1219aa Mon Sep 17 00:00:00 2001 From: roottool Date: Tue, 3 Mar 2026 23:21:01 +0900 Subject: [PATCH 5/6] refactor(index): remove internal module-level JSDoc The comment was an internal note pointing to AGENTS.md without a link, which leaked into dist/index.d.ts and was meaningless to library consumers. The parse() function already carries a proper @see link to AGENTS.md. Co-Authored-By: Claude Sonnet 4.6 --- src/index.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index cd2223b..383ba8d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,9 +1,3 @@ -/** - * safe-formdata: Boundary-focused FormData parser - * - * See AGENTS.md for design rules and boundary definition. - */ - export { parse } from "#parse"; export type { IssueCode } from "#types/IssueCode"; From 174a7ef32d4c49ea1555801faa86a64142942c95 Mon Sep 17 00:00:00 2001 From: roottool Date: Tue, 3 Mar 2026 23:24:48 +0900 Subject: [PATCH 6/6] refactor(index): move import to top, simplify ParseResult re-export Move `import type { ParseResult }` to the top of the file per convention. Simplify `export type { ParseResult } from "..."` to `export type { ParseResult }` since the import already declares the source. Co-Authored-By: Claude Sonnet 4.6 --- src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 383ba8d..0a1f69a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,10 @@ +import type { ParseResult } from "#types/ParseResult"; + export { parse } from "#parse"; export type { IssueCode } from "#types/IssueCode"; export type { ParseIssue } from "#types/ParseIssue"; -export type { ParseResult } from "#types/ParseResult"; - -import type { ParseResult } from "#types/ParseResult"; +export type { ParseResult }; export type SuccessResult = Extract }>; export type FailureResult = Extract;