fastify-decorators
Advanced tools
Comparing version 3.10.0 to 3.11.0
@@ -9,5 +9,4 @@ /** | ||
import fp from 'fastify-plugin'; | ||
import { readdirSync } from 'fs'; | ||
import { join } from 'path'; | ||
import { pathToFileURL } from 'url'; | ||
import { lstatSync, readdirSync } from 'fs'; | ||
import { fileURLToPath, URL } from 'url'; | ||
import { servicesWithDestructors } from '../decorators/destructor.js'; | ||
@@ -36,28 +35,22 @@ import { readyMap } from '../decorators/index.js'; | ||
}); | ||
async function loadControllers(config, fastify) { | ||
await Promise.all(config.controllers.map((controller) => loadController(controller, fastify, config))); | ||
} | ||
function autoLoadModules(config) { | ||
const flags = config.mask instanceof RegExp ? config.mask.flags.replace('g', '') : ''; | ||
const filter = config.mask ? new RegExp(config.mask, flags) : defaultMask; | ||
return Promise.all([...findModules(config.directory, filter)].map(loadModule)); | ||
return Promise.all([...findModules(parseDirectory(config.directory), filter)].map(loadModule)); | ||
} | ||
function loadController(controller, fastify, config) { | ||
if (verifyController(controller)) { | ||
return controller[CREATOR].register(fastify, config.prefix); | ||
} | ||
else if (!config.skipBroken) { | ||
throw new TypeError(`Loaded file is incorrect module and can not be bootstrapped: ${controller}`); | ||
} | ||
function parseDirectory(directory) { | ||
const urlLike = directory.toString('utf8'); | ||
const url = urlLike.startsWith('file://') ? new URL(urlLike) : new URL('file://' + urlLike); | ||
if (lstatSync(url).isFile()) | ||
url.pathname += './..'; | ||
return url; | ||
} | ||
function verifyController(controller) { | ||
return controller && CREATOR in controller; | ||
} | ||
function* findModules(path, filter) { | ||
const directoriesToRead = new Set([path]); | ||
function* findModules(rootDirUrl, filter) { | ||
const directoriesToRead = new Set([rootDirUrl]); | ||
for (const dirPath of directoriesToRead) { | ||
// TODO: can be replaced with for await (const filePath of fs.opendir) in Node.js >= 12.12 | ||
for (const filePath of readdirSync(dirPath, { withFileTypes: true })) { | ||
const fullFilePath = join(dirPath, filePath.name); | ||
const fullFilePath = new URL(`./${filePath.name}`, dirPath.href + '/'); | ||
if (filePath.isDirectory()) { | ||
fullFilePath.href += '/'; | ||
directoriesToRead.add(fullFilePath); | ||
@@ -72,12 +65,27 @@ } | ||
/* istanbul ignore next */ | ||
async function loadModule(module) { | ||
async function loadModule(moduleUrl) { | ||
if (typeof require !== 'undefined') { | ||
const module = fileURLToPath(moduleUrl); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
return require(module).__esModule ? require(module).default : require(module); | ||
} | ||
return import(pathToFileURL(module).toString()).then((m) => m.default); | ||
return import(moduleUrl.toString()).then((m) => m.default); | ||
} | ||
async function loadControllers(config, fastify) { | ||
await Promise.all(config.controllers.map((controller) => loadController(controller, fastify, config))); | ||
} | ||
function loadController(controller, fastify, config) { | ||
if (verifyController(controller)) { | ||
return controller[CREATOR].register(fastify, config.prefix); | ||
} | ||
else if (!config.skipBroken) { | ||
throw new TypeError(`Loaded file is incorrect module and can not be bootstrapped: ${controller}`); | ||
} | ||
} | ||
function verifyController(controller) { | ||
return controller && CREATOR in controller; | ||
} | ||
function useGracefulShutdown(fastify) { | ||
fastify.addHook('onClose', () => Promise.all([...servicesWithDestructors].map(([Service, property]) => getInstanceByToken(Service)[property]()))); | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYm9vdHN0cmFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vbGliL2Jvb3RzdHJhcC9ib290c3RyYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBR0gsT0FBTyxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDaEMsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLElBQUksQ0FBQztBQUNqQyxPQUFPLEVBQUUsSUFBSSxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBQzVCLE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSxLQUFLLENBQUM7QUFDcEMsT0FBTyxFQU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G93bihmYXN0aWZ5OiBGYXN0aWZ5SW5zdGFuY2UpOiB2b2lkIHtcbiAgZmFzdGlmeS5hZGRIb29rKCdvbkNsb3NlJywgKCkgPT5cbiAgICBQcm9taXNlLmFsbChbLi4uc2VydmljZXNXaXRoRGVzdHJ1Y3RvcnNdLm1hcCgoW1NlcnZpY2UsIHByb3BlcnR5XSkgPT4gZ2V0SW5zdGFuY2VCeVRva2VuPHR5cGVvZiBTZXJ2aWNlPihTZXJ2aWNlKVtwcm9wZXJ0eV0oKSkpLFxuICApO1xufVxuIl19 |
@@ -8,2 +8,38 @@ # Changelog | ||
## 3.11.0 | ||
### Changed | ||
- Bootstrap autoload config now accepts `PathLike` instead of just string. This is useful for ESM projects by simplifying code: | ||
_before_: | ||
```typescript | ||
import 'reflect-metadata'; | ||
import { fastify } from 'fastify'; | ||
import { bootstrap } from 'fastify-decorators'; | ||
import * as path from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
export const app = fastify(); | ||
app.register(bootstrap, { | ||
directory: path.dirname(fileURLToPath(import.meta.url)), | ||
}); | ||
``` | ||
_after_: | ||
```typescript | ||
import 'reflect-metadata'; | ||
import { fastify } from 'fastify'; | ||
import { bootstrap } from 'fastify-decorators'; | ||
export const app = fastify(); | ||
app.register(bootstrap, { | ||
directory: import.meta.url, | ||
}); | ||
``` | ||
## 3.10.0 | ||
@@ -10,0 +46,0 @@ |
@@ -0,0 +0,0 @@ <h1 style="text-align: center">Fastify decorators</h1> |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
/** | ||
@@ -9,2 +10,3 @@ * @license | ||
import { FastifyPluginOptions } from 'fastify'; | ||
import { PathLike } from 'fs'; | ||
import { Constructor } from '../decorators/helpers/inject-dependencies.js'; | ||
@@ -18,3 +20,3 @@ /** | ||
*/ | ||
directory: string; | ||
directory: PathLike; | ||
/** | ||
@@ -21,0 +23,0 @@ * Mask used to filter files to load |
@@ -9,2 +9,2 @@ /** | ||
export {}; | ||
//# sourceMappingURL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aW5PcHRpb25zIHtcbiAgLyoqXG4gICAqIExpc3Qgb2YgQ29udHJvbGxlciBjbGFzc2VzIHRvIGJvb3RzdHJhcFxuICAgKi9cbiAgY29udHJvbGxlcnM6IENvbnN0cnVjdG9yPHVua25vd24+W107XG5cbiAgLyoqXG4gICAqIEJ5IGRlZmF1bHQgYXBwbGljYXRpb24gd2lsbCBmYWlscyB0byBib290c3RyYXAgaWYgb25lIG9yIG1vcmUgb2YgbG9hZGVkIGZpbGVzIGRvZXMgbm90IGNvbnRhaW4gdmFsaWQgY29udHJvbGxlciBvciBoYW5kbGVyXG4gICAqIFRoaXMgb3B0aW9uIGFsbG93cyB0byBjaGFuZ2UgdGhpcyBiZWhhdmlvclxuICAgKiBAZGVmYXVsdCBmYWxzZVxuICAgKi9cbiAgc2tpcEJyb2tlbj86IGJvb2xlYW47XG5cbiAgLyoqXG4gICAqIEdsb2JhbCBwcmVmaXggdG8gYmUgYXBwbGllZCBmb3IgYWxsIHJvdXRlc1xuICAgKi9cbiAgcHJlZml4Pzogc3RyaW5nO1xufVxuXG5leHBvcnQgdHlwZSBCb290c3RyYXBDb25maWcgPSBBdXRvTG9hZENvbmZpZyB8IENvbnRyb2xsZXJzTGlzdENvbmZpZztcbiJdfQ== |
{ | ||
"name": "fastify-decorators", | ||
"version": "3.10.0", | ||
"version": "3.11.0", | ||
"description": "Framework aimed to provide useful TypeScript decorators to implement controllers, services and request handlers, built with Fastify.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -1,2 +0,2 @@ | ||
[![Fastify decorators](https://raw.githubusercontent.com/L2jLiga/fastify-decorators/v3.10.0/assets/logo.png)](https://github.com/L2jLiga/fastify-decorators) | ||
[![Fastify decorators](https://raw.githubusercontent.com/L2jLiga/fastify-decorators/v3.11.0/assets/logo.png)](https://github.com/L2jLiga/fastify-decorators) | ||
@@ -255,7 +255,7 @@ [![npm version](https://badge.fury.io/js/fastify-decorators.svg?colorB=brightgreen)](https://www.npmjs.com/package/fastify-decorators) | ||
[fastify resty]: https://github.com/FastifyResty/fastify-resty | ||
[bootstrapping]: https://github.com/L2jLiga/fastify-decorators/blob/v3.10.0/docs/Bootstrapping.md | ||
[controllers]: https://github.com/L2jLiga/fastify-decorators/blob/v3.10.0/docs/Controllers.md | ||
[request handlers]: https://github.com/L2jLiga/fastify-decorators/blob/v3.10.0/docs/Request%20Handlers.md | ||
[services and dependency injection]: https://github.com/L2jLiga/fastify-decorators/blob/v3.10.0/docs/Services%20and%20dependency%20injection.md | ||
[testing]: https://github.com/L2jLiga/fastify-decorators/blob/v3.10.0/docs/Testing.md | ||
[migration guide (v3)]: https://github.com/L2jLiga/fastify-decorators/blob/v3.10.0/docs/Migration%20to%20v3.md | ||
[bootstrapping]: https://github.com/L2jLiga/fastify-decorators/blob/v3.11.0/docs/Bootstrapping.md | ||
[controllers]: https://github.com/L2jLiga/fastify-decorators/blob/v3.11.0/docs/Controllers.md | ||
[request handlers]: https://github.com/L2jLiga/fastify-decorators/blob/v3.11.0/docs/Request%20Handlers.md | ||
[services and dependency injection]: https://github.com/L2jLiga/fastify-decorators/blob/v3.11.0/docs/Services%20and%20dependency%20injection.md | ||
[testing]: https://github.com/L2jLiga/fastify-decorators/blob/v3.11.0/docs/Testing.md | ||
[migration guide (v3)]: https://github.com/L2jLiga/fastify-decorators/blob/v3.11.0/docs/Migration%20to%20v3.md |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
2813
326245