Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .changeset/esm-only-guard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
'@svelte-vitals/core': minor
'@svelte-vitals/vite': minor
'svelte-vitals': patch
'@svelte-vitals/mcp': patch
---
Comment thread
Copilot marked this conversation as resolved.

Formalize the ESM-only stance (#20): drop the legacy top-level `main`/`types` from
`@svelte-vitals/core` and `@svelte-vitals/vite` so every package is `exports`-only,
add `sideEffects: false` across all packages for consistent tree-shaking, declare
`"engines": { "node": ">=18" }` on every package so the documented runtime floor is
machine-enforceable, and document the ESM-only (Node 18+, `require()` unsupported by
design) requirement in each README. CI now guards type-resolution with
`@arethetypeswrong/cli` (esm-only profile) alongside publint.

`core` and `vite` get a `minor` bump because dropping top-level `main`/`types` can
affect consumers/tools that resolve entry points without `exports` support (e.g.
`moduleResolution: node`); `svelte-vitals` and `@svelte-vitals/mcp` only gain the
additive `sideEffects: false` and `engines` declaration, so they stay `patch`.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
"test": "pnpm -r test",
"lint": "prettier --check . && eslint .",
"format": "prettier --write .",
"check:publish": "pnpm --filter @svelte-vitals/core --filter @svelte-vitals/vite --filter svelte-vitals --filter @svelte-vitals/mcp exec publint",
"check:publish": "pnpm run check:publint && pnpm run check:types",
"check:publint": "pnpm --filter @svelte-vitals/core --filter @svelte-vitals/vite --filter svelte-vitals --filter @svelte-vitals/mcp exec publint",
"check:types": "pnpm --workspace-concurrency=1 --filter @svelte-vitals/core --filter @svelte-vitals/vite --filter svelte-vitals --filter @svelte-vitals/mcp exec attw --pack . --profile esm-only",
"release": "changeset publish",
"changeset": "changeset"
},
"devDependencies": {
"@arethetypeswrong/cli": "catalog:",
"@changesets/cli": "catalog:",
"@eslint/compat": "catalog:",
"@eslint/js": "catalog:",
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

> **A SvelteKit SEO checker — not a runtime Web Vitals reporter.**
> Diagnose your project's SEO health by statically analyzing your source code, before it ships. No browser, no build server, no headless Chrome.
>
> **ESM-only** (Node 18+). Ships ES modules only; `require()` is unsupported by design.

```bash
npx svelte-vitals
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
"url": "https://github.com/oekazuma/svelte-vitals/issues"
},
"homepage": "https://github.com/oekazuma/svelte-vitals#readme",
"engines": {
"node": ">=18"
},
"sideEffects": false,
"bin": {
"svelte-vitals": "./dist/bin.js"
},
Expand Down
1 change: 1 addition & 0 deletions packages/cli/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineConfig } from 'tsup';

// ESM-only by design (issue #20) — never add 'cjs'.
export default defineConfig({
entry: ['src/index.ts', 'src/bin.ts'],
format: ['esm'],
Expand Down
2 changes: 2 additions & 0 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ This package is **mode-independent** and contains no I/O — it operates on a no

> Most users don't depend on this directly — install [`svelte-vitals`](https://www.npmjs.com/package/svelte-vitals) instead. This package is for building tools on top of the shared engine.

> **ESM-only** (Node 18+). Ships ES modules only; `require()` is unsupported by design.

## License

[MIT](https://github.com/oekazuma/svelte-vitals/blob/main/LICENSE.md) © [Kazuma Oe](https://github.com/oekazuma)
5 changes: 3 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@
"url": "https://github.com/oekazuma/svelte-vitals/issues"
},
"homepage": "https://github.com/oekazuma/svelte-vitals#readme",
"engines": {
"node": ">=18"
},
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
Expand Down
1 change: 1 addition & 0 deletions packages/core/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineConfig } from 'tsup';

// ESM-only by design (issue #20) — never add 'cjs'.
export default defineConfig({
entry: ['src/index.ts'],
format: ['esm'],
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ Add to your MCP client config:
}
```

ESM-only. Requires Node 18+.
**ESM-only** (Node 18+). Ships ES modules only; `require()` is unsupported by design.
4 changes: 4 additions & 0 deletions packages/mcp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
"url": "https://github.com/oekazuma/svelte-vitals/issues"
},
"homepage": "https://github.com/oekazuma/svelte-vitals#readme",
"engines": {
"node": ">=18"
},
"sideEffects": false,
"bin": {
"svelte-vitals-mcp": "./dist/bin.js"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/vite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Vite/SvelteKit plugin for [svelte-vitals](https://github.com/oekazuma/svelte-vitals). It piggybacks on `vite build`, parses the **prerendered HTML's `<head>`**, and runs the same SEO rules as the CLI — library-agnostic, because it inspects the real output. Fails the build when findings reach `failOn`.

> **ESM-only** (Node 18+). Ships ES modules only; `require()` is unsupported by design.

## Usage

```ts
Expand Down
6 changes: 4 additions & 2 deletions packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
"url": "https://github.com/oekazuma/svelte-vitals/issues"
},
"homepage": "https://github.com/oekazuma/svelte-vitals#readme",
"engines": {
"node": ">=18"
},
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
Expand All @@ -31,8 +35,6 @@
"import": "./dist/hooks/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
Expand Down
1 change: 1 addition & 0 deletions packages/vite/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineConfig } from 'tsup';

// ESM-only by design (issue #20) — never add 'cjs'.
export default defineConfig({
entry: ['src/index.ts', 'src/hooks/index.ts'],
format: ['esm'],
Expand Down
Loading