0.18.2
Changelog: v0.18.2
Release date: 2026-05-17
Release type: minor patch (CLI + project mutation)
Overview
v0.18.2 adds less add — a safe install flow for adding third-party Web
Component packages to LessJS projects. Every install is preceded by
validation (v0.18.1), so invalid packages are rejected before any files
are touched.
What's New
Safe Install Flow (@lessjs/core/less-add)
New module packages/core/src/less-add.ts with plan-based install logic:
Flow: Resolve → Validate → Plan → Review → Apply
Dry Run First
less add @scope/package --dry-runPrints the full plan without changing any files:
- Package source and version
- Compatibility tier
- Tags to register
- File mutations (add/modify/remove)
- Warnings and rejected tags
Validation Gate
Before any file mutation, the v0.18.1 validator is run. If the manifest
fails validation, the add stops immediately with zero file changes.
File Mutations Generated
For a valid SSR-capable package, the plan includes:
| File | Change |
|---|---|
vite.config.ts |
Add to packageIslands array |
vite.config.ts |
Add to ssr.noExternal list (SSR-capable only) |
src/less-imports.ts |
Create/update client registration |
Compatibility-Aware Behavior
| Tier | Behavior |
|---|---|
ssr-capable |
Full setup: packageIslands + noExternal + registration |
client-only |
packageIslands + registration only (no noExternal) |
rejected |
No mutations — validation error stops the flow |
Rollback Safety
If any write fails, the plan prints:
- Which files were changed
- Recovery command or manual rollback instructions
- Does not continue to build
New Public API
Added to @lessjs/core:
Types:
AddPlan— full install plan with tags, mutations, statusAddTagEntry— per-tag entry in the install planFileMutation— single file change descriptorPackageSource— local / jsr / npm
Functions:
generateAddPlan(options)— generate an install plan for a package
Exports:
@lessjs/core/less-add— install flow module@lessjs/core/cli/less-add— CLI entry point
Verification
-
less add ./fixtures/ssr-capable --dry-runchanges no files -
less add ./fixtures/client-only --dry-runreports client-only outcome - invalid package fails before file writes
- real install updates expected files only
- rerunning install is idempotent (same input → same plan)
- uninstall/manual rollback instructions are printed when needed
-
deno task fmt && deno task lint && deno task typecheck -
deno task test(673 tests, 14 new) -
deno task build
Breaking Changes
None. v0.18.2 adds new API surface without modifying existing interfaces.
- New optional exports:
generateAddPlan - New optional subpath exports:
@lessjs/core/less-add,@lessjs/core/cli/less-add - No behavior changes to existing code
Migration Guide
For users: No action needed. v0.18.2 is a drop-in replacement for v0.18.1.
To add a package:
# First, check what would happen
deno run -A jsr:@lessjs/core/cli/less-add @scope/package --dry-run
# Then apply
deno run -A jsr:@lessjs/core/cli/less-add @scope/packageNext Steps
With v0.18.2 complete, the project can now proceed to:
- v0.18.3: DOM simulation experiment for client-only components
- See
docs/sop/v0.18.3-dom-simulation-experiment.md
Diff Summary
git diff --stat v0.18.1..v0.18.2
packages/core/__tests__/less-add.test.ts (new, 193 lines)
packages/core/deno.json (2 lines changed)
packages/core/src/cli/less-add.ts (new, 123 lines)
packages/core/src/index.ts (10 lines changed)
packages/core/src/less-add.ts (new, 253 lines)Stats:
- 3 new files
- 2 modified files
- 14 new tests (673 total)
- +581 / -0 lines