@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/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 {'wite' | 'webpack' | { bundle: (dtwo: typeof import('../src/types/dtwo').Dtwo) => Promise<void> }}
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
- wite: "@dtwo/wite-builder",
273
+ lahm: "@dtwo/lahm-builder",
274
274
  webpack: "@dtwo/webpack-builder"
275
275
  };
276
- return map[val] || val || (await get("wite") === false ? map.webpack : map.wite);
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 wite](https://github.com/btd/rollup-plugin-visualizer#options).
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` and combined with `static` target, generated pages will simply display
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 || "localhost",
818
+ host: process.env.DTWO_HOST || process.env.HOLE_HOST || process.env.HOST || "",
820
819
  /**
821
- * Listening dev server url
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
- * Use wite-node for on-demand server chunk loading
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 `wite.devBundler: 'wite-node'`
863
+ * @deprecated use `lahm.devBundler: 'lahm-node'`
852
864
  */
853
- witeNode: {
865
+ lahmNode: {
854
866
  $resolve: (val) => {
855
- val = process.env.EXPERIMENTAL_WITE_NODE ? true : val;
867
+ val = process.env.EXPERIMENTAL_LAHM_NODE ? true : val;
856
868
  if (val === true) {
857
- console.warn("`wite-node` is now enabled by default. You can safely remove `experimental.witeNode` from your config.");
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("`wite-node` is now enabled by default. To disable it, set `wite.devBundler` to `legacy` instead.");
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
- witeServerDynamicImports: true,
879
+ lahmServerDynamicImports: true,
868
880
  /**
869
- * Inline styles when rendering HTML (currently wite only).
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 wite = defineUntypedSchema({
1146
+ const lahm = defineUntypedSchema({
1135
1147
  /**
1136
- * Configuration that will be passed directly to Wite.
1148
+ * Configuration that will be passed directly to Lahm.
1137
1149
  *
1138
- * See https://witejs.web.app/config for more information.
1139
- * Please note that not all wite options are supported in Dtwo.
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').WiteConfig}
1153
+ * @type {typeof import('../src/types/config').LahmConfig}
1142
1154
  */
1143
- wite: {
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 wite](https://github.com/btd/rollup-plugin-visualizer#options).
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
- ...wite,
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.1.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.0.20",
17
- "@witejs/plugin-kdu": "4.0.0",
18
- "holepack": "2.1.1",
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
- "wite": "4.2.0"
22
+ "lahm": "4.5.14"
22
23
  },
23
24
  "dependencies": {
24
- "c12": "1.1.0",
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.16.2",
29
- "kdimport": "2.1.0",
29
+ "jiti": "1.17.1",
30
+ "kdimport": "2.2.4",
30
31
  "pathe": "1.1.0",
31
- "pkg-types": "1.0.1",
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.1",
36
+ "ufo": "1.1.0",
36
37
  "untyped": "1.2.2"
37
38
  },
38
39
  "engines": {
39
- "node": "^14.16.0 || ^16.10.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
40
+ "node": "^14.18.0 || ^16.10.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
40
41
  },
41
42
  "scripts": {}
42
43
  }
@@ -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, WiteConfig } from '../src/types/config'
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/wite-builder"
237
+ * @default "@dtwo/lahm-builder"
238
238
  */
239
- builder: 'wite' | 'webpack' | { bundle: (dtwo: Dtwo) => Promise<void> },
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 wite](https://github.com/btd/rollup-plugin-visualizer#options).
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` and combined with `static` target, generated pages will simply display a loading screen with no content.
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 "localhost"
736
+ * @default ""
737
737
  */
738
738
  host: string,
739
739
 
740
740
  /**
741
- * Listening dev server url
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
- * Use wite-node for on-demand server chunk loading
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 `wite.devBundler: 'wite-node'`
795
+ * @deprecated use `lahm.devBundler: 'lahm-node'`
785
796
  */
786
- witeNode: boolean,
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
- witeServerDynamicImports: boolean,
804
+ lahmServerDynamicImports: boolean,
794
805
 
795
806
  /**
796
- * Inline styles when rendering HTML (currently wite only).
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 Wite.
1083
+ * Configuration that will be passed directly to Lahm.
1073
1084
  *
1074
- * See https://witejs.web.app/config for more information. Please note that not all wite options are supported in Dtwo.
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
- wite: WiteConfig,
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 wite](https://github.com/btd/rollup-plugin-visualizer#options).
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
- "wite": {
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/wite-builder",
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": "localhost",
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
- "witeNode": true,
190
- "witeServerDynamicImports": true,
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**: `'wite' | 'webpack' | { bundle: (dtwo: SrcTypesDtwoDtwo) => Promise<void> }`
140
- - **Default**: `"@dtwo/wite-builder"`
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 wite](https://github.com/btd/rollup-plugin-visualizer#options).
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` and combined with `static` target, generated pages will simply display a loading screen with no content.
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**: `"localhost"`
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 url
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
- ## `witeNode`
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 wite-node for on-demand server chunk loading
511
+ > Use lahm-node for on-demand server chunk loading
499
512
 
500
513
 
501
- ## `witeServerDynamicImports`
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 wite only).
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
- # `wite`
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 wite](https://github.com/btd/rollup-plugin-visualizer#options).
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`