@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.
- package/lib/cjs/globber.js +19 -10
- package/lib/cjs/index.d.ts +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +1 -1
- package/package.json +4 -4
package/lib/cjs/globber.js
CHANGED
|
@@ -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 (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
|
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
|
-
(
|
|
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
|
}));
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Globber } from './globber.js';
|
|
2
|
-
declare const plugin: import("fastify").
|
|
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
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Globber } from './globber.js';
|
|
2
|
-
declare const plugin: import("fastify").
|
|
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
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@efebia/fastify-auto-import",
|
|
3
|
-
"version": "
|
|
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": "^
|
|
10
|
-
"fastify-plugin": "^
|
|
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": "
|
|
19
|
+
"typescript": "~5.8.3"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"/lib"
|