@dtwo/schema 3.2.0 → 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 +64 -48
- package/dist/index.mjs +44 -24
- package/package.json +11 -10
- 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) */
|
|
@@ -522,7 +523,7 @@ interface DtwoHooks {
|
|
|
522
523
|
*/
|
|
523
524
|
'build:done': () => HookResult;
|
|
524
525
|
/**
|
|
525
|
-
* Called during the manifest build by
|
|
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.
|
|
526
527
|
* @param manifest The manifest object to build
|
|
527
528
|
* @returns Promise
|
|
528
529
|
*/
|
|
@@ -548,7 +549,7 @@ interface DtwoHooks {
|
|
|
548
549
|
'pages:extend': (pages: DtwoPage[]) => HookResult;
|
|
549
550
|
/**
|
|
550
551
|
* Called when the dev middleware is being registered on the Hole dev server.
|
|
551
|
-
* @param handler the
|
|
552
|
+
* @param handler the Lahm or Webpack event handler
|
|
552
553
|
* @returns Promise
|
|
553
554
|
*/
|
|
554
555
|
'server:devHandler': (handler: EventHandler) => HookResult;
|
|
@@ -661,39 +662,39 @@ interface DtwoHooks {
|
|
|
661
662
|
*/
|
|
662
663
|
'schema:written': () => void;
|
|
663
664
|
/**
|
|
664
|
-
* Allows to extend
|
|
665
|
-
* @param
|
|
665
|
+
* Allows to extend Lahm default context.
|
|
666
|
+
* @param lahmBuildContext The lahm build context object
|
|
666
667
|
* @returns Promise
|
|
667
668
|
*/
|
|
668
|
-
'
|
|
669
|
+
'lahm:extend': (lahmBuildContext: {
|
|
669
670
|
dtwo: Dtwo;
|
|
670
671
|
config: InlineConfig;
|
|
671
672
|
}) => HookResult;
|
|
672
673
|
/**
|
|
673
|
-
* Allows to extend
|
|
674
|
-
* @param
|
|
674
|
+
* Allows to extend Lahm default config.
|
|
675
|
+
* @param lahmInlineConfig The lahm inline config object
|
|
675
676
|
* @param env Server or client
|
|
676
677
|
* @returns Promise
|
|
677
678
|
*/
|
|
678
|
-
'
|
|
679
|
+
'lahm:extendConfig': (lahmInlineConfig: InlineConfig, env: {
|
|
679
680
|
isClient: boolean;
|
|
680
681
|
isServer: boolean;
|
|
681
682
|
}) => HookResult;
|
|
682
683
|
/**
|
|
683
|
-
* Called when the
|
|
684
|
-
* @param
|
|
684
|
+
* Called when the Lahm server is created.
|
|
685
|
+
* @param lahmServer Lahm development server
|
|
685
686
|
* @param env Server or client
|
|
686
687
|
* @returns Promise
|
|
687
688
|
*/
|
|
688
|
-
'
|
|
689
|
+
'lahm:serverCreated': (lahmServer: LahmDevServer, env: {
|
|
689
690
|
isClient: boolean;
|
|
690
691
|
isServer: boolean;
|
|
691
692
|
}) => HookResult;
|
|
692
693
|
/**
|
|
693
|
-
* Called after
|
|
694
|
+
* Called after Lahm server is compiled.
|
|
694
695
|
* @returns Promise
|
|
695
696
|
*/
|
|
696
|
-
'
|
|
697
|
+
'lahm:compiled': () => HookResult;
|
|
697
698
|
/**
|
|
698
699
|
* Called before configuring the webpack compiler.
|
|
699
700
|
* @param webpackConfigs Configs objects to be pushed to the compiler
|
|
@@ -1051,9 +1052,9 @@ interface ConfigSchema {
|
|
|
1051
1052
|
/**
|
|
1052
1053
|
* The builder to use for bundling the Kdu part of your application.
|
|
1053
1054
|
*
|
|
1054
|
-
* @default "@dtwo/
|
|
1055
|
+
* @default "@dtwo/lahm-builder"
|
|
1055
1056
|
*/
|
|
1056
|
-
builder: '
|
|
1057
|
+
builder: 'lahm' | 'webpack' | { bundle: (dtwo: Dtwo) => Promise<void> },
|
|
1057
1058
|
|
|
1058
1059
|
/**
|
|
1059
1060
|
* Whether to generate sourcemaps.
|
|
@@ -1104,7 +1105,7 @@ interface ConfigSchema {
|
|
|
1104
1105
|
/**
|
|
1105
1106
|
* Dtwo uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them.
|
|
1106
1107
|
*
|
|
1107
|
-
* 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).
|
|
1108
1109
|
*
|
|
1109
1110
|
* @default false
|
|
1110
1111
|
*
|
|
@@ -1258,7 +1259,7 @@ interface ConfigSchema {
|
|
|
1258
1259
|
debug: boolean,
|
|
1259
1260
|
|
|
1260
1261
|
/**
|
|
1261
|
-
* 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.
|
|
1262
1263
|
*
|
|
1263
1264
|
* @default true
|
|
1264
1265
|
*/
|
|
@@ -1550,12 +1551,14 @@ interface ConfigSchema {
|
|
|
1550
1551
|
/**
|
|
1551
1552
|
* Dev server listening host
|
|
1552
1553
|
*
|
|
1553
|
-
* @default "
|
|
1554
|
+
* @default ""
|
|
1554
1555
|
*/
|
|
1555
1556
|
host: string,
|
|
1556
1557
|
|
|
1557
1558
|
/**
|
|
1558
|
-
* 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).
|
|
1559
1562
|
*
|
|
1560
1563
|
* @default "http://localhost:3000"
|
|
1561
1564
|
*/
|
|
@@ -1594,23 +1597,32 @@ interface ConfigSchema {
|
|
|
1594
1597
|
treeshakeClientOnly: boolean,
|
|
1595
1598
|
|
|
1596
1599
|
/**
|
|
1597
|
-
*
|
|
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
|
|
1598
1610
|
*
|
|
1599
1611
|
* @default true
|
|
1600
1612
|
*
|
|
1601
|
-
* @deprecated use `
|
|
1613
|
+
* @deprecated use `lahm.devBundler: 'lahm-node'`
|
|
1602
1614
|
*/
|
|
1603
|
-
|
|
1615
|
+
lahmNode: boolean,
|
|
1604
1616
|
|
|
1605
1617
|
/**
|
|
1606
1618
|
* Split server bundle into multiple chunks and dynamically import them.
|
|
1607
1619
|
*
|
|
1608
1620
|
* @default true
|
|
1609
1621
|
*/
|
|
1610
|
-
|
|
1622
|
+
lahmServerDynamicImports: boolean,
|
|
1611
1623
|
|
|
1612
1624
|
/**
|
|
1613
|
-
* Inline styles when rendering HTML (currently
|
|
1625
|
+
* Inline styles when rendering HTML (currently lahm only).
|
|
1614
1626
|
*
|
|
1615
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.
|
|
1616
1628
|
*
|
|
@@ -1886,18 +1898,18 @@ interface ConfigSchema {
|
|
|
1886
1898
|
},
|
|
1887
1899
|
|
|
1888
1900
|
/**
|
|
1889
|
-
* Configuration that will be passed directly to
|
|
1901
|
+
* Configuration that will be passed directly to Lahm.
|
|
1890
1902
|
*
|
|
1891
|
-
* See https://
|
|
1903
|
+
* See https://lahmjs.web.app/config for more information. Please note that not all lahm options are supported in Dtwo.
|
|
1892
1904
|
*
|
|
1893
1905
|
*/
|
|
1894
|
-
|
|
1906
|
+
lahm: LahmConfig,
|
|
1895
1907
|
|
|
1896
1908
|
webpack: {
|
|
1897
1909
|
/**
|
|
1898
1910
|
* Dtwo uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them.
|
|
1899
1911
|
*
|
|
1900
|
-
* 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).
|
|
1901
1913
|
*
|
|
1902
1914
|
* @default false
|
|
1903
1915
|
*
|
|
@@ -2258,11 +2270,11 @@ type RuntimeValue<T, B extends string> = T & {
|
|
|
2258
2270
|
[message]?: B;
|
|
2259
2271
|
};
|
|
2260
2272
|
type Overrideable<T extends Record<string, any>, Path extends string = ''> = {
|
|
2261
|
-
[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>}`> : never;
|
|
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;
|
|
2262
2274
|
};
|
|
2263
2275
|
/** User configuration in `dtwo.config` file */
|
|
2264
|
-
interface DtwoConfig extends DeepPartial<Omit<ConfigSchema, '
|
|
2265
|
-
|
|
2276
|
+
interface DtwoConfig extends DeepPartial<Omit<ConfigSchema, 'lahm' | 'runtimeConfig'>> {
|
|
2277
|
+
lahm?: ConfigSchema['lahm'];
|
|
2266
2278
|
runtimeConfig?: Overrideable<RuntimeConfig>;
|
|
2267
2279
|
/**
|
|
2268
2280
|
* Experimental custom config schema
|
|
@@ -2281,24 +2293,28 @@ type DtwoConfigLayer = ConfigLayer<DtwoConfig & {
|
|
|
2281
2293
|
/** Normalized Dtwo options available as `dtwo.options.*` */
|
|
2282
2294
|
interface DtwoOptions extends Omit<ConfigSchema, 'builder'> {
|
|
2283
2295
|
sourcemap: Required<Exclude<ConfigSchema['sourcemap'], boolean>>;
|
|
2284
|
-
builder: '@dtwo/
|
|
2296
|
+
builder: '@dtwo/lahm-builder' | '@dtwo/webpack-builder' | {
|
|
2285
2297
|
bundle: (dtwo: Dtwo) => Promise<void>;
|
|
2286
2298
|
};
|
|
2287
2299
|
_layers: DtwoConfigLayer[];
|
|
2288
2300
|
$schema: SchemaDefinition;
|
|
2289
2301
|
}
|
|
2290
|
-
interface
|
|
2302
|
+
interface LahmConfig extends UserConfig {
|
|
2291
2303
|
/**
|
|
2292
|
-
* Options passed to @
|
|
2304
|
+
* Options passed to @lahmjs/plugin-kdu
|
|
2293
2305
|
*/
|
|
2294
2306
|
kdu?: Options$1;
|
|
2307
|
+
/**
|
|
2308
|
+
* Options passed to @lahmjs/plugin-kdu-jsx
|
|
2309
|
+
*/
|
|
2310
|
+
kduJsx?: Options$2;
|
|
2295
2311
|
/**
|
|
2296
2312
|
* Bundler for dev time server-side rendering.
|
|
2297
|
-
* @default '
|
|
2313
|
+
* @default 'lahm-node'
|
|
2298
2314
|
*/
|
|
2299
|
-
devBundler?: '
|
|
2315
|
+
devBundler?: 'lahm-node' | 'legacy';
|
|
2300
2316
|
/**
|
|
2301
|
-
* Warmup
|
|
2317
|
+
* Warmup lahm entrypoint caches on dev startup.
|
|
2302
2318
|
*/
|
|
2303
2319
|
warmupEntry?: boolean;
|
|
2304
2320
|
/**
|
|
@@ -2335,4 +2351,4 @@ declare const _default: {
|
|
|
2335
2351
|
[x: string]: untyped.SchemaDefinition | untyped.JSValue | untyped.InputObject;
|
|
2336
2352
|
};
|
|
2337
2353
|
|
|
2338
|
-
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, RuntimeValue, 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -262,7 +262,7 @@ const build = defineUntypedSchema({
|
|
|
262
262
|
/**
|
|
263
263
|
* The builder to use for bundling the Kdu part of your application.
|
|
264
264
|
*
|
|
265
|
-
* @type {'
|
|
265
|
+
* @type {'lahm' | 'webpack' | { bundle: (dtwo: typeof import('../src/types/dtwo').Dtwo) => Promise<void> }}
|
|
266
266
|
*/
|
|
267
267
|
builder: {
|
|
268
268
|
$resolve: async (val, get) => {
|
|
@@ -270,10 +270,10 @@ const build = defineUntypedSchema({
|
|
|
270
270
|
return val;
|
|
271
271
|
}
|
|
272
272
|
const map = {
|
|
273
|
-
|
|
273
|
+
lahm: "@dtwo/lahm-builder",
|
|
274
274
|
webpack: "@dtwo/webpack-builder"
|
|
275
275
|
};
|
|
276
|
-
return map[val] || val || (await get("
|
|
276
|
+
return map[val] || val || (await get("lahm") === false ? map.webpack : map.lahm);
|
|
277
277
|
}
|
|
278
278
|
},
|
|
279
279
|
/**
|
|
@@ -336,7 +336,7 @@ const build = defineUntypedSchema({
|
|
|
336
336
|
/**
|
|
337
337
|
* Dtwo uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them.
|
|
338
338
|
*
|
|
339
|
-
* 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
|
|
339
|
+
* 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).
|
|
340
340
|
*
|
|
341
341
|
* @example
|
|
342
342
|
* ```js
|
|
@@ -511,8 +511,7 @@ const common = defineUntypedSchema({
|
|
|
511
511
|
},
|
|
512
512
|
/**
|
|
513
513
|
* Whether to enable rendering of HTML - either dynamically (in server mode) or at generate time.
|
|
514
|
-
* If set to `false`
|
|
515
|
-
* a loading screen with no content.
|
|
514
|
+
* If set to `false` generated pages will have no content.
|
|
516
515
|
*/
|
|
517
516
|
ssr: {
|
|
518
517
|
$resolve: (val) => val ?? true
|
|
@@ -816,9 +815,12 @@ const dev = defineUntypedSchema({
|
|
|
816
815
|
/** Dev server listening port */
|
|
817
816
|
port: process.env.DTWO_PORT || process.env.HOLE_PORT || process.env.PORT || 3e3,
|
|
818
817
|
/** Dev server listening host */
|
|
819
|
-
host: process.env.DTWO_HOST || process.env.HOLE_HOST || process.env.HOST || "
|
|
818
|
+
host: process.env.DTWO_HOST || process.env.HOLE_HOST || process.env.HOST || "",
|
|
820
819
|
/**
|
|
821
|
-
* Listening dev server
|
|
820
|
+
* Listening dev server URL.
|
|
821
|
+
*
|
|
822
|
+
* This should not be set directly as it will always be overridden by the
|
|
823
|
+
* dev server with the full URL (for module and internal use).
|
|
822
824
|
*/
|
|
823
825
|
url: "http://localhost:3000"
|
|
824
826
|
}
|
|
@@ -846,17 +848,27 @@ const experimental = defineUntypedSchema({
|
|
|
846
848
|
*/
|
|
847
849
|
treeshakeClientOnly: true,
|
|
848
850
|
/**
|
|
849
|
-
*
|
|
851
|
+
* Emit `app:chunkError` hook when there is an error loading lahm/webpack
|
|
852
|
+
* chunks.
|
|
853
|
+
*
|
|
854
|
+
* You can set this to `reload` to perform a hard reload of the new route
|
|
855
|
+
* when a chunk fails to load when navigating to a new route.
|
|
856
|
+
*
|
|
857
|
+
* @type {boolean | 'reload'}
|
|
858
|
+
*/
|
|
859
|
+
emitRouteChunkError: false,
|
|
860
|
+
/**
|
|
861
|
+
* Use lahm-node for on-demand server chunk loading
|
|
850
862
|
*
|
|
851
|
-
* @deprecated use `
|
|
863
|
+
* @deprecated use `lahm.devBundler: 'lahm-node'`
|
|
852
864
|
*/
|
|
853
|
-
|
|
865
|
+
lahmNode: {
|
|
854
866
|
$resolve: (val) => {
|
|
855
|
-
val = process.env.
|
|
867
|
+
val = process.env.EXPERIMENTAL_LAHM_NODE ? true : val;
|
|
856
868
|
if (val === true) {
|
|
857
|
-
console.warn("`
|
|
869
|
+
console.warn("`lahm-node` is now enabled by default. You can safely remove `experimental.lahmNode` from your config.");
|
|
858
870
|
} else if (val === false) {
|
|
859
|
-
console.warn("`
|
|
871
|
+
console.warn("`lahm-node` is now enabled by default. To disable it, set `lahm.devBundler` to `legacy` instead.");
|
|
860
872
|
}
|
|
861
873
|
return val ?? true;
|
|
862
874
|
}
|
|
@@ -864,9 +876,9 @@ const experimental = defineUntypedSchema({
|
|
|
864
876
|
/**
|
|
865
877
|
* Split server bundle into multiple chunks and dynamically import them.
|
|
866
878
|
*/
|
|
867
|
-
|
|
879
|
+
lahmServerDynamicImports: true,
|
|
868
880
|
/**
|
|
869
|
-
* Inline styles when rendering HTML (currently
|
|
881
|
+
* Inline styles when rendering HTML (currently lahm only).
|
|
870
882
|
*
|
|
871
883
|
* You can also pass a function that receives the path of a Kdu component
|
|
872
884
|
* and returns a boolean indicating whether to inline the styles for that component.
|
|
@@ -1131,16 +1143,16 @@ const typescript = defineUntypedSchema({
|
|
|
1131
1143
|
}
|
|
1132
1144
|
});
|
|
1133
1145
|
|
|
1134
|
-
const
|
|
1146
|
+
const lahm = defineUntypedSchema({
|
|
1135
1147
|
/**
|
|
1136
|
-
* Configuration that will be passed directly to
|
|
1148
|
+
* Configuration that will be passed directly to Lahm.
|
|
1137
1149
|
*
|
|
1138
|
-
* See https://
|
|
1139
|
-
* Please note that not all
|
|
1150
|
+
* See https://lahmjs.web.app/config for more information.
|
|
1151
|
+
* Please note that not all lahm options are supported in Dtwo.
|
|
1140
1152
|
*
|
|
1141
|
-
* @type {typeof import('../src/types/config').
|
|
1153
|
+
* @type {typeof import('../src/types/config').LahmConfig}
|
|
1142
1154
|
*/
|
|
1143
|
-
|
|
1155
|
+
lahm: {
|
|
1144
1156
|
root: {
|
|
1145
1157
|
$resolve: async (val, get) => val ?? await get("srcDir")
|
|
1146
1158
|
},
|
|
@@ -1172,6 +1184,14 @@ const wite = defineUntypedSchema({
|
|
|
1172
1184
|
}
|
|
1173
1185
|
}
|
|
1174
1186
|
},
|
|
1187
|
+
kduJsx: {
|
|
1188
|
+
$resolve: async (val, get) => {
|
|
1189
|
+
return {
|
|
1190
|
+
isCustomElement: (await get("kdu")).compilerOptions?.isCustomElement,
|
|
1191
|
+
...val || {}
|
|
1192
|
+
};
|
|
1193
|
+
}
|
|
1194
|
+
},
|
|
1175
1195
|
optimizeDeps: {
|
|
1176
1196
|
exclude: {
|
|
1177
1197
|
$resolve: async (val, get) => [
|
|
@@ -1215,7 +1235,7 @@ const webpack = defineUntypedSchema({
|
|
|
1215
1235
|
/**
|
|
1216
1236
|
* Dtwo uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them.
|
|
1217
1237
|
*
|
|
1218
|
-
* 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
|
|
1238
|
+
* 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).
|
|
1219
1239
|
*
|
|
1220
1240
|
* @example
|
|
1221
1241
|
* ```js
|
|
@@ -1512,7 +1532,7 @@ const index = {
|
|
|
1512
1532
|
...postcss,
|
|
1513
1533
|
...router,
|
|
1514
1534
|
...typescript,
|
|
1515
|
-
...
|
|
1535
|
+
...lahm,
|
|
1516
1536
|
...webpack
|
|
1517
1537
|
};
|
|
1518
1538
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dtwo/schema",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"repository": "d2js/dtwo",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -13,30 +13,31 @@
|
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@types/lodash.template": "4.5.1",
|
|
15
15
|
"@types/semver": "7.3.13",
|
|
16
|
-
"@kdhead/schema": "1.
|
|
17
|
-
"@
|
|
18
|
-
"
|
|
16
|
+
"@kdhead/schema": "1.8.10",
|
|
17
|
+
"@lahmjs/plugin-kdu": "4.2.3",
|
|
18
|
+
"@lahmjs/plugin-kdu-jsx": "3.0.1",
|
|
19
|
+
"holepack": "2.2.2",
|
|
19
20
|
"kdu-router": "4.1.6",
|
|
20
21
|
"unbuild": "1.1.1",
|
|
21
|
-
"
|
|
22
|
+
"lahm": "4.5.14"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
|
-
"c12": "1.1.
|
|
25
|
+
"c12": "1.1.2",
|
|
25
26
|
"create-require": "1.1.1",
|
|
26
27
|
"defu": "6.1.2",
|
|
27
28
|
"hookable": "5.4.2",
|
|
28
|
-
"jiti": "1.17.
|
|
29
|
+
"jiti": "1.17.1",
|
|
29
30
|
"kdimport": "2.2.4",
|
|
30
31
|
"pathe": "1.1.0",
|
|
31
|
-
"pkg-types": "1.0.
|
|
32
|
+
"pkg-types": "1.0.2",
|
|
32
33
|
"postcss-import-resolver": "2.0.0",
|
|
33
34
|
"scule": "1.0.0",
|
|
34
35
|
"std-env": "3.3.2",
|
|
35
|
-
"ufo": "1.0
|
|
36
|
+
"ufo": "1.1.0",
|
|
36
37
|
"untyped": "1.2.2"
|
|
37
38
|
},
|
|
38
39
|
"engines": {
|
|
39
|
-
"node": "^14.
|
|
40
|
+
"node": "^14.18.0 || ^16.10.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
40
41
|
},
|
|
41
42
|
"scripts": {}
|
|
42
43
|
}
|
package/schema/config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComponentsOptions } from '../src/types/components'
|
|
2
2
|
import type { ImportsOptions } from '../src/types/imports'
|
|
3
3
|
import type { CompilerOptions } from '@kdujs/compiler-core'
|
|
4
|
-
import type { DtwoAppConfig, RuntimeConfig, AppConfig,
|
|
4
|
+
import type { DtwoAppConfig, RuntimeConfig, AppConfig, LahmConfig } from '../src/types/config'
|
|
5
5
|
import type { DtwoPlugin, Dtwo } from '../src/types/dtwo'
|
|
6
6
|
import type { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
|
|
7
7
|
import type { PluginVisualizerOptions } from 'rollup-plugin-visualizer'
|
|
@@ -234,9 +234,9 @@ export interface ConfigSchema {
|
|
|
234
234
|
/**
|
|
235
235
|
* The builder to use for bundling the Kdu part of your application.
|
|
236
236
|
*
|
|
237
|
-
* @default "@dtwo/
|
|
237
|
+
* @default "@dtwo/lahm-builder"
|
|
238
238
|
*/
|
|
239
|
-
builder: '
|
|
239
|
+
builder: 'lahm' | 'webpack' | { bundle: (dtwo: Dtwo) => Promise<void> },
|
|
240
240
|
|
|
241
241
|
/**
|
|
242
242
|
* Whether to generate sourcemaps.
|
|
@@ -287,7 +287,7 @@ export interface ConfigSchema {
|
|
|
287
287
|
/**
|
|
288
288
|
* Dtwo uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them.
|
|
289
289
|
*
|
|
290
|
-
* 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
|
|
290
|
+
* 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).
|
|
291
291
|
*
|
|
292
292
|
* @default false
|
|
293
293
|
*
|
|
@@ -441,7 +441,7 @@ export interface ConfigSchema {
|
|
|
441
441
|
debug: boolean,
|
|
442
442
|
|
|
443
443
|
/**
|
|
444
|
-
* Whether to enable rendering of HTML - either dynamically (in server mode) or at generate time. If set to `false`
|
|
444
|
+
* 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.
|
|
445
445
|
*
|
|
446
446
|
* @default true
|
|
447
447
|
*/
|
|
@@ -733,12 +733,14 @@ export interface ConfigSchema {
|
|
|
733
733
|
/**
|
|
734
734
|
* Dev server listening host
|
|
735
735
|
*
|
|
736
|
-
* @default "
|
|
736
|
+
* @default ""
|
|
737
737
|
*/
|
|
738
738
|
host: string,
|
|
739
739
|
|
|
740
740
|
/**
|
|
741
|
-
* Listening dev server
|
|
741
|
+
* Listening dev server URL.
|
|
742
|
+
*
|
|
743
|
+
* 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).
|
|
742
744
|
*
|
|
743
745
|
* @default "http://localhost:3000"
|
|
744
746
|
*/
|
|
@@ -777,23 +779,32 @@ export interface ConfigSchema {
|
|
|
777
779
|
treeshakeClientOnly: boolean,
|
|
778
780
|
|
|
779
781
|
/**
|
|
780
|
-
*
|
|
782
|
+
* Emit `app:chunkError` hook when there is an error loading lahm/webpack chunks.
|
|
783
|
+
*
|
|
784
|
+
* 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.
|
|
785
|
+
*
|
|
786
|
+
* @default false
|
|
787
|
+
*/
|
|
788
|
+
emitRouteChunkError: boolean | 'reload',
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* Use lahm-node for on-demand server chunk loading
|
|
781
792
|
*
|
|
782
793
|
* @default true
|
|
783
794
|
*
|
|
784
|
-
* @deprecated use `
|
|
795
|
+
* @deprecated use `lahm.devBundler: 'lahm-node'`
|
|
785
796
|
*/
|
|
786
|
-
|
|
797
|
+
lahmNode: boolean,
|
|
787
798
|
|
|
788
799
|
/**
|
|
789
800
|
* Split server bundle into multiple chunks and dynamically import them.
|
|
790
801
|
*
|
|
791
802
|
* @default true
|
|
792
803
|
*/
|
|
793
|
-
|
|
804
|
+
lahmServerDynamicImports: boolean,
|
|
794
805
|
|
|
795
806
|
/**
|
|
796
|
-
* Inline styles when rendering HTML (currently
|
|
807
|
+
* Inline styles when rendering HTML (currently lahm only).
|
|
797
808
|
*
|
|
798
809
|
* 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.
|
|
799
810
|
*
|
|
@@ -1069,18 +1080,18 @@ export interface ConfigSchema {
|
|
|
1069
1080
|
},
|
|
1070
1081
|
|
|
1071
1082
|
/**
|
|
1072
|
-
* Configuration that will be passed directly to
|
|
1083
|
+
* Configuration that will be passed directly to Lahm.
|
|
1073
1084
|
*
|
|
1074
|
-
* See https://
|
|
1085
|
+
* See https://lahmjs.web.app/config for more information. Please note that not all lahm options are supported in Dtwo.
|
|
1075
1086
|
*
|
|
1076
1087
|
*/
|
|
1077
|
-
|
|
1088
|
+
lahm: LahmConfig,
|
|
1078
1089
|
|
|
1079
1090
|
webpack: {
|
|
1080
1091
|
/**
|
|
1081
1092
|
* Dtwo uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them.
|
|
1082
1093
|
*
|
|
1083
|
-
* 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
|
|
1094
|
+
* 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).
|
|
1084
1095
|
*
|
|
1085
1096
|
* @default false
|
|
1086
1097
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"rootDir": "/<rootDir>",
|
|
3
|
-
"
|
|
3
|
+
"lahm": {
|
|
4
4
|
"base": "/",
|
|
5
5
|
"root": "/<rootDir>",
|
|
6
6
|
"mode": "production",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"compilerOptions": {}
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
|
+
"kduJsx": {},
|
|
29
30
|
"optimizeDeps": {
|
|
30
31
|
"exclude": [
|
|
31
32
|
"kdu-demi"
|
|
@@ -119,7 +120,7 @@
|
|
|
119
120
|
"/<rootDir>/node_modules",
|
|
120
121
|
"D:/Workspace/ORGs/d2js/dtwo/packages/schema/node_modules"
|
|
121
122
|
],
|
|
122
|
-
"builder": "@dtwo/
|
|
123
|
+
"builder": "@dtwo/lahm-builder",
|
|
123
124
|
"sourcemap": {
|
|
124
125
|
"server": true,
|
|
125
126
|
"client": false
|
|
@@ -178,7 +179,7 @@
|
|
|
178
179
|
"devServer": {
|
|
179
180
|
"https": false,
|
|
180
181
|
"port": 3000,
|
|
181
|
-
"host": "
|
|
182
|
+
"host": "",
|
|
182
183
|
"url": "http://localhost:3000"
|
|
183
184
|
},
|
|
184
185
|
"experimental": {
|
|
@@ -186,8 +187,9 @@
|
|
|
186
187
|
"reactivityTransform": false,
|
|
187
188
|
"externalKdu": true,
|
|
188
189
|
"treeshakeClientOnly": true,
|
|
189
|
-
"
|
|
190
|
-
"
|
|
190
|
+
"emitRouteChunkError": false,
|
|
191
|
+
"lahmNode": true,
|
|
192
|
+
"lahmServerDynamicImports": true,
|
|
191
193
|
"inlineSSRStyles": true,
|
|
192
194
|
"noScripts": false,
|
|
193
195
|
"payloadExtraction": false,
|
package/schema/config.md
CHANGED
|
@@ -136,8 +136,8 @@ Dtwo will automatically guess the file type by its extension and use the appropr
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
# `builder`
|
|
139
|
-
- **Type**: `'
|
|
140
|
-
- **Default**: `"@dtwo/
|
|
139
|
+
- **Type**: `'lahm' | 'webpack' | { bundle: (dtwo: SrcTypesDtwoDtwo) => Promise<void> }`
|
|
140
|
+
- **Default**: `"@dtwo/lahm-builder"`
|
|
141
141
|
|
|
142
142
|
> The builder to use for bundling the Kdu part of your application.
|
|
143
143
|
|
|
@@ -173,7 +173,7 @@ Templates are rendered using [`lodash.template`](https://lodash.com/docs/4.17.15
|
|
|
173
173
|
> Dtwo uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them.
|
|
174
174
|
|
|
175
175
|
|
|
176
|
-
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
|
|
176
|
+
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).
|
|
177
177
|
|
|
178
178
|
|
|
179
179
|
# `extends`
|
|
@@ -292,7 +292,7 @@ At the moment, it prints out hook names and timings on the server, and logs hook
|
|
|
292
292
|
- **Type**: `boolean`
|
|
293
293
|
- **Default**: `true`
|
|
294
294
|
|
|
295
|
-
> Whether to enable rendering of HTML - either dynamically (in server mode) or at generate time. If set to `false`
|
|
295
|
+
> 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.
|
|
296
296
|
|
|
297
297
|
|
|
298
298
|
# `modules`
|
|
@@ -449,7 +449,7 @@ For programmatic usage and type support, you can directly provide app config wit
|
|
|
449
449
|
|
|
450
450
|
## `host`
|
|
451
451
|
- **Type**: `string`
|
|
452
|
-
- **Default**: `"
|
|
452
|
+
- **Default**: `""`
|
|
453
453
|
|
|
454
454
|
> Dev server listening host
|
|
455
455
|
|
|
@@ -458,7 +458,10 @@ For programmatic usage and type support, you can directly provide app config wit
|
|
|
458
458
|
- **Type**: `string`
|
|
459
459
|
- **Default**: `"http://localhost:3000"`
|
|
460
460
|
|
|
461
|
-
> Listening dev server
|
|
461
|
+
> Listening dev server URL.
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
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).
|
|
462
465
|
|
|
463
466
|
|
|
464
467
|
# `experimental`
|
|
@@ -491,14 +494,24 @@ For programmatic usage and type support, you can directly provide app config wit
|
|
|
491
494
|
> Tree shakes contents of client-only components from server bundle.
|
|
492
495
|
|
|
493
496
|
|
|
494
|
-
## `
|
|
497
|
+
## `emitRouteChunkError`
|
|
498
|
+
- **Type**: `boolean | 'reload'`
|
|
499
|
+
- **Default**: `false`
|
|
500
|
+
|
|
501
|
+
> Emit `app:chunkError` hook when there is an error loading lahm/webpack chunks.
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
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.
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
## `lahmNode`
|
|
495
508
|
- **Type**: `boolean`
|
|
496
509
|
- **Default**: `true`
|
|
497
510
|
|
|
498
|
-
> Use
|
|
511
|
+
> Use lahm-node for on-demand server chunk loading
|
|
499
512
|
|
|
500
513
|
|
|
501
|
-
## `
|
|
514
|
+
## `lahmServerDynamicImports`
|
|
502
515
|
- **Type**: `boolean`
|
|
503
516
|
- **Default**: `true`
|
|
504
517
|
|
|
@@ -509,7 +522,7 @@ For programmatic usage and type support, you can directly provide app config wit
|
|
|
509
522
|
- **Type**: `boolean | ((id?: string) => boolean)`
|
|
510
523
|
- **Default**: `true`
|
|
511
524
|
|
|
512
|
-
> Inline styles when rendering HTML (currently
|
|
525
|
+
> Inline styles when rendering HTML (currently lahm only).
|
|
513
526
|
|
|
514
527
|
|
|
515
528
|
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.
|
|
@@ -751,7 +764,7 @@ If set to true, this will type check in development. You can restrict this to bu
|
|
|
751
764
|
We recommend instead either enabling [**Take Over Mode**](https://kdu-js.web.app/guide/typescript/overview.html#kocan-takeover-mode) or adding TypeScript Kdu Plugin (Kocan)** 👉 [[Download](https://marketplace.visualstudio.com/items?itemName=Kdu-Code.vscode-typescript-kdu-plugin)].
|
|
752
765
|
|
|
753
766
|
|
|
754
|
-
# `
|
|
767
|
+
# `lahm`
|
|
755
768
|
|
|
756
769
|
## `root`
|
|
757
770
|
- **Type**: `string`
|
|
@@ -793,6 +806,8 @@ We recommend instead either enabling [**Take Over Mode**](https://kdu-js.web.app
|
|
|
793
806
|
|
|
794
807
|
#### `compilerOptions`
|
|
795
808
|
|
|
809
|
+
## `kduJsx`
|
|
810
|
+
|
|
796
811
|
## `optimizeDeps`
|
|
797
812
|
|
|
798
813
|
### `exclude`
|
|
@@ -852,7 +867,7 @@ We recommend instead either enabling [**Take Over Mode**](https://kdu-js.web.app
|
|
|
852
867
|
> Dtwo uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them.
|
|
853
868
|
|
|
854
869
|
|
|
855
|
-
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
|
|
870
|
+
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).
|
|
856
871
|
|
|
857
872
|
|
|
858
873
|
## `profile`
|
|
@@ -271,10 +271,10 @@
|
|
|
271
271
|
"title": "The builder to use for bundling the Kdu part of your application.",
|
|
272
272
|
"description": "",
|
|
273
273
|
"tags": [],
|
|
274
|
-
"tsType": "'
|
|
275
|
-
"markdownType": "'
|
|
274
|
+
"tsType": "'lahm' | 'webpack' | { bundle: (dtwo: typeof import('../src/types/dtwo').Dtwo) => Promise<void> }",
|
|
275
|
+
"markdownType": "'lahm' | 'webpack' | { bundle: (dtwo: SrcTypesDtwoDtwo) => Promise<void> }",
|
|
276
276
|
"id": "#builder",
|
|
277
|
-
"default": "@dtwo/
|
|
277
|
+
"default": "@dtwo/lahm-builder",
|
|
278
278
|
"type": "string"
|
|
279
279
|
},
|
|
280
280
|
"sourcemap": {
|
|
@@ -324,7 +324,7 @@
|
|
|
324
324
|
},
|
|
325
325
|
"analyze": {
|
|
326
326
|
"title": "Dtwo uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them.",
|
|
327
|
-
"description": "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
|
|
327
|
+
"description": "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).",
|
|
328
328
|
"tags": [
|
|
329
329
|
"@example\n```js\nanalyze: {\n analyzerMode: 'static'\n}\n```"
|
|
330
330
|
],
|
|
@@ -445,7 +445,7 @@
|
|
|
445
445
|
"type": "boolean"
|
|
446
446
|
},
|
|
447
447
|
"ssr": {
|
|
448
|
-
"title": "Whether to enable rendering of HTML - either dynamically (in server mode) or at generate time. If set to `false`
|
|
448
|
+
"title": "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.",
|
|
449
449
|
"description": "",
|
|
450
450
|
"tags": [],
|
|
451
451
|
"id": "#ssr",
|
|
@@ -747,12 +747,12 @@
|
|
|
747
747
|
"description": "",
|
|
748
748
|
"tags": [],
|
|
749
749
|
"id": "#devServer/host",
|
|
750
|
-
"default": "
|
|
750
|
+
"default": "",
|
|
751
751
|
"type": "string"
|
|
752
752
|
},
|
|
753
753
|
"url": {
|
|
754
|
-
"title": "Listening dev server
|
|
755
|
-
"description": "",
|
|
754
|
+
"title": "Listening dev server URL.",
|
|
755
|
+
"description": "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).",
|
|
756
756
|
"tags": [],
|
|
757
757
|
"id": "#devServer/url",
|
|
758
758
|
"default": "http://localhost:3000",
|
|
@@ -762,7 +762,7 @@
|
|
|
762
762
|
"default": {
|
|
763
763
|
"https": false,
|
|
764
764
|
"port": 3000,
|
|
765
|
-
"host": "
|
|
765
|
+
"host": "",
|
|
766
766
|
"url": "http://localhost:3000"
|
|
767
767
|
},
|
|
768
768
|
"type": "object"
|
|
@@ -804,26 +804,35 @@
|
|
|
804
804
|
"default": true,
|
|
805
805
|
"type": "boolean"
|
|
806
806
|
},
|
|
807
|
-
"
|
|
808
|
-
"title": "
|
|
807
|
+
"emitRouteChunkError": {
|
|
808
|
+
"title": "Emit `app:chunkError` hook when there is an error loading lahm/webpack chunks.",
|
|
809
|
+
"description": "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.",
|
|
810
|
+
"tags": [],
|
|
811
|
+
"tsType": "boolean | 'reload'",
|
|
812
|
+
"id": "#experimental/emitRouteChunkError",
|
|
813
|
+
"default": false,
|
|
814
|
+
"type": "boolean"
|
|
815
|
+
},
|
|
816
|
+
"lahmNode": {
|
|
817
|
+
"title": "Use lahm-node for on-demand server chunk loading",
|
|
809
818
|
"description": "",
|
|
810
819
|
"tags": [
|
|
811
|
-
"@deprecated use `
|
|
820
|
+
"@deprecated use `lahm.devBundler: 'lahm-node'`"
|
|
812
821
|
],
|
|
813
|
-
"id": "#experimental/
|
|
822
|
+
"id": "#experimental/lahmNode",
|
|
814
823
|
"default": true,
|
|
815
824
|
"type": "boolean"
|
|
816
825
|
},
|
|
817
|
-
"
|
|
826
|
+
"lahmServerDynamicImports": {
|
|
818
827
|
"title": "Split server bundle into multiple chunks and dynamically import them.",
|
|
819
828
|
"description": "",
|
|
820
829
|
"tags": [],
|
|
821
|
-
"id": "#experimental/
|
|
830
|
+
"id": "#experimental/lahmServerDynamicImports",
|
|
822
831
|
"default": true,
|
|
823
832
|
"type": "boolean"
|
|
824
833
|
},
|
|
825
834
|
"inlineSSRStyles": {
|
|
826
|
-
"title": "Inline styles when rendering HTML (currently
|
|
835
|
+
"title": "Inline styles when rendering HTML (currently lahm only).",
|
|
827
836
|
"description": "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.",
|
|
828
837
|
"tags": [],
|
|
829
838
|
"tsType": "boolean | ((id?: string) => boolean)",
|
|
@@ -887,8 +896,9 @@
|
|
|
887
896
|
"reactivityTransform": false,
|
|
888
897
|
"externalKdu": true,
|
|
889
898
|
"treeshakeClientOnly": true,
|
|
890
|
-
"
|
|
891
|
-
"
|
|
899
|
+
"emitRouteChunkError": false,
|
|
900
|
+
"lahmNode": true,
|
|
901
|
+
"lahmServerDynamicImports": true,
|
|
892
902
|
"inlineSSRStyles": true,
|
|
893
903
|
"noScripts": false,
|
|
894
904
|
"payloadExtraction": false,
|
|
@@ -1279,42 +1289,42 @@
|
|
|
1279
1289
|
},
|
|
1280
1290
|
"type": "object"
|
|
1281
1291
|
},
|
|
1282
|
-
"
|
|
1283
|
-
"title": "Configuration that will be passed directly to
|
|
1284
|
-
"description": "See https://
|
|
1292
|
+
"lahm": {
|
|
1293
|
+
"title": "Configuration that will be passed directly to Lahm.",
|
|
1294
|
+
"description": "See https://lahmjs.web.app/config for more information. Please note that not all lahm options are supported in Dtwo.",
|
|
1285
1295
|
"tags": [],
|
|
1286
|
-
"tsType": "typeof import('../src/types/config').
|
|
1287
|
-
"markdownType": "
|
|
1288
|
-
"id": "#
|
|
1296
|
+
"tsType": "typeof import('../src/types/config').LahmConfig",
|
|
1297
|
+
"markdownType": "SrcTypesConfigLahmConfig",
|
|
1298
|
+
"id": "#lahm",
|
|
1289
1299
|
"properties": {
|
|
1290
1300
|
"root": {
|
|
1291
|
-
"id": "#
|
|
1301
|
+
"id": "#lahm/root",
|
|
1292
1302
|
"default": "/<rootDir>",
|
|
1293
1303
|
"type": "string"
|
|
1294
1304
|
},
|
|
1295
1305
|
"mode": {
|
|
1296
|
-
"id": "#
|
|
1306
|
+
"id": "#lahm/mode",
|
|
1297
1307
|
"default": "production",
|
|
1298
1308
|
"type": "string"
|
|
1299
1309
|
},
|
|
1300
1310
|
"logLevel": {
|
|
1301
|
-
"id": "#
|
|
1311
|
+
"id": "#lahm/logLevel",
|
|
1302
1312
|
"default": "info",
|
|
1303
1313
|
"type": "string"
|
|
1304
1314
|
},
|
|
1305
1315
|
"define": {
|
|
1306
|
-
"id": "#
|
|
1316
|
+
"id": "#lahm/define",
|
|
1307
1317
|
"default": {
|
|
1308
1318
|
"process.dev": false
|
|
1309
1319
|
},
|
|
1310
1320
|
"type": "object"
|
|
1311
1321
|
},
|
|
1312
1322
|
"resolve": {
|
|
1313
|
-
"id": "#
|
|
1323
|
+
"id": "#lahm/resolve",
|
|
1314
1324
|
"properties": {
|
|
1315
1325
|
"extensions": {
|
|
1316
1326
|
"type": "array",
|
|
1317
|
-
"id": "#
|
|
1327
|
+
"id": "#lahm/resolve/extensions",
|
|
1318
1328
|
"default": [
|
|
1319
1329
|
".mjs",
|
|
1320
1330
|
".js",
|
|
@@ -1343,23 +1353,23 @@
|
|
|
1343
1353
|
"type": "object"
|
|
1344
1354
|
},
|
|
1345
1355
|
"publicDir": {
|
|
1346
|
-
"id": "#
|
|
1356
|
+
"id": "#lahm/publicDir",
|
|
1347
1357
|
"default": "/<rootDir>/public",
|
|
1348
1358
|
"type": "string"
|
|
1349
1359
|
},
|
|
1350
1360
|
"kdu": {
|
|
1351
|
-
"id": "#
|
|
1361
|
+
"id": "#lahm/kdu",
|
|
1352
1362
|
"properties": {
|
|
1353
1363
|
"isProduction": {
|
|
1354
|
-
"id": "#
|
|
1364
|
+
"id": "#lahm/kdu/isProduction",
|
|
1355
1365
|
"default": true,
|
|
1356
1366
|
"type": "boolean"
|
|
1357
1367
|
},
|
|
1358
1368
|
"template": {
|
|
1359
|
-
"id": "#
|
|
1369
|
+
"id": "#lahm/kdu/template",
|
|
1360
1370
|
"properties": {
|
|
1361
1371
|
"compilerOptions": {
|
|
1362
|
-
"id": "#
|
|
1372
|
+
"id": "#lahm/kdu/template/compilerOptions",
|
|
1363
1373
|
"default": {},
|
|
1364
1374
|
"type": "object"
|
|
1365
1375
|
}
|
|
@@ -1378,11 +1388,16 @@
|
|
|
1378
1388
|
},
|
|
1379
1389
|
"type": "object"
|
|
1380
1390
|
},
|
|
1391
|
+
"kduJsx": {
|
|
1392
|
+
"id": "#lahm/kduJsx",
|
|
1393
|
+
"default": {},
|
|
1394
|
+
"type": "object"
|
|
1395
|
+
},
|
|
1381
1396
|
"optimizeDeps": {
|
|
1382
|
-
"id": "#
|
|
1397
|
+
"id": "#lahm/optimizeDeps",
|
|
1383
1398
|
"properties": {
|
|
1384
1399
|
"exclude": {
|
|
1385
|
-
"id": "#
|
|
1400
|
+
"id": "#lahm/optimizeDeps/exclude",
|
|
1386
1401
|
"default": [
|
|
1387
1402
|
"kdu-demi"
|
|
1388
1403
|
],
|
|
@@ -1400,21 +1415,21 @@
|
|
|
1400
1415
|
"type": "object"
|
|
1401
1416
|
},
|
|
1402
1417
|
"esbuild": {
|
|
1403
|
-
"id": "#
|
|
1418
|
+
"id": "#lahm/esbuild",
|
|
1404
1419
|
"properties": {
|
|
1405
1420
|
"jsxFactory": {
|
|
1406
1421
|
"type": "string",
|
|
1407
|
-
"id": "#
|
|
1422
|
+
"id": "#lahm/esbuild/jsxFactory",
|
|
1408
1423
|
"default": "h"
|
|
1409
1424
|
},
|
|
1410
1425
|
"jsxFragment": {
|
|
1411
1426
|
"type": "string",
|
|
1412
|
-
"id": "#
|
|
1427
|
+
"id": "#lahm/esbuild/jsxFragment",
|
|
1413
1428
|
"default": "Fragment"
|
|
1414
1429
|
},
|
|
1415
1430
|
"tsconfigRaw": {
|
|
1416
1431
|
"type": "string",
|
|
1417
|
-
"id": "#
|
|
1432
|
+
"id": "#lahm/esbuild/tsconfigRaw",
|
|
1418
1433
|
"default": "{}"
|
|
1419
1434
|
}
|
|
1420
1435
|
},
|
|
@@ -1427,20 +1442,20 @@
|
|
|
1427
1442
|
},
|
|
1428
1443
|
"clearScreen": {
|
|
1429
1444
|
"type": "boolean",
|
|
1430
|
-
"id": "#
|
|
1445
|
+
"id": "#lahm/clearScreen",
|
|
1431
1446
|
"default": false
|
|
1432
1447
|
},
|
|
1433
1448
|
"build": {
|
|
1434
|
-
"id": "#
|
|
1449
|
+
"id": "#lahm/build",
|
|
1435
1450
|
"properties": {
|
|
1436
1451
|
"assetsDir": {
|
|
1437
|
-
"id": "#
|
|
1452
|
+
"id": "#lahm/build/assetsDir",
|
|
1438
1453
|
"default": "_dtwo/",
|
|
1439
1454
|
"type": "string"
|
|
1440
1455
|
},
|
|
1441
1456
|
"emptyOutDir": {
|
|
1442
1457
|
"type": "boolean",
|
|
1443
|
-
"id": "#
|
|
1458
|
+
"id": "#lahm/build/emptyOutDir",
|
|
1444
1459
|
"default": false
|
|
1445
1460
|
}
|
|
1446
1461
|
},
|
|
@@ -1451,13 +1466,13 @@
|
|
|
1451
1466
|
"type": "object"
|
|
1452
1467
|
},
|
|
1453
1468
|
"server": {
|
|
1454
|
-
"id": "#
|
|
1469
|
+
"id": "#lahm/server",
|
|
1455
1470
|
"properties": {
|
|
1456
1471
|
"fs": {
|
|
1457
|
-
"id": "#
|
|
1472
|
+
"id": "#lahm/server/fs",
|
|
1458
1473
|
"properties": {
|
|
1459
1474
|
"allow": {
|
|
1460
|
-
"id": "#
|
|
1475
|
+
"id": "#lahm/server/fs/allow",
|
|
1461
1476
|
"default": [
|
|
1462
1477
|
"/<rootDir>/.dtwo",
|
|
1463
1478
|
"/<rootDir>",
|
|
@@ -1526,6 +1541,7 @@
|
|
|
1526
1541
|
"compilerOptions": {}
|
|
1527
1542
|
}
|
|
1528
1543
|
},
|
|
1544
|
+
"kduJsx": {},
|
|
1529
1545
|
"optimizeDeps": {
|
|
1530
1546
|
"exclude": [
|
|
1531
1547
|
"kdu-demi"
|
|
@@ -1561,7 +1577,7 @@
|
|
|
1561
1577
|
"properties": {
|
|
1562
1578
|
"analyze": {
|
|
1563
1579
|
"title": "Dtwo uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them.",
|
|
1564
|
-
"description": "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
|
|
1580
|
+
"description": "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).",
|
|
1565
1581
|
"tags": [
|
|
1566
1582
|
"@example\n```js\nanalyze: {\n analyzerMode: 'static'\n}\n```"
|
|
1567
1583
|
],
|
|
@@ -2343,7 +2359,7 @@
|
|
|
2343
2359
|
},
|
|
2344
2360
|
"plugins": [],
|
|
2345
2361
|
"css": [],
|
|
2346
|
-
"builder": "@dtwo/
|
|
2362
|
+
"builder": "@dtwo/lahm-builder",
|
|
2347
2363
|
"sourcemap": {
|
|
2348
2364
|
"server": true,
|
|
2349
2365
|
"client": false
|
|
@@ -2425,7 +2441,7 @@
|
|
|
2425
2441
|
"devServer": {
|
|
2426
2442
|
"https": false,
|
|
2427
2443
|
"port": 3000,
|
|
2428
|
-
"host": "
|
|
2444
|
+
"host": "",
|
|
2429
2445
|
"url": "http://localhost:3000"
|
|
2430
2446
|
},
|
|
2431
2447
|
"experimental": {
|
|
@@ -2433,8 +2449,9 @@
|
|
|
2433
2449
|
"reactivityTransform": false,
|
|
2434
2450
|
"externalKdu": true,
|
|
2435
2451
|
"treeshakeClientOnly": true,
|
|
2436
|
-
"
|
|
2437
|
-
"
|
|
2452
|
+
"emitRouteChunkError": false,
|
|
2453
|
+
"lahmNode": true,
|
|
2454
|
+
"lahmServerDynamicImports": true,
|
|
2438
2455
|
"inlineSSRStyles": true,
|
|
2439
2456
|
"noScripts": false,
|
|
2440
2457
|
"payloadExtraction": false,
|
|
@@ -2484,7 +2501,7 @@
|
|
|
2484
2501
|
"tsConfig": {},
|
|
2485
2502
|
"shim": true
|
|
2486
2503
|
},
|
|
2487
|
-
"
|
|
2504
|
+
"lahm": {
|
|
2488
2505
|
"base": "/",
|
|
2489
2506
|
"root": "/<rootDir>",
|
|
2490
2507
|
"mode": "production",
|
|
@@ -2510,6 +2527,7 @@
|
|
|
2510
2527
|
"compilerOptions": {}
|
|
2511
2528
|
}
|
|
2512
2529
|
},
|
|
2530
|
+
"kduJsx": {},
|
|
2513
2531
|
"optimizeDeps": {
|
|
2514
2532
|
"exclude": [
|
|
2515
2533
|
"kdu-demi"
|