Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
36578be
feat: replace pnpmBuildDependency with sv.file + pnpm helper and file…
jycouet Apr 3, 2026
a311c0a
fmt²
jycouet Apr 3, 2026
d4ea793
rmv addPnpmBuildDependencies
jycouet Apr 4, 2026
32d11a1
don't export he internal of addPnpmOnlyBuiltDependencies
jycouet Apr 4, 2026
0ca761e
lint
jycouet Apr 4, 2026
8671cd2
chore: add api-surface generator and tsdown hooks
jycouet Apr 4, 2026
d058caa
chore: add generated public API surface snapshots
jycouet Apr 4, 2026
622fed9
chore: format api-surface snapshots via Prettier in generator
jycouet Apr 4, 2026
f05e03b
chore: satisfy lint (Prettier on api-surface, import process in gener…
jycouet Apr 4, 2026
db5a2df
chore: regenerate api-surface snapshots on PR #1037 base
jycouet Apr 4, 2026
bceae43
align
jycouet Apr 4, 2026
b5adf57
refactor: loadFile/saveFile/loadPackageJson; trim workspace addon paths
jycouet Apr 4, 2026
4e2bf1b
docs(sv-utils): clarify deprecation on readFile/writeFile/getPackageJ…
jycouet Apr 4, 2026
773f828
cleanup types
jycouet Apr 4, 2026
95ee322
chore: Prettier on sources (align with post-build output)
jycouet Apr 4, 2026
a294ebb
chore(sv-testing): remove deprecated exports from public API; docs us…
jycouet Apr 4, 2026
0bc3d68
fix(sv-utils): type onlyBuiltDependencies from YamlDocument.get
jycouet Apr 4, 2026
dc30d9d
chore: consolidate minor changeset for sv and @sveltejs/sv-utils
jycouet Apr 4, 2026
4c58d50
gen improvement
jycouet Apr 4, 2026
b02f0d7
move things
jycouet Apr 4, 2026
d6767dd
Merge branch 'main' of github.com:sveltejs/cli into chore/coupling-v2
jycouet Apr 4, 2026
86fcf24
cs
jycouet Apr 4, 2026
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
22 changes: 22 additions & 0 deletions .changeset/coupling-sv-and-sv-utils.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
'sv': minor
'@sveltejs/sv-utils': minor
---

feat: sv / sv-utils coupling, pnpm helpers, experimental add-ons, and API snapshots

**Highlights**

- Replace `sv.pnpmBuildDependency` with `sv.file` plus `pnpm.onlyBuiltDependencies` from `@sveltejs/sv-utils` and `file.findUp`.

**`@sveltejs/sv-utils`**

- Add `pnpm.onlyBuiltDependencies` to append packages to `onlyBuiltDependencies` in pnpm YAML via `transforms.yaml`.
- Type `YamlDocument` (`parse.yaml`) with `get` / `set` using `unknown` so consumers narrow explicitly; align YAML transforms with that contract.

**`sv`**

- Refactor workspace / engine / package-manager flows around file IO and package JSON loading (`loadFile`, `saveFile`, `loadPackageJson`), and trim workspace addon path handling; update addons accordingly.
- Reorganize the public `testing` entry for Vitest helpers and document the surface.
- Add generated `api-surface` markdown snapshots and a `scripts/generate-api-surface.js` helper (wired through the build) to track the public API.
- Remove deprecated `pnpmBuildDependency` usage and stop exporting internal pnpm-only-built helpers from the public `sv` surface.
2 changes: 1 addition & 1 deletion documentation/docs/50-api/10-sv.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default defineAddon({
});
```

The `sv` object in `run` provides `file`, `dependency`, `devDependency`, `execute`, and `pnpmBuildDependency`. For file transforms (AST-based editing of scripts, Svelte components, CSS, JSON, etc.), see [`@sveltejs/sv-utils`](sv-utils).
The `sv` object in `run` provides `file`, `dependency`, `devDependency`, and `execute`. For file transforms (AST-based editing of scripts, Svelte components, CSS, JSON, etc.) and package manager helpers, see [`@sveltejs/sv-utils`](sv-utils).

## `defineAddonOptions`

Expand Down
17 changes: 16 additions & 1 deletion documentation/docs/50-api/20-sv-utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Return `false` from any transform callback to abort - the original content is re
import { transforms } from '@sveltejs/sv-utils';

sv.file(
file.eslintConfig,
'eslint.config.js',
transforms.script(({ ast, js }) => {
const { value: existing } = js.exports.createDefault(ast, { fallback: myConfig });
if (existing !== myConfig) {
Expand Down Expand Up @@ -229,3 +229,18 @@ Namespaced helpers for AST manipulation:
- **`json.*`** - arrayUpsert, packageScriptsUpsert
- **`html.*`** - attribute manipulation
- **`text.*`** - upsert lines in flat files (.env, .gitignore)

## Package manager helpers

### `pnpm.onlyBuiltDependencies`

Returns a transform for `pnpm-workspace.yaml` that adds packages to the `onlyBuiltDependencies` list. Use with `sv.file` when the project uses pnpm.

```js
// @noErrors
import { pnpm } from '@sveltejs/sv-utils';

if (packageManager === 'pnpm') {
sv.file(file.findUp('pnpm-workspace.yaml'), pnpm.onlyBuiltDependencies('my-native-dep'));
}
```
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"scripts": {
"build": "tsdown",
"postbuild": "node scripts/generate-api-surface.js",
"changeset:publish": "changeset publish",
"check": "pnpm --parallel check",
"dev": "tsdown -w & pnpm --parallel check -w & wait",
Expand Down
Loading
Loading