vike 0.4.224-commit-00ed9fe → 0.4.225-commit-37a36a5

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 (112) hide show
  1. package/dist/cjs/node/api/build.js +1 -1
  2. package/dist/cjs/node/api/context.js +4 -4
  3. package/dist/cjs/node/api/dev.js +1 -1
  4. package/dist/cjs/node/api/prepareViteApiCall.js +3 -2
  5. package/dist/cjs/node/api/prerender.js +1 -1
  6. package/dist/cjs/node/api/preview.js +1 -1
  7. package/dist/cjs/node/cli/context.js +5 -4
  8. package/dist/cjs/node/cli/entry.js +3 -3
  9. package/dist/cjs/node/cli/parseCli.js +43 -15
  10. package/dist/cjs/node/cli/utils.js +1 -1
  11. package/dist/cjs/node/plugin/plugins/build/pluginBuildEntry.js +1 -1
  12. package/dist/cjs/node/plugin/plugins/commonConfig.js +15 -4
  13. package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +6 -4
  14. package/dist/cjs/node/plugin/plugins/importUserCode/index.js +14 -10
  15. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +10 -2
  16. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +11 -12
  17. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +138 -83
  18. package/dist/cjs/node/plugin/plugins/setGlobalContext.js +10 -1
  19. package/dist/cjs/node/plugin/shared/getEnvVarObject.js +9 -8
  20. package/dist/cjs/node/plugin/shared/loggerNotProd/log.js +1 -1
  21. package/dist/cjs/node/prerender/resolvePrerenderConfig.js +25 -17
  22. package/dist/cjs/node/prerender/runPrerender.js +2 -2
  23. package/dist/cjs/node/prerender/utils.js +1 -1
  24. package/dist/cjs/node/runtime/globalContext.js +9 -5
  25. package/dist/cjs/node/runtime/html/injectAssets/getViteDevScript.js +6 -3
  26. package/dist/cjs/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +3 -2
  27. package/dist/cjs/node/runtime/utils.js +0 -1
  28. package/dist/cjs/node/runtime-dev/createDevMiddleware.js +10 -8
  29. package/dist/cjs/node/shared/assertV1Design.js +2 -1
  30. package/dist/cjs/node/shared/utils.js +0 -1
  31. package/dist/cjs/shared/page-configs/getConfigDefinedAt.js +19 -2
  32. package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +8 -5
  33. package/dist/cjs/shared/page-configs/helpers.js +1 -1
  34. package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +2 -5
  35. package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +9 -5
  36. package/dist/cjs/shared/route/loadPageRoutes.js +2 -2
  37. package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
  38. package/dist/cjs/utils/assert.js +11 -4
  39. package/dist/cjs/utils/assertSingleInstance.js +11 -17
  40. package/dist/cjs/utils/getRandomId.js +1 -1
  41. package/dist/cjs/utils/normalizeHeaders.js +1 -1
  42. package/dist/esm/client/client-routing-runtime/createPageContext.d.ts +1 -1
  43. package/dist/esm/client/client-routing-runtime/createPageContext.js +2 -2
  44. package/dist/esm/node/api/build.js +1 -1
  45. package/dist/esm/node/api/context.d.ts +8 -2
  46. package/dist/esm/node/api/context.js +4 -4
  47. package/dist/esm/node/api/dev.js +1 -1
  48. package/dist/esm/node/api/prepareViteApiCall.d.ts +2 -2
  49. package/dist/esm/node/api/prepareViteApiCall.js +3 -2
  50. package/dist/esm/node/api/prerender.js +1 -1
  51. package/dist/esm/node/api/preview.js +1 -1
  52. package/dist/esm/node/api/types.d.ts +7 -0
  53. package/dist/esm/node/cli/context.d.ts +4 -2
  54. package/dist/esm/node/cli/context.js +5 -4
  55. package/dist/esm/node/cli/entry.js +4 -4
  56. package/dist/esm/node/cli/parseCli.d.ts +3 -0
  57. package/dist/esm/node/cli/parseCli.js +44 -16
  58. package/dist/esm/node/cli/utils.d.ts +1 -1
  59. package/dist/esm/node/cli/utils.js +1 -1
  60. package/dist/esm/node/plugin/plugins/build/pluginBuildEntry.js +2 -2
  61. package/dist/esm/node/plugin/plugins/commonConfig.js +15 -4
  62. package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +6 -4
  63. package/dist/esm/node/plugin/plugins/importUserCode/index.js +15 -11
  64. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.d.ts +3 -1
  65. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +10 -2
  66. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.d.ts +5 -2
  67. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +11 -12
  68. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +3 -2
  69. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +140 -84
  70. package/dist/esm/node/plugin/plugins/setGlobalContext.js +11 -2
  71. package/dist/esm/node/plugin/shared/getEnvVarObject.d.ts +3 -1
  72. package/dist/esm/node/plugin/shared/getEnvVarObject.js +9 -8
  73. package/dist/esm/node/plugin/shared/loggerNotProd/log.js +2 -2
  74. package/dist/esm/node/prerender/resolvePrerenderConfig.js +26 -18
  75. package/dist/esm/node/prerender/runPrerender.js +3 -3
  76. package/dist/esm/node/prerender/utils.d.ts +1 -1
  77. package/dist/esm/node/prerender/utils.js +1 -1
  78. package/dist/esm/node/runtime/globalContext.js +10 -6
  79. package/dist/esm/node/runtime/html/injectAssets/getViteDevScript.js +6 -3
  80. package/dist/esm/node/runtime/index-deprecated.d.ts +1 -3
  81. package/dist/esm/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.d.ts +1 -1
  82. package/dist/esm/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +3 -2
  83. package/dist/esm/node/runtime/utils.d.ts +0 -1
  84. package/dist/esm/node/runtime/utils.js +0 -1
  85. package/dist/esm/node/runtime-dev/createDevMiddleware.js +10 -8
  86. package/dist/esm/node/shared/assertV1Design.js +2 -1
  87. package/dist/esm/node/shared/utils.d.ts +0 -1
  88. package/dist/esm/node/shared/utils.js +0 -1
  89. package/dist/esm/shared/page-configs/Config.d.ts +19 -1
  90. package/dist/esm/shared/page-configs/PageConfig.d.ts +16 -5
  91. package/dist/esm/shared/page-configs/getConfigDefinedAt.d.ts +5 -3
  92. package/dist/esm/shared/page-configs/getConfigDefinedAt.js +20 -3
  93. package/dist/esm/shared/page-configs/getConfigValueBuildTime.js +8 -5
  94. package/dist/esm/shared/page-configs/helpers.js +1 -1
  95. package/dist/esm/shared/page-configs/serialize/parsePageConfigs.d.ts +1 -1
  96. package/dist/esm/shared/page-configs/serialize/parsePageConfigs.js +2 -5
  97. package/dist/esm/shared/page-configs/serialize/serializeConfigValues.d.ts +3 -3
  98. package/dist/esm/shared/page-configs/serialize/serializeConfigValues.js +9 -5
  99. package/dist/esm/shared/route/loadPageRoutes.js +2 -2
  100. package/dist/esm/shared/types.d.ts +5 -1
  101. package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
  102. package/dist/esm/utils/PROJECT_VERSION.js +1 -1
  103. package/dist/esm/utils/assert.d.ts +2 -1
  104. package/dist/esm/utils/assert.js +11 -4
  105. package/dist/esm/utils/assertSingleInstance.js +11 -17
  106. package/dist/esm/utils/getRandomId.d.ts +1 -1
  107. package/dist/esm/utils/getRandomId.js +1 -1
  108. package/dist/esm/utils/normalizeHeaders.js +1 -1
  109. package/package.json +5 -3
  110. package/dist/cjs/utils/projectInfo.js +0 -8
  111. package/dist/esm/utils/projectInfo.d.ts +0 -4
  112. package/dist/esm/utils/projectInfo.js +0 -5
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.224-commit-00ed9fe";
1
+ export declare const PROJECT_VERSION: "0.4.225-commit-37a36a5";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.224-commit-00ed9fe';
2
+ export const PROJECT_VERSION = '0.4.225-commit-37a36a5';
@@ -10,8 +10,9 @@ export { isBug };
10
10
  export { setAlwaysShowStackTrace };
11
11
  type Logger = (msg: string | Error, logType: 'warn' | 'info') => void;
12
12
  declare function assert(condition: unknown, debugInfo?: unknown): asserts condition;
13
- declare function assertUsage(condition: unknown, errMsg: string, { showStackTrace }?: {
13
+ declare function assertUsage(condition: unknown, errMsg: string, { showStackTrace, exitOnError }?: {
14
14
  showStackTrace?: true;
15
+ exitOnError?: boolean;
15
16
  }): asserts condition;
16
17
  declare function getProjectError(errMsg: string): Error;
17
18
  declare function assertWarning(condition: unknown, msg: string, { onlyOnce, showStackTrace }: {
@@ -12,7 +12,7 @@ import { assertSingleInstance_onAssertModuleLoad } from './assertSingleInstance.
12
12
  import { createErrorWithCleanStackTrace } from './createErrorWithCleanStackTrace.js';
13
13
  import { getGlobalObject } from './getGlobalObject.js';
14
14
  import { isObject } from './isObject.js';
15
- import { projectInfo } from './projectInfo.js';
15
+ import { PROJECT_VERSION } from './PROJECT_VERSION.js';
16
16
  import pc from '@brillout/picocolors';
17
17
  const globalObject = getGlobalObject('utils/assert.ts', {
18
18
  alreadyLogged: new Set(),
@@ -29,7 +29,7 @@ const globalObject = getGlobalObject('utils/assert.ts', {
29
29
  });
30
30
  assertSingleInstance_onAssertModuleLoad();
31
31
  const projectTag = `[vike]`;
32
- const projectTagWithVersion = `[vike@${projectInfo.projectVersion}]`;
32
+ const projectTagWithVersion = `[vike@${PROJECT_VERSION}]`;
33
33
  const bugTag = 'Bug';
34
34
  const numberOfStackTraceLinesToRemove = 2;
35
35
  function assert(condition, debugInfo) {
@@ -56,7 +56,7 @@ function assert(condition, debugInfo) {
56
56
  globalObject.onBeforeLog?.();
57
57
  throw internalError;
58
58
  }
59
- function assertUsage(condition, errMsg, { showStackTrace } = {}) {
59
+ function assertUsage(condition, errMsg, { showStackTrace, exitOnError } = {}) {
60
60
  if (condition)
61
61
  return;
62
62
  showStackTrace = showStackTrace || globalObject.alwaysShowStackTrace;
@@ -68,7 +68,13 @@ function assertUsage(condition, errMsg, { showStackTrace } = {}) {
68
68
  globalObject.showStackTraceList.add(usageError);
69
69
  }
70
70
  globalObject.onBeforeLog?.();
71
- throw usageError;
71
+ if (!exitOnError) {
72
+ throw usageError;
73
+ }
74
+ else {
75
+ console.error(showStackTrace ? usageError : errMsg);
76
+ process.exit(1);
77
+ }
72
78
  }
73
79
  function getProjectError(errMsg) {
74
80
  errMsg = addWhitespace(errMsg);
@@ -182,6 +188,7 @@ function overwriteAssertProductionLogger(logger) {
182
188
  function isBug(err) {
183
189
  return String(err).includes(`[${bugTag}]`);
184
190
  }
191
+ // Called upon `DEBUG=vike:error`
185
192
  function setAlwaysShowStackTrace() {
186
193
  globalObject.alwaysShowStackTrace = true;
187
194
  }
@@ -1,15 +1,15 @@
1
1
  export { assertSingleInstance_onClientEntryServerRouting };
2
2
  export { assertSingleInstance_onClientEntryClientRouting };
3
3
  export { assertSingleInstance_onAssertModuleLoad };
4
- // - Throw error if there are two different versions of vike loaded
4
+ // - Show warning if there are two different Vike versions loaded
5
5
  // - Show warning if entry of Client Routing and entry of Server Routing are both loaded
6
- // - Show warning if vike is loaded twice
6
+ // - Show warning if Vike is loaded twice
7
7
  import { unique } from './unique.js';
8
8
  import { getGlobalObject } from './getGlobalObject.js';
9
- import { projectInfo } from './projectInfo.js';
10
9
  import pc from '@brillout/picocolors';
11
- /* Use original assertUsage() & assertWarning() after all CJS is removed from node_modules/vike/dist/
12
- import { assertUsage, assertWarning } from './assert.js'
10
+ import { PROJECT_VERSION } from './PROJECT_VERSION.js';
11
+ /* Use original assertWarning() after all CJS is removed from node_modules/vike/dist/
12
+ import { assertWarning } from './assert.js'
13
13
  */
14
14
  const globalObject = getGlobalObject('utils/assertSingleInstance.ts', {
15
15
  instances: [],
@@ -20,9 +20,10 @@ const clientNotSingleInstance = 'Client runtime loaded twice https://vike.dev/cl
20
20
  function assertSingleInstance() {
21
21
  {
22
22
  const versions = unique(globalObject.instances);
23
- assertUsage(versions.length <= 1,
24
- // DO *NOT* patch vike to remove this error: because of multiple conflicting versions, you *will* eventually encounter insidious issues that hard to debug and potentially a security hazard, see for example https://github.com/vikejs/vike/issues/1108
25
- `vike@${pc.bold(versions[0])} and vike@${pc.bold(versions[1])} loaded but it's forbidden to load different versions`);
23
+ assertWarning(versions.length <= 1,
24
+ // Do *NOT* patch Vike to remove this warning: you *will* eventually encounter the issues listed at https://vike.dev/warning/version-mismatch
25
+ // - This happened before: https://github.com/vikejs/vike/issues/1108#issuecomment-1719061509
26
+ `vike@${pc.bold(versions[0])} and vike@${pc.bold(versions[1])} loaded which is highly discouraged, see ${pc.underline('https://vike.dev/warning/version-mismatch')}`, { onlyOnce: true, showStackTrace: false });
26
27
  }
27
28
  if (globalObject.checkSingleInstance && globalObject.instances.length > 1) {
28
29
  /*/ Not sure whether circular dependency can cause problems? In principle not since client-side code is ESM.
@@ -62,21 +63,14 @@ function assertSingleInstance_onClientEntryClientRouting(isProduction) {
62
63
  }
63
64
  // Called by utils/assert.ts which is (most certainly) loaded by all entries. That way we don't have to call a callback for every entry. (There are a lot of entries: `client/router/`, `client/`, `node/runtime/`, `node/plugin/`, `node/cli`.)
64
65
  function assertSingleInstance_onAssertModuleLoad() {
65
- globalObject.instances.push(projectInfo.projectVersion);
66
+ globalObject.instances.push(PROJECT_VERSION);
66
67
  assertSingleInstance();
67
68
  }
68
- function assertUsage(condition, errorMessage) {
69
- if (condition) {
70
- return;
71
- }
72
- const errMsg = `[vike][Wrong Usage] ${errorMessage}`;
73
- throw new Error(errMsg);
74
- }
75
69
  function assertWarning(condition, errorMessage, { onlyOnce, showStackTrace }) {
76
70
  if (condition) {
77
71
  return;
78
72
  }
79
- const msg = `[vike][Warning] ${errorMessage}`;
73
+ const msg = `[Vike][Warning] ${errorMessage}`;
80
74
  if (onlyOnce) {
81
75
  const { alreadyLogged } = globalObject;
82
76
  const key = onlyOnce === true ? msg : onlyOnce;
@@ -1,2 +1,2 @@
1
1
  export { getRandomId };
2
- declare function getRandomId(length: number): string;
2
+ declare function getRandomId(length?: number): string;
@@ -1,7 +1,7 @@
1
1
  export { getRandomId };
2
2
  import { assert } from './assert.js';
3
3
  // https://stackoverflow.com/questions/1349404/generate-random-string-characters-in-javascript
4
- function getRandomId(length) {
4
+ function getRandomId(length = 12) {
5
5
  let randomId = '';
6
6
  while (randomId.length < length) {
7
7
  randomId += Math.random().toString(36).slice(2);
@@ -1,7 +1,7 @@
1
1
  export { normalizeHeaders };
2
2
  import { isObject } from './isObject.js';
3
3
  function normalizeHeaders(
4
- /* This type is precise, too precise which can be annoying: e.g. cannot pass a string[][] argument because it doesn't match the more precise [string,string][] type.
4
+ /* This type is too strict which is annoying: cannot pass `string[][]` because it doesn't match the more precise type `[string,string][]`.
5
5
  headersOriginal ConstructorParameters<typeof Headers>[0]
6
6
  */
7
7
  headersOriginal) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.224-commit-00ed9fe",
3
+ "version": "0.4.225-commit-37a36a5",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {
@@ -254,8 +254,8 @@
254
254
  "@types/source-map-support": "^0.5.10",
255
255
  "react-streaming": "^0.3.47",
256
256
  "rimraf": "^5.0.5",
257
- "typescript": "^5.7.3",
258
- "vite": "^6.2.0"
257
+ "typescript": "^5.8.2",
258
+ "vite": "^6.2.1"
259
259
  },
260
260
  "scripts": {
261
261
  "dev": "tsc --watch",
@@ -264,8 +264,10 @@
264
264
  "build:cjs": "pnpm run build:cjs:ts && pnpm run build:cjs:fixup",
265
265
  "build:cjs:ts": "tsc --project ./tsconfig.cjs.json",
266
266
  "build:cjs:fixup": "node ./dist-cjs-fixup.mjs",
267
+ "========= Release": "",
267
268
  "release": "release-me patch",
268
269
  "release:minor": "release-me minor",
270
+ "release:major": "release-me major",
269
271
  "release:commit": "release-me commit"
270
272
  }
271
273
  }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.projectInfo = void 0;
4
- const PROJECT_VERSION_js_1 = require("./PROJECT_VERSION.js");
5
- exports.projectInfo = {
6
- projectName: 'Vike',
7
- projectVersion: PROJECT_VERSION_js_1.PROJECT_VERSION
8
- };
@@ -1,4 +0,0 @@
1
- export declare const projectInfo: {
2
- projectName: "Vike";
3
- projectVersion: "0.4.224-commit-00ed9fe";
4
- };
@@ -1,5 +0,0 @@
1
- import { PROJECT_VERSION } from './PROJECT_VERSION.js';
2
- export const projectInfo = {
3
- projectName: 'Vike',
4
- projectVersion: PROJECT_VERSION
5
- };