@kimesh/kit 0.2.7 → 0.2.8-nightly.20260124084153
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/dist/index.d.mts +602 -548
- package/dist/index.mjs +477 -82
- package/package.json +9 -7
- package/types.d.ts +33 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hookable } from "hookable";
|
|
2
2
|
import { Ignore } from "ignore";
|
|
3
|
-
import * as
|
|
3
|
+
import * as vite3 from "vite";
|
|
4
4
|
import { Plugin, Plugin as VitePlugin, PluginOption, PluginOption as VitePluginOption, ResolvedConfig, UserConfig, ViteDevServer } from "vite";
|
|
5
5
|
import { KimeshLayerConfig, LayerAutoImportConfig, LayerComponentConfig, LayerComposableConfig, LayerRouteConfig, ResolvedLayer, ResolvedLayer as ResolvedLayer$1, generateLayerAliases, mergeLayerConfigs, prepareLayers, resolveLayers } from "@kimesh/layers";
|
|
6
6
|
import { AutoImportConfig, ImportPreset, LayerAutoImportSource as ImportSource, buildImportRegistry, generateDts, kimeshAutoImport, scanExports } from "@kimesh/auto-import";
|
|
@@ -138,7 +138,7 @@ interface KimeshHooks {
|
|
|
138
138
|
/** Called to extend Vite config before it's resolved */
|
|
139
139
|
"vite:extend": (ctx: {
|
|
140
140
|
kimesh: Kimesh;
|
|
141
|
-
config:
|
|
141
|
+
config: vite3.UserConfig;
|
|
142
142
|
}) => HookResult;
|
|
143
143
|
/** Called after Vite config is resolved */
|
|
144
144
|
"vite:configResolved": (config: ResolvedConfig, kimesh: Kimesh) => HookResult;
|
|
@@ -414,10 +414,10 @@ interface KimeshModuleDefinition<TOptions = Record<string, unknown>> {
|
|
|
414
414
|
/** Shorthand hook registration */
|
|
415
415
|
hooks?: Partial<KimeshHooks>;
|
|
416
416
|
/**
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
417
|
+
* Setup function called after layers are resolved
|
|
418
|
+
* @param options - Merged options (defaults + user config)
|
|
419
|
+
* @param kimesh - Kimesh context
|
|
420
|
+
*/
|
|
421
421
|
setup?: (options: TOptions, kimesh: Kimesh) => void | Promise<void>;
|
|
422
422
|
}
|
|
423
423
|
/**
|
|
@@ -445,10 +445,10 @@ interface KimeshPluginDefinition {
|
|
|
445
445
|
/** Plugin name */
|
|
446
446
|
name: string;
|
|
447
447
|
/**
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
setup: (kimesh: Kimesh) =>
|
|
448
|
+
* Setup function that returns Vite plugin(s)
|
|
449
|
+
* @param kimesh - Kimesh context
|
|
450
|
+
*/
|
|
451
|
+
setup: (kimesh: Kimesh) => vite3.PluginOption | vite3.PluginOption[];
|
|
452
452
|
}
|
|
453
453
|
interface KimeshPlugin {
|
|
454
454
|
/** Plugin definition */
|
|
@@ -456,7 +456,7 @@ interface KimeshPlugin {
|
|
|
456
456
|
/** Plugin name */
|
|
457
457
|
name: string;
|
|
458
458
|
/** Get Vite plugins */
|
|
459
|
-
getPlugins: (kimesh: Kimesh) =>
|
|
459
|
+
getPlugins: (kimesh: Kimesh) => vite3.PluginOption[];
|
|
460
460
|
}
|
|
461
461
|
//#endregion
|
|
462
462
|
//#region src/types/config.d.ts
|
|
@@ -529,9 +529,9 @@ interface ComponentsConfig {
|
|
|
529
529
|
*/
|
|
530
530
|
interface KimeshViteConfig extends Omit<UserConfig, "root" | "configFile"> {
|
|
531
531
|
/**
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
532
|
+
* Additional Vite plugins.
|
|
533
|
+
* These are merged AFTER Kimesh's internal plugins.
|
|
534
|
+
*/
|
|
535
535
|
plugins?: PluginOption[];
|
|
536
536
|
}
|
|
537
537
|
/**
|
|
@@ -545,39 +545,39 @@ declare const DEFAULT_ALIASES: Record<string, string>;
|
|
|
545
545
|
*/
|
|
546
546
|
interface DebugConfig {
|
|
547
547
|
/**
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
548
|
+
* Log hook execution with timing information
|
|
549
|
+
* @default false
|
|
550
|
+
*/
|
|
551
551
|
hooks?: boolean;
|
|
552
552
|
/**
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
553
|
+
* Log module loading and setup
|
|
554
|
+
* @default false
|
|
555
|
+
*/
|
|
556
556
|
modules?: boolean;
|
|
557
557
|
/**
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
558
|
+
* Log layer resolution
|
|
559
|
+
* @default false
|
|
560
|
+
*/
|
|
561
561
|
layers?: boolean;
|
|
562
562
|
/**
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
563
|
+
* Log configuration loading and merging
|
|
564
|
+
* @default false
|
|
565
|
+
*/
|
|
566
566
|
config?: boolean;
|
|
567
567
|
/**
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
568
|
+
* Log Vite plugin operations
|
|
569
|
+
* @default false
|
|
570
|
+
*/
|
|
571
571
|
vite?: boolean;
|
|
572
572
|
/**
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
573
|
+
* Log route generation
|
|
574
|
+
* @default false
|
|
575
|
+
*/
|
|
576
576
|
routes?: boolean;
|
|
577
577
|
/**
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
578
|
+
* Log auto-import resolution
|
|
579
|
+
* @default false
|
|
580
|
+
*/
|
|
581
581
|
imports?: boolean;
|
|
582
582
|
}
|
|
583
583
|
/**
|
|
@@ -589,9 +589,9 @@ declare const DEFAULT_IGNORE_PATTERNS: string[];
|
|
|
589
589
|
*/
|
|
590
590
|
interface IgnoreOptions {
|
|
591
591
|
/**
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
592
|
+
* Whether matching is case-insensitive
|
|
593
|
+
* @default false
|
|
594
|
+
*/
|
|
595
595
|
ignorecase?: boolean;
|
|
596
596
|
}
|
|
597
597
|
/**
|
|
@@ -615,42 +615,42 @@ interface IgnoreOptions {
|
|
|
615
615
|
*/
|
|
616
616
|
interface RouteRule {
|
|
617
617
|
/**
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
618
|
+
* Redirect to another path
|
|
619
|
+
* Can be a string path or an object with statusCode
|
|
620
|
+
*/
|
|
621
621
|
redirect?: string | {
|
|
622
622
|
to: string;
|
|
623
623
|
statusCode?: 301 | 302 | 307 | 308;
|
|
624
624
|
};
|
|
625
625
|
/**
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
626
|
+
* Pre-render this route at build time (for static generation)
|
|
627
|
+
* @default false
|
|
628
|
+
*/
|
|
629
629
|
prerender?: boolean;
|
|
630
630
|
/**
|
|
631
|
-
|
|
632
|
-
|
|
631
|
+
* Cache configuration for this route
|
|
632
|
+
*/
|
|
633
633
|
cache?: boolean | {
|
|
634
634
|
/**
|
|
635
|
-
|
|
636
|
-
|
|
635
|
+
* Cache max age in seconds
|
|
636
|
+
*/
|
|
637
637
|
maxAge?: number;
|
|
638
638
|
/**
|
|
639
|
-
|
|
640
|
-
|
|
639
|
+
* Stale-while-revalidate in seconds
|
|
640
|
+
*/
|
|
641
641
|
swr?: number;
|
|
642
642
|
/**
|
|
643
|
-
|
|
644
|
-
|
|
643
|
+
* Cache key modifiers
|
|
644
|
+
*/
|
|
645
645
|
varies?: string[];
|
|
646
646
|
};
|
|
647
647
|
/**
|
|
648
|
-
|
|
649
|
-
|
|
648
|
+
* Custom headers to set for this route
|
|
649
|
+
*/
|
|
650
650
|
headers?: Record<string, string>;
|
|
651
651
|
/**
|
|
652
|
-
|
|
653
|
-
|
|
652
|
+
* CORS configuration for this route
|
|
653
|
+
*/
|
|
654
654
|
cors?: boolean | {
|
|
655
655
|
origin?: string | string[];
|
|
656
656
|
methods?: string[];
|
|
@@ -658,8 +658,8 @@ interface RouteRule {
|
|
|
658
658
|
credentials?: boolean;
|
|
659
659
|
};
|
|
660
660
|
/**
|
|
661
|
-
|
|
662
|
-
|
|
661
|
+
* Custom meta data for the route
|
|
662
|
+
*/
|
|
663
663
|
meta?: Record<string, unknown>;
|
|
664
664
|
}
|
|
665
665
|
/**
|
|
@@ -668,24 +668,24 @@ interface RouteRule {
|
|
|
668
668
|
*/
|
|
669
669
|
interface DirectoryConfig {
|
|
670
670
|
/**
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
671
|
+
* Directory for static assets
|
|
672
|
+
* @default 'assets'
|
|
673
|
+
*/
|
|
674
674
|
assets?: string;
|
|
675
675
|
/**
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
676
|
+
* Directory for runtime plugins
|
|
677
|
+
* @default 'plugins'
|
|
678
|
+
*/
|
|
679
679
|
plugins?: string;
|
|
680
680
|
/**
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
681
|
+
* Directory for public static files
|
|
682
|
+
* @default 'public'
|
|
683
|
+
*/
|
|
684
684
|
public?: string;
|
|
685
685
|
/**
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
686
|
+
* Directory for shared code across the app
|
|
687
|
+
* @default 'shared'
|
|
688
|
+
*/
|
|
689
689
|
shared?: string;
|
|
690
690
|
}
|
|
691
691
|
/**
|
|
@@ -693,19 +693,19 @@ interface DirectoryConfig {
|
|
|
693
693
|
*/
|
|
694
694
|
interface AnalyzeConfig {
|
|
695
695
|
/**
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
696
|
+
* Enable the bundle analyzer
|
|
697
|
+
* @default false
|
|
698
|
+
*/
|
|
699
699
|
enabled?: boolean;
|
|
700
700
|
/**
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
701
|
+
* Automatically open analyzer report in browser
|
|
702
|
+
* @default false
|
|
703
|
+
*/
|
|
704
704
|
openAnalyzer?: boolean;
|
|
705
705
|
/**
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
706
|
+
* Custom filename for the report
|
|
707
|
+
* @default 'report.html'
|
|
708
|
+
*/
|
|
709
709
|
reportFilename?: string;
|
|
710
710
|
}
|
|
711
711
|
/**
|
|
@@ -714,48 +714,48 @@ interface AnalyzeConfig {
|
|
|
714
714
|
*/
|
|
715
715
|
interface BuildConfig {
|
|
716
716
|
/**
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
717
|
+
* Enable bundle analysis. Shows a visualization of bundle contents.
|
|
718
|
+
*
|
|
719
|
+
* @example
|
|
720
|
+
* ```ts
|
|
721
|
+
* build: {
|
|
722
|
+
* analyze: true,
|
|
723
|
+
* // or with options:
|
|
724
|
+
* analyze: {
|
|
725
|
+
* enabled: true,
|
|
726
|
+
* openAnalyzer: false,
|
|
727
|
+
* reportFilename: 'stats.html',
|
|
728
|
+
* },
|
|
729
|
+
* }
|
|
730
|
+
* ```
|
|
731
|
+
*/
|
|
732
732
|
analyze?: boolean | AnalyzeConfig;
|
|
733
733
|
/**
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
734
|
+
* Generate source maps for production builds.
|
|
735
|
+
* - `true`: Generate separate source map files
|
|
736
|
+
* - `'hidden'`: Generate source maps but don't reference them in bundles
|
|
737
|
+
* - `'inline'`: Inline source maps into bundles
|
|
738
|
+
* - `false`: No source maps
|
|
739
|
+
*
|
|
740
|
+
* @default false
|
|
741
|
+
*/
|
|
742
742
|
sourcemap?: boolean | "hidden" | "inline";
|
|
743
743
|
/**
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
744
|
+
* Build target for esbuild/terser.
|
|
745
|
+
* Specifies the JS language version to target.
|
|
746
|
+
*
|
|
747
|
+
* @default 'esnext'
|
|
748
|
+
*/
|
|
749
749
|
target?: string;
|
|
750
750
|
/**
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
751
|
+
* Minification strategy for production builds.
|
|
752
|
+
* - `true`: Use default minifier (esbuild)
|
|
753
|
+
* - `'esbuild'`: Fast minification with esbuild
|
|
754
|
+
* - `'terser'`: More aggressive minification with terser
|
|
755
|
+
* - `false`: No minification
|
|
756
|
+
*
|
|
757
|
+
* @default 'esbuild'
|
|
758
|
+
*/
|
|
759
759
|
minify?: boolean | "esbuild" | "terser";
|
|
760
760
|
}
|
|
761
761
|
/**
|
|
@@ -763,12 +763,12 @@ interface BuildConfig {
|
|
|
763
763
|
*/
|
|
764
764
|
interface HttpsConfig {
|
|
765
765
|
/**
|
|
766
|
-
|
|
767
|
-
|
|
766
|
+
* Path to SSL key file
|
|
767
|
+
*/
|
|
768
768
|
key?: string;
|
|
769
769
|
/**
|
|
770
|
-
|
|
771
|
-
|
|
770
|
+
* Path to SSL certificate file
|
|
771
|
+
*/
|
|
772
772
|
cert?: string;
|
|
773
773
|
}
|
|
774
774
|
/**
|
|
@@ -776,30 +776,30 @@ interface HttpsConfig {
|
|
|
776
776
|
*/
|
|
777
777
|
interface ProxyOptions {
|
|
778
778
|
/**
|
|
779
|
-
|
|
780
|
-
|
|
779
|
+
* Target URL to proxy to
|
|
780
|
+
*/
|
|
781
781
|
target: string;
|
|
782
782
|
/**
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
783
|
+
* Change the origin header to match target
|
|
784
|
+
* @default true
|
|
785
|
+
*/
|
|
786
786
|
changeOrigin?: boolean;
|
|
787
787
|
/**
|
|
788
|
-
|
|
789
|
-
|
|
788
|
+
* Rewrite the URL path
|
|
789
|
+
*/
|
|
790
790
|
rewrite?: (path: string) => string;
|
|
791
791
|
/**
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
792
|
+
* Whether to proxy WebSocket connections
|
|
793
|
+
* @default false
|
|
794
|
+
*/
|
|
795
795
|
ws?: boolean;
|
|
796
796
|
/**
|
|
797
|
-
|
|
798
|
-
|
|
797
|
+
* SSL verification options
|
|
798
|
+
*/
|
|
799
799
|
secure?: boolean;
|
|
800
800
|
/**
|
|
801
|
-
|
|
802
|
-
|
|
801
|
+
* Custom headers to send with the proxy request
|
|
802
|
+
*/
|
|
803
803
|
headers?: Record<string, string>;
|
|
804
804
|
}
|
|
805
805
|
/**
|
|
@@ -807,32 +807,32 @@ interface ProxyOptions {
|
|
|
807
807
|
*/
|
|
808
808
|
interface CorsOptions {
|
|
809
809
|
/**
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
810
|
+
* Allowed origins
|
|
811
|
+
* @default '*'
|
|
812
|
+
*/
|
|
813
813
|
origin?: string | string[] | boolean;
|
|
814
814
|
/**
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
815
|
+
* Allowed HTTP methods
|
|
816
|
+
* @default ['GET', 'HEAD', 'PUT', 'PATCH', 'POST', 'DELETE']
|
|
817
|
+
*/
|
|
818
818
|
methods?: string[];
|
|
819
819
|
/**
|
|
820
|
-
|
|
821
|
-
|
|
820
|
+
* Allowed headers
|
|
821
|
+
*/
|
|
822
822
|
allowedHeaders?: string[];
|
|
823
823
|
/**
|
|
824
|
-
|
|
825
|
-
|
|
824
|
+
* Headers exposed to the client
|
|
825
|
+
*/
|
|
826
826
|
exposedHeaders?: string[];
|
|
827
827
|
/**
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
828
|
+
* Allow credentials (cookies, authorization headers)
|
|
829
|
+
* @default false
|
|
830
|
+
*/
|
|
831
831
|
credentials?: boolean;
|
|
832
832
|
/**
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
833
|
+
* Max age for preflight request caching (seconds)
|
|
834
|
+
* @default 86400
|
|
835
|
+
*/
|
|
836
836
|
maxAge?: number;
|
|
837
837
|
}
|
|
838
838
|
/**
|
|
@@ -840,70 +840,70 @@ interface CorsOptions {
|
|
|
840
840
|
*/
|
|
841
841
|
interface DevServerConfig {
|
|
842
842
|
/**
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
843
|
+
* Port to listen on
|
|
844
|
+
* @default 3000
|
|
845
|
+
*/
|
|
846
846
|
port?: number;
|
|
847
847
|
/**
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
848
|
+
* Host to bind to.
|
|
849
|
+
* - `'localhost'`: Only accessible from this machine
|
|
850
|
+
* - `true` or `'0.0.0.0'`: Accessible from network
|
|
851
|
+
*
|
|
852
|
+
* @default 'localhost'
|
|
853
|
+
*/
|
|
854
854
|
host?: string | boolean;
|
|
855
855
|
/**
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
856
|
+
* Automatically open browser when server starts
|
|
857
|
+
* @default false
|
|
858
|
+
*/
|
|
859
859
|
open?: boolean;
|
|
860
860
|
/**
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
861
|
+
* Enable HTTPS for dev server.
|
|
862
|
+
* Set to `true` to use auto-generated certificates,
|
|
863
|
+
* or provide custom key/cert paths.
|
|
864
|
+
*
|
|
865
|
+
* @example
|
|
866
|
+
* ```ts
|
|
867
|
+
* dev: {
|
|
868
|
+
* https: true, // Auto-generate certificates
|
|
869
|
+
* // or with custom certs:
|
|
870
|
+
* https: {
|
|
871
|
+
* key: './certs/localhost.key',
|
|
872
|
+
* cert: './certs/localhost.crt',
|
|
873
|
+
* },
|
|
874
|
+
* }
|
|
875
|
+
* ```
|
|
876
|
+
*/
|
|
877
877
|
https?: boolean | HttpsConfig;
|
|
878
878
|
/**
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
879
|
+
* Configure proxy rules for dev server.
|
|
880
|
+
* Useful for API proxying during development.
|
|
881
|
+
*
|
|
882
|
+
* @example
|
|
883
|
+
* ```ts
|
|
884
|
+
* dev: {
|
|
885
|
+
* proxy: {
|
|
886
|
+
* '/api': 'http://localhost:8080',
|
|
887
|
+
* '/socket': {
|
|
888
|
+
* target: 'ws://localhost:8081',
|
|
889
|
+
* ws: true,
|
|
890
|
+
* },
|
|
891
|
+
* },
|
|
892
|
+
* }
|
|
893
|
+
* ```
|
|
894
|
+
*/
|
|
895
895
|
proxy?: Record<string, string | ProxyOptions>;
|
|
896
896
|
/**
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
897
|
+
* Configure CORS for dev server.
|
|
898
|
+
* Set to `true` to enable default CORS settings.
|
|
899
|
+
*
|
|
900
|
+
* @default false
|
|
901
|
+
*/
|
|
902
902
|
cors?: boolean | CorsOptions;
|
|
903
903
|
/**
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
904
|
+
* Exit if the specified port is already in use
|
|
905
|
+
* @default false
|
|
906
|
+
*/
|
|
907
907
|
strictPort?: boolean;
|
|
908
908
|
}
|
|
909
909
|
/**
|
|
@@ -911,37 +911,37 @@ interface DevServerConfig {
|
|
|
911
911
|
*/
|
|
912
912
|
interface TypeScriptConfig {
|
|
913
913
|
/**
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
914
|
+
* Enable strict TypeScript mode.
|
|
915
|
+
* When true, adds strict compiler options to generated tsconfig.
|
|
916
|
+
*
|
|
917
|
+
* @default true
|
|
918
|
+
*/
|
|
919
919
|
strict?: boolean;
|
|
920
920
|
/**
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
921
|
+
* Enable type checking during development and/or build.
|
|
922
|
+
* - `true`: Enable type checking during both dev and build
|
|
923
|
+
* - `'build'`: Only type check during build
|
|
924
|
+
* - `false`: Disable type checking
|
|
925
|
+
*
|
|
926
|
+
* @default false
|
|
927
|
+
*/
|
|
928
928
|
typeCheck?: boolean | "build";
|
|
929
929
|
/**
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
930
|
+
* Additional tsconfig compiler options to merge with generated config.
|
|
931
|
+
* These options will extend the auto-generated `.kimesh/tsconfig.json`.
|
|
932
|
+
*
|
|
933
|
+
* @example
|
|
934
|
+
* ```ts
|
|
935
|
+
* typescript: {
|
|
936
|
+
* tsConfig: {
|
|
937
|
+
* compilerOptions: {
|
|
938
|
+
* experimentalDecorators: true,
|
|
939
|
+
* emitDecoratorMetadata: true,
|
|
940
|
+
* },
|
|
941
|
+
* },
|
|
942
|
+
* }
|
|
943
|
+
* ```
|
|
944
|
+
*/
|
|
945
945
|
tsConfig?: {
|
|
946
946
|
compilerOptions?: Record<string, unknown>;
|
|
947
947
|
include?: string[];
|
|
@@ -957,46 +957,46 @@ interface TypeScriptConfig {
|
|
|
957
957
|
*/
|
|
958
958
|
interface ChokidarOptions {
|
|
959
959
|
/**
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
960
|
+
* Indicates whether the process should continue as long as files are being watched
|
|
961
|
+
* @default true
|
|
962
|
+
*/
|
|
963
963
|
persistent?: boolean;
|
|
964
964
|
/**
|
|
965
|
-
|
|
966
|
-
|
|
965
|
+
* Patterns to ignore
|
|
966
|
+
*/
|
|
967
967
|
ignored?: string | RegExp | string[] | ((path: string) => boolean);
|
|
968
968
|
/**
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
969
|
+
* Use polling instead of native events
|
|
970
|
+
* @default false
|
|
971
|
+
*/
|
|
972
972
|
usePolling?: boolean;
|
|
973
973
|
/**
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
974
|
+
* Polling interval in milliseconds (if usePolling is true)
|
|
975
|
+
* @default 100
|
|
976
|
+
*/
|
|
977
977
|
interval?: number;
|
|
978
978
|
/**
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
979
|
+
* Polling interval for binary files (if usePolling is true)
|
|
980
|
+
* @default 300
|
|
981
|
+
*/
|
|
982
982
|
binaryInterval?: number;
|
|
983
983
|
/**
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
984
|
+
* Delay in milliseconds for stabilized 'add' events
|
|
985
|
+
* @default 2000
|
|
986
|
+
*/
|
|
987
987
|
awaitWriteFinish?: boolean | {
|
|
988
988
|
stabilityThreshold?: number;
|
|
989
989
|
pollInterval?: number;
|
|
990
990
|
};
|
|
991
991
|
/**
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
992
|
+
* Use file descriptor watching instead of stat polling
|
|
993
|
+
* @default false
|
|
994
|
+
*/
|
|
995
995
|
atomic?: boolean | number;
|
|
996
996
|
/**
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
997
|
+
* Watch depth limit (how many levels to traverse)
|
|
998
|
+
* @default undefined (no limit)
|
|
999
|
+
*/
|
|
1000
1000
|
depth?: number;
|
|
1001
1001
|
}
|
|
1002
1002
|
/**
|
|
@@ -1004,12 +1004,12 @@ interface ChokidarOptions {
|
|
|
1004
1004
|
*/
|
|
1005
1005
|
interface WatchersConfig {
|
|
1006
1006
|
/**
|
|
1007
|
-
|
|
1008
|
-
|
|
1007
|
+
* Chokidar options for file watching
|
|
1008
|
+
*/
|
|
1009
1009
|
chokidar?: ChokidarOptions;
|
|
1010
1010
|
/**
|
|
1011
|
-
|
|
1012
|
-
|
|
1011
|
+
* Webpack watch options (for future use if needed)
|
|
1012
|
+
*/
|
|
1013
1013
|
webpack?: {
|
|
1014
1014
|
aggregateTimeout?: number;
|
|
1015
1015
|
poll?: boolean | number;
|
|
@@ -1040,9 +1040,9 @@ interface KimeshModuleOptions {
|
|
|
1040
1040
|
*/
|
|
1041
1041
|
interface AppConfig {
|
|
1042
1042
|
/**
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1043
|
+
* Global head configuration for the app
|
|
1044
|
+
* Automatically enables @kimesh/head plugin when configured
|
|
1045
|
+
*/
|
|
1046
1046
|
head?: {
|
|
1047
1047
|
/** Page title */title?: string; /** Title template (e.g., '%s | My App') */
|
|
1048
1048
|
titleTemplate?: string | ((title: string) => string); /** Meta tags */
|
|
@@ -1066,279 +1066,279 @@ interface KimeshConfig extends KimeshModuleOptions {
|
|
|
1066
1066
|
/** Base path for routes (for layers) */
|
|
1067
1067
|
basePath?: string;
|
|
1068
1068
|
/**
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1069
|
+
* Define additional aliases to access custom directories within your JavaScript and CSS.
|
|
1070
|
+
*
|
|
1071
|
+
* Aliases are automatically added to the generated TypeScript configurations
|
|
1072
|
+
* for full type support and path auto-complete.
|
|
1073
|
+
*
|
|
1074
|
+
* @default { "~": "/<srcDir>", "@": "/<srcDir>", "~~": "/<rootDir>", "@@": "/<rootDir>", "#build": "/<rootDir>/.kimesh" }
|
|
1075
|
+
*
|
|
1076
|
+
* @example
|
|
1077
|
+
* ```ts
|
|
1078
|
+
* import { fileURLToPath } from 'node:url'
|
|
1079
|
+
*
|
|
1080
|
+
* export default defineKmConfig({
|
|
1081
|
+
* alias: {
|
|
1082
|
+
* 'images': fileURLToPath(new URL('./assets/images', import.meta.url)),
|
|
1083
|
+
* 'style': fileURLToPath(new URL('./assets/style', import.meta.url)),
|
|
1084
|
+
* },
|
|
1085
|
+
* })
|
|
1086
|
+
* ```
|
|
1087
|
+
*/
|
|
1088
1088
|
alias?: Record<string, string>;
|
|
1089
1089
|
/**
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1090
|
+
* Set to `true` to enable debug mode.
|
|
1091
|
+
*
|
|
1092
|
+
* Prints out hook names and timings, logs hook arguments,
|
|
1093
|
+
* and provides detailed information about module loading and layer resolution.
|
|
1094
|
+
*
|
|
1095
|
+
* @default false
|
|
1096
|
+
*
|
|
1097
|
+
* @example
|
|
1098
|
+
* ```ts
|
|
1099
|
+
* export default defineKmConfig({
|
|
1100
|
+
* debug: true,
|
|
1101
|
+
* // or with specific options:
|
|
1102
|
+
* debug: {
|
|
1103
|
+
* hooks: true,
|
|
1104
|
+
* modules: true,
|
|
1105
|
+
* layers: true,
|
|
1106
|
+
* },
|
|
1107
|
+
* })
|
|
1108
|
+
* ```
|
|
1109
|
+
*/
|
|
1110
1110
|
debug?: boolean | DebugConfig;
|
|
1111
1111
|
/**
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1112
|
+
* Hooks are listeners to Kimesh events that are typically used in modules,
|
|
1113
|
+
* but are also available in `kimesh.config.ts`.
|
|
1114
|
+
*
|
|
1115
|
+
* Internally, hooks follow a naming pattern using colons (e.g., build:done).
|
|
1116
|
+
* For ease of configuration, you can structure them as an hierarchical object.
|
|
1117
|
+
*
|
|
1118
|
+
* @example
|
|
1119
|
+
* ```ts
|
|
1120
|
+
* export default defineKmConfig({
|
|
1121
|
+
* hooks: {
|
|
1122
|
+
* 'ready': (kimesh) => {
|
|
1123
|
+
* console.log('Kimesh is ready!')
|
|
1124
|
+
* },
|
|
1125
|
+
* 'build:done': (kimesh) => {
|
|
1126
|
+
* console.log('Build completed!')
|
|
1127
|
+
* },
|
|
1128
|
+
* },
|
|
1129
|
+
* })
|
|
1130
|
+
* ```
|
|
1131
|
+
*/
|
|
1132
1132
|
hooks?: Partial<KimeshHooks>;
|
|
1133
1133
|
/**
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1134
|
+
* Files matching glob patterns specified inside the `ignore` array
|
|
1135
|
+
* will be ignored in building.
|
|
1136
|
+
*
|
|
1137
|
+
* More customizable than `ignorePrefix`: allows complex patterns.
|
|
1138
|
+
*
|
|
1139
|
+
* @default ["**\/*.stories.{js,cts,mts,ts,jsx,tsx}", "**\/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}", "**\/*.d.{cts,mts,ts}", ".kimesh"]
|
|
1140
|
+
*
|
|
1141
|
+
* @example
|
|
1142
|
+
* ```ts
|
|
1143
|
+
* export default defineKmConfig({
|
|
1144
|
+
* ignore: [
|
|
1145
|
+
* '**\/__tests__/**',
|
|
1146
|
+
* '**\/*.mock.ts',
|
|
1147
|
+
* 'legacy/**',
|
|
1148
|
+
* ],
|
|
1149
|
+
* })
|
|
1150
|
+
* ```
|
|
1151
|
+
*/
|
|
1152
1152
|
ignore?: string[];
|
|
1153
1153
|
/**
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1154
|
+
* Any file in routes, layouts, middleware directories will be ignored
|
|
1155
|
+
* during the build process if its filename starts with the prefix specified.
|
|
1156
|
+
*
|
|
1157
|
+
* @default "-"
|
|
1158
|
+
*
|
|
1159
|
+
* @example
|
|
1160
|
+
* ```ts
|
|
1161
|
+
* export default defineKmConfig({
|
|
1162
|
+
* ignorePrefix: '_', // Ignore files starting with underscore
|
|
1163
|
+
* })
|
|
1164
|
+
* ```
|
|
1165
|
+
*/
|
|
1166
1166
|
ignorePrefix?: string;
|
|
1167
1167
|
/**
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1168
|
+
* Pass options directly to `node-ignore` (which is used by Kimesh to ignore files).
|
|
1169
|
+
*
|
|
1170
|
+
* @see https://github.com/kaelzhang/node-ignore
|
|
1171
|
+
*
|
|
1172
|
+
* @example
|
|
1173
|
+
* ```ts
|
|
1174
|
+
* export default defineKmConfig({
|
|
1175
|
+
* ignoreOptions: {
|
|
1176
|
+
* ignorecase: false, // Case-sensitive matching
|
|
1177
|
+
* },
|
|
1178
|
+
* })
|
|
1179
|
+
* ```
|
|
1180
|
+
*/
|
|
1181
1181
|
ignoreOptions?: IgnoreOptions;
|
|
1182
1182
|
/**
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1183
|
+
* Global route rules applied to matching routes.
|
|
1184
|
+
*
|
|
1185
|
+
* Keys are route patterns (supports wildcards with **).
|
|
1186
|
+
* Useful for redirects, caching, and per-route configuration.
|
|
1187
|
+
*
|
|
1188
|
+
* @experimental This feature's API may change in the future.
|
|
1189
|
+
*
|
|
1190
|
+
* @example
|
|
1191
|
+
* ```ts
|
|
1192
|
+
* export default defineKmConfig({
|
|
1193
|
+
* routeRules: {
|
|
1194
|
+
* '/admin/**': {
|
|
1195
|
+
* redirect: '/login',
|
|
1196
|
+
* },
|
|
1197
|
+
* '/api/**': {
|
|
1198
|
+
* headers: { 'Cache-Control': 'no-store' },
|
|
1199
|
+
* cors: true,
|
|
1200
|
+
* },
|
|
1201
|
+
* '/blog/**': {
|
|
1202
|
+
* prerender: true,
|
|
1203
|
+
* },
|
|
1204
|
+
* },
|
|
1205
|
+
* })
|
|
1206
|
+
* ```
|
|
1207
|
+
*/
|
|
1208
1208
|
routeRules?: Record<string, RouteRule>;
|
|
1209
1209
|
/**
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1210
|
+
* Source directory for your application code.
|
|
1211
|
+
* All relative paths are resolved from this directory.
|
|
1212
|
+
*
|
|
1213
|
+
* @default 'src'
|
|
1214
|
+
*
|
|
1215
|
+
* @example
|
|
1216
|
+
* ```ts
|
|
1217
|
+
* export default defineKmConfig({
|
|
1218
|
+
* srcDir: 'app', // Use 'app' instead of 'src'
|
|
1219
|
+
* })
|
|
1220
|
+
* ```
|
|
1221
|
+
*/
|
|
1222
1222
|
srcDir?: string;
|
|
1223
1223
|
/**
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1224
|
+
* Build output directory for Kimesh's generated files.
|
|
1225
|
+
* Contains TypeScript configs, generated routes, and other build artifacts.
|
|
1226
|
+
*
|
|
1227
|
+
* @default '.kimesh'
|
|
1228
|
+
*
|
|
1229
|
+
* @example
|
|
1230
|
+
* ```ts
|
|
1231
|
+
* export default defineKmConfig({
|
|
1232
|
+
* buildDir: '.output', // Use '.output' instead of '.kimesh'
|
|
1233
|
+
* })
|
|
1234
|
+
* ```
|
|
1235
|
+
*/
|
|
1236
1236
|
buildDir?: string;
|
|
1237
1237
|
/**
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1238
|
+
* Directory configuration for customizing the project structure.
|
|
1239
|
+
*
|
|
1240
|
+
* @example
|
|
1241
|
+
* ```ts
|
|
1242
|
+
* export default defineKmConfig({
|
|
1243
|
+
* dir: {
|
|
1244
|
+
* assets: 'static/assets',
|
|
1245
|
+
* plugins: 'app/plugins',
|
|
1246
|
+
* public: 'public',
|
|
1247
|
+
* shared: 'lib/shared',
|
|
1248
|
+
* },
|
|
1249
|
+
* })
|
|
1250
|
+
* ```
|
|
1251
|
+
*/
|
|
1252
1252
|
dir?: DirectoryConfig;
|
|
1253
1253
|
/**
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1254
|
+
* Build configuration for production builds.
|
|
1255
|
+
*
|
|
1256
|
+
* @example
|
|
1257
|
+
* ```ts
|
|
1258
|
+
* export default defineKmConfig({
|
|
1259
|
+
* build: {
|
|
1260
|
+
* analyze: true,
|
|
1261
|
+
* sourcemap: 'hidden',
|
|
1262
|
+
* target: 'es2022',
|
|
1263
|
+
* minify: 'esbuild',
|
|
1264
|
+
* },
|
|
1265
|
+
* })
|
|
1266
|
+
* ```
|
|
1267
|
+
*/
|
|
1268
1268
|
build?: BuildConfig;
|
|
1269
1269
|
/**
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1270
|
+
* Enhanced development server configuration.
|
|
1271
|
+
* Supports HTTPS, proxy, CORS, and more.
|
|
1272
|
+
*
|
|
1273
|
+
* @example
|
|
1274
|
+
* ```ts
|
|
1275
|
+
* export default defineKmConfig({
|
|
1276
|
+
* dev: {
|
|
1277
|
+
* port: 3000,
|
|
1278
|
+
* host: 'localhost',
|
|
1279
|
+
* open: true,
|
|
1280
|
+
* https: true,
|
|
1281
|
+
* proxy: {
|
|
1282
|
+
* '/api': 'http://localhost:8080',
|
|
1283
|
+
* },
|
|
1284
|
+
* cors: true,
|
|
1285
|
+
* strictPort: false,
|
|
1286
|
+
* },
|
|
1287
|
+
* })
|
|
1288
|
+
* ```
|
|
1289
|
+
*/
|
|
1290
1290
|
dev?: DevServerConfig;
|
|
1291
1291
|
/**
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1292
|
+
* TypeScript configuration options.
|
|
1293
|
+
*
|
|
1294
|
+
* @example
|
|
1295
|
+
* ```ts
|
|
1296
|
+
* export default defineKmConfig({
|
|
1297
|
+
* typescript: {
|
|
1298
|
+
* strict: true,
|
|
1299
|
+
* typeCheck: 'build',
|
|
1300
|
+
* tsConfig: {
|
|
1301
|
+
* compilerOptions: {
|
|
1302
|
+
* experimentalDecorators: true,
|
|
1303
|
+
* },
|
|
1304
|
+
* },
|
|
1305
|
+
* },
|
|
1306
|
+
* })
|
|
1307
|
+
* ```
|
|
1308
|
+
*/
|
|
1309
1309
|
typescript?: TypeScriptConfig;
|
|
1310
1310
|
/**
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1311
|
+
* Additional file patterns to watch during development.
|
|
1312
|
+
* Uses glob patterns relative to the project root.
|
|
1313
|
+
*
|
|
1314
|
+
* @example
|
|
1315
|
+
* ```ts
|
|
1316
|
+
* export default defineKmConfig({
|
|
1317
|
+
* watch: [
|
|
1318
|
+
* './custom-dir/**\/*',
|
|
1319
|
+
* './config/**\/*.json',
|
|
1320
|
+
* ],
|
|
1321
|
+
* })
|
|
1322
|
+
* ```
|
|
1323
|
+
*/
|
|
1324
1324
|
watch?: string[];
|
|
1325
1325
|
/**
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1326
|
+
* Advanced watcher configuration.
|
|
1327
|
+
* Customize chokidar options for file watching.
|
|
1328
|
+
*
|
|
1329
|
+
* @example
|
|
1330
|
+
* ```ts
|
|
1331
|
+
* export default defineKmConfig({
|
|
1332
|
+
* watchers: {
|
|
1333
|
+
* chokidar: {
|
|
1334
|
+
* usePolling: true,
|
|
1335
|
+
* interval: 1000,
|
|
1336
|
+
* ignored: ['**\/.git/**'],
|
|
1337
|
+
* },
|
|
1338
|
+
* },
|
|
1339
|
+
* })
|
|
1340
|
+
* ```
|
|
1341
|
+
*/
|
|
1342
1342
|
watchers?: WatchersConfig;
|
|
1343
1343
|
/** Router configuration */
|
|
1344
1344
|
router?: {
|
|
@@ -1353,13 +1353,13 @@ interface KimeshConfig extends KimeshModuleOptions {
|
|
|
1353
1353
|
/** Layers configuration */
|
|
1354
1354
|
layers?: LayersConfig;
|
|
1355
1355
|
/**
|
|
1356
|
-
|
|
1357
|
-
|
|
1356
|
+
* Kimesh modules to load
|
|
1357
|
+
*/
|
|
1358
1358
|
modules?: KimeshModuleInput[];
|
|
1359
1359
|
/**
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1360
|
+
* App-level configuration
|
|
1361
|
+
* Includes head management and other app-wide settings
|
|
1362
|
+
*/
|
|
1363
1363
|
app?: AppConfig;
|
|
1364
1364
|
/** Routes configuration (for layers) */
|
|
1365
1365
|
routes?: {
|
|
@@ -1377,26 +1377,26 @@ interface KimeshConfig extends KimeshModuleOptions {
|
|
|
1377
1377
|
/** CSS files to include */
|
|
1378
1378
|
css?: string[];
|
|
1379
1379
|
/**
|
|
1380
|
-
|
|
1381
|
-
|
|
1380
|
+
* Vite configuration options.
|
|
1381
|
+
*/
|
|
1382
1382
|
vite?: KimeshViteConfig;
|
|
1383
1383
|
/**
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1384
|
+
* Runtime configuration with environment variable override support.
|
|
1385
|
+
*
|
|
1386
|
+
* In Phase 1, all config is client-side (build-time injection).
|
|
1387
|
+
* Use KIMESH_* environment variables to override values.
|
|
1388
|
+
*
|
|
1389
|
+
* @example
|
|
1390
|
+
* ```ts
|
|
1391
|
+
* runtimeConfig: {
|
|
1392
|
+
* apiBase: '/api', // KIMESH_API_BASE
|
|
1393
|
+
* debug: false, // KIMESH_DEBUG=true
|
|
1394
|
+
* features: {
|
|
1395
|
+
* darkMode: true, // KIMESH_FEATURES_DARK_MODE
|
|
1396
|
+
* }
|
|
1397
|
+
* }
|
|
1398
|
+
* ```
|
|
1399
|
+
*/
|
|
1400
1400
|
runtimeConfig?: RuntimeConfig;
|
|
1401
1401
|
}
|
|
1402
1402
|
/**
|
|
@@ -1784,6 +1784,60 @@ declare function generatePluginsTemplate(options: GeneratePluginsTemplateOptions
|
|
|
1784
1784
|
*/
|
|
1785
1785
|
declare function addPluginsTemplate(kimesh: Kimesh, discoveredPlugins: DiscoveredPlugin[]): void;
|
|
1786
1786
|
//#endregion
|
|
1787
|
+
//#region src/kit/internal-alias-template.d.ts
|
|
1788
|
+
/**
|
|
1789
|
+
* Configuration for an internal alias
|
|
1790
|
+
*/
|
|
1791
|
+
interface InternalAliasConfig {
|
|
1792
|
+
/** Alias specifier, e.g., '#kimesh/head/plugin' */
|
|
1793
|
+
alias: string;
|
|
1794
|
+
/** Package specifier to resolve, e.g., '@kimesh/head/plugin' */
|
|
1795
|
+
packageSpecifier: string;
|
|
1796
|
+
/** Generated template filename, e.g., 'head-plugin.mjs' */
|
|
1797
|
+
filename: string;
|
|
1798
|
+
}
|
|
1799
|
+
/**
|
|
1800
|
+
* Internal aliases that should be resolved via generated templates.
|
|
1801
|
+
*
|
|
1802
|
+
* Each entry maps an internal alias (#kimesh/...) to the actual internal
|
|
1803
|
+
* package subpath export (@kimesh/...) that should be resolved and re-exported.
|
|
1804
|
+
*/
|
|
1805
|
+
declare const INTERNAL_ALIASES: InternalAliasConfig[];
|
|
1806
|
+
/**
|
|
1807
|
+
* Generate the content for an internal alias template file.
|
|
1808
|
+
*
|
|
1809
|
+
* The generated file re-exports everything from the **resolved absolute path**,
|
|
1810
|
+
* not from a package specifier. This ensures the import works correctly even
|
|
1811
|
+
* when the package is a transitive dependency that can't be directly resolved
|
|
1812
|
+
* from the host app.
|
|
1813
|
+
*
|
|
1814
|
+
* @param config - The internal alias configuration
|
|
1815
|
+
* @param resolvedPath - The resolved absolute path to the module
|
|
1816
|
+
* @returns Generated template content
|
|
1817
|
+
*/
|
|
1818
|
+
declare function generateInternalAliasTemplate(config: InternalAliasConfig, resolvedPath: string): string;
|
|
1819
|
+
/**
|
|
1820
|
+
* Register internal alias templates with the Kimesh context.
|
|
1821
|
+
*
|
|
1822
|
+
* This function resolves the actual paths to @kimesh/* packages at build time
|
|
1823
|
+
* and generates templates that use those absolute paths. This ensures the
|
|
1824
|
+
* imports work correctly across all environments including PR preview packages.
|
|
1825
|
+
*
|
|
1826
|
+
* @param kimesh - The Kimesh context
|
|
1827
|
+
*/
|
|
1828
|
+
declare function addInternalAliasTemplates(kimesh: Kimesh): void;
|
|
1829
|
+
/**
|
|
1830
|
+
* Build a map of internal alias to generated template file path.
|
|
1831
|
+
*
|
|
1832
|
+
* This is used to configure Vite's resolve.alias so that imports
|
|
1833
|
+
* like '#kimesh/head/plugin' are resolved to the generated template
|
|
1834
|
+
* file in .kimesh/.
|
|
1835
|
+
*
|
|
1836
|
+
* @param buildDir - The .kimesh build directory path
|
|
1837
|
+
* @returns Record mapping alias to generated file path
|
|
1838
|
+
*/
|
|
1839
|
+
declare function buildInternalAliasMap(buildDir: string): Record<string, string>;
|
|
1840
|
+
//#endregion
|
|
1787
1841
|
//#region src/kit/alias-utils.d.ts
|
|
1788
1842
|
/**
|
|
1789
1843
|
* Resolve an alias path template to an actual path
|
|
@@ -1955,40 +2009,40 @@ declare function isDebug(category?: keyof DebugConfig): boolean;
|
|
|
1955
2009
|
*/
|
|
1956
2010
|
declare const debug: {
|
|
1957
2011
|
/**
|
|
1958
|
-
|
|
1959
|
-
|
|
2012
|
+
* Log debug message for hooks
|
|
2013
|
+
*/
|
|
1960
2014
|
hook(hookName: string, ...args: unknown[]): void;
|
|
1961
2015
|
/**
|
|
1962
|
-
|
|
1963
|
-
|
|
2016
|
+
* Log debug message for modules
|
|
2017
|
+
*/
|
|
1964
2018
|
module(moduleName: string, message: string, ...args: unknown[]): void;
|
|
1965
2019
|
/**
|
|
1966
|
-
|
|
1967
|
-
|
|
2020
|
+
* Log debug message for layers
|
|
2021
|
+
*/
|
|
1968
2022
|
layer(layerName: string, message: string, ...args: unknown[]): void;
|
|
1969
2023
|
/**
|
|
1970
|
-
|
|
1971
|
-
|
|
2024
|
+
* Log debug message for config
|
|
2025
|
+
*/
|
|
1972
2026
|
config(message: string, ...args: unknown[]): void;
|
|
1973
2027
|
/**
|
|
1974
|
-
|
|
1975
|
-
|
|
2028
|
+
* Log debug message for Vite
|
|
2029
|
+
*/
|
|
1976
2030
|
vite(message: string, ...args: unknown[]): void;
|
|
1977
2031
|
/**
|
|
1978
|
-
|
|
1979
|
-
|
|
2032
|
+
* Log debug message for routes
|
|
2033
|
+
*/
|
|
1980
2034
|
route(routePath: string, message: string, ...args: unknown[]): void;
|
|
1981
2035
|
/**
|
|
1982
|
-
|
|
1983
|
-
|
|
2036
|
+
* Log debug message for imports
|
|
2037
|
+
*/
|
|
1984
2038
|
import(name: string, message: string, ...args: unknown[]): void;
|
|
1985
2039
|
/**
|
|
1986
|
-
|
|
1987
|
-
|
|
2040
|
+
* Log timing information
|
|
2041
|
+
*/
|
|
1988
2042
|
timing(label: string, startTime: number): void;
|
|
1989
2043
|
/**
|
|
1990
|
-
|
|
1991
|
-
|
|
2044
|
+
* Create a timing tracker
|
|
2045
|
+
*/
|
|
1992
2046
|
startTiming(label: string): () => void;
|
|
1993
2047
|
};
|
|
1994
2048
|
/**
|
|
@@ -2248,9 +2302,9 @@ interface KimeshPluginOptions {
|
|
|
2248
2302
|
/** Enable debug logging */
|
|
2249
2303
|
debug?: boolean;
|
|
2250
2304
|
/**
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
additionalPlugins?:
|
|
2305
|
+
* Additional Vite plugins added programmatically.
|
|
2306
|
+
*/
|
|
2307
|
+
additionalPlugins?: vite3.PluginOption[];
|
|
2254
2308
|
}
|
|
2255
2309
|
//#endregion
|
|
2256
|
-
export { type AddRuntimePluginOptions, type AutoImportConfig, type AutoImportOptions, type ComponentsConfig, DEFAULT_ALIASES, DEFAULT_IGNORE_PATTERNS, type DebugConfig, type DiscoveredPlugin, type EnvOptions, type ErrorContext, type FormattedError, type GeneratePluginsTemplateOptions, type HMRContext, type HMRWatcherOptions, type HookResult, type IgnoreOptions, type ImportPreset, type ImportSource, type Kimesh, type KimeshAlias, type KimeshAppContext, type KimeshComponent, type KimeshComponentsDir, type KimeshConfig, type KimeshHooks, type KimeshImport, type KimeshImportPreset, type KimeshImportsDir, type KimeshLayerConfig, type KimeshModule, type KimeshModuleDefaults, type KimeshModuleDefinition, type KimeshModuleInput, type KimeshModuleMeta, type KimeshModuleOptions, type KimeshOptions, type KimeshPlugin, type KimeshPluginDefinition, KimeshPluginOptions, type KimeshRegistries, type KimeshResolver, type KimeshRoute, type KimeshRouteMiddleware, type KimeshRuntimeHooks, type KimeshRuntimePlugin, type KimeshRuntimePluginDefinition, type KimeshRuntimePluginEntry, type KimeshRuntimePluginMeta, type KimeshRuntimePluginResult, type KimeshTemplate, type KimeshTypeTemplate, type KimeshViteConfig, type KimeshVitePluginEntry, type LayerAutoImportConfig, type LayerComponentConfig, type LayerComposableConfig, type LayerRouteConfig, type LayersConfig, type LoadConfigOptions, type PrepareOptions, type PrepareResult, type ResolvedLayer, type ResolvedTemplate, type RouteRule, type RuntimeConfig, type RuntimeConfigPublic, type ScanPluginsOptions, type VitePlugin, type VitePluginOption, addAlias, addBuildPlugin, addComponent, addComponentResolver, addComponentsDir, addImports, addImportsDir, addImportsPreset, addPluginsTemplate, addRuntimePlugin, addTemplate, addTypeTemplate, addVitePlugin, applyEnv, buildAliases, buildImportRegistry, createDebugLogger, createDefaultRuntimeConfig, createHMRWatcher, createIgnoreFilter, createIgnoreMatcher, createKimesh, createResolver, createTimer, debug, debugTable, defineKimeshModule, defineKimeshPlugin, defineKmConfig, envToKey, executeModule, executeModules, filterIgnored, findMatchingRules, formatConflictWarning, formatError, formatTiming, formatWarning, generateDts, generateLayerAliases, generatePluginsTemplate, generateRouteRulesManifest, getIgnorePatterns, getRedirectInfo, getRouteRule, getRuntimePlugins, hasPlugins, hasRuntimePlugin, isDebug, isDebugEnabled, keyToEnv, kimeshAutoImport, kimeshPlugin, loadConfig, matchRoutePattern, mergeLayerConfigs, mergeRouteRules, normalizeDebugConfig, normalizeModuleInput, prepare, prepareLayers, removeRuntimePlugin, resolveAlias, resolveAliasPath, resolveLayers, resolvePathFromBuild, resolvePathFromRoot, scanExports, scanPluginsDir, setDebugConfig, shouldIgnore, toTsConfigPaths, toViteAliases, tryUseKimesh, updateTemplates, useKimesh, writeTemplates };
|
|
2310
|
+
export { type AddRuntimePluginOptions, type AutoImportConfig, type AutoImportOptions, type ComponentsConfig, DEFAULT_ALIASES, DEFAULT_IGNORE_PATTERNS, type DebugConfig, type DiscoveredPlugin, type EnvOptions, type ErrorContext, type FormattedError, type GeneratePluginsTemplateOptions, type HMRContext, type HMRWatcherOptions, type HookResult, INTERNAL_ALIASES, type IgnoreOptions, type ImportPreset, type ImportSource, type InternalAliasConfig, type Kimesh, type KimeshAlias, type KimeshAppContext, type KimeshComponent, type KimeshComponentsDir, type KimeshConfig, type KimeshHooks, type KimeshImport, type KimeshImportPreset, type KimeshImportsDir, type KimeshLayerConfig, type KimeshModule, type KimeshModuleDefaults, type KimeshModuleDefinition, type KimeshModuleInput, type KimeshModuleMeta, type KimeshModuleOptions, type KimeshOptions, type KimeshPlugin, type KimeshPluginDefinition, KimeshPluginOptions, type KimeshRegistries, type KimeshResolver, type KimeshRoute, type KimeshRouteMiddleware, type KimeshRuntimeHooks, type KimeshRuntimePlugin, type KimeshRuntimePluginDefinition, type KimeshRuntimePluginEntry, type KimeshRuntimePluginMeta, type KimeshRuntimePluginResult, type KimeshTemplate, type KimeshTypeTemplate, type KimeshViteConfig, type KimeshVitePluginEntry, type LayerAutoImportConfig, type LayerComponentConfig, type LayerComposableConfig, type LayerRouteConfig, type LayersConfig, type LoadConfigOptions, type PrepareOptions, type PrepareResult, type ResolvedLayer, type ResolvedTemplate, type RouteRule, type RuntimeConfig, type RuntimeConfigPublic, type ScanPluginsOptions, type VitePlugin, type VitePluginOption, addAlias, addBuildPlugin, addComponent, addComponentResolver, addComponentsDir, addImports, addImportsDir, addImportsPreset, addInternalAliasTemplates, addPluginsTemplate, addRuntimePlugin, addTemplate, addTypeTemplate, addVitePlugin, applyEnv, buildAliases, buildImportRegistry, buildInternalAliasMap, createDebugLogger, createDefaultRuntimeConfig, createHMRWatcher, createIgnoreFilter, createIgnoreMatcher, createKimesh, createResolver, createTimer, debug, debugTable, defineKimeshModule, defineKimeshPlugin, defineKmConfig, envToKey, executeModule, executeModules, filterIgnored, findMatchingRules, formatConflictWarning, formatError, formatTiming, formatWarning, generateDts, generateInternalAliasTemplate, generateLayerAliases, generatePluginsTemplate, generateRouteRulesManifest, getIgnorePatterns, getRedirectInfo, getRouteRule, getRuntimePlugins, hasPlugins, hasRuntimePlugin, isDebug, isDebugEnabled, keyToEnv, kimeshAutoImport, kimeshPlugin, loadConfig, matchRoutePattern, mergeLayerConfigs, mergeRouteRules, normalizeDebugConfig, normalizeModuleInput, prepare, prepareLayers, removeRuntimePlugin, resolveAlias, resolveAliasPath, resolveLayers, resolvePathFromBuild, resolvePathFromRoot, scanExports, scanPluginsDir, setDebugConfig, shouldIgnore, toTsConfigPaths, toViteAliases, tryUseKimesh, updateTemplates, useKimesh, writeTemplates };
|