vike 0.4.173 → 0.4.174-commit-8abdb8f

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.isPlainObject = void 0;
4
4
  function isPlainObject(value) {
5
+ // Is object?
5
6
  if (typeof value !== 'object' || value === null) {
6
7
  return false;
7
8
  }
@@ -9,6 +10,7 @@ function isPlainObject(value) {
9
10
  if (Object.getPrototypeOf(value) === null) {
10
11
  return true;
11
12
  }
13
+ // Is plain object?
12
14
  return (
13
15
  /* Doesn't work in Cloudflare Pages workers
14
16
  value.constructor === Object
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeHeaders = void 0;
4
+ const isObject_js_1 = require("./isObject.js");
4
5
  function normalizeHeaders(
5
6
  /* 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.
6
7
  headersOriginal ConstructorParameters<typeof Headers>[0]
7
8
  */
8
9
  headersOriginal) {
9
- const headersStandard = new Headers(headersOriginal);
10
+ let headersCleaned = headersOriginal;
11
+ // Copied from https://github.com/hattipjs/hattip/blob/69237d181300b200a14114df2c3c115c44e0f3eb/packages/adapter/adapter-node/src/request.ts#L78-L83
12
+ if ((0, isObject_js_1.isObject)(headersCleaned) && headersCleaned[':method'])
13
+ headersCleaned = Object.fromEntries(Object.entries(headersCleaned).filter(([key]) => !key.startsWith(':')));
14
+ const headersStandard = new Headers(headersCleaned);
10
15
  const headers = Object.fromEntries(headersStandard.entries());
11
16
  return headers;
12
17
  }
@@ -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.173';
4
+ const PROJECT_VERSION = '0.4.174-commit-8abdb8f';
5
5
  exports.PROJECT_VERSION = PROJECT_VERSION;
6
6
  const projectInfo = {
7
7
  projectName: 'Vike',
@@ -1,3 +1 @@
1
- export { isPlainObject };
2
- type PlainObject = Record<string, unknown>;
3
- declare function isPlainObject(value: unknown): value is PlainObject;
1
+ export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
@@ -1,5 +1,5 @@
1
- export { isPlainObject };
2
- function isPlainObject(value) {
1
+ export function isPlainObject(value) {
2
+ // Is object?
3
3
  if (typeof value !== 'object' || value === null) {
4
4
  return false;
5
5
  }
@@ -7,6 +7,7 @@ function isPlainObject(value) {
7
7
  if (Object.getPrototypeOf(value) === null) {
8
8
  return true;
9
9
  }
10
+ // Is plain object?
10
11
  return (
11
12
  /* Doesn't work in Cloudflare Pages workers
12
13
  value.constructor === Object
@@ -1 +1,2 @@
1
- export declare function normalizeHeaders(headersOriginal: unknown): Record<string, string>;
1
+ export { normalizeHeaders };
2
+ declare function normalizeHeaders(headersOriginal: unknown): Record<string, string>;
@@ -1,9 +1,15 @@
1
- export function normalizeHeaders(
1
+ export { normalizeHeaders };
2
+ import { isObject } from './isObject.js';
3
+ function normalizeHeaders(
2
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.
3
5
  headersOriginal ConstructorParameters<typeof Headers>[0]
4
6
  */
5
7
  headersOriginal) {
6
- const headersStandard = new Headers(headersOriginal);
8
+ let headersCleaned = headersOriginal;
9
+ // Copied from https://github.com/hattipjs/hattip/blob/69237d181300b200a14114df2c3c115c44e0f3eb/packages/adapter/adapter-node/src/request.ts#L78-L83
10
+ if (isObject(headersCleaned) && headersCleaned[':method'])
11
+ headersCleaned = Object.fromEntries(Object.entries(headersCleaned).filter(([key]) => !key.startsWith(':')));
12
+ const headersStandard = new Headers(headersCleaned);
7
13
  const headers = Object.fromEntries(headersStandard.entries());
8
14
  return headers;
9
15
  }
@@ -1,7 +1,7 @@
1
1
  export { projectInfo };
2
2
  export { PROJECT_VERSION };
3
- declare const PROJECT_VERSION: "0.4.173";
3
+ declare const PROJECT_VERSION: "0.4.174-commit-8abdb8f";
4
4
  declare const projectInfo: {
5
5
  projectName: "Vike";
6
- projectVersion: "0.4.173";
6
+ projectVersion: "0.4.174-commit-8abdb8f";
7
7
  };
@@ -1,6 +1,6 @@
1
1
  export { projectInfo };
2
2
  export { PROJECT_VERSION };
3
- const PROJECT_VERSION = '0.4.173';
3
+ const PROJECT_VERSION = '0.4.174-commit-8abdb8f';
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.173",
3
+ "version": "0.4.174-commit-8abdb8f",
4
4
  "scripts": {
5
5
  "dev": "tsc --watch",
6
6
  "build": "rimraf dist/ && pnpm run build:esm && pnpm run build:cjs",
@@ -23,6 +23,7 @@
23
23
  "es-module-lexer": "^1.0.0",
24
24
  "esbuild": "^0.19.0",
25
25
  "fast-glob": "^3.0.0",
26
+ "semver": "^7.6.2",
26
27
  "sirv": "^2.0.0",
27
28
  "source-map-support": "^0.5.0"
28
29
  },