@hono/node-server 1.18.2 → 1.19.0

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.
@@ -60,6 +60,9 @@ var getStats = (path) => {
60
60
  var serveStatic = (options = { root: "" }) => {
61
61
  const root = options.root || "";
62
62
  const optionPath = options.path;
63
+ if (root !== "" && !(0, import_node_fs.existsSync)(root)) {
64
+ console.error(`serveStatic: root path '${root}' is not found, are you sure it's correct?`);
65
+ }
63
66
  return async (c, next) => {
64
67
  if (c.finalized) {
65
68
  return next();
@@ -1,6 +1,6 @@
1
1
  // src/serve-static.ts
2
2
  import { getMimeType } from "hono/utils/mime";
3
- import { createReadStream, lstatSync } from "fs";
3
+ import { createReadStream, lstatSync, existsSync } from "fs";
4
4
  import { join } from "path";
5
5
  var COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i;
6
6
  var ENCODINGS = {
@@ -36,6 +36,9 @@ var getStats = (path) => {
36
36
  var serveStatic = (options = { root: "" }) => {
37
37
  const root = options.root || "";
38
38
  const optionPath = options.path;
39
+ if (root !== "" && !existsSync(root)) {
40
+ console.error(`serveStatic: root path '${root}' is not found, are you sure it's correct?`);
41
+ }
39
42
  return async (c, next) => {
40
43
  if (c.finalized) {
41
44
  return next();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hono/node-server",
3
- "version": "1.18.2",
3
+ "version": "1.19.0",
4
4
  "description": "Node.js Adapter for Hono",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",