mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-14 03:30:19 +00:00
8cd03c8013
* ⚡️ perf: warm route chunks after idle * 🐛 fix: normalize platform route chunk ids * ⚡️ perf: refine route chunk preloading * 🔧 chore: keep desktop renderer preload unchanged * ⚡️ perf: skip renderer chunks in route warmup * ⚡️ perf: preload agent route dynamic chunks * ⚡️ perf: align route preload deployment urls * ⚡️ perf: coalesce stable vendor chunks * ⚡️ perf: group shared data runtime chunks * ⚡️ perf: group model runtime chunks * ⚡️ perf: trim initial route preloads * ⚡️ perf: limit idle route micro preloads * ⚡️ perf: strip tiny html modulepreloads * ⚡️ perf: prune redundant route chunk imports * ⚡️ perf: enable rolldown devtools * ⚡️ perf: gate vite devtools output * ⚡️ perf: optimize react-scan integration and update global types Signed-off-by: Innei <tukon479@gmail.com> * ⚡️ perf: support cloud route chunk preload --------- Signed-off-by: Innei <tukon479@gmail.com>
65 lines
2.1 KiB
TypeScript
65 lines
2.1 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { __testing, sharedModulePreload } from './sharedRendererConfig';
|
|
|
|
describe('sharedModulePreload', () => {
|
|
it('keeps vendor modulepreload dependencies while excluding i18n chunks', () => {
|
|
const resolveDependencies = sharedModulePreload.resolveDependencies!;
|
|
|
|
expect(
|
|
resolveDependencies(
|
|
'assets/index.js',
|
|
[
|
|
'assets/vendor-icons.js',
|
|
'vendor/vendor-react.js',
|
|
'i18n/i18n-default.js',
|
|
'assets/i18n-en-US.js',
|
|
'assets/page.js',
|
|
],
|
|
{ hostId: 'index.html', hostType: 'html' },
|
|
),
|
|
).toEqual(['assets/vendor-icons.js', 'vendor/vendor-react.js', 'assets/page.js']);
|
|
});
|
|
});
|
|
|
|
describe('sharedManualChunks', () => {
|
|
it('groups stable runtime packages into coarse vendor chunks', () => {
|
|
expect(
|
|
__testing.sharedManualChunks('/repo/node_modules/.pnpm/react@19/node_modules/react/index.js'),
|
|
).toBe('vendor-react');
|
|
expect(
|
|
__testing.sharedManualChunks(
|
|
'/repo/node_modules/.pnpm/react-dom@19/node_modules/react-dom/client.js',
|
|
),
|
|
).toBe('vendor-react');
|
|
expect(
|
|
__testing.sharedManualChunks(
|
|
'/repo/node_modules/.pnpm/@emotion+react/node_modules/@emotion/react/dist/index.js',
|
|
),
|
|
).toBe('vendor-ui-runtime');
|
|
expect(
|
|
__testing.sharedManualChunks(
|
|
'/repo/node_modules/.pnpm/motion@12/node_modules/motion/react/dist/index.js',
|
|
),
|
|
).toBe('vendor-ui-runtime');
|
|
expect(
|
|
__testing.sharedManualChunks(
|
|
'/repo/node_modules/.pnpm/lucide-react/node_modules/lucide-react/dist/index.js',
|
|
),
|
|
).toBe('vendor-icons');
|
|
expect(
|
|
__testing.sharedManualChunks(
|
|
'/repo/node_modules/.pnpm/zustand@5/node_modules/zustand/esm/index.mjs',
|
|
),
|
|
).toBe('vendor-data-runtime');
|
|
expect(
|
|
__testing.sharedManualChunks('/repo/packages/model-runtime/src/providers/openai/index.ts'),
|
|
).toBe('vendor-ai-runtime');
|
|
expect(
|
|
__testing.sharedManualChunks(
|
|
'/repo/node_modules/.pnpm/openai@4/node_modules/openai/index.mjs',
|
|
),
|
|
).toBe('vendor-ai-runtime');
|
|
});
|
|
});
|