vike 0.4.168-commit-ce94f5c → 0.4.168-commit-42406a9

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.
Files changed (173) hide show
  1. package/dist/cjs/node/plugin/plugins/buildConfig.js +10 -2
  2. package/dist/cjs/node/plugin/plugins/commonConfig/assertResolveAlias.js +1 -1
  3. package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +19 -16
  4. package/dist/cjs/node/plugin/plugins/distFileNames.js +7 -1
  5. package/dist/cjs/node/plugin/plugins/envVars.js +1 -5
  6. package/dist/cjs/node/plugin/plugins/importUserCode/index.js +7 -7
  7. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getConfigValuesSerialized.js +14 -11
  8. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +11 -14
  9. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/{resolveImportPath.js → resolvePointerImport.js} +58 -44
  10. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformFileImports.js +8 -8
  11. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +52 -12
  12. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +81 -106
  13. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +2 -2
  14. package/dist/cjs/node/plugin/shared/getFilePath.js +44 -48
  15. package/dist/cjs/node/plugin/utils.js +2 -2
  16. package/dist/cjs/node/prerender/runPrerender.js +6 -5
  17. package/dist/cjs/node/prerender/utils.js +2 -1
  18. package/dist/cjs/node/runtime/html/serializePageContextClientSide.js +1 -0
  19. package/dist/cjs/node/runtime/index-common.js +14 -3
  20. package/dist/cjs/node/runtime/renderPage/createHttpResponseObject/getCacheControl.js +2 -1
  21. package/dist/cjs/node/runtime/renderPage/loadUserFilesServerSide.js +25 -14
  22. package/dist/cjs/node/runtime/renderPage/log404/index.js +2 -2
  23. package/dist/cjs/node/runtime/renderPage/logErrorHint.js +1 -1
  24. package/dist/cjs/node/runtime/utils.js +2 -1
  25. package/dist/cjs/node/shared/assertV1Design.js +1 -1
  26. package/dist/cjs/node/shared/getClientEntry.js +2 -2
  27. package/dist/cjs/node/shared/prependEntriesDir.js +1 -0
  28. package/dist/cjs/node/shared/utils.js +0 -1
  29. package/dist/cjs/shared/getPageFiles/analyzeClientSide.js +3 -3
  30. package/dist/cjs/shared/getPageFiles/getExports.js +8 -15
  31. package/dist/cjs/shared/getPageFiles.js +3 -6
  32. package/dist/cjs/shared/hooks/getHook.js +7 -6
  33. package/dist/cjs/shared/page-configs/getConfigDefinedAt.js +48 -0
  34. package/dist/cjs/shared/page-configs/{helpers/getConfigValue.js → getConfigValue.js} +6 -8
  35. package/dist/cjs/shared/page-configs/helpers.js +6 -11
  36. package/dist/cjs/shared/page-configs/serialize/assertPageConfigsSerialized.js +1 -1
  37. package/dist/cjs/shared/page-configs/serialize/parseConfigValuesImported.js +2 -1
  38. package/dist/cjs/shared/page-configs/serialize/parseConfigValuesSerialized.js +11 -6
  39. package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +4 -3
  40. package/dist/cjs/shared/page-configs/serialize/serializeConfigValue.js +3 -3
  41. package/dist/cjs/shared/route/index.js +2 -2
  42. package/dist/cjs/shared/route/loadPageRoutes.js +12 -10
  43. package/dist/cjs/shared/route/resolveRouteFunction.js +8 -9
  44. package/dist/cjs/shared/route/resolveRouteString.js +5 -16
  45. package/dist/cjs/shared/route/utils.js +0 -1
  46. package/dist/cjs/shared/utils.js +1 -0
  47. package/dist/cjs/utils/assertPathFilesystemAbsolute.js +39 -0
  48. package/dist/cjs/utils/createErrorWithCleanStackTrace.js +1 -7
  49. package/dist/cjs/utils/debug.js +2 -1
  50. package/dist/cjs/utils/findFile.js +2 -1
  51. package/dist/cjs/utils/hasProp.js +9 -5
  52. package/dist/cjs/utils/injectRollupInputs.js +2 -1
  53. package/dist/cjs/utils/isArray.js +8 -0
  54. package/dist/cjs/utils/isArrayOfStrings.js +8 -0
  55. package/dist/cjs/utils/isDev.js +12 -4
  56. package/dist/cjs/utils/isNpmPackage.js +1 -1
  57. package/dist/cjs/utils/isObjectOfStrings.js +8 -0
  58. package/dist/cjs/utils/projectInfo.js +1 -1
  59. package/dist/esm/client/client-routing-runtime/getPageContextFromHooks.d.ts +3 -1
  60. package/dist/esm/client/client-routing-runtime/getPageContextFromHooks.js +2 -1
  61. package/dist/esm/client/server-routing-runtime/getPageContext.d.ts +1 -0
  62. package/dist/esm/client/shared/getPageContextSerializedInHtml.d.ts +1 -0
  63. package/dist/esm/client/shared/getPageContextSerializedInHtml.js +1 -0
  64. package/dist/esm/client/shared/loadUserFilesClientSide.js +3 -7
  65. package/dist/esm/node/plugin/plugins/buildConfig.js +9 -1
  66. package/dist/esm/node/plugin/plugins/commonConfig/assertResolveAlias.js +2 -2
  67. package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +20 -17
  68. package/dist/esm/node/plugin/plugins/distFileNames.js +8 -2
  69. package/dist/esm/node/plugin/plugins/envVars.js +2 -6
  70. package/dist/esm/node/plugin/plugins/importUserCode/index.js +9 -9
  71. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getConfigValuesSerialized.d.ts +2 -2
  72. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getConfigValuesSerialized.js +14 -11
  73. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.d.ts +4 -3
  74. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.d.ts +2 -2
  75. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +12 -15
  76. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.d.ts +12 -0
  77. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.js +123 -0
  78. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformFileImports.d.ts +8 -8
  79. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformFileImports.js +7 -7
  80. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +53 -13
  81. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +81 -106
  82. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +1 -1
  83. package/dist/esm/node/plugin/shared/getFilePath.d.ts +11 -5
  84. package/dist/esm/node/plugin/shared/getFilePath.js +43 -47
  85. package/dist/esm/node/plugin/utils.d.ts +2 -2
  86. package/dist/esm/node/plugin/utils.js +2 -2
  87. package/dist/esm/node/prerender/runPrerender.js +6 -5
  88. package/dist/esm/node/prerender/utils.d.ts +2 -1
  89. package/dist/esm/node/prerender/utils.js +2 -1
  90. package/dist/esm/node/runtime/html/serializePageContextClientSide.d.ts +1 -0
  91. package/dist/esm/node/runtime/html/serializePageContextClientSide.js +1 -0
  92. package/dist/esm/node/runtime/index-common.d.ts +0 -4
  93. package/dist/esm/node/runtime/index-common.js +14 -3
  94. package/dist/esm/node/runtime/renderPage/createHttpResponseObject/getCacheControl.js +2 -1
  95. package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.d.ts +4 -4
  96. package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.js +27 -16
  97. package/dist/esm/node/runtime/renderPage/log404/index.js +2 -2
  98. package/dist/esm/node/runtime/renderPage/logErrorHint.js +2 -2
  99. package/dist/esm/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.d.ts +2 -7
  100. package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +16 -16
  101. package/dist/esm/node/runtime/utils.d.ts +2 -1
  102. package/dist/esm/node/runtime/utils.js +2 -1
  103. package/dist/esm/node/shared/assertV1Design.js +1 -1
  104. package/dist/esm/node/shared/getClientEntry.js +1 -1
  105. package/dist/esm/node/shared/prependEntriesDir.js +1 -0
  106. package/dist/esm/node/shared/utils.d.ts +0 -1
  107. package/dist/esm/node/shared/utils.js +0 -1
  108. package/dist/esm/shared/getPageFiles/analyzeClientSide.js +1 -1
  109. package/dist/esm/shared/getPageFiles/getExports.d.ts +4 -5
  110. package/dist/esm/shared/getPageFiles/getExports.js +9 -16
  111. package/dist/esm/shared/getPageFiles.d.ts +1 -2
  112. package/dist/esm/shared/getPageFiles.js +1 -3
  113. package/dist/esm/shared/hooks/getHook.js +6 -5
  114. package/dist/esm/shared/page-configs/Config.d.ts +2 -2
  115. package/dist/esm/shared/page-configs/FilePath.d.ts +32 -22
  116. package/dist/esm/shared/page-configs/PageConfig.d.ts +27 -15
  117. package/dist/esm/shared/page-configs/getConfigDefinedAt.d.ts +11 -0
  118. package/dist/esm/shared/page-configs/getConfigDefinedAt.js +42 -0
  119. package/dist/esm/shared/page-configs/{helpers/getConfigValue.d.ts → getConfigValue.d.ts} +2 -2
  120. package/dist/esm/shared/page-configs/{helpers/getConfigValue.js → getConfigValue.js} +6 -8
  121. package/dist/esm/shared/page-configs/helpers.d.ts +3 -9
  122. package/dist/esm/shared/page-configs/helpers.js +6 -8
  123. package/dist/esm/shared/page-configs/serialize/PageConfigSerialized.d.ts +7 -4
  124. package/dist/esm/shared/page-configs/serialize/assertPageConfigsSerialized.js +2 -2
  125. package/dist/esm/shared/page-configs/serialize/parseConfigValuesImported.js +2 -1
  126. package/dist/esm/shared/page-configs/serialize/parseConfigValuesSerialized.js +12 -7
  127. package/dist/esm/shared/page-configs/serialize/parsePageConfigs.js +5 -4
  128. package/dist/esm/shared/page-configs/serialize/serializeConfigValue.js +3 -3
  129. package/dist/esm/shared/route/index.js +2 -2
  130. package/dist/esm/shared/route/loadPageRoutes.d.ts +3 -3
  131. package/dist/esm/shared/route/loadPageRoutes.js +10 -8
  132. package/dist/esm/shared/route/resolveRouteFunction.d.ts +1 -1
  133. package/dist/esm/shared/route/resolveRouteFunction.js +9 -10
  134. package/dist/esm/shared/route/resolveRouteString.d.ts +0 -2
  135. package/dist/esm/shared/route/resolveRouteString.js +5 -16
  136. package/dist/esm/shared/route/utils.d.ts +0 -1
  137. package/dist/esm/shared/route/utils.js +0 -1
  138. package/dist/esm/shared/utils.d.ts +1 -0
  139. package/dist/esm/shared/utils.js +1 -0
  140. package/dist/esm/utils/assertPathFilesystemAbsolute.d.ts +6 -0
  141. package/dist/esm/utils/assertPathFilesystemAbsolute.js +33 -0
  142. package/dist/esm/utils/createErrorWithCleanStackTrace.js +1 -7
  143. package/dist/esm/utils/debug.js +2 -1
  144. package/dist/esm/utils/findFile.js +2 -1
  145. package/dist/esm/utils/hasProp.d.ts +1 -0
  146. package/dist/esm/utils/hasProp.js +9 -5
  147. package/dist/esm/utils/injectRollupInputs.js +2 -1
  148. package/dist/esm/utils/isArray.d.ts +1 -0
  149. package/dist/esm/utils/isArray.js +4 -0
  150. package/dist/esm/utils/isArrayOfStrings.d.ts +2 -0
  151. package/dist/esm/utils/isArrayOfStrings.js +5 -0
  152. package/dist/esm/utils/isDev.d.ts +3 -0
  153. package/dist/esm/utils/isDev.js +11 -3
  154. package/dist/esm/utils/isNpmPackage.js +1 -1
  155. package/dist/esm/utils/isObjectOfStrings.d.ts +2 -0
  156. package/dist/esm/utils/isObjectOfStrings.js +5 -0
  157. package/dist/esm/utils/projectInfo.d.ts +2 -2
  158. package/dist/esm/utils/projectInfo.js +1 -1
  159. package/package.json +1 -1
  160. package/dist/cjs/shared/page-configs/helpers/getConfigDefinedAtString.js +0 -43
  161. package/dist/cjs/utils/assertPathIsFilesystemAbsolute.js +0 -21
  162. package/dist/cjs/utils/isStringRecord.js +0 -7
  163. package/dist/cjs/utils/mergeCumulativeValues.js +0 -21
  164. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.d.ts +0 -13
  165. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +0 -109
  166. package/dist/esm/shared/page-configs/helpers/getConfigDefinedAtString.d.ts +0 -7
  167. package/dist/esm/shared/page-configs/helpers/getConfigDefinedAtString.js +0 -37
  168. package/dist/esm/utils/assertPathIsFilesystemAbsolute.d.ts +0 -3
  169. package/dist/esm/utils/assertPathIsFilesystemAbsolute.js +0 -15
  170. package/dist/esm/utils/isStringRecord.d.ts +0 -1
  171. package/dist/esm/utils/isStringRecord.js +0 -3
  172. package/dist/esm/utils/mergeCumulativeValues.d.ts +0 -2
  173. package/dist/esm/utils/mergeCumulativeValues.js +0 -18
@@ -1,6 +1,18 @@
1
1
  export type { FilePath };
2
+ export type { FilePathUnresolved };
2
3
  export type { FilePathResolved };
3
- type FilePathResolved = FilePath & {
4
+ type FilePath = FilePathResolved | FilePathUnresolved;
5
+ type FilePathUnresolved = FilePathCommon & {
6
+ filePathAbsoluteFilesystem: null;
7
+ } & ImportPathAbsolute;
8
+ type FilePathResolved = FilePathCommon & {
9
+ /**
10
+ * The file's path, absolute starting from the filesystem root.
11
+ *
12
+ * Example: `/home/rom/code/my-app/pages/some-page/+Page.js`
13
+ *
14
+ * The value is `null` for imports using path aliases. (Because Vike cannot resolve path aliases, otherwise Vike would need to re-implement https://www.npmjs.com/package/@rollup/plugin-alias.)
15
+ */
4
16
  filePathAbsoluteFilesystem: string;
5
17
  /**
6
18
  * The file's path, shown to the user in logs.
@@ -10,22 +22,23 @@ type FilePathResolved = FilePath & {
10
22
  * Its value is equivalent to `filePath.filePathAbsoluteUserRootDir ?? filePath.filePathAbsoluteFilesystem`.
11
23
  */
12
24
  filePathToShowToUserResolved: string;
13
- };
14
- type IsReferencedByUserLandFile = {
15
- filePathAbsoluteUserRootDir: string;
16
- } | {
17
- importPathAbsolute: string;
18
- };
19
- type FilePath = FilePathProps & IsReferencedByUserLandFile;
20
- type FilePathProps = {
21
25
  /**
22
- * The file's path, absolute starting from the filesystem root.
26
+ * File's name (without its file path).
23
27
  *
24
- * Example: `/home/rom/code/my-app/pages/some-page/+Page.js`
25
- *
26
- * The value is `null` for imports using path aliases. (Because Vike cannot resolve path aliases, otherwise Vike would need to re-implement https://www.npmjs.com/package/@rollup/plugin-alias.)
28
+ * Example: `+Page.js`
27
29
  */
28
- filePathAbsoluteFilesystem: string | null;
30
+ fileName: string;
31
+ } & (FilePathAbsoluteUserRootDir | ImportPathAbsolute);
32
+ type ImportPathAbsolute = {
33
+ /**
34
+ * The file's non-relative import path. It's either:
35
+ * - an npm package import (e.g. `vike-react/config`), or
36
+ * - a path alias import (e.g. `#components/Counter').
37
+ */
38
+ importPathAbsolute: string;
39
+ filePathAbsoluteUserRootDir: null;
40
+ };
41
+ type FilePathAbsoluteUserRootDir = {
29
42
  /**
30
43
  * The file's path, absolute starting from the user root directory (i.e. Vite's `config.root`).
31
44
  *
@@ -34,7 +47,10 @@ type FilePathProps = {
34
47
  * Its value is `null` if the file is outside of the user root directory (i.e. Vite's `config.root`).
35
48
  *
36
49
  */
37
- filePathAbsoluteUserRootDir: string | null;
50
+ filePathAbsoluteUserRootDir: string;
51
+ importPathAbsolute: string | null;
52
+ };
53
+ type FilePathCommon = {
38
54
  /**
39
55
  * The file's path, shown to the user in logs.
40
56
  *
@@ -50,15 +66,9 @@ type FilePathProps = {
50
66
  * - `/pages/+config.js`
51
67
  * - `vike-react/config`
52
68
  *
53
- * We use it to generate import paths in virtual modules. (Since import paths in virtual modules cannot be relative.)
69
+ * We use it to generate imports in virtual modules. (Since import paths in virtual modules cannot be relative.)
54
70
  *
55
71
  * Its value is equivalent to `filePath.filePathAbsoluteUserRootDir ?? filePath.importPathAbsolute`.
56
72
  */
57
73
  filePathAbsoluteVite: string;
58
- /**
59
- * The file's non-relative import path. It's either:
60
- * - an npm package import (e.g. `vike-react/config`), or
61
- * - a path alias import (e.g. `#components/Counter').
62
- */
63
- importPathAbsolute: string | null;
64
74
  };
@@ -6,14 +6,16 @@ export type { ConfigEnvInternal };
6
6
  export type { PageConfigGlobalRuntime };
7
7
  export type { PageConfigGlobalBuildTime };
8
8
  export type { ConfigValue };
9
+ export type { ConfigValueClassic };
10
+ export type { ConfigValueCumulative };
11
+ export type { ConfigValueComputed };
9
12
  export type { ConfigValues };
10
13
  export type { ConfigValueSource };
11
14
  export type { ConfigValueSources };
12
- export type { ConfigValueComputed };
13
15
  export type { ConfigValuesComputed };
14
- export type { DefinedAt };
16
+ export type { DefinedAtData };
15
17
  export type { DefinedAtFile };
16
- export type { DefinedAtFileFullInfo };
18
+ export type { DefinedAtFilePath };
17
19
  import type { ConfigValueImported, ConfigValueSerialized } from './serialize/PageConfigSerialized.js';
18
20
  import type { LocationId } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js';
19
21
  import type { FilePath } from './FilePath.js';
@@ -68,7 +70,7 @@ type ConfigEnvInternal = Omit<ConfigEnv, 'client'> & {
68
70
  type ConfigValueSource = {
69
71
  value?: unknown;
70
72
  configEnv: ConfigEnvInternal;
71
- definedAt: DefinedAtFileFullInfo;
73
+ definedAtFilePath: DefinedAtFilePath;
72
74
  locationId: LocationId;
73
75
  /** Wether the config value is loaded at runtime, for example config.Page or config.onBeforeRender */
74
76
  valueIsImportedAtRuntime: boolean;
@@ -76,26 +78,36 @@ type ConfigValueSource = {
76
78
  valueIsFilePath?: true;
77
79
  valueIsDefinedByValueFile: boolean;
78
80
  };
79
- type DefinedAtFileFullInfo = DefinedAtFile & FilePath & {
81
+ type DefinedAtFilePath = DefinedAtFile & FilePath & {
80
82
  fileExportName?: string;
81
83
  };
82
84
  type ConfigValueSources = Record<string, ConfigValueSource[]>;
83
- type ConfigValueComputed = {
85
+ type ConfigValuesComputed = Record<string, {
84
86
  configEnv: ConfigEnvInternal;
85
87
  value: unknown;
86
- };
87
- type ConfigValuesComputed = Record<string, ConfigValueComputed>;
88
- type ConfigValue = {
88
+ }>;
89
+ type ConfigValue = ConfigValueClassic | ConfigValueCumulative | ConfigValueComputed;
90
+ /** Defined by a unique source (thus unique file path). */
91
+ type ConfigValueClassic = {
92
+ type: 'classic';
89
93
  value: unknown;
90
- definedAt: DefinedAt;
94
+ definedAtData: DefinedAtFile;
91
95
  };
92
- type DefinedAt = DefinedAtFile | {
93
- files: DefinedAtFile[];
94
- } | {
95
- isComputed: true;
96
+ /** Defined by multiple sources (thus multiple file paths). */
97
+ type ConfigValueCumulative = {
98
+ type: 'cumulative';
99
+ value: unknown[];
100
+ definedAtData: DefinedAtFile[];
96
101
  };
102
+ /** Defined internally by Vike (currently, Vike doesn't support computed configs created by users). */
103
+ type ConfigValueComputed = {
104
+ type: 'computed';
105
+ value: unknown;
106
+ definedAtData: null;
107
+ };
108
+ type ConfigValues = Record<string, ConfigValue>;
109
+ type DefinedAtData = DefinedAtFile | DefinedAtFile[] | null;
97
110
  type DefinedAtFile = {
98
111
  filePathToShowToUser: string;
99
112
  fileExportPathToShowToUser: null | string[];
100
113
  };
101
- type ConfigValues = Record<string, ConfigValue>;
@@ -0,0 +1,11 @@
1
+ export { getConfigDefinedAt };
2
+ export { getConfigDefinedAtOptional };
3
+ export { getDefinedAtString };
4
+ export type { ConfigDefinedAt };
5
+ export type { ConfigDefinedAtOptional };
6
+ import type { DefinedAtData, DefinedAtFile } from './PageConfig.js';
7
+ type ConfigDefinedAtOptional = ConfigDefinedAt | `Config ${string} defined internally`;
8
+ type ConfigDefinedAt = `Config ${string} defined at ${string}`;
9
+ declare function getConfigDefinedAt<SentenceBegin extends 'Config' | 'config', ConfigName extends string>(sentenceBegin: SentenceBegin, configName: ConfigName, definedAtData: DefinedAtFile | DefinedAtFile[]): `${SentenceBegin} ${ConfigName} defined at ${string}`;
10
+ declare function getConfigDefinedAtOptional<SentenceBegin extends 'Config' | 'config', ConfigName extends string>(sentenceBegin: SentenceBegin, configName: ConfigName, definedAtData: DefinedAtData): `${SentenceBegin} ${ConfigName} defined ${'internally' | `at ${string}`}`;
11
+ declare function getDefinedAtString(definedAtData: DefinedAtFile | DefinedAtFile[], configName: string): string;
@@ -0,0 +1,42 @@
1
+ export { getConfigDefinedAt };
2
+ export { getConfigDefinedAtOptional };
3
+ export { getDefinedAtString };
4
+ import { assert, isArray } from '../utils.js';
5
+ import pc from '@brillout/picocolors';
6
+ import { getExportPath } from './getExportPath.js';
7
+ function getConfigDefinedAt(sentenceBegin, configName, definedAtData) {
8
+ return `${begin(sentenceBegin, configName)} at ${getDefinedAtString(definedAtData, configName)}`;
9
+ }
10
+ function getConfigDefinedAtOptional(sentenceBegin, configName, definedAtData) {
11
+ if (!definedAtData) {
12
+ return `${begin(sentenceBegin, configName)} internally`;
13
+ }
14
+ else {
15
+ return `${begin(sentenceBegin, configName)} at ${getDefinedAtString(definedAtData, configName)}`;
16
+ }
17
+ }
18
+ function begin(sentenceBegin, configName) {
19
+ return `${sentenceBegin} ${pc.cyan(configName)} defined`;
20
+ }
21
+ function getDefinedAtString(definedAtData, configName) {
22
+ let files;
23
+ if (isArray(definedAtData)) {
24
+ files = definedAtData;
25
+ }
26
+ else {
27
+ files = [definedAtData];
28
+ }
29
+ assert(files.length >= 1);
30
+ const definedAtString = files
31
+ .map((source) => {
32
+ const { filePathToShowToUser, fileExportPathToShowToUser } = source;
33
+ let s = filePathToShowToUser;
34
+ const exportPath = getExportPath(fileExportPathToShowToUser, configName);
35
+ if (exportPath) {
36
+ s = `${s} > ${pc.cyan(exportPath)}`;
37
+ }
38
+ return s;
39
+ })
40
+ .join(' / ');
41
+ return definedAtString;
42
+ }
@@ -1,6 +1,6 @@
1
1
  export { getConfigValue };
2
- import type { PageConfigRuntime, PageConfigBuildTime, ConfigValue } from '../PageConfig.js';
3
- import type { ConfigNameBuiltIn } from '../Config.js';
2
+ import type { PageConfigRuntime, PageConfigBuildTime, ConfigValue } from './PageConfig.js';
3
+ import type { ConfigNameBuiltIn } from './Config.js';
4
4
  type PageConfigCommon = PageConfigRuntime | PageConfigBuildTime;
5
5
  type ConfigName = ConfigNameBuiltIn;
6
6
  declare function getConfigValue(pageConfig: PageConfigCommon, configName: ConfigName, type: 'string'): null | ConfigValue & {
@@ -1,19 +1,19 @@
1
1
  export { getConfigValue };
2
- import { assert, assertUsage, getValuePrintable } from '../../utils.js';
2
+ import { assert, assertUsage, getValuePrintable } from '../utils.js';
3
3
  import pc from '@brillout/picocolors';
4
- import { getConfigDefinedAtString } from './getConfigDefinedAtString.js';
4
+ import { getConfigDefinedAtOptional } from './getConfigDefinedAt.js';
5
5
  // prettier-ignore
6
6
  // biome-ignore format:
7
7
  function getConfigValue(pageConfig, configName, type) {
8
8
  const configValue = getConfigValueEntry(pageConfig, configName);
9
9
  if (configValue === null)
10
10
  return null;
11
- const { value, definedAt } = configValue;
11
+ const { value, definedAtData } = configValue;
12
12
  if (type)
13
- assertConfigValueType(value, type, configName, definedAt);
13
+ assertConfigValueType(value, type, configName, definedAtData);
14
14
  return configValue;
15
15
  }
16
- function assertConfigValueType(value, type, configName, definedAt) {
16
+ function assertConfigValueType(value, type, configName, definedAtData) {
17
17
  assert(value !== null);
18
18
  const typeActual = typeof value;
19
19
  if (typeActual === type)
@@ -22,9 +22,7 @@ function assertConfigValueType(value, type, configName, definedAt) {
22
22
  const problem = valuePrintable !== null
23
23
  ? `value ${pc.cyan(valuePrintable)}`
24
24
  : `type ${pc.cyan(typeActual)}`;
25
- const configDefinedAt = getConfigDefinedAtString('Config', configName, {
26
- definedAt
27
- });
25
+ const configDefinedAt = getConfigDefinedAtOptional('Config', configName, definedAtData);
28
26
  const errMsg = `${configDefinedAt} has an invalid ${problem}: it should be a ${pc.cyan(type)} instead`;
29
27
  assertUsage(false, errMsg);
30
28
  }
@@ -1,13 +1,7 @@
1
1
  export { getPageConfig };
2
2
  export { getConfigValueFilePathToShowToUser };
3
3
  export { getHookFilePathToShowToUser };
4
- export { getConfigDefinedAtString, getDefinedAtString } from './helpers/getConfigDefinedAtString.js';
5
- export { getConfigValue } from './helpers/getConfigValue.js';
6
- import type { PageConfigRuntime, DefinedAt } from './PageConfig.js';
4
+ import type { PageConfigRuntime, DefinedAtData } from './PageConfig.js';
7
5
  declare function getPageConfig(pageId: string, pageConfigs: PageConfigRuntime[]): PageConfigRuntime;
8
- declare function getConfigValueFilePathToShowToUser({ definedAt }: {
9
- definedAt: DefinedAt;
10
- }): null | string;
11
- declare function getHookFilePathToShowToUser({ definedAt }: {
12
- definedAt: DefinedAt;
13
- }): string;
6
+ declare function getConfigValueFilePathToShowToUser(definedAtData: DefinedAtData): null | string;
7
+ declare function getHookFilePathToShowToUser(definedAtData: DefinedAtData): string;
@@ -1,27 +1,25 @@
1
1
  export { getPageConfig };
2
2
  export { getConfigValueFilePathToShowToUser };
3
3
  export { getHookFilePathToShowToUser };
4
- export { getConfigDefinedAtString, getDefinedAtString } from './helpers/getConfigDefinedAtString.js';
5
- export { getConfigValue } from './helpers/getConfigValue.js';
6
- import { assert } from '../utils.js';
4
+ import { assert, isArray } from '../utils.js';
7
5
  function getPageConfig(pageId, pageConfigs) {
8
6
  const pageConfig = pageConfigs.find((p) => p.pageId === pageId);
9
7
  assert(pageConfigs.length > 0);
10
8
  assert(pageConfig);
11
9
  return pageConfig;
12
10
  }
13
- function getConfigValueFilePathToShowToUser({ definedAt }) {
11
+ function getConfigValueFilePathToShowToUser(definedAtData) {
14
12
  // A unique file path only exists if the config value isn't cumulative nor computed:
15
13
  // - cumulative config values have multiple file paths
16
14
  // - computed values don't have any file path
17
- if ('isComputed' in definedAt || 'files' in definedAt)
15
+ if (!definedAtData || isArray(definedAtData))
18
16
  return null;
19
- const { filePathToShowToUser } = definedAt;
17
+ const { filePathToShowToUser } = definedAtData;
20
18
  assert(filePathToShowToUser);
21
19
  return filePathToShowToUser;
22
20
  }
23
- function getHookFilePathToShowToUser({ definedAt }) {
24
- const filePathToShowToUser = getConfigValueFilePathToShowToUser({ definedAt });
21
+ function getHookFilePathToShowToUser(definedAtData) {
22
+ const filePathToShowToUser = getConfigValueFilePathToShowToUser(definedAtData);
25
23
  assert(filePathToShowToUser);
26
24
  return filePathToShowToUser;
27
25
  }
@@ -2,7 +2,7 @@ export type { PageConfigRuntimeSerialized };
2
2
  export type { PageConfigGlobalRuntimeSerialized };
3
3
  export type { ConfigValueSerialized };
4
4
  export type { ConfigValueImported };
5
- import type { DefinedAt, PageConfigRuntime } from '../PageConfig.js';
5
+ import type { ConfigValueClassic, ConfigValueComputed, ConfigValueCumulative, PageConfigRuntime } from '../PageConfig.js';
6
6
  /** Page config data structure serialized in virtual files: parsing it results in PageConfigRuntime */
7
7
  type PageConfigRuntimeSerialized = Omit<PageConfigRuntime, 'configValues'> & {
8
8
  /** Config values that are serializable and loaded eagerly such as config.passToClient */
@@ -14,10 +14,13 @@ type PageConfigGlobalRuntimeSerialized = {
14
14
  configValuesImported: ConfigValueImported[];
15
15
  };
16
16
  /** Value is serialized */
17
- type ConfigValueSerialized = {
17
+ type ConfigValueSerialized = (Omit<ConfigValueClassic, 'value'> & {
18
18
  valueSerialized: string;
19
- definedAt: DefinedAt;
20
- };
19
+ }) | (Omit<ConfigValueCumulative, 'value'> & {
20
+ valueSerialized: string;
21
+ }) | (Omit<ConfigValueComputed, 'value'> & {
22
+ valueSerialized: string;
23
+ });
21
24
  /** Value is imported */
22
25
  type ConfigValueImported = {
23
26
  configName: string;
@@ -1,8 +1,8 @@
1
1
  export { assertPageConfigsSerialized };
2
2
  export { assertPageConfigGlobalSerialized };
3
- import { assert, isObject, hasProp } from '../../utils.js';
3
+ import { assert, isObject, hasProp, isArray } from '../../utils.js';
4
4
  function assertPageConfigsSerialized(pageConfigsSerialized) {
5
- assert(Array.isArray(pageConfigsSerialized));
5
+ assert(isArray(pageConfigsSerialized));
6
6
  pageConfigsSerialized.forEach((pageConfigSerialized) => {
7
7
  assert(isObject(pageConfigSerialized));
8
8
  assert(hasProp(pageConfigSerialized, 'pageId', 'string'));
@@ -51,8 +51,9 @@ function parseConfigValuesImported(configValuesImported) {
51
51
  assert(val);
52
52
  const { value, importPath, exportName } = val;
53
53
  configValues[configName] = {
54
+ type: 'classic',
54
55
  value,
55
- definedAt: {
56
+ definedAtData: {
56
57
  // importPath cannot be relative to the current file, since the current file is a virtual file
57
58
  filePathToShowToUser: importPath,
58
59
  fileExportPathToShowToUser: [configName, 'default'].includes(exportName)
@@ -1,16 +1,21 @@
1
1
  export { parseConfigValuesSerialized };
2
- import { assert } from '../../utils.js';
2
+ import { assert, isArray } from '../../utils.js';
3
3
  import { parse } from '@brillout/json-serializer/parse';
4
4
  function parseConfigValuesSerialized(configValuesSerialized) {
5
5
  const configValues = {};
6
6
  Object.entries(configValuesSerialized).forEach(([configName, configValueSeriliazed]) => {
7
- const { valueSerialized, definedAt } = configValueSeriliazed;
8
- assert(valueSerialized);
9
7
  assert(!configValues[configName]);
10
- configValues[configName] = {
11
- value: parse(valueSerialized),
12
- definedAt
13
- };
8
+ const { valueSerialized, ...common } = configValueSeriliazed;
9
+ const value = parse(valueSerialized);
10
+ let configValue;
11
+ if (common.type === 'cumulative') {
12
+ assert(isArray(value));
13
+ configValue = { value, ...common };
14
+ }
15
+ else {
16
+ configValue = { value, ...common };
17
+ }
18
+ configValues[configName] = configValue;
14
19
  });
15
20
  return configValues;
16
21
  }
@@ -1,7 +1,7 @@
1
1
  export { parsePageConfigs };
2
2
  import { parseConfigValuesImported } from './parseConfigValuesImported.js';
3
- import { assertUsage, isCallable } from '../../utils.js';
4
- import { getConfigDefinedAtString } from '../helpers.js';
3
+ import { assert, assertUsage, isCallable } from '../../utils.js';
4
+ import { getConfigDefinedAt } from '../getConfigDefinedAt.js';
5
5
  import { parseConfigValuesSerialized } from './parseConfigValuesSerialized.js';
6
6
  function parsePageConfigs(pageConfigsSerialized, pageConfigGlobalSerialized) {
7
7
  const pageConfigs = pageConfigsSerialized.map((pageConfigSerialized) => {
@@ -38,9 +38,10 @@ function assertRouteConfigValue(configValues) {
38
38
  const configValue = configValues[configName];
39
39
  if (!configValue)
40
40
  return;
41
- const { value } = configValue;
41
+ const { value, definedAtData } = configValue;
42
42
  const configValueType = typeof value;
43
- const configDefinedAt = getConfigDefinedAtString('Config', configName, configValue);
43
+ assert(definedAtData);
44
+ const configDefinedAt = getConfigDefinedAt('Config', configName, definedAtData);
44
45
  assertUsage(configValueType === 'string' || isCallable(value), `${configDefinedAt} has an invalid type '${configValueType}': it should be a string or a function instead, see https://vike.dev/route`);
45
46
  /* We don't use assertRouteString() in order to avoid unnecessarily bloating the client-side bundle when using Server Routing:
46
47
  * - When using Server Routing, this file is loaded => loading assertRouteString() would bloat the client bundle.
@@ -13,7 +13,7 @@ function serializeConfigValue(lines, configName, configValueSerialized) {
13
13
  lines.push(`${whitespace}['${configName}']: {`);
14
14
  whitespace += ' ';
15
15
  Object.entries(configValueSerialized).forEach(([key, val]) => {
16
- const valSerialized = key === 'definedAt' ? JSON.stringify(val) : val;
16
+ const valSerialized = key === 'valueSerialized' ? val : JSON.stringify(val);
17
17
  lines.push(`${whitespace} ${key}: ${valSerialized},`);
18
18
  });
19
19
  whitespace = whitespace.slice(2);
@@ -22,9 +22,9 @@ function serializeConfigValue(lines, configName, configValueSerialized) {
22
22
  function serializeConfigValueImported(configValueSource, configName, whitespace, varCounterContainer, importStatements) {
23
23
  assert(!configValueSource.valueIsFilePath);
24
24
  assert(whitespace.replaceAll(' ', '').length === 0);
25
- const { valueIsImportedAtRuntime, valueIsDefinedByValueFile, definedAt } = configValueSource;
25
+ const { valueIsImportedAtRuntime, valueIsDefinedByValueFile, definedAtFilePath } = configValueSource;
26
26
  assert(valueIsImportedAtRuntime);
27
- const { filePathAbsoluteVite, fileExportName } = definedAt;
27
+ const { filePathAbsoluteVite, fileExportName } = definedAtFilePath;
28
28
  if (valueIsDefinedByValueFile)
29
29
  assert(fileExportName === undefined);
30
30
  const { importName, importStatement } = generateEagerImport(filePathAbsoluteVite, varCounterContainer.varCounter++, fileExportName);
@@ -69,8 +69,8 @@ async function route(pageContextForRoute) {
69
69
  }
70
70
  // Route Function defined in `.page.route.js`
71
71
  if (pageRoute.routeType === 'FUNCTION') {
72
- const { routeFunction, routeDefinedAt } = pageRoute;
73
- const match = await resolveRouteFunction(routeFunction, pageContext, routeDefinedAt);
72
+ const { routeFunction, routeDefinedAtString } = pageRoute;
73
+ const match = await resolveRouteFunction(routeFunction, pageContext, routeDefinedAtString);
74
74
  if (match) {
75
75
  const { routeParams, precedence } = match;
76
76
  routeMatches.push({ pageId, precedence, routeParams, routeType });
@@ -9,16 +9,16 @@ type PageRoute = {
9
9
  comesFromV1PageConfig: boolean;
10
10
  } & ({
11
11
  routeString: string;
12
- routeDefinedAt: null;
12
+ routeDefinedAtString: null;
13
13
  routeType: 'FILESYSTEM';
14
14
  routeFilesystemDefinedBy: string;
15
15
  } | {
16
16
  routeString: string;
17
- routeDefinedAt: string;
17
+ routeDefinedAtString: string;
18
18
  routeType: 'STRING';
19
19
  } | {
20
20
  routeFunction: Function;
21
- routeDefinedAt: string;
21
+ routeDefinedAtString: string;
22
22
  routeType: 'FUNCTION';
23
23
  });
24
24
  type PageRoutes = PageRoute[];
@@ -3,7 +3,8 @@ import { isErrorPageId } from '../error-page.js';
3
3
  import { assert, assertUsage, hasProp, slice } from './utils.js';
4
4
  import { deduceRouteStringFromFilesystemPath } from './deduceRouteStringFromFilesystemPath.js';
5
5
  import { isCallable } from '../utils.js';
6
- import { getConfigValue, getDefinedAtString } from '../page-configs/helpers.js';
6
+ import { getConfigValue } from '../page-configs/getConfigValue.js';
7
+ import { getDefinedAtString } from '../page-configs/getConfigDefinedAt.js';
7
8
  import { warnDeprecatedAllowKey } from './resolveRouteFunction.js';
8
9
  import { getHookFromPageConfigGlobal, getHookTimeoutDefault } from '../hooks/getHook.js';
9
10
  async function loadPageRoutes(
@@ -30,13 +31,14 @@ function getPageRoutes(filesystemRoots, pageFilesAll, pageConfigs, allPageIds) {
30
31
  const configValue = getConfigValue(pageConfig, configName);
31
32
  if (configValue) {
32
33
  const route = configValue.value;
33
- const definedAt = getDefinedAtString(configValue.definedAt, configName);
34
+ assert(configValue.definedAtData);
35
+ const definedAtString = getDefinedAtString(configValue.definedAtData, configName);
34
36
  if (typeof route === 'string') {
35
37
  pageRoute = {
36
38
  pageId,
37
39
  comesFromV1PageConfig,
38
40
  routeString: route,
39
- routeDefinedAt: definedAt,
41
+ routeDefinedAtString: definedAtString,
40
42
  routeType: 'STRING'
41
43
  };
42
44
  }
@@ -48,7 +50,7 @@ function getPageRoutes(filesystemRoots, pageFilesAll, pageConfigs, allPageIds) {
48
50
  pageId,
49
51
  comesFromV1PageConfig,
50
52
  routeFunction: route,
51
- routeDefinedAt: definedAt,
53
+ routeDefinedAtString: definedAtString,
52
54
  routeType: 'FUNCTION'
53
55
  };
54
56
  }
@@ -64,7 +66,7 @@ function getPageRoutes(filesystemRoots, pageFilesAll, pageConfigs, allPageIds) {
64
66
  routeFilesystemDefinedBy: definedBy,
65
67
  comesFromV1PageConfig,
66
68
  routeString,
67
- routeDefinedAt: null,
69
+ routeDefinedAtString: null,
68
70
  routeType: 'FILESYSTEM'
69
71
  };
70
72
  }
@@ -89,7 +91,7 @@ function getPageRoutes(filesystemRoots, pageFilesAll, pageConfigs, allPageIds) {
89
91
  pageId,
90
92
  comesFromV1PageConfig,
91
93
  routeString,
92
- routeDefinedAt: null,
94
+ routeDefinedAtString: null,
93
95
  routeFilesystemDefinedBy: `${pageId}.page.*`,
94
96
  routeType: 'FILESYSTEM'
95
97
  });
@@ -104,7 +106,7 @@ function getPageRoutes(filesystemRoots, pageFilesAll, pageConfigs, allPageIds) {
104
106
  pageId,
105
107
  comesFromV1PageConfig,
106
108
  routeString,
107
- routeDefinedAt: filePath,
109
+ routeDefinedAtString: filePath,
108
110
  routeType: 'STRING'
109
111
  });
110
112
  return;
@@ -121,7 +123,7 @@ function getPageRoutes(filesystemRoots, pageFilesAll, pageConfigs, allPageIds) {
121
123
  pageId,
122
124
  comesFromV1PageConfig,
123
125
  routeFunction,
124
- routeDefinedAt: filePath,
126
+ routeDefinedAtString: filePath,
125
127
  routeType: 'FUNCTION'
126
128
  });
127
129
  return;
@@ -3,7 +3,7 @@ export { assertRouteParams };
3
3
  export { assertSyncRouting };
4
4
  export { warnDeprecatedAllowKey };
5
5
  import { PageContextUrlComputedPropsInternal } from '../addUrlComputedProps.js';
6
- declare function resolveRouteFunction(routeFunction: Function, pageContext: PageContextUrlComputedPropsInternal, routeDefinedAt: string): Promise<null | {
6
+ declare function resolveRouteFunction(routeFunction: Function, pageContext: PageContextUrlComputedPropsInternal, routeDefinedAtString: string): Promise<null | {
7
7
  precedence: number | null;
8
8
  routeParams: Record<string, string>;
9
9
  }>;
@@ -3,12 +3,12 @@ export { assertRouteParams };
3
3
  export { assertSyncRouting };
4
4
  export { warnDeprecatedAllowKey };
5
5
  import { assertPageContextUrlComputedProps } from '../addUrlComputedProps.js';
6
- import { assert, assertUsage, assertWarning, hasProp, isPlainObject, isPromise, isStringRecord } from './utils.js';
6
+ import { assert, assertUsage, assertWarning, hasProp, isPlainObject, isPromise } from './utils.js';
7
7
  import pc from '@brillout/picocolors';
8
- async function resolveRouteFunction(routeFunction, pageContext, routeDefinedAt) {
8
+ async function resolveRouteFunction(routeFunction, pageContext, routeDefinedAtString) {
9
9
  assertPageContextUrlComputedProps(pageContext);
10
10
  let result = routeFunction(pageContext);
11
- assertSyncRouting(result, `The Route Function ${routeDefinedAt}`);
11
+ assertSyncRouting(result, `The Route Function ${routeDefinedAtString}`);
12
12
  // TODO/v1-release: make resolveRouteFunction() and route() sync
13
13
  //* We disallow asynchronous routing, because we need to check whether a link is a Vike link in a synchronous fashion before calling ev.preventDefault() in the 'click' event listener
14
14
  result = await result;
@@ -19,11 +19,11 @@ async function resolveRouteFunction(routeFunction, pageContext, routeDefinedAt)
19
19
  if (result === true) {
20
20
  result = {};
21
21
  }
22
- assertUsage(isPlainObject(result), `The Route Function ${routeDefinedAt} should return a boolean or a plain JavaScript object (but it's ${pc.cyan(`typeof result === ${JSON.stringify(typeof result)}`)} instead)`);
22
+ assertUsage(isPlainObject(result), `The Route Function ${routeDefinedAtString} should return a boolean or a plain JavaScript object (but it's ${pc.cyan(`typeof result === ${JSON.stringify(typeof result)}`)} instead)`);
23
23
  // AFAICT this return interface is superfluous. Should we soft-deprecate it and remove it?
24
24
  if ('match' in result) {
25
25
  const { match } = result;
26
- assertUsage(typeof match === 'boolean', `The ${pc.cyan('match')} value returned by the Route Function ${routeDefinedAt} should be a boolean.`);
26
+ assertUsage(typeof match === 'boolean', `The ${pc.cyan('match')} value returned by the Route Function ${routeDefinedAtString} should be a boolean.`);
27
27
  if (!match) {
28
28
  return null;
29
29
  }
@@ -31,14 +31,14 @@ async function resolveRouteFunction(routeFunction, pageContext, routeDefinedAt)
31
31
  let precedence = null;
32
32
  if ('precedence' in result) {
33
33
  precedence = result.precedence;
34
- assertUsage(typeof precedence === 'number', `The ${pc.cyan('precedence')} value returned by the Route Function ${routeDefinedAt} should be a number.`);
34
+ assertUsage(typeof precedence === 'number', `The ${pc.cyan('precedence')} value returned by the Route Function ${routeDefinedAtString} should be a number.`);
35
35
  }
36
- assertRouteParams(result, `The ${pc.cyan('routeParams')} object returned by the Route Function ${routeDefinedAt} should`);
36
+ assertRouteParams(result, `The ${pc.cyan('routeParams')} object returned by the Route Function ${routeDefinedAtString} should`);
37
37
  const routeParams = result.routeParams || {};
38
38
  assertUsage(!('pageContext' in result), `Providing ${pc.cyan('pageContext')} in Route Functions is prohibited, see https://vike.dev/route-function#cannot-provide-pagecontext`);
39
39
  assert(isPlainObject(routeParams));
40
40
  Object.keys(result).forEach((key) => {
41
- assertUsage(key === 'match' || key === 'routeParams' || key === 'precedence', `The Route Function ${routeDefinedAt} returned an object with an unknown property ${pc.cyan(key)} (the known properties are ${pc.cyan('match')}, ${pc.cyan('routeParams')}, and ${pc.cyan('precedence')})`);
41
+ assertUsage(key === 'match' || key === 'routeParams' || key === 'precedence', `The Route Function ${routeDefinedAtString} returned an object with an unknown property ${pc.cyan(key)} (the known properties are ${pc.cyan('match')}, ${pc.cyan('routeParams')}, and ${pc.cyan('precedence')})`);
42
42
  });
43
43
  return {
44
44
  precedence,
@@ -60,6 +60,5 @@ function assertRouteParams(result, errPrefix) {
60
60
  return;
61
61
  }
62
62
  assert(errPrefix.endsWith(' should'));
63
- assertUsage(isPlainObject(result.routeParams), `${errPrefix} be a plain JavaScript object.`);
64
- assertUsage(isStringRecord(result.routeParams), `${errPrefix} only hold string values.`);
63
+ assertUsage(hasProp(result, 'routeParams', 'string{}'), `${errPrefix} be an object holding string values.`);
65
64
  }
@@ -10,8 +10,6 @@ declare function resolveRouteString(routeString: string, urlPathname: string): n
10
10
  };
11
11
  type Segment = {
12
12
  glob: true;
13
- /** Make route /a/* match URL /a */
14
- isLastDir?: true;
15
13
  static?: undefined;
16
14
  param?: undefined;
17
15
  } | {