@dtwo/schema 3.1.2 → 3.2.1
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/LICENSE +21 -21
- package/dist/index.d.ts +280 -38
- package/dist/index.mjs +44 -24
- package/package.json +12 -11
- package/schema/config.d.ts +27 -16
- package/schema/config.defaults.json +7 -5
- package/schema/config.md +27 -12
- package/schema/config.schema.json +72 -54
- package/README.md +0 -7
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 - Dtwo Team
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 - Dtwo Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { Ignore } from 'ignore';
|
|
|
7
7
|
import { TSConfig, readPackageJSON } from 'pkg-types';
|
|
8
8
|
import { Server } from 'node:http';
|
|
9
9
|
import { Server as Server$1 } from 'node:https';
|
|
10
|
-
import { InlineConfig,
|
|
10
|
+
import { InlineConfig, LahmDevServer, UserConfig, ServerOptions } from 'lahm';
|
|
11
11
|
import { Manifest } from 'kdu-bundle-renderer';
|
|
12
12
|
import { EventHandler } from 'h3';
|
|
13
13
|
import { Configuration, Compiler, Stats, WebpackError } from 'webpack';
|
|
@@ -23,10 +23,11 @@ import { BasePluginOptions as BasePluginOptions$1, DefinedDefaultMinimizerAndOpt
|
|
|
23
23
|
import { Options } from 'webpack-dev-middleware';
|
|
24
24
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
25
25
|
import { MiddlewareOptions, ClientOptions } from 'webpack-hot-middleware';
|
|
26
|
-
import { Options as Options$1 } from '@
|
|
26
|
+
import { Options as Options$1 } from '@lahmjs/plugin-kdu';
|
|
27
|
+
import { Options as Options$2 } from '@lahmjs/plugin-kdu-jsx';
|
|
27
28
|
import { MergeHead, Head } from '@kdhead/schema';
|
|
28
29
|
|
|
29
|
-
interface
|
|
30
|
+
interface LahmHot {
|
|
30
31
|
readonly data: any;
|
|
31
32
|
accept(): void;
|
|
32
33
|
accept(cb: (mod: any) => void): void;
|
|
@@ -38,18 +39,18 @@ interface WiteHot {
|
|
|
38
39
|
on(event: any, cb: (payload: any) => void): void;
|
|
39
40
|
send(event: any, data?: any): void;
|
|
40
41
|
}
|
|
41
|
-
interface
|
|
42
|
+
interface LahmGlobOptions {
|
|
42
43
|
as?: string;
|
|
43
44
|
eager?: boolean;
|
|
44
45
|
import?: string;
|
|
45
46
|
query?: string | Record<string, string | number | boolean>;
|
|
46
47
|
exhaustive?: boolean;
|
|
47
48
|
}
|
|
48
|
-
interface
|
|
49
|
-
/**
|
|
50
|
-
readonly hot?:
|
|
51
|
-
/**
|
|
52
|
-
glob(glob: string | string[], options?:
|
|
49
|
+
interface LahmImportMeta {
|
|
50
|
+
/** Lahm client HMR API - see https://lahmjs.web.app/guide/api-hmr.html */
|
|
51
|
+
readonly hot?: LahmHot;
|
|
52
|
+
/** lahm glob import utility - https://lahmjs.web.app/guide/features.html#glob-import */
|
|
53
|
+
glob(glob: string | string[], options?: LahmGlobOptions): Record<string, () => Promise<Record<string, any>>>;
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
/**
|
|
@@ -257,7 +258,7 @@ interface WebpackImportMeta {
|
|
|
257
258
|
webpack?: number;
|
|
258
259
|
}
|
|
259
260
|
|
|
260
|
-
type BundlerImportMeta =
|
|
261
|
+
type BundlerImportMeta = LahmImportMeta & WebpackImportMeta;
|
|
261
262
|
declare global {
|
|
262
263
|
interface ImportMeta extends BundlerImportMeta {
|
|
263
264
|
/** the `file:` url of the current file (similar to `__filename` but as file url) */
|
|
@@ -460,71 +461,286 @@ interface ImportPresetWithDeprecation extends InlinePreset {
|
|
|
460
461
|
interface GenerateAppOptions {
|
|
461
462
|
filter?: (template: ResolvedDtwoTemplate<any>) => boolean;
|
|
462
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* The listeners to Dtwo build time events
|
|
466
|
+
*/
|
|
463
467
|
interface DtwoHooks {
|
|
468
|
+
/**
|
|
469
|
+
* Allows extending compatibility checks.
|
|
470
|
+
* @param compatibility Compatibility object
|
|
471
|
+
* @param issues Issues to be mapped
|
|
472
|
+
* @returns Promise
|
|
473
|
+
*/
|
|
464
474
|
'kit:compatibility': (compatibility: DtwoCompatibility, issues: DtwoCompatibilityIssues) => HookResult;
|
|
475
|
+
/**
|
|
476
|
+
* Called after Dtwo initialization, when the Dtwo instance is ready to work.
|
|
477
|
+
* @param dtwo The configured Dtwo object
|
|
478
|
+
* @returns Promise
|
|
479
|
+
*/
|
|
465
480
|
'ready': (dtwo: Dtwo) => HookResult;
|
|
481
|
+
/**
|
|
482
|
+
* Called when Dtwo instance is gracefully closing.
|
|
483
|
+
* @param dtwo The configured Dtwo object
|
|
484
|
+
* @returns Promise
|
|
485
|
+
*/
|
|
466
486
|
'close': (dtwo: Dtwo) => HookResult;
|
|
487
|
+
/**
|
|
488
|
+
* Called during Dtwo initialization, before installing user modules.
|
|
489
|
+
* @returns Promise
|
|
490
|
+
*/
|
|
467
491
|
'modules:before': () => HookResult;
|
|
492
|
+
/**
|
|
493
|
+
* Called during Dtwo initialization, after installing user modules.
|
|
494
|
+
* @returns Promise
|
|
495
|
+
*/
|
|
468
496
|
'modules:done': () => HookResult;
|
|
497
|
+
/**
|
|
498
|
+
* Called after resolving the `app` instance.
|
|
499
|
+
* @param app The resolved `DtwoApp` object
|
|
500
|
+
* @returns Promise
|
|
501
|
+
*/
|
|
469
502
|
'app:resolve': (app: DtwoApp) => HookResult;
|
|
503
|
+
/**
|
|
504
|
+
* Called during `DtwoApp` generation, to allow customizing, modifying or adding new files to the build directory (either virtually or to written to `.dtwo`).
|
|
505
|
+
* @param app The configured `DtwoApp` object
|
|
506
|
+
* @returns Promise
|
|
507
|
+
*/
|
|
470
508
|
'app:templates': (app: DtwoApp) => HookResult;
|
|
509
|
+
/**
|
|
510
|
+
* Called after templates are compiled into the [virtual file system](https://dtwojs.web.app/docs/guide/directory-structure/dtwo#virtual-file-system) (vfs).
|
|
511
|
+
* @param app The configured `DtwoApp` object
|
|
512
|
+
* @returns Promise
|
|
513
|
+
*/
|
|
471
514
|
'app:templatesGenerated': (app: DtwoApp) => HookResult;
|
|
515
|
+
/**
|
|
516
|
+
* Called before Dtwo bundle builder.
|
|
517
|
+
* @returns Promise
|
|
518
|
+
*/
|
|
472
519
|
'build:before': () => HookResult;
|
|
520
|
+
/**
|
|
521
|
+
* Called after Dtwo bundle builder is complete.
|
|
522
|
+
* @returns Promise
|
|
523
|
+
*/
|
|
473
524
|
'build:done': () => HookResult;
|
|
525
|
+
/**
|
|
526
|
+
* Called during the manifest build by Lahm and Webpack. This allows customizing the manifest that Hole will use to render `<script>` and `<link>` tags in the final HTML.
|
|
527
|
+
* @param manifest The manifest object to build
|
|
528
|
+
* @returns Promise
|
|
529
|
+
*/
|
|
474
530
|
'build:manifest': (manifest: Manifest) => HookResult;
|
|
531
|
+
/**
|
|
532
|
+
* Called before generating the app.
|
|
533
|
+
* @param options GenerateAppOptions object
|
|
534
|
+
* @returns Promise
|
|
535
|
+
*/
|
|
475
536
|
'builder:generateApp': (options?: GenerateAppOptions) => HookResult;
|
|
537
|
+
/**
|
|
538
|
+
* Called at build time in development when the watcher spots a change to a file or directory in the project.
|
|
539
|
+
* @param event "add" | "addDir" | "change" | "unlink" | "unlinkDir"
|
|
540
|
+
* @param path the path to the watched file
|
|
541
|
+
* @returns Promise
|
|
542
|
+
*/
|
|
476
543
|
'builder:watch': (event: WatchEvent, path: string) => HookResult;
|
|
544
|
+
/**
|
|
545
|
+
* Called after pages routes are resolved.
|
|
546
|
+
* @param pages Array containing resolved pages
|
|
547
|
+
* @returns Promise
|
|
548
|
+
*/
|
|
477
549
|
'pages:extend': (pages: DtwoPage[]) => HookResult;
|
|
550
|
+
/**
|
|
551
|
+
* Called when the dev middleware is being registered on the Hole dev server.
|
|
552
|
+
* @param handler the Lahm or Webpack event handler
|
|
553
|
+
* @returns Promise
|
|
554
|
+
*/
|
|
478
555
|
'server:devHandler': (handler: EventHandler) => HookResult;
|
|
556
|
+
/**
|
|
557
|
+
* Called at setup allowing modules to extend sources.
|
|
558
|
+
* @param presets Array containing presets objects
|
|
559
|
+
* @returns Promise
|
|
560
|
+
*/
|
|
479
561
|
'imports:sources': (presets: ImportPresetWithDeprecation[]) => HookResult;
|
|
562
|
+
/**
|
|
563
|
+
* Called at setup allowing modules to extend imports.
|
|
564
|
+
* @param imports Array containing the imports to extend
|
|
565
|
+
* @returns Promise
|
|
566
|
+
*/
|
|
480
567
|
'imports:extend': (imports: Import[]) => HookResult;
|
|
568
|
+
/**
|
|
569
|
+
* Called when the `kdimport` context is created.
|
|
570
|
+
* @param context The Kdimport context
|
|
571
|
+
* @returns Promise
|
|
572
|
+
*/
|
|
481
573
|
'imports:context': (context: Kdimport) => HookResult;
|
|
574
|
+
/**
|
|
575
|
+
* Allows extending import directories.
|
|
576
|
+
* @param dirs Array containing directories as string
|
|
577
|
+
* @returns Promise
|
|
578
|
+
*/
|
|
482
579
|
'imports:dirs': (dirs: string[]) => HookResult;
|
|
580
|
+
/**
|
|
581
|
+
* Called within `app:resolve` allowing to extend the directories that are scanned for auto-importable components.
|
|
582
|
+
* @param dirs The `dirs` option to push new items
|
|
583
|
+
* @returns Promise
|
|
584
|
+
*/
|
|
483
585
|
'components:dirs': (dirs: ComponentsOptions['dirs']) => HookResult;
|
|
586
|
+
/**
|
|
587
|
+
* Allows extending new components.
|
|
588
|
+
* @param components The `components` array to push new items
|
|
589
|
+
* @returns Promise
|
|
590
|
+
*/
|
|
484
591
|
'components:extend': (components: Component[]) => HookResult;
|
|
592
|
+
/**
|
|
593
|
+
* Called before initializing Hole, allowing customization of Hole's configuration.
|
|
594
|
+
* @param holeConfig The hole config to be extended
|
|
595
|
+
* @returns Promise
|
|
596
|
+
*/
|
|
485
597
|
'hole:config': (holeConfig: HoleConfig) => HookResult;
|
|
598
|
+
/**
|
|
599
|
+
* Called after Hole is initialized, which allows registering Hole hooks and interacting directly with Hole.
|
|
600
|
+
* @param hole The created hole object
|
|
601
|
+
* @returns Promise
|
|
602
|
+
*/
|
|
486
603
|
'hole:init': (hole: Hole) => HookResult;
|
|
604
|
+
/**
|
|
605
|
+
* Called before building the Hole instance.
|
|
606
|
+
* @param hole The created hole object
|
|
607
|
+
* @returns Promise
|
|
608
|
+
*/
|
|
487
609
|
'hole:build:before': (hole: Hole) => HookResult;
|
|
610
|
+
/**
|
|
611
|
+
* Allows extending the routes to be pre-rendered.
|
|
612
|
+
* @param ctx Dtwo context
|
|
613
|
+
* @returns Promise
|
|
614
|
+
*/
|
|
488
615
|
'prerender:routes': (ctx: {
|
|
489
616
|
routes: Set<string>;
|
|
490
617
|
}) => HookResult;
|
|
618
|
+
/**
|
|
619
|
+
* Called when an error occurs at build time.
|
|
620
|
+
* @param error Error object
|
|
621
|
+
* @returns Promise
|
|
622
|
+
*/
|
|
491
623
|
'build:error': (error: Error) => HookResult;
|
|
624
|
+
/**
|
|
625
|
+
* Called before Dtwc writes `.dtwo/tsconfig.json` and `.dtwo/dtwo.d.ts`, allowing addition of custom references and declarations in `dtwo.d.ts`, or directly modifying the options in `tsconfig.json`
|
|
626
|
+
* @param options Objects containing `references`, `declarations`, `tsConfig`
|
|
627
|
+
* @returns Promise
|
|
628
|
+
*/
|
|
492
629
|
'prepare:types': (options: {
|
|
493
630
|
references: TSReference[];
|
|
494
631
|
declarations: string[];
|
|
495
632
|
tsConfig: TSConfig;
|
|
496
633
|
}) => HookResult;
|
|
634
|
+
/**
|
|
635
|
+
* Called when the dev server is loading.
|
|
636
|
+
* @param listenerServer The HTTP/HTTPS server object
|
|
637
|
+
* @param listener The server's listener object
|
|
638
|
+
* @returns Promise
|
|
639
|
+
*/
|
|
497
640
|
'listen': (listenerServer: Server | Server$1, listener: any) => HookResult;
|
|
641
|
+
/**
|
|
642
|
+
* Allows extending default schemas.
|
|
643
|
+
* @param schemas Schemas to be extend
|
|
644
|
+
* @returns void
|
|
645
|
+
*/
|
|
498
646
|
'schema:extend': (schemas: SchemaDefinition[]) => void;
|
|
647
|
+
/**
|
|
648
|
+
* Allows extending resolved schema.
|
|
649
|
+
* @param schema Schema object
|
|
650
|
+
* @returns void
|
|
651
|
+
*/
|
|
499
652
|
'schema:resolved': (schema: Schema) => void;
|
|
653
|
+
/**
|
|
654
|
+
* Called before writing the given schema.
|
|
655
|
+
* @param schema Schema object
|
|
656
|
+
* @returns void
|
|
657
|
+
*/
|
|
500
658
|
'schema:beforeWrite': (schema: Schema) => void;
|
|
659
|
+
/**
|
|
660
|
+
* Called after the schema is written.
|
|
661
|
+
* @returns void
|
|
662
|
+
*/
|
|
501
663
|
'schema:written': () => void;
|
|
502
|
-
|
|
664
|
+
/**
|
|
665
|
+
* Allows to extend Lahm default context.
|
|
666
|
+
* @param lahmBuildContext The lahm build context object
|
|
667
|
+
* @returns Promise
|
|
668
|
+
*/
|
|
669
|
+
'lahm:extend': (lahmBuildContext: {
|
|
503
670
|
dtwo: Dtwo;
|
|
504
671
|
config: InlineConfig;
|
|
505
672
|
}) => HookResult;
|
|
506
|
-
|
|
673
|
+
/**
|
|
674
|
+
* Allows to extend Lahm default config.
|
|
675
|
+
* @param lahmInlineConfig The lahm inline config object
|
|
676
|
+
* @param env Server or client
|
|
677
|
+
* @returns Promise
|
|
678
|
+
*/
|
|
679
|
+
'lahm:extendConfig': (lahmInlineConfig: InlineConfig, env: {
|
|
507
680
|
isClient: boolean;
|
|
508
681
|
isServer: boolean;
|
|
509
682
|
}) => HookResult;
|
|
510
|
-
|
|
683
|
+
/**
|
|
684
|
+
* Called when the Lahm server is created.
|
|
685
|
+
* @param lahmServer Lahm development server
|
|
686
|
+
* @param env Server or client
|
|
687
|
+
* @returns Promise
|
|
688
|
+
*/
|
|
689
|
+
'lahm:serverCreated': (lahmServer: LahmDevServer, env: {
|
|
511
690
|
isClient: boolean;
|
|
512
691
|
isServer: boolean;
|
|
513
692
|
}) => HookResult;
|
|
514
|
-
|
|
693
|
+
/**
|
|
694
|
+
* Called after Lahm server is compiled.
|
|
695
|
+
* @returns Promise
|
|
696
|
+
*/
|
|
697
|
+
'lahm:compiled': () => HookResult;
|
|
698
|
+
/**
|
|
699
|
+
* Called before configuring the webpack compiler.
|
|
700
|
+
* @param webpackConfigs Configs objects to be pushed to the compiler
|
|
701
|
+
* @returns Promise
|
|
702
|
+
*/
|
|
515
703
|
'webpack:config': (webpackConfigs: Configuration[]) => HookResult;
|
|
704
|
+
/**
|
|
705
|
+
* Called right before compilation.
|
|
706
|
+
* @param options The options to be added
|
|
707
|
+
* @returns Promise
|
|
708
|
+
*/
|
|
516
709
|
'webpack:compile': (options: {
|
|
517
710
|
name: string;
|
|
518
711
|
compiler: Compiler;
|
|
519
712
|
}) => HookResult;
|
|
713
|
+
/**
|
|
714
|
+
* Called after resources are loaded.
|
|
715
|
+
* @param options The compiler options
|
|
716
|
+
* @returns Promise
|
|
717
|
+
*/
|
|
520
718
|
'webpack:compiled': (options: {
|
|
521
719
|
name: string;
|
|
522
720
|
compiler: Compiler;
|
|
523
721
|
stats: Stats;
|
|
524
722
|
}) => HookResult;
|
|
723
|
+
/**
|
|
724
|
+
* Called on `change` on WebpackBar.
|
|
725
|
+
* @param shortPath the short path
|
|
726
|
+
* @returns void
|
|
727
|
+
*/
|
|
525
728
|
'webpack:change': (shortPath: string) => void;
|
|
729
|
+
/**
|
|
730
|
+
* Called on `done` if has errors on WebpackBar.
|
|
731
|
+
* @returns void
|
|
732
|
+
*/
|
|
526
733
|
'webpack:error': () => void;
|
|
734
|
+
/**
|
|
735
|
+
* Called on `allDone` on WebpackBar.
|
|
736
|
+
* @returns void
|
|
737
|
+
*/
|
|
527
738
|
'webpack:done': () => void;
|
|
739
|
+
/**
|
|
740
|
+
* Called on `progress` on WebpackBar.
|
|
741
|
+
* @param statesArray The array containing the states on progress
|
|
742
|
+
* @returns void
|
|
743
|
+
*/
|
|
528
744
|
'webpack:progress': (statesArray: any[]) => void;
|
|
529
745
|
}
|
|
530
746
|
type DtwoHookName = keyof DtwoHooks;
|
|
@@ -836,9 +1052,9 @@ interface ConfigSchema {
|
|
|
836
1052
|
/**
|
|
837
1053
|
* The builder to use for bundling the Kdu part of your application.
|
|
838
1054
|
*
|
|
839
|
-
* @default "@dtwo/
|
|
1055
|
+
* @default "@dtwo/lahm-builder"
|
|
840
1056
|
*/
|
|
841
|
-
builder: '
|
|
1057
|
+
builder: 'lahm' | 'webpack' | { bundle: (dtwo: Dtwo) => Promise<void> },
|
|
842
1058
|
|
|
843
1059
|
/**
|
|
844
1060
|
* Whether to generate sourcemaps.
|
|
@@ -889,7 +1105,7 @@ interface ConfigSchema {
|
|
|
889
1105
|
/**
|
|
890
1106
|
* Dtwo uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them.
|
|
891
1107
|
*
|
|
892
|
-
* Set to `true` to enable bundle analysis, or pass an object with options: [for webpack](https://github.com/webpack-contrib/webpack-bundle-analyzer#options-for-plugin) or [for
|
|
1108
|
+
* Set to `true` to enable bundle analysis, or pass an object with options: [for webpack](https://github.com/webpack-contrib/webpack-bundle-analyzer#options-for-plugin) or [for lahm](https://github.com/btd/rollup-plugin-visualizer#options).
|
|
893
1109
|
*
|
|
894
1110
|
* @default false
|
|
895
1111
|
*
|
|
@@ -1043,7 +1259,7 @@ interface ConfigSchema {
|
|
|
1043
1259
|
debug: boolean,
|
|
1044
1260
|
|
|
1045
1261
|
/**
|
|
1046
|
-
* Whether to enable rendering of HTML - either dynamically (in server mode) or at generate time. If set to `false`
|
|
1262
|
+
* Whether to enable rendering of HTML - either dynamically (in server mode) or at generate time. If set to `false` generated pages will have no content.
|
|
1047
1263
|
*
|
|
1048
1264
|
* @default true
|
|
1049
1265
|
*/
|
|
@@ -1335,12 +1551,14 @@ interface ConfigSchema {
|
|
|
1335
1551
|
/**
|
|
1336
1552
|
* Dev server listening host
|
|
1337
1553
|
*
|
|
1338
|
-
* @default "
|
|
1554
|
+
* @default ""
|
|
1339
1555
|
*/
|
|
1340
1556
|
host: string,
|
|
1341
1557
|
|
|
1342
1558
|
/**
|
|
1343
|
-
* Listening dev server
|
|
1559
|
+
* Listening dev server URL.
|
|
1560
|
+
*
|
|
1561
|
+
* This should not be set directly as it will always be overridden by the dev server with the full URL (for module and internal use).
|
|
1344
1562
|
*
|
|
1345
1563
|
* @default "http://localhost:3000"
|
|
1346
1564
|
*/
|
|
@@ -1379,23 +1597,32 @@ interface ConfigSchema {
|
|
|
1379
1597
|
treeshakeClientOnly: boolean,
|
|
1380
1598
|
|
|
1381
1599
|
/**
|
|
1382
|
-
*
|
|
1600
|
+
* Emit `app:chunkError` hook when there is an error loading lahm/webpack chunks.
|
|
1601
|
+
*
|
|
1602
|
+
* You can set this to `reload` to perform a hard reload of the new route when a chunk fails to load when navigating to a new route.
|
|
1603
|
+
*
|
|
1604
|
+
* @default false
|
|
1605
|
+
*/
|
|
1606
|
+
emitRouteChunkError: boolean | 'reload',
|
|
1607
|
+
|
|
1608
|
+
/**
|
|
1609
|
+
* Use lahm-node for on-demand server chunk loading
|
|
1383
1610
|
*
|
|
1384
1611
|
* @default true
|
|
1385
1612
|
*
|
|
1386
|
-
* @deprecated use `
|
|
1613
|
+
* @deprecated use `lahm.devBundler: 'lahm-node'`
|
|
1387
1614
|
*/
|
|
1388
|
-
|
|
1615
|
+
lahmNode: boolean,
|
|
1389
1616
|
|
|
1390
1617
|
/**
|
|
1391
1618
|
* Split server bundle into multiple chunks and dynamically import them.
|
|
1392
1619
|
*
|
|
1393
1620
|
* @default true
|
|
1394
1621
|
*/
|
|
1395
|
-
|
|
1622
|
+
lahmServerDynamicImports: boolean,
|
|
1396
1623
|
|
|
1397
1624
|
/**
|
|
1398
|
-
* Inline styles when rendering HTML (currently
|
|
1625
|
+
* Inline styles when rendering HTML (currently lahm only).
|
|
1399
1626
|
*
|
|
1400
1627
|
* You can also pass a function that receives the path of a Kdu component and returns a boolean indicating whether to inline the styles for that component.
|
|
1401
1628
|
*
|
|
@@ -1671,18 +1898,18 @@ interface ConfigSchema {
|
|
|
1671
1898
|
},
|
|
1672
1899
|
|
|
1673
1900
|
/**
|
|
1674
|
-
* Configuration that will be passed directly to
|
|
1901
|
+
* Configuration that will be passed directly to Lahm.
|
|
1675
1902
|
*
|
|
1676
|
-
* See https://
|
|
1903
|
+
* See https://lahmjs.web.app/config for more information. Please note that not all lahm options are supported in Dtwo.
|
|
1677
1904
|
*
|
|
1678
1905
|
*/
|
|
1679
|
-
|
|
1906
|
+
lahm: LahmConfig,
|
|
1680
1907
|
|
|
1681
1908
|
webpack: {
|
|
1682
1909
|
/**
|
|
1683
1910
|
* Dtwo uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them.
|
|
1684
1911
|
*
|
|
1685
|
-
* Set to `true` to enable bundle analysis, or pass an object with options: [for webpack](https://github.com/webpack-contrib/webpack-bundle-analyzer#options-for-plugin) or [for
|
|
1912
|
+
* Set to `true` to enable bundle analysis, or pass an object with options: [for webpack](https://github.com/webpack-contrib/webpack-bundle-analyzer#options-for-plugin) or [for lahm](https://github.com/btd/rollup-plugin-visualizer#options).
|
|
1686
1913
|
*
|
|
1687
1914
|
* @default false
|
|
1688
1915
|
*
|
|
@@ -2035,9 +2262,20 @@ type AppHeadMetaObject = MetaObjectRaw & {
|
|
|
2035
2262
|
type DeepPartial<T> = T extends Function ? T : T extends Record<string, any> ? {
|
|
2036
2263
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
2037
2264
|
} : T;
|
|
2265
|
+
type ExtractUpperChunk<T extends string> = T extends `${infer A}${infer B}` ? A extends Uppercase<A> ? B extends `${Uppercase<string>}${infer Rest}` ? B extends `${infer C}${Rest}` ? `${A}${C}${ExtractUpperChunk<Rest>}` : never : A : '' : never;
|
|
2266
|
+
type SliceLast<T extends string> = T extends `${infer A}${infer B}` ? B extends `${infer C}${infer D}` ? D extends '' ? A : `${A}${C}${SliceLast<D>}` : '' : never;
|
|
2267
|
+
type UpperSnakeCase<T extends string, State extends 'start' | 'lower' | 'upper' = 'start'> = T extends `${infer A}${infer B}` ? A extends Uppercase<A> ? A extends `${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0}` ? `${A}${UpperSnakeCase<B, 'lower'>}` : State extends 'lower' | 'upper' ? B extends `${SliceLast<ExtractUpperChunk<B>>}${infer Rest}` ? SliceLast<ExtractUpperChunk<B>> extends '' ? `_${A}_${UpperSnakeCase<B, 'start'>}` : `_${A}${SliceLast<ExtractUpperChunk<B>>}_${UpperSnakeCase<Rest, 'start'>}` : B extends Uppercase<B> ? `_${A}${B}` : `_${A}${UpperSnakeCase<B, 'lower'>}` : State extends 'start' ? `${A}${UpperSnakeCase<B, 'lower'>}` : never : State extends 'start' | 'lower' ? `${Uppercase<A>}${UpperSnakeCase<B, 'lower'>}` : `_${Uppercase<A>}${UpperSnakeCase<B, 'lower'>}` : Uppercase<T>;
|
|
2268
|
+
declare const message: unique symbol;
|
|
2269
|
+
type RuntimeValue<T, B extends string> = T & {
|
|
2270
|
+
[message]?: B;
|
|
2271
|
+
};
|
|
2272
|
+
type Overrideable<T extends Record<string, any>, Path extends string = ''> = {
|
|
2273
|
+
[K in keyof T]?: K extends string ? T[K] extends Record<string, any> ? RuntimeValue<Overrideable<T[K], `${Path}_${UpperSnakeCase<K>}`>, `You can override this value at runtime with DTWO${Path}_${UpperSnakeCase<K>}`> : RuntimeValue<T[K], `You can override this value at runtime with DTWO${Path}_${UpperSnakeCase<K>}`> : K extends number ? T[K] : never;
|
|
2274
|
+
};
|
|
2038
2275
|
/** User configuration in `dtwo.config` file */
|
|
2039
|
-
interface DtwoConfig extends DeepPartial<Omit<ConfigSchema, '
|
|
2040
|
-
|
|
2276
|
+
interface DtwoConfig extends DeepPartial<Omit<ConfigSchema, 'lahm' | 'runtimeConfig'>> {
|
|
2277
|
+
lahm?: ConfigSchema['lahm'];
|
|
2278
|
+
runtimeConfig?: Overrideable<RuntimeConfig>;
|
|
2041
2279
|
/**
|
|
2042
2280
|
* Experimental custom config schema
|
|
2043
2281
|
*/
|
|
@@ -2055,24 +2293,28 @@ type DtwoConfigLayer = ConfigLayer<DtwoConfig & {
|
|
|
2055
2293
|
/** Normalized Dtwo options available as `dtwo.options.*` */
|
|
2056
2294
|
interface DtwoOptions extends Omit<ConfigSchema, 'builder'> {
|
|
2057
2295
|
sourcemap: Required<Exclude<ConfigSchema['sourcemap'], boolean>>;
|
|
2058
|
-
builder: '@dtwo/
|
|
2296
|
+
builder: '@dtwo/lahm-builder' | '@dtwo/webpack-builder' | {
|
|
2059
2297
|
bundle: (dtwo: Dtwo) => Promise<void>;
|
|
2060
2298
|
};
|
|
2061
2299
|
_layers: DtwoConfigLayer[];
|
|
2062
2300
|
$schema: SchemaDefinition;
|
|
2063
2301
|
}
|
|
2064
|
-
interface
|
|
2302
|
+
interface LahmConfig extends UserConfig {
|
|
2065
2303
|
/**
|
|
2066
|
-
* Options passed to @
|
|
2304
|
+
* Options passed to @lahmjs/plugin-kdu
|
|
2067
2305
|
*/
|
|
2068
2306
|
kdu?: Options$1;
|
|
2307
|
+
/**
|
|
2308
|
+
* Options passed to @lahmjs/plugin-kdu-jsx
|
|
2309
|
+
*/
|
|
2310
|
+
kduJsx?: Options$2;
|
|
2069
2311
|
/**
|
|
2070
2312
|
* Bundler for dev time server-side rendering.
|
|
2071
|
-
* @default '
|
|
2313
|
+
* @default 'lahm-node'
|
|
2072
2314
|
*/
|
|
2073
|
-
devBundler?: '
|
|
2315
|
+
devBundler?: 'lahm-node' | 'legacy';
|
|
2074
2316
|
/**
|
|
2075
|
-
* Warmup
|
|
2317
|
+
* Warmup lahm entrypoint caches on dev startup.
|
|
2076
2318
|
*/
|
|
2077
2319
|
warmupEntry?: boolean;
|
|
2078
2320
|
/**
|
|
@@ -2109,4 +2351,4 @@ declare const _default: {
|
|
|
2109
2351
|
[x: string]: untyped.SchemaDefinition | untyped.JSValue | untyped.InputObject;
|
|
2110
2352
|
};
|
|
2111
2353
|
|
|
2112
|
-
export { AppConfig, AppConfigInput, AppHeadMetaObject, Component, ComponentsDir, ComponentsOptions, Dtwo, DtwoApp, DtwoAppConfig, DtwoCompatibility, DtwoCompatibilityIssue, DtwoCompatibilityIssues, DtwoConfig, DtwoConfigLayer, _default as DtwoConfigSchema, DtwoHookName, DtwoHooks, DtwoLayout, DtwoMiddleware, DtwoModule, DtwoOptions, DtwoPage, DtwoPlugin, DtwoPluginTemplate, DtwoTemplate, GenerateAppOptions, HeadAugmentations, HookResult, ImportPresetWithDeprecation, ImportsOptions, MetaObject, MetaObjectRaw, ModuleDefinition, ModuleMeta, ModuleOptions, PublicRuntimeConfig, ResolvedDtwoTemplate, RouterConfig, RouterConfigSerializable, RouterOptions, RuntimeConfig, ScanDir, TSReference, WatchEvent
|
|
2354
|
+
export { AppConfig, AppConfigInput, AppHeadMetaObject, Component, ComponentsDir, ComponentsOptions, Dtwo, DtwoApp, DtwoAppConfig, DtwoCompatibility, DtwoCompatibilityIssue, DtwoCompatibilityIssues, DtwoConfig, DtwoConfigLayer, _default as DtwoConfigSchema, DtwoHookName, DtwoHooks, DtwoLayout, DtwoMiddleware, DtwoModule, DtwoOptions, DtwoPage, DtwoPlugin, DtwoPluginTemplate, DtwoTemplate, GenerateAppOptions, HeadAugmentations, HookResult, ImportPresetWithDeprecation, ImportsOptions, LahmConfig, MetaObject, MetaObjectRaw, ModuleDefinition, ModuleMeta, ModuleOptions, PublicRuntimeConfig, ResolvedDtwoTemplate, RouterConfig, RouterConfigSerializable, RouterOptions, RuntimeConfig, RuntimeValue, ScanDir, TSReference, WatchEvent };
|