Wire loadPlugin(builtinPlugin) at editor app bootstrap
Adds apps/editor/lib/bootstrap.ts that calls loadPlugin(builtinPlugin) as a module-side-effect on first import. Imported from scene-loader.tsx so it runs on the client side where the editor mounts. Idempotency guard handles HMR re-execution (would otherwise throw on duplicate registerNode). For the empty plugin this commit, the entire call is a no-op — included now so future commits that add real node kinds only need to push them onto builtinPlugin.nodes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
a41321e193
commit
4d5226ce10
@@ -1,5 +1,6 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
|
import '../lib/bootstrap'
|
||||||
import {
|
import {
|
||||||
applySceneGraphToEditor,
|
applySceneGraphToEditor,
|
||||||
Editor,
|
Editor,
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { loadPlugin } from '@pascal-app/core'
|
||||||
|
import { builtinPlugin } from '@pascal-app/nodes'
|
||||||
|
|
||||||
|
// Idempotency guard: HMR can reload this module, but `registerNode` throws on
|
||||||
|
// duplicate kinds. The flag lives in the module closure so it's reset on a
|
||||||
|
// hard reload but survives within a session.
|
||||||
|
let loaded = false
|
||||||
|
|
||||||
|
export function loadBuiltinNodes(): void {
|
||||||
|
if (loaded) return
|
||||||
|
loaded = true
|
||||||
|
void loadPlugin(builtinPlugin)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run as a side effect on first import so any consumer of this module gets a
|
||||||
|
// populated registry without remembering to call the function explicitly.
|
||||||
|
loadBuiltinNodes()
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
"@pascal-app/core": "*",
|
"@pascal-app/core": "*",
|
||||||
"@pascal-app/editor": "*",
|
"@pascal-app/editor": "*",
|
||||||
"@pascal-app/mcp": "*",
|
"@pascal-app/mcp": "*",
|
||||||
|
"@pascal-app/nodes": "*",
|
||||||
"@pascal-app/viewer": "*",
|
"@pascal-app/viewer": "*",
|
||||||
"@radix-ui/react-tooltip": "^1.2.8",
|
"@radix-ui/react-tooltip": "^1.2.8",
|
||||||
"@react-three/drei": "^10.7.7",
|
"@react-three/drei": "^10.7.7",
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
"@pascal-app/core": "*",
|
"@pascal-app/core": "*",
|
||||||
"@pascal-app/editor": "*",
|
"@pascal-app/editor": "*",
|
||||||
"@pascal-app/mcp": "*",
|
"@pascal-app/mcp": "*",
|
||||||
|
"@pascal-app/nodes": "*",
|
||||||
"@pascal-app/viewer": "*",
|
"@pascal-app/viewer": "*",
|
||||||
"@radix-ui/react-tooltip": "^1.2.8",
|
"@radix-ui/react-tooltip": "^1.2.8",
|
||||||
"@react-three/drei": "^10.7.7",
|
"@react-three/drei": "^10.7.7",
|
||||||
|
|||||||
Reference in New Issue
Block a user