[loader] Add renderer ESM execution host and hybrid delegation #219
Labels
No labels
abandoned
active
audit
blocked
data-safety
difficulty:easy
difficulty:hard
difficulty:high
difficulty:medium
docs
done
duplicate
notebook-v0
open
priority:high
ready
release-critical
safe-mode
spec
spec-backlog
subsystem:api
subsystem:backlog
subsystem:bases
subsystem:ci
subsystem:command
subsystem:configuration
subsystem:consolidate
subsystem:dependencies
subsystem:desktop-electron
subsystem:diffmerge
subsystem:docker
subsystem:docs
subsystem:fuzzy
subsystem:graph
subsystem:hotkeys
subsystem:lapis
subsystem:maint
subsystem:maintenance
subsystem:markdown
subsystem:markdown-lint
subsystem:md018
subsystem:notebook
subsystem:notifications
subsystem:opfs
subsystem:package
subsystem:plugin-markdown
subsystem:plugin-tasks
subsystem:plugins
subsystem:registry
subsystem:release
subsystem:renovate
subsystem:restore
subsystem:scripts
subsystem:search
subsystem:settings
subsystem:spec
subsystem:tasks
subsystem:testing
subsystem:ui
subsystem:web
subsystem:workspace
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lapis-notes/lapis#219
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
First-party Lapis plugins need an ESM-first renderer execution path, while Obsidian-compatible and legacy plugins must continue to load through CommonJS compatibility.
Goal
Add renderer ESM execution and hybrid delegation so the loader can choose ESM, CommonJS, or sidecar execution from the shared runtime selector and diagnostics policy.
Scope
RendererEsmPluginExecutionHostusingPluginAssetServerand dependency policy checks.HybridCommunityPluginExecutionHostto delegate between ESM, CommonJS, and sidecar hosts.selectPluginRuntimeEntry()for format and host decisions.fallbackPathis explicitly declared or the plugin is Obsidian-compatible.Non-goals
Acceptance Criteria
esm-basicstyle plugins load in web and Electron renderer.Implementation Notes
PluginManagerflow; the execution host should return a constructor or module shape.Active Implementation Plan
packages/api/src/lib/plugin-manager.tsthat uses the configuredPluginAssetServerto obtain a versioned module URL, dynamically imports it with Vite ignored URL resolution, scans/prepares bare host dependencies for diagnostics, and returns the same constructor/module export shapes as the CommonJS host.format: "esm"entries to the ESM host. ESM import failure may fall back to CommonJS only when the selected structured runtime entry declaresfallbackPath.PluginManageradvertise renderer ESM support only when aPluginAssetServeris present, and selectelectron-rendererstructured entries when the native bridge advertisesplugin-assets; otherwise preserve existingworkspaceand sidecar behavior.Affected Packages and Files
packages/api/src/lib/plugin-manager.tspackages/api/src/lib/__tests__/plugin-manager.test.tspackages/api/spec.mdpackages/workspace/spec.mdspec/src/30-cross-package-contracts/plugin-runtime.mdspec/src/20-packages/api/index.mdspec/src/20-packages/workspace/index.mdSuggested Files or Specs To Inspect
spec/src/30-cross-package-contracts/plugin-runtime.mdspec/src/20-packages/workspace/index.mdpackages/api/src/lib/plugin-manager.tspackages/api/src/lib/plugin-runtime-entry.tspackages/workspace/src/lib/components/app/App.svelteValidation Commands
pnpm --filter @lapis-notes/api exec vitest run src/lib/__tests__/plugin-manager.test.tspnpm --filter @lapis-notes/api check:typespnpm --filter @lapis-notes/api check:allmake spec-lintmdbook build specpnpm test:smokeRelated Issues
Follow-up Tasks
Implementation Summary
Fixed the renderer ESM plugin-manager test formatting regression so the API package format gate passes again.
Reopen Reason
Fix format regression in the renderer ESM execution host test from the last committed change.