vike 0.4.156 → 0.4.158

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 (70) hide show
  1. package/dist/cjs/node/plugin/plugins/commonConfig.js +21 -2
  2. package/dist/cjs/node/plugin/plugins/distFileNames.js +3 -3
  3. package/dist/cjs/node/plugin/plugins/importBuild/index.js +1 -1
  4. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +3 -1
  5. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +2 -0
  6. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +2 -0
  7. package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx.js +1 -1
  8. package/dist/cjs/node/prerender/runPrerender.js +2 -0
  9. package/dist/cjs/node/runtime/html/injectAssets/getHtmlTags.js +2 -2
  10. package/dist/cjs/node/runtime/html/injectAssets/inferHtmlTags.js +1 -1
  11. package/dist/cjs/node/runtime/html/serializePageContextClientSide.js +2 -2
  12. package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +8 -1
  13. package/dist/cjs/node/runtime/renderPage/isNewError.js +3 -1
  14. package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +3 -3
  15. package/dist/cjs/node/runtime/renderPage.js +8 -10
  16. package/dist/cjs/node/shared/extractAssetsQuery.js +7 -6
  17. package/dist/cjs/shared/addUrlComputedProps.js +22 -2
  18. package/dist/cjs/shared/hooks/executeHook.js +1 -1
  19. package/dist/cjs/shared/misc/isServerSideError.js +4 -0
  20. package/dist/cjs/shared/route/abort.js +19 -8
  21. package/dist/cjs/shared/route/index.js +3 -1
  22. package/dist/cjs/shared/route/resolveRedirects.js +2 -3
  23. package/dist/cjs/utils/assert.js +1 -1
  24. package/dist/cjs/utils/debug.js +2 -1
  25. package/dist/cjs/utils/parseUrl-extras.js +1 -6
  26. package/dist/cjs/utils/parseUrl.js +6 -1
  27. package/dist/cjs/utils/projectInfo.js +1 -1
  28. package/dist/esm/client/client-routing-runtime/getPageContextFromHooks.d.ts +12 -11
  29. package/dist/esm/client/client-routing-runtime/getPageContextFromHooks.js +16 -32
  30. package/dist/esm/client/client-routing-runtime/prefetch.js +1 -1
  31. package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +65 -60
  32. package/dist/esm/client/shared/loadUserFilesClientSide.js +3 -1
  33. package/dist/esm/node/plugin/plugins/commonConfig.js +21 -2
  34. package/dist/esm/node/plugin/plugins/distFileNames.js +3 -3
  35. package/dist/esm/node/plugin/plugins/importBuild/index.js +1 -1
  36. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +3 -1
  37. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +2 -0
  38. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +2 -0
  39. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx.js +1 -1
  40. package/dist/esm/node/prerender/runPrerender.js +2 -0
  41. package/dist/esm/node/runtime/html/injectAssets/getHtmlTags.js +2 -2
  42. package/dist/esm/node/runtime/html/injectAssets/inferHtmlTags.js +1 -1
  43. package/dist/esm/node/runtime/html/serializePageContextClientSide.js +2 -2
  44. package/dist/esm/node/runtime/renderPage/getHttpResponseBody.d.ts +1 -0
  45. package/dist/esm/node/runtime/renderPage/getHttpResponseBody.js +8 -1
  46. package/dist/esm/node/runtime/renderPage/isNewError.js +3 -1
  47. package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +3 -3
  48. package/dist/esm/node/runtime/renderPage.js +8 -10
  49. package/dist/esm/node/shared/extractAssetsQuery.js +7 -6
  50. package/dist/esm/shared/addUrlComputedProps.js +22 -2
  51. package/dist/esm/shared/hooks/executeHook.js +1 -1
  52. package/dist/esm/shared/misc/isServerSideError.d.ts +1 -0
  53. package/dist/esm/shared/misc/isServerSideError.js +1 -0
  54. package/dist/esm/shared/page-configs/Config.d.ts +2 -2
  55. package/dist/esm/shared/route/abort.d.ts +6 -1
  56. package/dist/esm/shared/route/abort.js +20 -9
  57. package/dist/esm/shared/route/index.js +3 -1
  58. package/dist/esm/shared/route/resolveRedirects.js +1 -2
  59. package/dist/esm/utils/assert.js +1 -1
  60. package/dist/esm/utils/debug.js +2 -1
  61. package/dist/esm/utils/parseUrl-extras.d.ts +0 -2
  62. package/dist/esm/utils/parseUrl-extras.js +0 -5
  63. package/dist/esm/utils/parseUrl.d.ts +2 -0
  64. package/dist/esm/utils/parseUrl.js +5 -0
  65. package/dist/esm/utils/projectInfo.d.ts +2 -2
  66. package/dist/esm/utils/projectInfo.js +1 -1
  67. package/package.json +2 -2
  68. package/dist/cjs/shared/misc/isRenderFailure.js +0 -4
  69. package/dist/esm/shared/misc/isRenderFailure.d.ts +0 -1
  70. package/dist/esm/shared/misc/isRenderFailure.js +0 -1
@@ -145,6 +145,7 @@ async function renderPageAlreadyPrepared(pageContextInit, httpRequestId, renderC
145
145
  assert(pageContextNominalPageInit);
146
146
  assert(hasProp(pageContextNominalPageInit, 'urlOriginal', 'string'));
147
147
  const pageContextErrorPageInit = await getPageContextErrorPageInit(pageContextInit, errNominalPage, pageContextNominalPageInit, renderContext, httpRequestId);
148
+ // Handle `throw redirect()` and `throw render()` while rendering nominal page
148
149
  if (isAbortError(errNominalPage)) {
149
150
  const handled = await handleAbortError(errNominalPage, pageContextsFromRewrite, pageContextInit, pageContextNominalPageInit, httpRequestId, renderContext, pageContextErrorPageInit);
150
151
  if (handled.pageContextReturn) {
@@ -173,6 +174,7 @@ async function renderPageAlreadyPrepared(pageContextInit, httpRequestId, renderC
173
174
  pageContextErrorPage = await renderPageAlreadyRouted(pageContextErrorPageInit);
174
175
  }
175
176
  catch (errErrorPage) {
177
+ // Handle `throw redirect()` and `throw render()` while rendering error page
176
178
  if (isAbortError(errErrorPage)) {
177
179
  const handled = await handleAbortError(errErrorPage, pageContextsFromRewrite, pageContextInit, pageContextNominalPageInit, httpRequestId, renderContext, pageContextErrorPageInit);
178
180
  // throw render(abortStatusCode)
@@ -283,7 +285,7 @@ async function getPageContextErrorPageInit(pageContextInit, errNominalPage, page
283
285
  return pageContext;
284
286
  }
285
287
  function getPageContextInitEnhancedSSR(pageContextInit, renderContext, urlRewrite, httpRequestId) {
286
- const { isClientSideNavigation, _urlHandler } = handleUrl(pageContextInit.urlOriginal, urlRewrite);
288
+ const { isClientSideNavigation, _urlHandler } = handlePageContextUrl(pageContextInit.urlOriginal);
287
289
  const pageContextInitEnhanced = getPageContextInitEnhanced(pageContextInit, renderContext, {
288
290
  ssr: {
289
291
  urlRewrite,
@@ -294,18 +296,12 @@ function getPageContextInitEnhancedSSR(pageContextInit, renderContext, urlRewrit
294
296
  objectAssign(pageContextInitEnhanced, { _httpRequestId: httpRequestId });
295
297
  return pageContextInitEnhanced;
296
298
  }
297
- function handleUrl(urlOriginal, urlRewrite) {
298
- assert(isUrlValid(urlOriginal));
299
- assert(urlRewrite === null || isUrlValid(urlRewrite));
299
+ function handlePageContextUrl(urlOriginal) {
300
300
  const { isPageContextRequest } = handlePageContextRequestUrl(urlOriginal);
301
- const pageContextAddendum = {
301
+ return {
302
302
  isClientSideNavigation: isPageContextRequest,
303
303
  _urlHandler: (url) => handlePageContextRequestUrl(url).urlWithoutPageContextRequestSuffix
304
304
  };
305
- return pageContextAddendum;
306
- }
307
- function isUrlValid(url) {
308
- return url.startsWith('/') || url.startsWith('http');
309
305
  }
310
306
  function getRequestId() {
311
307
  const httpRequestId = ++globalObject.httpRequestsCount;
@@ -368,7 +364,9 @@ function getPermanentRedirect(pageContextInit, httpRequestId) {
368
364
  const pageContextHttpResponse = { ...pageContextInit, httpResponse };
369
365
  return pageContextHttpResponse;
370
366
  }
371
- async function handleAbortError(errAbort, pageContextsFromRewrite, pageContextInit, pageContextNominalPageInit, httpRequestId, renderContext, pageContextErrorPageInit) {
367
+ async function handleAbortError(errAbort, pageContextsFromRewrite, pageContextInit,
368
+ // handleAbortError() creates a new pageContext object and we don't merge pageContextNominalPageInit to it: we only use some pageContextNominalPageInit information.
369
+ pageContextNominalPageInit, httpRequestId, renderContext, pageContextErrorPageInit) {
372
370
  logAbortErrorHandled(errAbort, getGlobalContext().isProduction, pageContextNominalPageInit);
373
371
  const pageContextAbort = errAbort._pageContextAbort;
374
372
  let pageContextSerialized;
@@ -5,16 +5,17 @@ import { assert, getFileExtension } from './utils.js';
5
5
  const query = 'extractAssets';
6
6
  function extractAssetsAddQuery(id) {
7
7
  const fileExtension = getFileExtension(id);
8
- assert(fileExtension || id.includes('virtual:vike:'));
9
- if (!fileExtension)
8
+ if (!fileExtension || id.includes('virtual:vike:')) {
10
9
  return `${id}?${query}`;
11
- if (id.includes('?')) {
12
- id = id.replace('?', `?${query}&`);
13
10
  }
14
11
  else {
15
- id = `${id}?${query}&lang.${fileExtension}`;
12
+ if (!id.includes('?')) {
13
+ return `${id}?${query}&lang.${fileExtension}`;
14
+ }
15
+ else {
16
+ return id.replace('?', `?${query}&`);
17
+ }
16
18
  }
17
- return id;
18
19
  }
19
20
  function extractAssetsRemoveQuery(id) {
20
21
  if (!id.includes('?'))
@@ -6,7 +6,7 @@ function addUrlComputedProps(pageContext, enumerable = true) {
6
6
  assert(pageContext.urlOriginal);
7
7
  if ('urlPathname' in pageContext) {
8
8
  assert(typeof pageContext.urlPathname === 'string');
9
- /* If this assert() fails then it's most likely because Object.assign() was used instead of objectAssign(), i.e.:
9
+ /* If the following assert() fails then it's most likely because Object.assign() was used instead of objectAssign(), i.e.:
10
10
  ```js
11
11
  // Add property getters such as pageContext.urlPathname to pageContext
12
12
  addUrlComputedProps(pageContext)
@@ -47,8 +47,28 @@ function getUrlParsed(pageContext) {
47
47
  if (!urlHandler) {
48
48
  urlHandler = (url) => url;
49
49
  }
50
- let urlResolved = pageContext._urlRewrite ?? pageContext.urlLogical ?? pageContext.urlOriginal;
50
+ // Example of i18n app using `throw render()`:
51
+ // 1. User goes to '/fr-FR/admin'.
52
+ // 2. The first onBeforeRoute() call accesses pageContext.urlPathname (its value is '/fr-FR/admin': the pathname of pageContext.urlOriginal, since both pageContext.urlLogical and pageContext._urlRewrite are undefined) and sets pageContext.urlLogical to '/admin'.
53
+ // 3. A guard() hooks accesses pageContext.urlPathname (its value is '/admin': the pathname of pageContext.urlLogical) and calls `throw render('/fr-FR/login')`
54
+ // 4. Vike create a new pageContext object (pageContext.urlLogical is erased) and sets pageContext._urlRewrite to '/fr-FR/login'. (While pageContext.urlOriginal is still '/fr-FR/admin'.)
55
+ // 5. The second onBeforeRoute() call accesses pageContext.urlPathname (its value is '/fr-FR/login': the pathname of pageContext._urlRewrite, since pageContext.urlLogical is undefined) and sets pageContext.urlLogical to '/login'.
56
+ // 6. The value of pageContext.urlPathname is now '/login': the pathname of `pageContext.urlLogical`. (While pageContext.urlOriginal is still '/fr-FR/admin'.)
57
+ // Reproduction: https://github.com/vikejs/vike/discussions/1436#discussioncomment-8142023
58
+ let urlResolved =
59
+ // Set by onBeforeRoute()
60
+ pageContext.urlLogical ??
61
+ // Set by `throw render()`
62
+ pageContext._urlRewrite ??
63
+ // Set by renderPage()
64
+ pageContext.urlOriginal;
51
65
  urlResolved = urlHandler(urlResolved);
66
+ /*
67
+ console.log('pageContext.urlLogical', pageContext.urlLogical)
68
+ console.log('pageContext._urlRewrite', pageContext._urlRewrite)
69
+ console.log('pageContext.urlOriginal', pageContext.urlOriginal)
70
+ console.log()
71
+ //*/
52
72
  const baseServer = pageContext._baseServer;
53
73
  assert(urlResolved && typeof urlResolved === 'string');
54
74
  assert(baseServer.startsWith('/'));
@@ -5,7 +5,7 @@ import { getGlobalObject } from '../../utils/getGlobalObject.js';
5
5
  import { humanizeTime } from '../../utils/humanizeTime.js';
6
6
  import { isObject } from '../../utils/isObject.js';
7
7
  const globalObject = getGlobalObject('utils/executeHook.ts', {
8
- userHookErrors: new Map()
8
+ userHookErrors: new WeakMap()
9
9
  });
10
10
  function isUserHookError(err) {
11
11
  if (!isObject(err))
@@ -0,0 +1 @@
1
+ export declare const isServerSideError = "_isServerSideError";
@@ -0,0 +1 @@
1
+ export const isServerSideError = '_isServerSideError';
@@ -46,12 +46,12 @@ type Config = ConfigBuiltIn & Vike.Config & (VikePackages.ConfigVikeReact | Vike
46
46
  *
47
47
  * https://vike.dev/data
48
48
  */
49
- type DataAsync<Data> = (pageContext: PageContextServer) => Promise<Data>;
49
+ type DataAsync<Data = unknown> = (pageContext: PageContextServer) => Promise<Data>;
50
50
  /** Hook for fetching data.
51
51
  *
52
52
  * https://vike.dev/data
53
53
  */
54
- type DataSync<Data> = (pageContext: PageContextServer) => Data;
54
+ type DataSync<Data = unknown> = (pageContext: PageContextServer) => Data;
55
55
  /** Protect page(s), e.g. forbid unauthorized access.
56
56
  *
57
57
  * https://vike.dev/guard
@@ -30,7 +30,7 @@ type AbortReason = Required<({
30
30
  * @param url The URL to redirect to.
31
31
  * @param statusCode By default a temporary redirection (`302`) is performed. For permanent redirections (`301`), use `config.redirects` https://vike.dev/redirects instead or, alternatively, set the `statusCode` argument to `301`.
32
32
  */
33
- declare function redirect(url: `/${string}` | `https://${string}` | `http://${string}`, statusCode?: 301 | 302): AbortRedirect;
33
+ declare function redirect(url: string, statusCode?: 301 | 302): AbortRedirect;
34
34
  /**
35
35
  * Abort the rendering of the current page, and render the error page instead.
36
36
  *
@@ -58,16 +58,21 @@ declare function render(abortStatusCode: 401 | 403 | 404 | 410 | 429 | 500 | 503
58
58
  */
59
59
  declare function render(url: `/${string}`, abortReason?: AbortReason): Error;
60
60
  type AbortCall = `redirect(${string})` | `render(${string})` | `RenderErrorPage()`;
61
+ type AbortCaller = `throw redirect()` | `throw render()` | `throw RenderErrorPage()`;
61
62
  type PageContextAbort = {
62
63
  _abortCall: AbortCall;
64
+ _abortCaller: AbortCaller;
63
65
  } & (({
66
+ _abortCall: `redirect(${string})`;
64
67
  _abortCaller: 'throw redirect()';
65
68
  _urlRedirect: UrlRedirect;
66
69
  } & Omit<AbortUndefined, '_urlRedirect'>) | ({
70
+ _abortCall: `render(${string})` | `RenderErrorPage()`;
67
71
  _abortCaller: 'throw render()' | 'throw RenderErrorPage()';
68
72
  abortReason: undefined | unknown;
69
73
  _urlRewrite: string;
70
74
  } & Omit<AbortUndefined, '_urlRewrite'>) | ({
75
+ _abortCall: `render(${string})` | `RenderErrorPage()`;
71
76
  _abortCaller: 'throw render()' | 'throw RenderErrorPage()';
72
77
  abortReason: undefined | unknown;
73
78
  abortStatusCode: number;
@@ -7,7 +7,7 @@ export { logAbortErrorHandled };
7
7
  export { getPageContextFromAllRewrites };
8
8
  export { AbortRender };
9
9
  export { assertNoInfiniteAbortLoop };
10
- import { assert, assertInfo, assertUsage, assertWarning, checkType, hasProp, isUserHookError, joinEnglish, objectAssign, projectInfo, truncateString } from './utils.js';
10
+ import { assert, assertInfo, assertUsage, assertWarning, checkType, hasProp, isUriWithProtocol, isUserHookError, joinEnglish, objectAssign, projectInfo, truncateString } from './utils.js';
11
11
  import pc from '@brillout/picocolors';
12
12
  /**
13
13
  * Abort the rendering of the current page, and redirect the user to another URL instead.
@@ -19,6 +19,7 @@ import pc from '@brillout/picocolors';
19
19
  */
20
20
  function redirect(url, statusCode) {
21
21
  const abortCaller = 'throw redirect()';
22
+ assertUrl(url, abortCaller, true);
22
23
  const args = [JSON.stringify(url)];
23
24
  if (!statusCode) {
24
25
  statusCode = 302;
@@ -38,15 +39,15 @@ function redirect(url, statusCode) {
38
39
  });
39
40
  return AbortRender(pageContextAbort);
40
41
  }
41
- function render(value, abortReason) {
42
- const args = [typeof value === 'number' ? String(value) : JSON.stringify(value)];
42
+ function render(urlOrStatusCode, abortReason) {
43
+ const args = [typeof urlOrStatusCode === 'number' ? String(urlOrStatusCode) : JSON.stringify(urlOrStatusCode)];
43
44
  if (abortReason !== undefined)
44
45
  args.push(truncateString(JSON.stringify(abortReason), 30));
45
46
  const abortCaller = 'throw render()';
46
47
  const abortCall = `render(${args.join(', ')})`;
47
- return render_(value, abortReason, abortCall, abortCaller);
48
+ return render_(urlOrStatusCode, abortReason, abortCall, abortCaller);
48
49
  }
49
- function render_(value, abortReason, abortCall, abortCaller, pageContextAddendum) {
50
+ function render_(urlOrStatusCode, abortReason, abortCall, abortCaller, pageContextAddendum) {
50
51
  const pageContextAbort = {
51
52
  abortReason,
52
53
  _abortCaller: abortCaller,
@@ -56,16 +57,17 @@ function render_(value, abortReason, abortCall, abortCaller, pageContextAddendum
56
57
  assert(pageContextAddendum._isLegacyRenderErrorPage === true);
57
58
  objectAssign(pageContextAbort, pageContextAddendum);
58
59
  }
59
- if (typeof value === 'string') {
60
- const url = value;
60
+ if (typeof urlOrStatusCode === 'string') {
61
+ const url = urlOrStatusCode;
62
+ assertUrl(url, abortCaller);
61
63
  objectAssign(pageContextAbort, {
62
64
  _urlRewrite: url
63
65
  });
64
66
  return AbortRender(pageContextAbort);
65
67
  }
66
68
  else {
67
- const abortStatusCode = value;
68
- assertStatusCode(value, [401, 403, 404, 410, 429, 500, 503], 'render');
69
+ const abortStatusCode = urlOrStatusCode;
70
+ assertStatusCode(urlOrStatusCode, [401, 403, 404, 410, 429, 500, 503], 'render');
69
71
  objectAssign(pageContextAbort, {
70
72
  abortStatusCode,
71
73
  is404: abortStatusCode === 404
@@ -164,3 +166,12 @@ function assertNoInfiniteAbortLoop(rewriteCount, redirectCount) {
164
166
  .join(' and ');
165
167
  assertUsage(rewriteCount + redirectCount <= 7, `Maximum chain length of 7 ${abortCalls} exceeded. Did you define an infinite loop of ${abortCalls}?`);
166
168
  }
169
+ function assertUrl(url, abortCaller, allowAbsoluteUrl) {
170
+ assertUsage(url.startsWith('/') || (allowAbsoluteUrl && isUriWithProtocol(url)), [
171
+ `Invalid URL ${pc.cyan(url)} passed to ${pc.cyan(abortCaller)}:`,
172
+ `the URL should start with ${pc.cyan('/')}`,
173
+ allowAbsoluteUrl && `or a valid protocol (${pc.cyan('https:')}, ${pc.cyan('ipfs:')}, ...)`
174
+ ]
175
+ .filter(Boolean)
176
+ .join(' '));
177
+ }
@@ -81,9 +81,11 @@ async function route(pageContextForRoute) {
81
81
  assert(false);
82
82
  }));
83
83
  resolvePrecendence(routeMatches);
84
- const winner = routeMatches[0];
84
+ const winner = routeMatches[0] ?? null;
85
85
  debug(`Route matches for URL ${pc.cyan(urlPathname)} (in precedence order):`, routeMatches);
86
86
  objectAssign(pageContextFromRoute, { _debugRouteMatches: routeMatches });
87
+ // For vite-plugin-vercel https://github.com/magne4000/vite-plugin-vercel/blob/main/packages/vike-integration/vike.ts#L173
88
+ objectAssign(pageContextFromRoute, { _routeMatch: winner });
87
89
  if (!winner) {
88
90
  objectAssign(pageContextFromRoute, {
89
91
  _pageId: null,
@@ -2,8 +2,7 @@ export { resolveRedirects };
2
2
  // For ./resolveRedirects.spec.ts
3
3
  export { resolveRouteStringRedirect };
4
4
  import { assertIsNotBrowser } from '../../utils/assertIsNotBrowser.js';
5
- import { isUriWithProtocol } from '../../utils/parseUrl-extras.js';
6
- import { assert, assertUsage } from '../utils.js';
5
+ import { assert, assertUsage, isUriWithProtocol } from '../utils.js';
7
6
  import { resolveUrlPathname } from './resolveUrlPathname.js';
8
7
  import { assertRouteString, resolveRouteString } from './resolveRouteString.js';
9
8
  import pc from '@brillout/picocolors';
@@ -41,7 +41,7 @@ function assert(condition, debugInfo) {
41
41
  const link = `${projectInfo.githubRepository}/issues/new`;
42
42
  let errMsg = [
43
43
  `You stumbled upon a bug in ${projectInfo.projectName}'s source code.`,
44
- `Go to ${pc.blue(link)} and copy-paste this error; a maintainer will fix the bug (usually under 24 hours).`,
44
+ `Go to ${pc.blue(link)} and copy-paste this error. A maintainer will fix the bug (usually under 24 hours).`,
45
45
  debugStr
46
46
  ]
47
47
  .filter(Boolean)
@@ -56,7 +56,8 @@ function isDebugEnabled(flag) {
56
56
  DEBUG = process.env.DEBUG;
57
57
  }
58
58
  catch { }
59
- return DEBUG?.includes(flag) ?? false;
59
+ const isEnabled = DEBUG?.includes(flag) ?? false;
60
+ return isEnabled;
60
61
  }
61
62
  function formatMsg(info, options, padding, position) {
62
63
  if (info === undefined) {
@@ -5,7 +5,6 @@ export { removeBaseServer };
5
5
  export { modifyUrlPathname };
6
6
  export { removeUrlOrigin };
7
7
  export { addUrlOrigin };
8
- export { isUriWithProtocol };
9
8
  declare function prependBase(url: string, baseServer: string): string;
10
9
  declare function removeBaseServer(url: string, baseServer: string): string;
11
10
  declare function isBaseAssets(base: string): boolean;
@@ -16,4 +15,3 @@ declare function removeUrlOrigin(url: string): {
16
15
  origin: string | null;
17
16
  };
18
17
  declare function addUrlOrigin(url: string, origin: string | null): string;
19
- declare function isUriWithProtocol(uri: string): boolean;
@@ -5,7 +5,6 @@ export { removeBaseServer };
5
5
  export { modifyUrlPathname };
6
6
  export { removeUrlOrigin };
7
7
  export { addUrlOrigin };
8
- export { isUriWithProtocol };
9
8
  import { assertUrlComponents, createUrlFromComponents, isBaseServer, parseUrl } from './parseUrl.js';
10
9
  import { assert } from './assert.js';
11
10
  import { slice } from './slice.js';
@@ -101,7 +100,3 @@ function addUrlOrigin(url, origin) {
101
100
  const urlModified = createUrlFromComponents(origin, pathnameOriginal, searchOriginal, hashOriginal);
102
101
  return urlModified;
103
102
  }
104
- function isUriWithProtocol(uri) {
105
- // https://en.wikipedia.org/wiki/List_of_URI_schemes
106
- return /^[a-z0-9][a-z0-9\.\+\-]*:/i.test(uri);
107
- }
@@ -4,6 +4,7 @@ export { assertUsageUrl };
4
4
  export { isBaseServer };
5
5
  export { assertUrlComponents };
6
6
  export { createUrlFromComponents };
7
+ export { isUriWithProtocol };
7
8
  declare function isParsable(url: string): boolean;
8
9
  declare function assertUsageUrl(url: unknown, errPrefix: string): asserts url is string;
9
10
  declare function parseUrl(url: string, baseServer: string): {
@@ -20,3 +21,4 @@ declare function parseUrl(url: string, baseServer: string): {
20
21
  declare function isBaseServer(baseServer: string): boolean;
21
22
  declare function assertUrlComponents(url: string, origin: string | null, pathname: string, searchOriginal: string | null, hashOriginal: string | null): void;
22
23
  declare function createUrlFromComponents(origin: string | null, pathname: string, searchOriginal: string | null, hashOriginal: string | null): string;
24
+ declare function isUriWithProtocol(uri: string): boolean;
@@ -8,6 +8,7 @@ export { assertUsageUrl };
8
8
  export { isBaseServer };
9
9
  export { assertUrlComponents };
10
10
  export { createUrlFromComponents };
11
+ export { isUriWithProtocol };
11
12
  import { slice } from './slice.js';
12
13
  import { assert, assertUsage } from './assert.js';
13
14
  import pc from '@brillout/picocolors';
@@ -227,3 +228,7 @@ function createUrlFromComponents(origin, pathname, searchOriginal, hashOriginal)
227
228
  const urlRecreated = `${origin || ''}${pathname}${searchOriginal || ''}${hashOriginal || ''}`;
228
229
  return urlRecreated;
229
230
  }
231
+ function isUriWithProtocol(uri) {
232
+ // https://en.wikipedia.org/wiki/List_of_URI_schemes
233
+ return /^[a-z0-9][a-z0-9\.\+\-]*:/i.test(uri);
234
+ }
@@ -1,13 +1,13 @@
1
1
  export { projectInfo };
2
2
  export type { ProjectTag };
3
3
  export { PROJECT_VERSION };
4
- declare const PROJECT_VERSION: "0.4.156";
4
+ declare const PROJECT_VERSION: "0.4.158";
5
5
  type PackageName = typeof projectInfo.npmPackageName;
6
6
  type ProjectVersion = typeof projectInfo.projectVersion;
7
7
  type ProjectTag = `[${PackageName}]` | `[${PackageName}@${ProjectVersion}]`;
8
8
  declare const projectInfo: {
9
9
  projectName: "Vike";
10
- projectVersion: "0.4.156";
10
+ projectVersion: "0.4.158";
11
11
  npmPackageName: "vike";
12
12
  githubRepository: "https://github.com/vikejs/vike";
13
13
  };
@@ -1,7 +1,7 @@
1
1
  export { projectInfo };
2
2
  export { PROJECT_VERSION };
3
3
  import { onProjectInfo } from './assertSingleInstance.js';
4
- const PROJECT_VERSION = '0.4.156';
4
+ const PROJECT_VERSION = '0.4.158';
5
5
  const projectInfo = {
6
6
  projectName: 'Vike',
7
7
  projectVersion: PROJECT_VERSION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.156",
3
+ "version": "0.4.158",
4
4
  "scripts": {
5
5
  "dev": "tsc --watch",
6
6
  "build": "rimraf dist/ && pnpm run build:esm && pnpm run build:cjs",
@@ -16,7 +16,7 @@
16
16
  "@brillout/json-serializer": "^0.5.8",
17
17
  "@brillout/picocolors": "^1.0.10",
18
18
  "@brillout/require-shim": "^0.1.2",
19
- "@brillout/vite-plugin-server-entry": "^0.4.2",
19
+ "@brillout/vite-plugin-server-entry": "^0.4.3",
20
20
  "acorn": "^8.0.0",
21
21
  "cac": "^6.0.0",
22
22
  "es-module-lexer": "^1.0.0",
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isRenderFailure = void 0;
4
- exports.isRenderFailure = '_isRenderFailure';
@@ -1 +0,0 @@
1
- export declare const isRenderFailure = "_isRenderFailure";
@@ -1 +0,0 @@
1
- export const isRenderFailure = '_isRenderFailure';