@efebia/fastify-auto-import 0.0.3 → 1.0.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.
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
@@ -50,19 +60,18 @@ const globFiles = async (opts) => {
50
60
  const filteredDirectories = routesDirectories.filter(dir => !opts.excludedDirectories.includes(dir));
51
61
  const importedFiles = await (0, serial_js_1.serial)(filteredDirectories.map((dir) => async () => {
52
62
  var _a;
53
- var _b;
54
63
  const osPath = node_path_1.default.join(pluginsDirectory, dir, packageType === 'module' ? `${opts.routeFile.replace(".js", "")}.js` : opts.routeFile.replace(".js", ""));
55
64
  const href = node_url_1.default.pathToFileURL(osPath).href;
56
65
  try {
57
66
  if (packageType === "module") {
58
- const importedPlugin = await (_a = href, Promise.resolve().then(() => __importStar(require(_a))));
67
+ const importedPlugin = await Promise.resolve(`${href}`).then(s => __importStar(require(s)));
59
68
  return importedPlugin.default;
60
69
  }
61
70
  return require(osPath);
62
71
  }
63
72
  catch (e) {
64
73
  console.log(e);
65
- (_b = opts.log) === null || _b === void 0 ? void 0 : _b.error({ error: e, path: osPath }, "@efebia/fastify-auto-import error on importing plugin");
74
+ (_a = opts.log) === null || _a === void 0 ? void 0 : _a.error({ error: e, path: osPath }, "@efebia/fastify-auto-import error on importing plugin");
66
75
  return null;
67
76
  }
68
77
  }));
@@ -1,3 +1,3 @@
1
1
  import { Globber } from './globber.js';
2
- declare const plugin: import("fastify").FastifyPluginAsync<Globber, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
2
+ declare const plugin: import("fastify").FastifyPluginCallback<Globber, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
3
3
  export default plugin;
package/lib/cjs/index.js CHANGED
@@ -13,6 +13,6 @@ const plugin = (0, fastify_plugin_1.default)(async (fastify, opts) => {
13
13
  }));
14
14
  }, {
15
15
  name: '@efebia/fastify-auto-import',
16
- fastify: '4.x'
16
+ fastify: '5.x'
17
17
  });
18
18
  exports.default = plugin;
@@ -1,3 +1,3 @@
1
1
  import { Globber } from './globber.js';
2
- declare const plugin: import("fastify").FastifyPluginAsync<Globber, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
2
+ declare const plugin: import("fastify").FastifyPluginCallback<Globber, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
3
3
  export default plugin;
package/lib/esm/index.js CHANGED
@@ -8,6 +8,6 @@ const plugin = fp(async (fastify, opts) => {
8
8
  }));
9
9
  }, {
10
10
  name: '@efebia/fastify-auto-import',
11
- fastify: '4.x'
11
+ fastify: '5.x'
12
12
  });
13
13
  export default plugin;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@efebia/fastify-auto-import",
3
- "version": "0.0.3",
3
+ "version": "1.0.1",
4
4
  "license": "MIT",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
7
  "type": "module",
8
8
  "dependencies": {
9
- "fastify": "^4.11.0",
10
- "fastify-plugin": "^4.4.0",
9
+ "fastify": "^5.3.0",
10
+ "fastify-plugin": "^5.0.1",
11
11
  "pino": "^8.8.0",
12
12
  "pkg-up": "^3.1.0"
13
13
  },
@@ -16,7 +16,7 @@
16
16
  "@types/node": "^18.11.18",
17
17
  "jest": "^29.3.1",
18
18
  "ts-jest": "^29.0.3",
19
- "typescript": "^4.9.4"
19
+ "typescript": "~5.8.3"
20
20
  },
21
21
  "files": [
22
22
  "/lib"