@base-framework/base 3.9.21 → 3.9.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/copilot.md +20 -0
- package/dist/base.js +1 -1
- package/dist/chunks/chunk-5CC4UQ7G.js +2 -0
- package/dist/chunks/chunk-I6YSM7G4.js +2 -0
- package/dist/chunks/chunk-NLDTREN3.js +2 -0
- package/dist/modules/component.js +1 -1
- package/dist/modules/router.js +1 -1
- package/dist/types/base.d.ts +2 -1
- package/dist/types/modules/import/import-wrapper.d.ts +1 -0
- package/dist/types/modules/router/router.d.ts +75 -6
- package/dist/types/modules/router/routes/route.d.ts +16 -0
- package/package.json +89 -89
package/copilot.md
CHANGED
|
@@ -355,6 +355,26 @@ Purpose: concise, project-specific guidance so AI agents are instantly productiv
|
|
|
355
355
|
});
|
|
356
356
|
```
|
|
357
357
|
|
|
358
|
+
- **Loading layout** (shown while the chunk loads, skipped when it is cached):
|
|
359
|
+
```javascript
|
|
360
|
+
Import({
|
|
361
|
+
src: () => import('./pages/Item.js'),
|
|
362
|
+
loading: () => ({ class: 'page-skeleton' }), // function: fresh layout per render
|
|
363
|
+
onReplaceLoading: (roots, layout) => {} // runs after the module replaced it
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
// Same options on a route import
|
|
367
|
+
{ uri: '/items/:id', import: { src: () => import('./pages/Item.js'), loading: PageFrame } }
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
- **Prefetch** (load a route's chunk before the user navigates):
|
|
371
|
+
```javascript
|
|
372
|
+
import { router, preloadImport } from '@base-framework/base';
|
|
373
|
+
|
|
374
|
+
router.prefetch('/items/5'); // matches routes like navigate(); never navigates
|
|
375
|
+
preloadImport(loaderFn); // same src reference the Import uses
|
|
376
|
+
```
|
|
377
|
+
|
|
358
378
|
- **CRITICAL**: Always use function form `() => import()` for bundler support (Vite, Webpack)
|
|
359
379
|
- **DON'T** use string paths with bundlers: `Import('./file.js')` won't code-split
|
|
360
380
|
- **DO** use function form: `Import(() => import('./file.js'))` enables code-splitting
|