vike 0.4.235-commit-d2ac38a → 0.4.236

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.
@@ -12,7 +12,7 @@ const error_page_js_1 = require("../../../shared/error-page.js");
12
12
  const getHttpResponseBody_js_1 = require("./getHttpResponseBody.js");
13
13
  const getEarlyHints_js_1 = require("./getEarlyHints.js");
14
14
  const assertNoInfiniteHttpRedirect_js_1 = require("./createHttpResponse/assertNoInfiniteHttpRedirect.js");
15
- const getCacheControl_js_1 = require("./createHttpResponse/getCacheControl.js");
15
+ const getCacheControl_js_1 = require("./getCacheControl.js");
16
16
  async function createHttpResponsePage(htmlRender, renderHook, pageContext) {
17
17
  let statusCode = pageContext.abortStatusCode;
18
18
  if (!statusCode) {
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cacheControlDisable = void 0;
4
4
  exports.getCacheControl = getCacheControl;
5
- const helpers_js_1 = require("../../../../shared/page-configs/helpers.js");
6
- const getConfigValueRuntime_js_1 = require("../../../../shared/page-configs/getConfigValueRuntime.js");
5
+ const helpers_js_1 = require("../../../shared/page-configs/helpers.js");
6
+ const getConfigValueRuntime_js_1 = require("../../../shared/page-configs/getConfigValueRuntime.js");
7
7
  const cacheControlDisable = 'no-store, max-age=0';
8
8
  exports.cacheControlDisable = cacheControlDisable;
9
9
  function getCacheControl(pageId, pageConfigs) {
@@ -11,20 +11,18 @@ const findPageConfig_js_1 = require("../../../shared/page-configs/findPageConfig
11
11
  const analyzePage_js_1 = require("./analyzePage.js");
12
12
  const loadConfigValues_js_1 = require("../../../shared/page-configs/loadConfigValues.js");
13
13
  const execHookServer_js_1 = require("./execHookServer.js");
14
- const getCacheControl_js_1 = require("./createHttpResponse/getCacheControl.js");
15
- // TODO/now: rename?
14
+ const getCacheControl_js_1 = require("./getCacheControl.js");
16
15
  async function loadPageConfigsLazyServerSideAndExecHook(pageContext) {
17
16
  const pageContextAddendum = await loadPageConfigsLazyServerSide(pageContext);
18
17
  (0, utils_js_1.objectAssign)(pageContext, pageContextAddendum);
19
18
  await (0, execHookServer_js_1.execHookServer)('onCreatePageContext', pageContext);
20
19
  return pageContext;
21
20
  }
22
- // TODO/now: rename?
23
21
  async function loadPageConfigsLazyServerSide(pageContext) {
24
22
  const pageConfig = (0, findPageConfig_js_1.findPageConfig)(pageContext._globalContext._pageConfigs, pageContext.pageId); // Make pageConfig globally available as pageContext._pageConfig ?
25
23
  const globalContext = pageContext._globalContext;
26
24
  const [{ pageFilesLoaded, configPublicPageLazy }] = await Promise.all([
27
- loadPageUserFiles(pageContext._globalContext._pageFilesAll, pageConfig, globalContext._pageConfigGlobal, pageContext.pageId, !globalContext._isProduction),
25
+ loadPageConfigFiles(pageContext._globalContext._pageFilesAll, pageConfig, globalContext._pageConfigGlobal, pageContext.pageId, !globalContext._isProduction),
28
26
  (0, analyzePageClientSide_js_1.analyzePageClientSideInit)(pageContext._globalContext._pageFilesAll, pageContext.pageId, {
29
27
  sharedPageFilesAlreadyLoaded: true,
30
28
  }),
@@ -107,8 +105,7 @@ async function loadPageConfigsLazyServerSide(pageContext) {
107
105
  });
108
106
  return pageContextAddendum;
109
107
  }
110
- // TODO/now: rename?
111
- async function loadPageUserFiles(pageFilesAll, pageConfig, pageConfigGlobal, pageId, isDev) {
108
+ async function loadPageConfigFiles(pageFilesAll, pageConfig, pageConfigGlobal, pageId, isDev) {
112
109
  const pageFilesServerSide = (0, getPageFiles_js_1.getPageFilesServerSide)(pageFilesAll, pageId);
113
110
  const pageConfigLoaded = !pageConfig ? null : await (0, loadConfigValues_js_1.loadConfigValues)(pageConfig, isDev);
114
111
  await Promise.all(pageFilesServerSide.map((p) => p.loadFile?.()));
@@ -118,9 +115,7 @@ async function loadPageUserFiles(pageFilesAll, pageConfig, pageConfigGlobal, pag
118
115
  pageFilesLoaded: pageFilesServerSide,
119
116
  };
120
117
  }
121
- function resolveHeadersResponse(
122
- // TODO/now: merge pageContextAddendum with pageContext
123
- pageContext, pageContextAddendum) {
118
+ function resolveHeadersResponse(pageContext, pageContextAddendum) {
124
119
  const headersResponse = mergeHeaders(pageContextAddendum.config.headersResponse);
125
120
  if (!headersResponse.get('Cache-Control')) {
126
121
  const cacheControl = (0, getCacheControl_js_1.getCacheControl)(pageContext.pageId, pageContext._globalContext._pageConfigs);
@@ -174,10 +174,7 @@ async function renderPageOnError(errNominalPage, pageContextBegin, pageContextNo
174
174
  (0, utils_js_1.objectAssign)(pageContextErrorPageInit, { pageId: null });
175
175
  return (0, handleErrorWithoutErrorPage_js_1.handleErrorWithoutErrorPage)(pageContextErrorPageInit);
176
176
  }
177
- else {
178
- // TODO/now: minor refactor
179
- (0, utils_js_1.objectAssign)(pageContextErrorPageInit, { pageId: errorPageId });
180
- }
177
+ (0, utils_js_1.objectAssign)(pageContextErrorPageInit, { pageId: errorPageId });
181
178
  }
182
179
  let pageContextErrorPage;
183
180
  try {
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROJECT_VERSION = void 0;
4
4
  // Automatically updated by @brillout/release-me
5
- exports.PROJECT_VERSION = '0.4.235-commit-d2ac38a';
5
+ exports.PROJECT_VERSION = '0.4.236';
@@ -49,7 +49,7 @@ function isPathAliasRecommended(alias) {
49
49
  // - In principle, we could allow path aliases that don't start with special character as long as they can be distinguished from npm package names.
50
50
  // - But we still enforce path aliases to start with a special character because it's a much simpler rule to follow.
51
51
  if (alias.startsWith('@/'))
52
- return true; // Needed by contra.com
52
+ return true; // Needed by contra.com and https://github.com/vikejs/vike/issues/1567#issuecomment-3076374243
53
53
  const firstLetter = alias[0];
54
54
  (0, assert_js_1.assert)(firstLetter);
55
55
  if (firstLetter === '@' || /[0-9a-z]/.test(firstLetter.toLowerCase()))
@@ -10,7 +10,7 @@ import { getErrorPageId, isErrorPage } from '../../../shared/error-page.js';
10
10
  import { getHttpResponseBody, getHttpResponseBodyStreamHandlers } from './getHttpResponseBody.js';
11
11
  import { getEarlyHints } from './getEarlyHints.js';
12
12
  import { assertNoInfiniteHttpRedirect } from './createHttpResponse/assertNoInfiniteHttpRedirect.js';
13
- import { cacheControlDisable } from './createHttpResponse/getCacheControl.js';
13
+ import { cacheControlDisable } from './getCacheControl.js';
14
14
  async function createHttpResponsePage(htmlRender, renderHook, pageContext) {
15
15
  let statusCode = pageContext.abortStatusCode;
16
16
  if (!statusCode) {
@@ -1,5 +1,5 @@
1
1
  export { getCacheControl };
2
2
  export { cacheControlDisable };
3
- import type { PageConfigRuntime } from '../../../../types/PageConfig.js';
3
+ import type { PageConfigRuntime } from '../../../types/PageConfig.js';
4
4
  declare const cacheControlDisable = "no-store, max-age=0";
5
5
  declare function getCacheControl(pageId: string | null, pageConfigs: PageConfigRuntime[]): string;
@@ -1,8 +1,7 @@
1
- // TODO/now: move
2
1
  export { getCacheControl };
3
2
  export { cacheControlDisable };
4
- import { getPageConfig } from '../../../../shared/page-configs/helpers.js';
5
- import { getConfigValueRuntime } from '../../../../shared/page-configs/getConfigValueRuntime.js';
3
+ import { getPageConfig } from '../../../shared/page-configs/helpers.js';
4
+ import { getConfigValueRuntime } from '../../../shared/page-configs/getConfigValueRuntime.js';
6
5
  const cacheControlDisable = 'no-store, max-age=0';
7
6
  function getCacheControl(pageId, pageConfigs) {
8
7
  // TO-DO/next-major-release: remove this line
@@ -9,20 +9,18 @@ import { findPageConfig } from '../../../shared/page-configs/findPageConfig.js';
9
9
  import { analyzePage } from './analyzePage.js';
10
10
  import { loadConfigValues } from '../../../shared/page-configs/loadConfigValues.js';
11
11
  import { execHookServer } from './execHookServer.js';
12
- import { getCacheControl } from './createHttpResponse/getCacheControl.js';
13
- // TODO/now: rename?
12
+ import { getCacheControl } from './getCacheControl.js';
14
13
  async function loadPageConfigsLazyServerSideAndExecHook(pageContext) {
15
14
  const pageContextAddendum = await loadPageConfigsLazyServerSide(pageContext);
16
15
  objectAssign(pageContext, pageContextAddendum);
17
16
  await execHookServer('onCreatePageContext', pageContext);
18
17
  return pageContext;
19
18
  }
20
- // TODO/now: rename?
21
19
  async function loadPageConfigsLazyServerSide(pageContext) {
22
20
  const pageConfig = findPageConfig(pageContext._globalContext._pageConfigs, pageContext.pageId); // Make pageConfig globally available as pageContext._pageConfig ?
23
21
  const globalContext = pageContext._globalContext;
24
22
  const [{ pageFilesLoaded, configPublicPageLazy }] = await Promise.all([
25
- loadPageUserFiles(pageContext._globalContext._pageFilesAll, pageConfig, globalContext._pageConfigGlobal, pageContext.pageId, !globalContext._isProduction),
23
+ loadPageConfigFiles(pageContext._globalContext._pageFilesAll, pageConfig, globalContext._pageConfigGlobal, pageContext.pageId, !globalContext._isProduction),
26
24
  analyzePageClientSideInit(pageContext._globalContext._pageFilesAll, pageContext.pageId, {
27
25
  sharedPageFilesAlreadyLoaded: true,
28
26
  }),
@@ -105,8 +103,7 @@ async function loadPageConfigsLazyServerSide(pageContext) {
105
103
  });
106
104
  return pageContextAddendum;
107
105
  }
108
- // TODO/now: rename?
109
- async function loadPageUserFiles(pageFilesAll, pageConfig, pageConfigGlobal, pageId, isDev) {
106
+ async function loadPageConfigFiles(pageFilesAll, pageConfig, pageConfigGlobal, pageId, isDev) {
110
107
  const pageFilesServerSide = getPageFilesServerSide(pageFilesAll, pageId);
111
108
  const pageConfigLoaded = !pageConfig ? null : await loadConfigValues(pageConfig, isDev);
112
109
  await Promise.all(pageFilesServerSide.map((p) => p.loadFile?.()));
@@ -116,9 +113,7 @@ async function loadPageUserFiles(pageFilesAll, pageConfig, pageConfigGlobal, pag
116
113
  pageFilesLoaded: pageFilesServerSide,
117
114
  };
118
115
  }
119
- function resolveHeadersResponse(
120
- // TODO/now: merge pageContextAddendum with pageContext
121
- pageContext, pageContextAddendum) {
116
+ function resolveHeadersResponse(pageContext, pageContextAddendum) {
122
117
  const headersResponse = mergeHeaders(pageContextAddendum.config.headersResponse);
123
118
  if (!headersResponse.get('Cache-Control')) {
124
119
  const cacheControl = getCacheControl(pageContext.pageId, pageContext._globalContext._pageConfigs);
@@ -169,10 +169,7 @@ async function renderPageOnError(errNominalPage, pageContextBegin, pageContextNo
169
169
  objectAssign(pageContextErrorPageInit, { pageId: null });
170
170
  return handleErrorWithoutErrorPage(pageContextErrorPageInit);
171
171
  }
172
- else {
173
- // TODO/now: minor refactor
174
- objectAssign(pageContextErrorPageInit, { pageId: errorPageId });
175
- }
172
+ objectAssign(pageContextErrorPageInit, { pageId: errorPageId });
176
173
  }
177
174
  let pageContextErrorPage;
178
175
  try {
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.235-commit-d2ac38a";
1
+ export declare const PROJECT_VERSION: "0.4.236";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.235-commit-d2ac38a';
2
+ export const PROJECT_VERSION = '0.4.236';
@@ -52,7 +52,7 @@ function isPathAliasRecommended(alias) {
52
52
  // - In principle, we could allow path aliases that don't start with special character as long as they can be distinguished from npm package names.
53
53
  // - But we still enforce path aliases to start with a special character because it's a much simpler rule to follow.
54
54
  if (alias.startsWith('@/'))
55
- return true; // Needed by contra.com
55
+ return true; // Needed by contra.com and https://github.com/vikejs/vike/issues/1567#issuecomment-3076374243
56
56
  const firstLetter = alias[0];
57
57
  assert(firstLetter);
58
58
  if (firstLetter === '@' || /[0-9a-z]/.test(firstLetter.toLowerCase()))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.235-commit-d2ac38a",
3
+ "version": "0.4.236",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {