Commit 0bcf64a
authored
perf(bundle): stop three routes shipping the block and tool registries (#6138)
The public /integrations page downloaded, parsed and executed 19.54 MB of
JavaScript, 15.52 MB of which was the tool registry — 4,351 tool configs, to
render a catalog of names and icons. It arrived as `<script async>` in the
initial HTML, so the browser fetched and ran it on load.
Measured on a production build, chunks referenced by the page's own HTML:
/integrations 19.54 MB -> 3.55 MB across 41 chunks (-82%)
No chunk over 1 MB remains on that route. credit-usage also loses its copy.
Three separate import edges, all the same shape: a module mixing pure helpers
with registry-backed ones, so importing the pure half dragged in all 282 block
configs and the tool registry behind them.
- `lib/integrations/index.ts` built POPULAR_WORKFLOWS at module scope via
`getAllBlockMeta()` and re-exported registry functions. The landing grid is a
client component, so importing anything from that barrel inherited the whole
graph. POPULAR_WORKFLOWS moves to its own module — its one real consumer is a
server page — and the re-export goes, which .claude/rules/sim-imports.md
already forbids and which nothing imported through the barrel.
- `blocks/icon-color.ts` mixed pure contrast maths (`getTileIconColorClass`,
`isLightTileColor`, used by the landing page) with `getBareIconStyle`, which
reads `getAllBlocks()`. Split by dependency into `blocks/brand-icon-style.ts`;
all six of its consumers are under app/workspace/** where the registry is
already legitimately present.
- `credit-usage-view.tsx` imported a date formatter from the logs feature's
`utils.ts`, which also exports registry-backed badge components.
`formatDateShort` has three consumers across three features, so it moves to
`lib/core/utils/date-display.ts` per the repo's utils-location rule.
Not addressed: account/settings/[section] still reaches the registry through
workspace-permissions-provider -> socket-provider, one of the four known
client edges from the module-graph audit rather than a stray import. It is
also loaded via `dynamic()`, so it is likely lazy rather than on first paint.
That belongs with the registry split, not here.
workspace/* keeps its copy, which is correct — the editor needs tool params
and outputs.1 parent c0e7ea9 commit 0bcf64a
16 files changed
Lines changed: 174 additions & 120 deletions
File tree
- apps/sim
- app
- (landing)/integrations/(shell)
- workspace/[workspaceId]
- files/components/file-viewer/rich-markdown-editor/mention
- home/components
- chat-context-kind-registry
- message-content/components/agent-group
- mothership-view/components/resource-registry
- suggested-actions
- logs
- settings/billing/credit-usage
- w/[workflowId]/components/panel/components/editor/components/sub-block/components/credential-selector
- blocks
- ee/audit-logs/components
- lib
- core/utils
- integrations
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
20 | | - | |
| 19 | + | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
94 | | - | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | 191 | | |
217 | 192 | | |
218 | 193 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | | - | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
0 commit comments