h3 1.6.4 → 1.6.5

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.
package/dist/index.cjs CHANGED
@@ -8,6 +8,11 @@ const crypto = require('uncrypto');
8
8
  const ironWebcrypto = require('iron-webcrypto');
9
9
  const defu = require('defu');
10
10
 
11
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
12
+
13
+ const destr__default = /*#__PURE__*/_interopDefaultCompat(destr);
14
+ const crypto__default = /*#__PURE__*/_interopDefaultCompat(crypto);
15
+
11
16
  function useBase(base, handler) {
12
17
  base = ufo.withoutTrailingSlash(base);
13
18
  if (!base) {
@@ -278,8 +283,8 @@ function readRawBody(event, encoding = "utf8") {
278
283
  assertMethod(event, PayloadMethods$1);
279
284
  const _rawBody = event.node.req[RawBodySymbol] || event.node.req.body;
280
285
  if (_rawBody) {
281
- const promise2 = Promise.resolve(
282
- Buffer.isBuffer(_rawBody) ? _rawBody : Buffer.from(_rawBody)
286
+ const promise2 = Promise.resolve(_rawBody).then(
287
+ (_resolved) => Buffer.isBuffer(_resolved) ? _resolved : Buffer.from(_resolved)
283
288
  );
284
289
  return encoding ? promise2.then((buff) => buff.toString(encoding)) : promise2;
285
290
  }
@@ -321,7 +326,7 @@ async function readBody(event) {
321
326
  }
322
327
  return parsedForm;
323
328
  }
324
- const json = destr(body);
329
+ const json = destr__default(body);
325
330
  event.node.req[ParsedBodySymbol] = json;
326
331
  return json;
327
332
  }
@@ -805,7 +810,7 @@ async function getSession(event, config) {
805
810
  Object.assign(session, unsealed);
806
811
  }
807
812
  if (!session.id) {
808
- session.id = (config.crypto || crypto).randomUUID();
813
+ session.id = (config.crypto || crypto__default).randomUUID();
809
814
  session.createdAt = Date.now();
810
815
  await updateSession(event, config);
811
816
  }
@@ -833,7 +838,7 @@ async function updateSession(event, config, update) {
833
838
  async function sealSession(event, config) {
834
839
  const sessionName = config.name || DEFAULT_NAME;
835
840
  const session = event.context.sessions?.[sessionName] || await getSession(event, config);
836
- const sealed = await ironWebcrypto.seal(config.crypto || crypto, session, config.password, {
841
+ const sealed = await ironWebcrypto.seal(config.crypto || crypto__default, session, config.password, {
837
842
  ...ironWebcrypto.defaults,
838
843
  ttl: config.maxAge ? config.maxAge * 1e3 : 0,
839
844
  ...config.seal
@@ -842,7 +847,7 @@ async function sealSession(event, config) {
842
847
  }
843
848
  async function unsealSession(_event, config, sealed) {
844
849
  const unsealed = await ironWebcrypto.unseal(
845
- config.crypto || crypto,
850
+ config.crypto || crypto__default,
846
851
  sealed,
847
852
  config.password,
848
853
  {
package/dist/index.mjs CHANGED
@@ -276,8 +276,8 @@ function readRawBody(event, encoding = "utf8") {
276
276
  assertMethod(event, PayloadMethods$1);
277
277
  const _rawBody = event.node.req[RawBodySymbol] || event.node.req.body;
278
278
  if (_rawBody) {
279
- const promise2 = Promise.resolve(
280
- Buffer.isBuffer(_rawBody) ? _rawBody : Buffer.from(_rawBody)
279
+ const promise2 = Promise.resolve(_rawBody).then(
280
+ (_resolved) => Buffer.isBuffer(_resolved) ? _resolved : Buffer.from(_resolved)
281
281
  );
282
282
  return encoding ? promise2.then((buff) => buff.toString(encoding)) : promise2;
283
283
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "h3",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "description": "Tiny JavaScript Server",
5
5
  "repository": "unjs/h3",
6
6
  "license": "MIT",
@@ -20,37 +20,37 @@
20
20
  "dist"
21
21
  ],
22
22
  "dependencies": {
23
- "cookie-es": "^0.5.0",
23
+ "cookie-es": "^1.0.0",
24
24
  "defu": "^6.1.2",
25
25
  "destr": "^1.2.2",
26
- "iron-webcrypto": "^0.6.0",
26
+ "iron-webcrypto": "^0.7.0",
27
27
  "radix3": "^1.0.1",
28
- "ufo": "^1.1.1",
28
+ "ufo": "^1.1.2",
29
29
  "uncrypto": "^0.1.2"
30
30
  },
31
31
  "devDependencies": {
32
32
  "0x": "^5.5.0",
33
33
  "@types/express": "^4.17.17",
34
- "@types/node": "^18.15.10",
34
+ "@types/node": "^20.0.0",
35
35
  "@types/supertest": "^2.0.12",
36
- "@vitest/coverage-c8": "^0.29.7",
37
- "autocannon": "^7.10.0",
38
- "changelogen": "^0.5.1",
36
+ "@vitest/coverage-c8": "^0.31.0",
37
+ "autocannon": "^7.11.0",
38
+ "changelogen": "^0.5.3",
39
39
  "connect": "^3.7.0",
40
- "eslint": "^8.36.0",
40
+ "eslint": "^8.39.0",
41
41
  "eslint-config-unjs": "^0.1.0",
42
42
  "express": "^4.18.2",
43
43
  "get-port": "^6.1.2",
44
44
  "jiti": "^1.18.2",
45
45
  "listhen": "^1.0.4",
46
- "node-fetch-native": "^1.0.2",
47
- "prettier": "^2.8.7",
46
+ "node-fetch-native": "^1.1.0",
47
+ "prettier": "^2.8.8",
48
48
  "supertest": "^6.3.3",
49
- "typescript": "^5.0.2",
50
- "unbuild": "^1.1.2",
51
- "vitest": "^0.29.7"
49
+ "typescript": "^5.0.4",
50
+ "unbuild": "^1.2.1",
51
+ "vitest": "^0.31.0"
52
52
  },
53
- "packageManager": "pnpm@8.0.0",
53
+ "packageManager": "pnpm@8.4.0",
54
54
  "scripts": {
55
55
  "build": "unbuild",
56
56
  "dev": "vitest",