elysia-autoload 1.5.0 → 1.5.1

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.
Files changed (2) hide show
  1. package/dist/index.js +5 -1
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -26,6 +26,10 @@ function addRelativeIfNotDot(path2) {
26
26
  if (path2.at(0) !== ".") return `./${path2}`;
27
27
  return path2;
28
28
  }
29
+ const IS_BUN = typeof Bun !== "undefined";
30
+ function globSync(globPattern, globOptions) {
31
+ return IS_BUN ? Array.from(new Bun.Glob(globPattern).scanSync(globOptions)) : fs.globSync(globPattern, globOptions);
32
+ }
29
33
 
30
34
  const DIR_ROUTES_DEFAULT = "./routes";
31
35
  const TYPES_OUTPUT_DEFAULT = "./routes-types.ts";
@@ -62,7 +66,7 @@ async function autoload(options = {}) {
62
66
  });
63
67
  const globPattern = pattern || "**/*.{ts,tsx,js,jsx,mjs,cjs}";
64
68
  const globOptions = { cwd: directoryPath };
65
- const files = typeof Bun === "undefined" ? fs.globSync(globPattern, globOptions) : Array.from(new Bun.Glob(globPattern).scanSync(globOptions));
69
+ const files = globSync(globPattern, globOptions);
66
70
  if (failGlob && files.length === 0)
67
71
  throw new Error(
68
72
  `No matches found in ${directoryPath}. You can disable this error by setting the failGlob parameter to false in the options of autoload plugin`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elysia-autoload",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "author": "kravetsone",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
@@ -33,13 +33,13 @@
33
33
  },
34
34
  "files": ["dist"],
35
35
  "devDependencies": {
36
- "@biomejs/biome": "1.9.4",
36
+ "@biomejs/biome": "^1.9.4",
37
37
  "@elysiajs/eden": "^1.2.0",
38
38
  "@elysiajs/swagger": "^1.2.0",
39
- "@types/bun": "^1.1.14",
40
- "@types/node": "^22.10.2",
41
- "elysia": "^1.2.9",
42
- "pkgroll": "2.5.1",
39
+ "@types/bun": "^1.1.15",
40
+ "@types/node": "^22.10.5",
41
+ "elysia": "^1.2.10",
42
+ "pkgroll": "^2.6.1",
43
43
  "typescript": "^5.7.2",
44
44
  "@elysiajs/node": "^1.2.3"
45
45
  },