Skip to content

Commit 571cf90

Browse files
perf(console): plugin-form and plugin-view helpers come from side-effect-free /core subpaths (#34176)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9QjKmMVoDWtE45ELv1652Kd)_ Part of #33581 Clause-②: yes (widening) — two new published `exports` subpaths, `@object-ui/plugin-form/core` and `@object-ui/plugin-view/core`; nothing removed or renamed, the package roots export the same names as before Metadata-protocol: none ## 维护者速读 - 做了什么:控制台首屏不再下载表单包和视图包。两个包各新增一个不注册任何东西的 `/core` 子路径,壳层只从它取辅助函数;表单和视图组件在第一次画出时才加载。 - 效果:首屏 eager 闭包 gzip 从 1,961,037 B 降到 1,909,225 B(−51,812 B,约 −2.6%);plugin-form(44 KB)、plugin-view(16 KB)两块离开首屏,换进来两个小块(6.4 KB + 1.8 KB)。 - 用户可见的变化:一个会话里第一次打开记录表单、动作弹窗表单或流程表单步骤时,要等表单块下载完才显示;其余页面画出的内容不变。 - 没做的:卡里第 2 项(plugin-detail 的 11 处直取)不在本 PR。原因是 plugin-detail 有带订阅的模块级缓存,单独打一个 `/core` 包会在发布包里造出第二个实例,种子写不到根入口那一份;要改发布包的构建形状,需要席位定。plugin-grid 因此仍在首屏。 - 风险:公开面只加不减(两个新子路径)。九个测试套件原来顺着首屏图读到表单注册,需要改。另有两个 sideEffects 门禁测试对“无副作用的次入口”自相矛盾,做了窄口对齐,这超出了卡上写的文件范围。以上都逐个列在下面。 - 需要你做的:无;按惯例走契约复审后落地。 ## What changes **Two side-effect-free subpaths.** `@object-ui/plugin-form` and `@object-ui/plugin-view` register their renderers when their root entry is evaluated, and each root reaches every surface of its package. One pure helper imported from a root kept the whole package in the console's first load. Each package now publishes `/core` (ESM only, built by a second `vite build --config vite.core.config.ts` pass, the `@object-ui/plugin-chatbot/core` precedent), and it registers nothing: - `plugin-form/core` (`src/core.ts`): `filterSystemFields`, `isAutoGeneratedFieldType`, `isWideFieldType`, `inferColumns`, `containerGridColsFor`, `resolveInlineMode`, `omitServerResolvedDefaults`, `optionListDefault`, `resolveSectionGroupReferences`, `useInitialFieldFocus`, plus their parameter types. - `plugin-view/core` (`src/core.ts`): `deriveRecordSurface`, `deriveRecordFlowSurface`, `overlayWidthFor`, `toFilterGroup`, `deriveFieldOptions`, `isImageLikeField`, `isGeoLikeField`, `pickPreferredField`, the three `*_PREFERRED` lists, plus their types. The roots still export every one of these names, unchanged. Both `sideEffects` arrays name the new entry form (`./src/core.ts`, `./dist/core.js`), as `check:side-effects-array` requires of every entry; its derived walk finds no registering module behind either. **The shell takes its helpers from `/core`.** Eleven importers moved: `MetadataProvider`, `ActionParamDialog`, `ObjectFormDesigner`, `editFormLockedByState`, `SchemaForm`, the console's `FormPage`, `AppContent`, `objectViewRecordNavigation`, `userFilterUrlState`, `recordDrawerStack`, `CreateViewDialog`. **Forms drawn outside a route load on first draw.** `views/lazyFormSurfaces.tsx` wraps `ModalForm` and `ObjectForm` in `lazy()` + `Suspense`. `AppContent` (the global record form), `useActionModal` (the action form) and `ScreenView` (a flow's object-form screen) draw through it. **The console registers the two packages' tags as lazy stubs.** `register-plugins.ts` drops its eager `import '@object-ui/plugin-form'` / `'@object-ui/plugin-view'` and registers `object-form`, `embeddable-form`, `object-master-detail-form`, `view:form`, `record:line_items`, `object-view`, `view:simple`, `view-switcher`, `filter-ui`, `sort-ui` with `registerLazy`, each with the namespace, `skipFallback` and category its real registration declares. `check:sdui-registration-pins` confirms every promised registration is still in the built console. **Bundling.** `apps/console/vite.config.ts` adds `plugin-form-core` and `plugin-view-core` groups at priority 71 with `includeDependenciesRecursively: false`, so the core modules do not land in (and drag in) the priority-70 package chunks. `ui/vitest.config.mts` aliases both `/core` subpaths to source, ahead of the bare package aliases. ## Why Card #33581 item 1. Measured with #33677's method: a production build of the console, `dist/eager-closure.json`, gzip of the closure and of the five watched chunks (node `zlib.gzipSync`, the report's own level). | | main `86350e12` | this head | |:--|--:|--:| | eager closure (100 chunks) | 1,961,037 B | 1,909,225 B (−51,812) | | `plugin-grid` | 160,176 eager | 160,190 eager | | `plugin-form` | 44,205 eager | 39,961 lazy | | `plugin-view` | 16,051 eager | 19,776 lazy | | `plugins-views` | lazy | 40,255 lazy | | `RecordDetailView` | lazy | 23,139 lazy | | `plugin-form-core` (new) | — | 6,438 eager | | `plugin-view-core` (new) | — | 1,793 eager | `check:eager-closure` passes on this head. ## Tests - **New pin** `app-shell/src/__tests__/pluginCoreSubpaths-33581.test.ts` (3 tests). It reads the export names from the `/core` subpaths themselves, scans every non-test source under `app-shell/src` and `apps/console/src` (floors: >500 files, ≥10 `/core` importers), and fails when (a) any of them imports a `/core` name from a package entry, or (b) any of ten always-eager modules imports either entry by value, a bare import included. - **Ablation** (`scripts/ablation-replace.mjs`, restore proved by blob == HEAD and an empty `git diff HEAD`): - `MetadataProvider.tsx`: `resolveInlineMode` from `'@object-ui/plugin-form'` → (a) and (b) both red, naming the file and the name. - `register-plugins.ts`: `import '@object-ui/plugin-detail'` → `import '@object-ui/plugin-view'` → (b) red: `bare import from '@object-ui/plugin-view'`. - **Forced test edits** (each read a form or view registration through the old eager graph): - `apps/console/src/__tests__/masterDetailFormTypeManifest.test.ts`, `masterDetailFormI18nLabelManifest.test.ts`, `objectFormI18nLabelManifest.test.ts`, `registry-inputs-spec-parity.test.ts`: `import '@object-ui/plugin-form'` beside `../register-plugins`, because a lazy stub carries no `inputs` and these read the manifest from `inputs` (the plugin-list precedent from PR 1). - `apps/console/src/__tests__/record-block-record-reach.test.tsx`: the same import; it renders `record:line_items` synchronously. - `apps/console/src/__tests__/public-contract.test.ts`: the same import; the reverse direction reads `record:line_items`'s `inputs`. `EXPECTED_LAZY` is unchanged. - `app-shell/src/views/RecordDetailView.childWriteRefreshesParent-12244.test.tsx`: `import '@object-ui/plugin-grid'`. The related list renders through the registered `object-grid`; this page reached it only through plugin-view's entry (`ObjectView` imports plugin-grid). The console registers it in `register-plugins.ts`. - `app-shell/src/views/__tests__/FlowRunner.suspense.test.tsx`: the mocked `ObjectForm` was itself a `lazy()`; ScreenView now takes `ObjectForm` as the resolved value of its own `lazy()`, and React refuses a lazy that resolves to a lazy. The mock is now a component that renders an inner lazy body (still suspending on `formLoaded`), and the mocked package is loaded once before `FlowRunner` so its cold load does not eat `waitFor`'s budget. - `app-shell/src/views/metadata-admin/previews/ScreenPreview.test.tsx`: the two object-form tests `await screen.findByTestId('object-form')` instead of a synchronous `getByTestId`. - `ui/scripts/__tests__/side-effects-declaration-consistency.test.ts`: its phantom direction ("every declared source entry has a load-time side effect") contradicted `check-side-effects-array.mjs` and its own coverage direction, which both require every entry form in the array. A side-effect-free secondary entry (`src/core.ts`) could satisfy one only by failing the other. The phantom direction now skips secondary entry forms (exports subpaths other than the barrel) and still judges every barrel; a new anti-vacuity line pins that the exemption reaches the two `src/core.ts` and no `src/index.*`. Red before the edit (first gate run), green after. - `ui/scripts/__tests__/check-side-effects-array.test.ts`: the population pin "every package walks from exactly one root" now names the multi-entry population exactly: plugin-form and plugin-view, each `['src/core.ts', 'src/index.tsx']`. The gate walks both roots and finds the same single registrar as before. ## Acceptance notes - **Item 2 (plugin-detail's eleven reach-ins) is not in this PR**, so it reads `Part of`. `queueClaim.ts`, `recordFieldAccess.tsx` and `useRecordEditable.ts` keep module-level caches with `subscribeDataChanges` subscriptions and sit in plugin-detail's `sideEffects` array. The shell seeds those caches (`seedQueueClaimDecision`, `seedRecordFieldAccess`, `seedRecordVerdict`). A `/core` built as a separate `dist/core.js` bundle, as here and in plugin-chatbot, would carry a second copy of each cache in the published package, so a seed written through core would never reach the hooks the root entry reads. Routing them needs a different published build shape (ES multi-entry with shared chunks, plus `sideEffects` globs), which is a package-shape choice for the seat. Item 2 would also need lazy stubs for plugin-grid's and plugin-detail's tags and a lazy `DevRowActions` (imported statically by `App.tsx`); only then does plugin-grid (160 KB) leave the first load. The detail-core closure measured at about 20 modules and contains no plugin-grid module. - **`ModalForm` is not in `plugin-form/core`.** The card listed it with the helpers, but its closure is most of the form package, so `/core` would stop being small. The shell loads it from the entry through `lazy()` instead (`lazyFormSurfaces.tsx`). - **Changeset is `patch`, not `minor`.** `Metadata-protocol: none` maps to `patch` under AGENTS.md's Post-Task Checklist step 3, and `check-changeset-no-major` refuses `minor` with `none`. - **plugin-form's `/core` duplicates three warning-dedupe sets** (`reported`, `warnedHeadinglessCollapse`, `reportedCurrencyColumnScales`) in the published package. The worst case is a dev warning printed once more. No state the UI reads is duplicated. In the console, Vite resolves both to one source module, so nothing is duplicated there. - **The FlowRunner suspension pin is now also covered by ScreenView's own boundary.** `LazyObjectForm` carries its own `Suspense`, so a form screen body's suspension stops inside the dialog even without FlowRunner's. The pin still proves the route-level fallback never shows. - **File surface breach: `ui/scripts/__tests__/**`** (two forced edits above). The card's surface did not name the sideEffects gates' tests, and the two checks could not both pass on any `/core` subpath of an array package. The alternative was `sideEffects: true` for both packages (the plugin-chatbot shape), which gives up tree-shaking for every consumer of the two packages; I chose the narrow reconciliation. The seat can ask for the other. - Surface outside the card's literal list, inside its "importers" clause: `apps/console/vite.config.ts` (chunk groups), `ui/vitest.config.mts` (aliases). Untouched per the claim's serial limits: plugin-view `ObjectView.tsx`, plugin-grid `ObjectGrid` and `src/index.tsx`. ## Verification - Type-check: plugin-form, plugin-view, app-shell, console (`type-check`, including `tsconfig.test.json`) all exit 0. - Affected suites: 462 files on the first pass; the 9 that went red are the forced edits above, and they pass after the edits. - `pnpm --dir ui check:eager-closure`, `check:side-effects-array`, `check:sdui-registration-pins`, `check:new-line-citations` exit 0. `eslint` on the changed files: 0 errors. - `dispatch-gates.mjs --commands` (59 commands) run and reconciled with `--ran`: `59 derived famil(ies) accounted for — 58 run, 1 NOT-MEASURED`. The NOT-MEASURED one is `check:dual-build-cjs-loads` (exit 3, prerequisite: unbuilt server packages; left to CI). - First-run reds, fixed and rerun on this head: `pnpm --dir ui exec vitest run scripts/` (the two sideEffects tests above; rerun 171 files passed), `check:dts-closure` (the console's `plugin.d.ts` was absent because the measurement build ran `vite build` only; after `build:plugin`, 228/228 present). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmT5bCDp1MDcReXVCop --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
1 parent 44fc2fc commit 571cf90

36 files changed

Lines changed: 550 additions & 34 deletions
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@object-ui/plugin-form': patch
3+
'@object-ui/plugin-view': patch
4+
'@object-ui/app-shell': patch
5+
'@object-ui/console': patch
6+
---
7+
8+
perf(console): the first load stops downloading the form and view packages; `@object-ui/plugin-form/core` and `@object-ui/plugin-view/core` publish their pure helpers without registering anything
9+
10+
Clause-②: yes (widening) — two new published `exports` subpaths, `@object-ui/plugin-form/core` and `@object-ui/plugin-view/core`, join what the packages accept; nothing is removed or renamed, and the package roots export the same names as before
11+
Metadata-protocol: none
12+
13+
`@object-ui/plugin-form` and `@object-ui/plugin-view` register their renderers with `ComponentRegistry` when their root entry is evaluated, and each root reaches every surface of its package. A host that imported one pure helper from the root therefore kept the whole package. Each package now publishes a `/core` subpath that registers nothing:
14+
15+
- `@object-ui/plugin-form/core`: `filterSystemFields`, `isAutoGeneratedFieldType`, `isWideFieldType`, `inferColumns`, `containerGridColsFor`, `resolveInlineMode`, `omitServerResolvedDefaults`, `optionListDefault`, `resolveSectionGroupReferences`, `useInitialFieldFocus`, and the parameter types they take (`InlineMode`, `FieldDefaultsSchemaLike`, `OptionListFieldLike`, `ResolveSectionGroupsOptions`).
16+
- `@object-ui/plugin-view/core`: `deriveRecordSurface`, `deriveRecordFlowSurface`, `overlayWidthFor`, `toFilterGroup`, `deriveFieldOptions`, `isImageLikeField`, `isGeoLikeField`, `pickPreferredField`, `KANBAN_GROUP_PREFERRED`, `PRIMARY_DATE_PREFERRED`, `END_DATE_PREFERRED`, and the types `RecordSurface`, `RecordFlowSurface`, `FieldOption`.
17+
18+
The same names stay exported from each package root, unchanged; nothing to migrate. The subpath ships ESM only (`import`), as `@object-ui/plugin-chatbot/core` does.
19+
20+
The console (`@object-ui/console`, and the shell it draws, `@object-ui/app-shell`) takes these helpers from the subpaths, draws the global record form, the action modal's form and a flow's object-form screen through `lazy()`, and registers the tags the two packages register (`object-form`, `view:form`, `embeddable-form`, `object-master-detail-form`, `record:line_items`, `object-view`, `view:simple`, `view-switcher`, `filter-ui`, `sort-ui`) as lazy stubs with the namespaces those registrations declare. Neither package is downloaded on the first load any more; each loads, and registers once, the first time a form or a view is drawn. What every page draws is unchanged; the first record form or action form opened in a session waits for the form chunk before it shows.

‎ui/apps/console/src/__tests__/masterDetailFormI18nLabelManifest.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ import { manifestFromConfigs, validateTree } from '@objectstack/sdui-parser';
2929
import type { Diagnostic, SchemaElement } from '@objectstack/sdui-parser';
3030
import '@object-ui/components';
3131
import '../register-plugins';
32+
// `@object-ui/plugin-form` too: the console registers its tags as lazy stubs
33+
// since its first load stopped carrying the package (objectstack#33581), and
34+
// a stub carries no `inputs`, which is what this manifest is read from.
35+
import '@object-ui/plugin-form';
3236

3337
const manifest = manifestFromConfigs(
3438
ComponentRegistry.getPublicConfigs() as unknown as Parameters<typeof manifestFromConfigs>[0],

‎ui/apps/console/src/__tests__/masterDetailFormTypeManifest.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ import { manifestFromConfigs, validateTree } from '@objectstack/sdui-parser';
3232
import type { Diagnostic, SchemaElement } from '@objectstack/sdui-parser';
3333
import '@object-ui/components';
3434
import '../register-plugins';
35+
// `@object-ui/plugin-form` too: the console registers its tags as lazy stubs
36+
// since its first load stopped carrying the package (objectstack#33581), and
37+
// a stub carries no `inputs`, which is what this manifest is read from.
38+
import '@object-ui/plugin-form';
3539

3640
const manifest = manifestFromConfigs(
3741
ComponentRegistry.getAllConfigs() as unknown as Parameters<typeof manifestFromConfigs>[0],

‎ui/apps/console/src/__tests__/objectFormI18nLabelManifest.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ import { manifestFromConfigs, validateTree } from '@objectstack/sdui-parser';
2929
import type { Diagnostic, SchemaElement } from '@objectstack/sdui-parser';
3030
import '@object-ui/components';
3131
import '../register-plugins';
32+
// `@object-ui/plugin-form` too: the console registers its tags as lazy stubs
33+
// since its first load stopped carrying the package (objectstack#33581), and
34+
// a stub carries no `inputs`, which is what this manifest is read from.
35+
import '@object-ui/plugin-form';
3236

3337
const manifest = manifestFromConfigs(
3438
ComponentRegistry.getPublicConfigs() as unknown as Parameters<typeof manifestFromConfigs>[0],

‎ui/apps/console/src/__tests__/public-contract.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ import { ComponentPropsMap } from '@objectstack/spec/ui';
4444
import '@object-ui/components';
4545
// … and the console's own plugin layer, from the module main.tsx boots from.
4646
import '../register-plugins';
47+
// `@object-ui/plugin-form` too: the console registers its tags as lazy stubs
48+
// since its first load stopped carrying the package (objectstack#33581), and
49+
// the reverse direction below reads `record:line_items`'s `inputs`, which a
50+
// stub does not carry. `EXPECTED_LAZY` therefore stays the list it was.
51+
import '@object-ui/plugin-form';
4752

4853
/**
4954
* Every curated tag the console makes available, in `PUBLIC_BLOCKS` order.

‎ui/apps/console/src/__tests__/record-block-record-reach.test.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ import {
8585
// binding-reach probe: a hand-copied list would agree with itself.
8686
import '@object-ui/components';
8787
import '../register-plugins';
88+
// `@object-ui/plugin-form` too: the console registers its tags as lazy stubs
89+
// since its first load stopped carrying the package (objectstack#33581), and
90+
// this probe renders `record:line_items` synchronously, through its real renderer.
91+
import '@object-ui/plugin-form';
8892

8993
/** The object every probed block is mounted against. */
9094
const PROBE_OBJECT = 'probe_object__c';

‎ui/apps/console/src/__tests__/registry-inputs-spec-parity.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,11 @@ import {
264264
// test/hook timeout (AGENTS.md §测试纪律, objectui#3010).
265265
import '@object-ui/components';
266266
import '../register-plugins';
267+
// `@object-ui/plugin-form` too: the console registers its tags as lazy stubs
268+
// since its first load stopped carrying the package (objectstack#33581), and
269+
// a stub carries no `inputs`, so without this import the three form blocks
270+
// leave `covered`.
271+
import '@object-ui/plugin-form';
267272

268273
// ── objectui#8176: the blocks `register-plugins` alone cannot show this gate ──
269274
//

‎ui/apps/console/src/components/FormPage.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ import {
136136
omitServerResolvedDefaults,
137137
optionListDefault,
138138
resolveSectionGroupReferences,
139-
} from '@object-ui/plugin-form';
139+
} from '@object-ui/plugin-form/core';
140140
// ADR-0059's published door for a host that renders field widgets OUTSIDE the
141141
// form renderer: `resolveFormWidgetType` + `getLazyFieldWidget` hand back the
142142
// very component `@object-ui/fields` registers for the form, so a host built on

‎ui/apps/console/src/register-plugins.ts‎

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@
2626
import { ComponentRegistry } from '@object-ui/core';
2727

2828
// Eager imports — core views the console shell itself imports by name today
29-
// (the shell's own helpers and record surfaces reach these four packages'
29+
// (the shell's own helpers and record surfaces reach these two packages'
3030
// entries), so a lazy stub here would move nothing out of the first load.
3131
import '@object-ui/plugin-grid';
32-
import '@object-ui/plugin-form';
33-
import '@object-ui/plugin-view';
3432
import '@object-ui/plugin-detail';
3533

3634
// Lazy plugins — registered as deferred loaders. The first time the
@@ -59,6 +57,41 @@ ComponentRegistry.registerLazy('object-gallery', () => import('@object-ui/plugin
5957
category: 'view',
6058
});
6159

60+
// The form and the object view: the shell takes their pure helpers from the
61+
// side-effect-free `/core` subpaths and draws their components behind
62+
// `lazy()`, so nothing on the first load imports either entry. Each tag the
63+
// entry registers is a stub with the namespace, `skipFallback` and category
64+
// that registration declares; the first schema naming one loads the package,
65+
// whose own registrations then replace every stub of it, once.
66+
for (const variant of ['object-form', 'embeddable-form', 'object-master-detail-form']) {
67+
ComponentRegistry.registerLazy(variant, () => import('@object-ui/plugin-form'), {
68+
namespace: 'plugin-form',
69+
category: 'plugin',
70+
});
71+
}
72+
ComponentRegistry.registerLazy('form', () => import('@object-ui/plugin-form'), {
73+
namespace: 'view',
74+
skipFallback: true,
75+
category: 'view',
76+
});
77+
ComponentRegistry.registerLazy('line_items', () => import('@object-ui/plugin-form'), {
78+
namespace: 'record',
79+
skipFallback: true,
80+
category: 'record',
81+
});
82+
for (const variant of ['object-view', 'view:simple']) {
83+
ComponentRegistry.registerLazy(variant, () => import('@object-ui/plugin-view'), {
84+
namespace: 'plugin-view',
85+
category: 'view',
86+
});
87+
}
88+
for (const variant of ['view-switcher', 'filter-ui', 'sort-ui']) {
89+
ComponentRegistry.registerLazy(variant, () => import('@object-ui/plugin-view'), {
90+
namespace: 'view',
91+
category: 'view',
92+
});
93+
}
94+
6295
ComponentRegistry.registerLazy('object-map', () => import('@object-ui/plugin-map'), {
6396
namespace: 'plugin-map',
6497
category: 'view',

‎ui/apps/console/vite.config.ts‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ const workspaceAliases: Record<string, string> = {
627627
'@object-ui/layout': path.resolve(import.meta.dirname, '../../packages/layout/src'),
628628
'@object-ui/plugin-dashboard': path.resolve(import.meta.dirname, '../../packages/plugin-dashboard/src'),
629629
'@object-ui/plugin-report': path.resolve(import.meta.dirname, '../../packages/plugin-report/src'),
630+
'@object-ui/plugin-form/core': path.resolve(import.meta.dirname, '../../packages/plugin-form/src/core.ts'),
630631
'@object-ui/plugin-form': path.resolve(import.meta.dirname, '../../packages/plugin-form/src'),
631632
'@object-ui/plugin-grid': path.resolve(import.meta.dirname, '../../packages/plugin-grid/src'),
632633
'@object-ui/react': path.resolve(import.meta.dirname, '../../packages/react/src'),
@@ -661,6 +662,7 @@ const workspaceAliases: Record<string, string> = {
661662
'@object-ui/plugin-markdown': path.resolve(import.meta.dirname, '../../packages/plugin-markdown/src'),
662663
'@object-ui/plugin-timeline': path.resolve(import.meta.dirname, '../../packages/plugin-timeline/src'),
663664
'@object-ui/plugin-tree': path.resolve(import.meta.dirname, '../../packages/plugin-tree/src'),
665+
'@object-ui/plugin-view/core': path.resolve(import.meta.dirname, '../../packages/plugin-view/src/core.ts'),
664666
'@object-ui/plugin-view': path.resolve(import.meta.dirname, '../../packages/plugin-view/src'),
665667
'@object-ui/plugin-designer': path.resolve(import.meta.dirname, '../../packages/plugin-designer/src'),
666668
};
@@ -1523,6 +1525,30 @@ export default defineConfig({
15231525
{ name: 'plugin-calendar', test: /[\\/]packages[\\/]plugin-calendar[\\/]/, priority: 70 },
15241526
{ name: 'plugin-kanban', test: /[\\/]packages[\\/]plugin-kanban[\\/]/, priority: 70 },
15251527
//
1528+
// ## The form and view helpers stay out of their plugin chunks
1529+
//
1530+
// The console shell is eager and imports pure helpers through
1531+
// `@object-ui/plugin-form/core` and `@object-ui/plugin-view/core`.
1532+
// Left to the `plugin-form` / `plugin-view` groups above, those
1533+
// modules would be co-tenants of the renderers and pull each whole
1534+
// chunk back into every first load, the mechanism the chatbot group
1535+
// below names. Each group takes exactly the modules its `core.ts`
1536+
// reaches inside its package, for the reason `types-zod` above gives
1537+
// for `includeDependenciesRecursively: false`. ⛔ A module added to a
1538+
// `core.ts` closure belongs in its list.
1539+
{
1540+
name: 'plugin-form-core',
1541+
test: /[\\/]packages[\\/]plugin-form[\\/]src[\\/](core|autoLayout|sanitize|deriveMasterDetail|schemaDefaults|sectionGroups|fieldGroups|initialFieldFocus)\.tsx?$/,
1542+
priority: 71,
1543+
includeDependenciesRecursively: false,
1544+
},
1545+
{
1546+
name: 'plugin-view-core',
1547+
test: /[\\/]packages[\\/]plugin-view[\\/]src[\\/](core|recordSurface|config[\\/]view-config-utils)\.tsx?$/,
1548+
priority: 71,
1549+
includeDependenciesRecursively: false,
1550+
},
1551+
//
15261552
// ## The chatbot's side-effect-free half stays out of its chunk (objectui#13410)
15271553
//
15281554
// The console shell is eager and imports the agent catalog hook and a

0 commit comments

Comments
 (0)