Skip to content

Commit b5de5ea

Browse files
Goosterhofclaude
andcommitted
chore(pkg): declare sideEffects:false across all 11 packages — queue #70
Adds "sideEffects": false immediately after "type": "module" in every packages/*/package.json. Clears the publint 0.3.21 Suggestion ("package appears to be consumed by bundlers but does not specify sideEffects") that the now-honest Gate 6 (queue #63 fix) flags as fatal, and lets consumers tree-shake under deep imports. Per-package side-effect audit re-run on current main (post-#87 streamRequest removal from fs-http): every package's src/index.ts is a pure re-export or a file whose top-level statements are imports, type declarations, and const/function factory declarations. console.*/document.*/window.*/ Object.defineProperty and the dialog body-scroll write are all inside function bodies (call-time, not module-evaluation). cached-adapter-store's top-level `new WeakMap()` is pure construction. No bare side-effect imports anywhere. All 11 cleared. CLAUDE.md gains a "No top-level side effects" Conventions bullet locking the convention so a future package author doesn't ship without the flag and re-fire Gate 6. Closes enforcement queue #70. Supersedes PR #88. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8644157 commit b5de5ea

12 files changed

Lines changed: 12 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Consumer territories must apply per-call timeouts at instantiation OR rely on th
5454
- **Test environment:** Browser-dependent tests use `// @vitest-environment happy-dom` file-level comments.
5555
- **Identical build config:** All packages share the same `tsdown.config.ts` structure.
5656
- **No direct axios imports in dependent packages.** Route `AxiosResponse` / `AxiosRequestConfig` / sibling types through `fs-http`'s re-exports (e.g. `Parameters<ResponseMiddlewareFunc>[0]` for response types). Direct `import type {AxiosResponse} from 'axios'` breaks rolldown's `d.cts` emission on dual-bundle packages — caught during `fs-cached-adapter-store` scaffold 2026-05-13.
57+
- **No top-level side effects.** Every published package declares `"sideEffects": false` in its `package.json` so bundlers can tree-shake under deep imports. The factory + barrel pattern ensures this is structurally true — every package's `src/index.ts` is either a pure re-export or a file whose top-level statements are imports, type declarations, and `const`/`function` factory declarations. The manifest entry makes it explicit and bundler-actionable. Closes enforcement queue #70 (publint 0.3.21 Suggestion, fatal-promoted by `scripts/lint-pkg.mjs`).
5758
- **Transport-surface discipline.** Every `fs-http` transport method must inherit option-honoring from the `axios.create()` instance. Adding a new transport path that uses native `fetch` (or any non-axios transport) requires a deliberate audit against the full `HttpServiceOptions` matrix — `headers`, `withCredentials`, `withXSRFToken`, `smartCredentials`, `timeout`, plus the per-call `AxiosRequestConfig` override surface. The Library-Config-Honor Surface Audit (Sapper M3 + Surveyor M3, 2026-05-15) is the standing checklist. The pre-1.0 `streamRequest` function violated this rule on four axes (queue #22 streamRequest portion + queue #64 XSRF + Surveyor M3 F-1 headers + F-2 timeout) and was removed in 0.4.0 with zero realized consumer impact. If a future streaming use case emerges, the right design is either axios's `responseType: 'stream'` mode via the standard methods (inherits all options for free) or a deliberate `createStreamHttpService` factory designed against the option-honoring matrix from the start — not a re-add of an axios-bypassing transport.
5859

5960
### Internal Dependency Coordination

packages/adapter-store/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"dist"
1414
],
1515
"type": "module",
16+
"sideEffects": false,
1617
"main": "./dist/index.cjs",
1718
"module": "./dist/index.mjs",
1819
"types": "./dist/index.d.mts",

packages/cached-adapter-store/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"dist"
1414
],
1515
"type": "module",
16+
"sideEffects": false,
1617
"main": "./dist/index.cjs",
1718
"module": "./dist/index.mjs",
1819
"types": "./dist/index.d.mts",

packages/dialog/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"dist"
1414
],
1515
"type": "module",
16+
"sideEffects": false,
1617
"main": "./dist/index.cjs",
1718
"module": "./dist/index.mjs",
1819
"types": "./dist/index.d.mts",

packages/helpers/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"dist"
1414
],
1515
"type": "module",
16+
"sideEffects": false,
1617
"main": "./dist/index.cjs",
1718
"module": "./dist/index.mjs",
1819
"types": "./dist/index.d.mts",

packages/http/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"dist"
1414
],
1515
"type": "module",
16+
"sideEffects": false,
1617
"main": "./dist/index.cjs",
1718
"module": "./dist/index.mjs",
1819
"types": "./dist/index.d.mts",

packages/loading/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"dist"
1414
],
1515
"type": "module",
16+
"sideEffects": false,
1617
"main": "./dist/index.cjs",
1718
"module": "./dist/index.mjs",
1819
"types": "./dist/index.d.mts",

packages/router/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"dist"
1414
],
1515
"type": "module",
16+
"sideEffects": false,
1617
"main": "./dist/index.cjs",
1718
"module": "./dist/index.mjs",
1819
"types": "./dist/index.d.mts",

packages/storage/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"dist"
1414
],
1515
"type": "module",
16+
"sideEffects": false,
1617
"main": "./dist/index.cjs",
1718
"module": "./dist/index.mjs",
1819
"types": "./dist/index.d.mts",

packages/theme/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"dist"
1414
],
1515
"type": "module",
16+
"sideEffects": false,
1617
"main": "./dist/index.cjs",
1718
"module": "./dist/index.mjs",
1819
"types": "./dist/index.d.mts",

0 commit comments

Comments
 (0)