fix: link peer dependencies for local-source plugins too - #2503
Open
tyrcho wants to merge 1 commit into
Open
Conversation
installPlugin() only calls linkPeerDependencies() for git-sourced plugins, inside buildInstalledPlugin(). Local sources take an earlier return (symlink only) and skip that call entirely. This means a local plugin that peer-depends on another @quartz-community/* plugin (e.g. a custom view type registering against bases-page's view registry) resolves a *different* module instance of that peer than the rest of Quartz uses — since @quartz-community/* peers are resolved by symlinking directly to the sibling plugin's own installed directory (see linkPeerDependencies), not through node_modules resolution. Without that symlink, Node falls back to whatever it finds walking up parent directories, which is either a stale copy or nothing at all. In practice this breaks any module-level singleton state shared between the local plugin and its peer — e.g. a view-type registry: the peer's registration call runs against one module instance, while the actual renderer (instantiated by the loader) reads a different, never-populated instance, silently rendering nothing. Fix: call linkPeerDependencies(pluginDir) for local sources too, at both existing-symlink and freshly-linked return points.
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
tyrcho
marked this pull request as ready for review
July 27, 2026 18:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
installPlugin()only callslinkPeerDependencies()for git-sourced plugins (insidebuildInstalledPlugin()). Local sources (./path/to/plugin) take an earlier return after symlinking and skip that call entirely.This means a local plugin that peer-depends on another
@quartz-community/*plugin (e.g. a custom view type registering againstbases-page's view registry) resolves a different module instance of that peer than the rest of Quartz uses — since@quartz-community/*peers are resolved by symlinking directly to the sibling plugin's own installed directory (seelinkPeerDependencies), not through normalnode_modulesresolution. Without that symlink, Node falls back to whatever it finds walking up parent directories, which is either a stale copy or nothing at all.In practice this breaks any module-level singleton state shared between the local plugin and its peer — e.g. a view-type registry: the peer's registration call runs against one module instance, while the actual renderer (instantiated by the loader) reads a different, never-populated instance, silently rendering nothing (no error, since the import itself doesn't necessarily fail).
Found while building a custom local leaflet-map view type against
bases-pagefor a personal site — the view type registration ran, butbases-pagenever saw it registered.Fix
Call
linkPeerDependencies(pluginDir)for local sources too, at both the existing-symlink and freshly-linked return points ininstallPlugin().Test plan
npx tsc --noEmitpasses cleanbases-page; this fix makes that automatic