|
| 1 | +# Changelog: v0.18.2 |
| 2 | + |
| 3 | +> Release date: 2026-05-17 |
| 4 | +> Release type: **minor patch (CLI + project mutation)** |
| 5 | +
|
| 6 | +## Overview |
| 7 | + |
| 8 | +v0.18.2 adds `less add` — a safe install flow for adding third-party Web |
| 9 | +Component packages to LessJS projects. Every install is preceded by |
| 10 | +validation (v0.18.1), so invalid packages are rejected before any files |
| 11 | +are touched. |
| 12 | + |
| 13 | +## What's New |
| 14 | + |
| 15 | +### Safe Install Flow (`@lessjs/core/less-add`) |
| 16 | + |
| 17 | +New module `packages/core/src/less-add.ts` with plan-based install logic: |
| 18 | + |
| 19 | +``` |
| 20 | +Flow: Resolve → Validate → Plan → Review → Apply |
| 21 | +``` |
| 22 | + |
| 23 | +### Dry Run First |
| 24 | + |
| 25 | +```sh |
| 26 | +less add @scope/package --dry-run |
| 27 | +``` |
| 28 | + |
| 29 | +Prints the full plan without changing any files: |
| 30 | + |
| 31 | +- Package source and version |
| 32 | +- Compatibility tier |
| 33 | +- Tags to register |
| 34 | +- File mutations (add/modify/remove) |
| 35 | +- Warnings and rejected tags |
| 36 | + |
| 37 | +### Validation Gate |
| 38 | + |
| 39 | +Before any file mutation, the v0.18.1 validator is run. If the manifest |
| 40 | +fails validation, the add stops immediately with zero file changes. |
| 41 | + |
| 42 | +### File Mutations Generated |
| 43 | + |
| 44 | +For a valid SSR-capable package, the plan includes: |
| 45 | + |
| 46 | +| File | Change | |
| 47 | +| --------------------- | ----------------------------------------------- | |
| 48 | +| `vite.config.ts` | Add to `packageIslands` array | |
| 49 | +| `vite.config.ts` | Add to `ssr.noExternal` list (SSR-capable only) | |
| 50 | +| `src/less-imports.ts` | Create/update client registration | |
| 51 | + |
| 52 | +### Compatibility-Aware Behavior |
| 53 | + |
| 54 | +| Tier | Behavior | |
| 55 | +| ------------- | ------------------------------------------------------ | |
| 56 | +| `ssr-capable` | Full setup: packageIslands + noExternal + registration | |
| 57 | +| `client-only` | packageIslands + registration only (no noExternal) | |
| 58 | +| `rejected` | No mutations — validation error stops the flow | |
| 59 | + |
| 60 | +### Rollback Safety |
| 61 | + |
| 62 | +If any write fails, the plan prints: |
| 63 | + |
| 64 | +- Which files were changed |
| 65 | +- Recovery command or manual rollback instructions |
| 66 | +- Does not continue to build |
| 67 | + |
| 68 | +## New Public API |
| 69 | + |
| 70 | +Added to `@lessjs/core`: |
| 71 | + |
| 72 | +**Types**: |
| 73 | + |
| 74 | +- `AddPlan` — full install plan with tags, mutations, status |
| 75 | +- `AddTagEntry` — per-tag entry in the install plan |
| 76 | +- `FileMutation` — single file change descriptor |
| 77 | +- `PackageSource` — local / jsr / npm |
| 78 | + |
| 79 | +**Functions**: |
| 80 | + |
| 81 | +- `generateAddPlan(options)` — generate an install plan for a package |
| 82 | + |
| 83 | +**Exports**: |
| 84 | + |
| 85 | +- `@lessjs/core/less-add` — install flow module |
| 86 | +- `@lessjs/core/cli/less-add` — CLI entry point |
| 87 | + |
| 88 | +## Verification |
| 89 | + |
| 90 | +- [x] `less add ./fixtures/ssr-capable --dry-run` changes no files |
| 91 | +- [x] `less add ./fixtures/client-only --dry-run` reports client-only outcome |
| 92 | +- [x] invalid package fails before file writes |
| 93 | +- [x] real install updates expected files only |
| 94 | +- [x] rerunning install is idempotent (same input → same plan) |
| 95 | +- [x] uninstall/manual rollback instructions are printed when needed |
| 96 | +- [x] `deno task fmt && deno task lint && deno task typecheck` |
| 97 | +- [x] `deno task test` (673 tests, 14 new) |
| 98 | +- [x] `deno task build` |
| 99 | + |
| 100 | +## Breaking Changes |
| 101 | + |
| 102 | +None. v0.18.2 adds new API surface without modifying existing interfaces. |
| 103 | + |
| 104 | +- New optional exports: `generateAddPlan` |
| 105 | +- New optional subpath exports: `@lessjs/core/less-add`, `@lessjs/core/cli/less-add` |
| 106 | +- No behavior changes to existing code |
| 107 | + |
| 108 | +## Migration Guide |
| 109 | + |
| 110 | +**For users**: No action needed. v0.18.2 is a drop-in replacement for v0.18.1. |
| 111 | + |
| 112 | +**To add a package**: |
| 113 | + |
| 114 | +```sh |
| 115 | +# First, check what would happen |
| 116 | +deno run -A jsr:@lessjs/core/cli/less-add @scope/package --dry-run |
| 117 | + |
| 118 | +# Then apply |
| 119 | +deno run -A jsr:@lessjs/core/cli/less-add @scope/package |
| 120 | +``` |
| 121 | + |
| 122 | +## Next Steps |
| 123 | + |
| 124 | +With v0.18.2 complete, the project can now proceed to: |
| 125 | + |
| 126 | +- **v0.18.3**: DOM simulation experiment for client-only components |
| 127 | +- See `docs/sop/v0.18.3-dom-simulation-experiment.md` |
| 128 | + |
| 129 | +## Diff Summary |
| 130 | + |
| 131 | +```bash |
| 132 | +git diff --stat v0.18.1..v0.18.2 |
| 133 | + |
| 134 | +packages/core/__tests__/less-add.test.ts (new, 193 lines) |
| 135 | +packages/core/deno.json (2 lines changed) |
| 136 | +packages/core/src/cli/less-add.ts (new, 123 lines) |
| 137 | +packages/core/src/index.ts (10 lines changed) |
| 138 | +packages/core/src/less-add.ts (new, 253 lines) |
| 139 | +``` |
| 140 | + |
| 141 | +**Stats**: |
| 142 | + |
| 143 | +- 3 new files |
| 144 | +- 2 modified files |
| 145 | +- 14 new tests (673 total) |
| 146 | +- +581 / -0 lines |
0 commit comments