vike 0.4.171-commit-43aef47 → 0.4.171-commit-bb72501

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.
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addSsrMiddleware = void 0;
4
4
  const renderPage_js_1 = require("../../runtime/renderPage.js");
5
+ const utils_js_1 = require("../utils.js");
5
6
  function addSsrMiddleware(middlewares) {
6
7
  middlewares.use(async (req, res, next) => {
7
8
  if (res.headersSent)
@@ -10,10 +11,15 @@ function addSsrMiddleware(middlewares) {
10
11
  if (!url)
11
12
  return next();
12
13
  const { headers } = req;
13
- const userAgent = headers['user-agent'];
14
14
  const pageContextInit = {
15
15
  urlOriginal: url,
16
- userAgent,
16
+ get userAgent() {
17
+ (0, utils_js_1.assertWarning)(false, "pageContext.userAgent is deprecated in favor of pageContext.headers['user-agent']", {
18
+ showStackTrace: true,
19
+ onlyOnce: true
20
+ });
21
+ return headers['user-agent'];
22
+ },
17
23
  headers
18
24
  };
19
25
  let pageContext;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROJECT_VERSION = exports.projectInfo = void 0;
4
- const PROJECT_VERSION = '0.4.171-commit-43aef47';
4
+ const PROJECT_VERSION = '0.4.171-commit-bb72501';
5
5
  exports.PROJECT_VERSION = PROJECT_VERSION;
6
6
  const projectInfo = {
7
7
  projectName: 'Vike',
@@ -1,5 +1,6 @@
1
1
  export { addSsrMiddleware };
2
2
  import { renderPage } from '../../runtime/renderPage.js';
3
+ import { assertWarning } from '../utils.js';
3
4
  function addSsrMiddleware(middlewares) {
4
5
  middlewares.use(async (req, res, next) => {
5
6
  if (res.headersSent)
@@ -8,10 +9,15 @@ function addSsrMiddleware(middlewares) {
8
9
  if (!url)
9
10
  return next();
10
11
  const { headers } = req;
11
- const userAgent = headers['user-agent'];
12
12
  const pageContextInit = {
13
13
  urlOriginal: url,
14
- userAgent,
14
+ get userAgent() {
15
+ assertWarning(false, "pageContext.userAgent is deprecated in favor of pageContext.headers['user-agent']", {
16
+ showStackTrace: true,
17
+ onlyOnce: true
18
+ });
19
+ return headers['user-agent'];
20
+ },
15
21
  headers
16
22
  };
17
23
  let pageContext;
@@ -1,7 +1,7 @@
1
1
  export { projectInfo };
2
2
  export { PROJECT_VERSION };
3
- declare const PROJECT_VERSION: "0.4.171-commit-43aef47";
3
+ declare const PROJECT_VERSION: "0.4.171-commit-bb72501";
4
4
  declare const projectInfo: {
5
5
  projectName: "Vike";
6
- projectVersion: "0.4.171-commit-43aef47";
6
+ projectVersion: "0.4.171-commit-bb72501";
7
7
  };
@@ -1,6 +1,6 @@
1
1
  export { projectInfo };
2
2
  export { PROJECT_VERSION };
3
- const PROJECT_VERSION = '0.4.171-commit-43aef47';
3
+ const PROJECT_VERSION = '0.4.171-commit-bb72501';
4
4
  const projectInfo = {
5
5
  projectName: 'Vike',
6
6
  projectVersion: PROJECT_VERSION
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.171-commit-43aef47",
3
+ "version": "0.4.171-commit-bb72501",
4
4
  "scripts": {
5
5
  "dev": "tsc --watch",
6
6
  "build": "rimraf dist/ && pnpm run build:esm && pnpm run build:cjs",