Skip to content

Add inline links option to plugin#1

Open
joshhbk wants to merge 2 commits intomainfrom
inline-plugin-links
Open

Add inline links option to plugin#1
joshhbk wants to merge 2 commits intomainfrom
inline-plugin-links

Conversation

@joshhbk
Copy link
Owner

@joshhbk joshhbk commented Mar 9, 2026

Summary

  • Adds a links option to LocaldevPluginOptions so consumers can pass a Record<string, string> (package name → local path) directly to the plugin without needing the CLI, .localdev.json, or heartbeat
  • When inline links are provided, resolution is always active — no CLI session required
  • Extracts Vite lifecycle setup (setupCliLifecycle, watchLinkedOutputDirs) out of the configureServer hook into named helpers

Usage

import { localdev } from "localdev/vite";

export default {
  plugins: [
    localdev({ links: { "@acme/ui": "../packages/ui" } }),
  ],
};

Test plan

  • Existing tests pass (68/68)
  • New test: resolves with inline links and no heartbeat
  • New test: returns null for non-linked import with inline links
  • Manual: wire up inline links in a Vite project and verify resolution works without localdev start

joshhbk added 2 commits March 8, 2026 23:45
Support passing links directly to the plugin via a `links` option
(Record<string, string>) so consumers can use localdev without the CLI.
When inline links are provided, the plugin resolves unconditionally —
no .localdev.json, no heartbeat, no CLI session required.

Extract Vite-specific lifecycle (config watching, heartbeat polling,
restart debouncing) into setupCliLifecycle and watchLinkedOutputDirs
helpers to keep the unplugin body focused on resolution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant