perf(data-inspector): lazy-load and inline jora on the node side - #250
Merged
Conversation
jora only loads on the first actual query now — engine/query-engine.ts
caches a single `await import('jora')` + `setup()` instead of paying
for it eagerly at module load, which used to happen just from
registering the plugin's RPC functions, whether or not anyone opens
the panel.
The node tsdown build inlines jora (deps.alwaysBundle) so that lazy
import resolves a chunk shipped inside dist instead of a node_modules
lookup consumers would otherwise need to satisfy. The browser build
keeps jora external/dependency-resolved, since it already loads
eagerly there for query-editor syntax gating.
✅ Deploy Preview for devfra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
jora no longer needs to be an installable dependency for either build: it now moves under devDependencies with catalog:inlined (matching devframe's ua-parser-modern precedent), so tsdown vendors it into this package's own dist on both the node and browser platforms by default. Drops the now-redundant deps.alwaysBundle override from tsdown.config.ts.
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
jora now loads lazily and only on the node side is it inlined into the package's own build output.
engine/query-engine.ts: replaced the staticimport jora from 'jora'+ eagerjora.setup(...)with a memoized loader that doesawait import('jora')on first use, so simply registering the data-inspector's RPC functions — which happens on every host that sets the plugin up, whether or not anyone opens the panel — no longer pays for parsing jora.runQuery,runQueryAtPath, andsuggestare now async; all real call sites (RPC handlers, the SPA's static-mode backend) already awaited/returned from async functions, so this is non-breaking there.tsdown.config.ts: the node-platform build now setsdeps.alwaysBundle: ['jora'], so the lazyimport('jora')resolves a chunk shipped inside this package's owndistinstead of anode_moduleslookup consumers would otherwise need to satisfy. The browser build (SPA +engine/indexclient entry) is untouched — jora stays external/dependency-resolved there, since the query editor already loads it eagerly for syntax gating, so laziness buys nothing client-side.test/engine.test.tsandtest/registry.test.tstoawaitthe now-async calls.Verified with a real build: the emitted
node-*.mjsrewritesimport('jora')toimport('./src-<hash>.mjs'), a local chunk, whiledist/engine/index.mjs(browser) keeps the bareimport('jora')specifier.🤖 Generated with the help of an agent.