Skip to content

perf(data-inspector): lazy-load and inline jora on the node side - #250

Merged
antfu merged 6 commits into
mainfrom
perf/data-inspector-lazy-jora
Aug 17, 2026
Merged

perf(data-inspector): lazy-load and inline jora on the node side#250
antfu merged 6 commits into
mainfrom
perf/data-inspector-lazy-jora

Conversation

@antfubot

Copy link
Copy Markdown
Collaborator

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 static import jora from 'jora' + eager jora.setup(...) with a memoized loader that does await 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, and suggest are 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 sets deps.alwaysBundle: ['jora'], so the lazy import('jora') resolves a chunk shipped inside this package's own dist instead of a node_modules lookup consumers would otherwise need to satisfy. The browser build (SPA + engine/index client 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.
  • Updated test/engine.test.ts and test/registry.test.ts to await the now-async calls.

Verified with a real build: the emitted node-*.mjs rewrites import('jora') to import('./src-<hash>.mjs'), a local chunk, while dist/engine/index.mjs (browser) keeps the bare import('jora') specifier.


🤖 Generated with the help of an agent.

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.
@netlify

netlify Bot commented Aug 17, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit 2cc08a2
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a82a0598b3e7a00084087cf
😎 Deploy Preview https://deploy-preview-250--devfra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

antfubot and others added 5 commits August 17, 2026 05:21
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.
@antfu
antfu merged commit efce507 into main Aug 17, 2026
11 of 12 checks passed
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.

2 participants