@expressots/adapter-express 1.5.0 → 1.7.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.
Files changed (31) hide show
  1. package/lib/CHANGELOG.md +38 -1
  2. package/lib/cjs/adapter-express/application-express.js +40 -10
  3. package/lib/cjs/adapter-express/express-utils/constants.js +2 -1
  4. package/lib/cjs/adapter-express/express-utils/decorators.js +29 -12
  5. package/lib/cjs/adapter-express/express-utils/inversify-express-server.js +11 -5
  6. package/lib/cjs/adapter-express/express-utils/utils.js +7 -8
  7. package/lib/cjs/adapter-express/index.js +1 -0
  8. package/lib/cjs/adapter-express/render/ejs/ejs.config.js +37 -0
  9. package/lib/cjs/adapter-express/render/ejs/ejs.types.js +3 -0
  10. package/lib/cjs/adapter-express/render/engine.js +15 -0
  11. package/lib/cjs/adapter-express/render/handlebars/hbs.config.js +38 -0
  12. package/lib/cjs/adapter-express/render/index.js +5 -0
  13. package/lib/cjs/adapter-express/render/pug/pug.config.js +25 -0
  14. package/lib/cjs/adapter-express/render/resolve-render.js +33 -0
  15. package/lib/cjs/types/adapter-express/application-express.d.ts +10 -5
  16. package/lib/cjs/types/adapter-express/application-express.interface.d.ts +1 -13
  17. package/lib/cjs/types/adapter-express/application-express.types.d.ts +3 -2
  18. package/lib/cjs/types/adapter-express/express-utils/constants.d.ts +1 -0
  19. package/lib/cjs/types/adapter-express/express-utils/content/httpContent.d.ts +0 -1
  20. package/lib/cjs/types/adapter-express/express-utils/decorators.d.ts +12 -1
  21. package/lib/cjs/types/adapter-express/express-utils/httpResponseMessage.d.ts +0 -1
  22. package/lib/cjs/types/adapter-express/index.d.ts +1 -0
  23. package/lib/cjs/types/adapter-express/render/ejs/ejs.config.d.ts +21 -0
  24. package/lib/cjs/types/adapter-express/render/ejs/ejs.types.d.ts +169 -0
  25. package/lib/cjs/types/adapter-express/render/engine.d.ts +28 -0
  26. package/lib/cjs/types/adapter-express/render/handlebars/hbs.config.d.ts +20 -0
  27. package/lib/cjs/types/adapter-express/render/index.d.ts +4 -0
  28. package/lib/cjs/types/adapter-express/render/pug/pug.config.d.ts +17 -0
  29. package/lib/cjs/types/adapter-express/render/resolve-render.d.ts +7 -0
  30. package/lib/package.json +18 -19
  31. package/package.json +18 -19
package/lib/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
 
2
2
 
3
+ ## [1.7.0](https://github.com/expressots/adapter-express/compare/1.6.0...1.7.0) (2024-07-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * add @Render decorator ([522d6e2](https://github.com/expressots/adapter-express/commit/522d6e27163b1ec638a9d5328fb3bf5f81054c5c))
9
+ * add pug engine support ([a879f96](https://github.com/expressots/adapter-express/commit/a879f9642dccd74a49b9188a25fcd1bbf30eb8ba))
10
+ * bump husky from 9.0.11 to 9.1.1 ([7c1678a](https://github.com/expressots/adapter-express/commit/7c1678abf4a78e52483fff190524c5658dba1100))
11
+ * bump vite from 5.3.3 to 5.3.4 ([86f51a3](https://github.com/expressots/adapter-express/commit/86f51a3f5f920fcc7a760730e877ae830fa574e5))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * add options to ejs and hbs support ([b52ce5c](https://github.com/expressots/adapter-express/commit/b52ce5c3860ea7d859534d96cee030dbc4ffc19c))
17
+
18
+ ## [1.6.0](https://github.com/expressots/adapter-express/compare/1.5.0...1.6.0) (2024-07-17)
19
+
20
+
21
+ ### Features
22
+
23
+ * add render support for EJS and HBS ([8618655](https://github.com/expressots/adapter-express/commit/861865564bcdb2d90d7a083bf19f76918e810744))
24
+ * adjust version of core package ([a699bd4](https://github.com/expressots/adapter-express/commit/a699bd4e24fd86474f2c678798abcdd311bce0f1))
25
+ * bump @types/node from 20.14.9 to 20.14.10 ([9a1291b](https://github.com/expressots/adapter-express/commit/9a1291b7c5174d68e079f2b46b0cd140cf4332c1))
26
+ * bump @typescript-eslint/eslint-plugin from 7.15.0 to 7.16.1 ([e7d3c9a](https://github.com/expressots/adapter-express/commit/e7d3c9aea3e260417af7a77694e0c0511e0307b7))
27
+ * bump @typescript-eslint/parser from 7.15.0 to 7.16.1 ([2a99945](https://github.com/expressots/adapter-express/commit/2a99945f749015301b7e53d9bbfa151aa9adb0f6))
28
+ * bump prettier from 3.3.2 to 3.3.3 ([d7de72a](https://github.com/expressots/adapter-express/commit/d7de72a87b8ca503ff37d6ce0974ceb53af51dfe))
29
+ * bump release-it from 17.4.1 to 17.6.0 ([c36aeb6](https://github.com/expressots/adapter-express/commit/c36aeb6a51e446bb3757421fe613fd3202dfaf16))
30
+ * bump typescript from 5.2.2 to 5.5.3 ([53f9f96](https://github.com/expressots/adapter-express/commit/53f9f96f65d2b4652126f7f42c2b9774f0db7328))
31
+ * bump vitest and @vitest/coverage-v8 ([b2dae7e](https://github.com/expressots/adapter-express/commit/b2dae7e4e247e288a5fe8fefe135e47925b2f122))
32
+ * bump vitest and @vitest/coverage-v8 ([b3221eb](https://github.com/expressots/adapter-express/commit/b3221eba32cc85e304fef1cb98389dcae0566c24))
33
+ * linter adjust ([e43d222](https://github.com/expressots/adapter-express/commit/e43d2221ec3f869d60dc2b967ab325e3aaecc97b))
34
+
35
+
36
+ ### Bug Fixes
37
+
38
+ * bump node version 18.18 and removed deprecated install in husky ([778ed79](https://github.com/expressots/adapter-express/commit/778ed79c3595fd239656d8182623635a8fff16d0))
39
+
3
40
  ## [1.5.0](https://github.com/expressots/adapter-express/compare/1.4.0...1.5.0) (2024-06-11)
4
41
 
5
42
 
@@ -119,4 +156,4 @@
119
156
 
120
157
  ### Bug Fixes
121
158
 
122
- * testing commitlint ([0e78653](https://github.com/expressots/<<repo_name>>/commit/0e786539402f69fdca3fe5b684d850e523db7698))
159
+ * testing commitlint ([0e78653](https://github.com/expressots/<<repo_name>>/commit/0e786539402f69fdca3fe5b684d850e523db7698))
@@ -15,8 +15,12 @@ const inversify_binding_decorators_1 = require("inversify-binding-decorators");
15
15
  const process_1 = __importDefault(require("process"));
16
16
  const application_express_base_1 = require("./application-express.base");
17
17
  const application_express_types_1 = require("./application-express.types");
18
- const inversify_express_server_1 = require("./express-utils/inversify-express-server");
19
18
  const http_status_middleware_1 = require("./express-utils/http-status-middleware");
19
+ const inversify_express_server_1 = require("./express-utils/inversify-express-server");
20
+ const ejs_config_1 = require("./render/ejs/ejs.config");
21
+ const engine_1 = require("./render/engine");
22
+ const hbs_config_1 = require("./render/handlebars/hbs.config");
23
+ const pug_config_1 = require("./render/pug/pug.config");
20
24
  /**
21
25
  * The AppExpress class provides methods for configuring and running an Express application.
22
26
  * @class AppExpress
@@ -34,6 +38,7 @@ let AppExpress = class AppExpress extends application_express_base_1.Application
34
38
  this.logger = new core_1.Logger();
35
39
  this.globalPrefix = "/";
36
40
  this.middlewares = [];
41
+ this.renderOptions = {};
37
42
  }
38
43
  configureServices() { }
39
44
  postServerInitialization() { }
@@ -122,6 +127,7 @@ let AppExpress = class AppExpress extends application_express_base_1.Application
122
127
  */
123
128
  async listen(port, environment, consoleMessage) {
124
129
  await this.init();
130
+ await this.configEngine();
125
131
  this.port = port || 3000;
126
132
  this.environment = environment;
127
133
  this.app.set("env", environment);
@@ -145,6 +151,26 @@ let AppExpress = class AppExpress extends application_express_base_1.Application
145
151
  setGlobalRoutePrefix(prefix) {
146
152
  this.globalPrefix = prefix;
147
153
  }
154
+ /**
155
+ * Configures the application's view engine based on the provided configuration options.
156
+ */
157
+ async configEngine() {
158
+ if (this.renderOptions.engine) {
159
+ switch (this.renderOptions.engine) {
160
+ case engine_1.Engine.HBS:
161
+ await (0, hbs_config_1.setEngineHandlebars)(this.app, this.renderOptions.options);
162
+ break;
163
+ case engine_1.Engine.EJS:
164
+ await (0, ejs_config_1.setEngineEjs)(this.app, this.renderOptions.options);
165
+ break;
166
+ case engine_1.Engine.PUG:
167
+ await (0, pug_config_1.setEnginePug)(this.app, this.renderOptions.options);
168
+ break;
169
+ default:
170
+ throw new Error("Unsupported engine type!");
171
+ }
172
+ }
173
+ }
148
174
  /**
149
175
  * Configures the application's view engine based on the provided configuration options.
150
176
  *
@@ -152,16 +178,20 @@ let AppExpress = class AppExpress extends application_express_base_1.Application
152
178
  * @method setEngine
153
179
  * @template T - A generic type extending from RenderTemplateOptions.
154
180
  *
155
- * @param {T} options - An object of type T (must be an object that extends RenderTemplateOptions)
156
- * that provides the configuration options for setting the view engine.
157
- * This includes the extension name, view path, and the engine function itself.
181
+ * @param {Engine} engine - The view engine to set
182
+ * @param {EngineOptions} [options] - The configuration options for the view engine
158
183
  */
159
- setEngine(options) {
160
- if ("extName" in options) {
161
- const { extName, viewPath, engine } = options;
162
- this.app.engine(extName, engine);
163
- this.app.set("view engine", extName);
164
- this.app.set("views", viewPath);
184
+ async setEngine(engine, options) {
185
+ try {
186
+ if (options) {
187
+ this.renderOptions = { engine, options };
188
+ }
189
+ else {
190
+ this.renderOptions = { engine };
191
+ }
192
+ }
193
+ catch (error) {
194
+ this.logger.error(error.message, "adapter-express");
165
195
  }
166
196
  }
167
197
  /**
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_ROUTING_ROOT_PATH = exports.NO_CONTROLLERS_FOUND = exports.DUPLICATED_CONTROLLER_NAME = exports.HTTP_VERBS_ENUM = exports.PARAMETER_TYPE = exports.HTTP_CODE_METADATA = exports.METADATA_KEY = exports.TYPE = void 0;
3
+ exports.DEFAULT_ROUTING_ROOT_PATH = exports.NO_CONTROLLERS_FOUND = exports.DUPLICATED_CONTROLLER_NAME = exports.HTTP_VERBS_ENUM = exports.PARAMETER_TYPE = exports.RENDER_METADATA_KEY = exports.HTTP_CODE_METADATA = exports.METADATA_KEY = exports.TYPE = void 0;
4
4
  exports.TYPE = {
5
5
  AuthProvider: Symbol.for("AuthProvider"),
6
6
  Controller: Symbol.for("Controller"),
@@ -17,6 +17,7 @@ exports.HTTP_CODE_METADATA = {
17
17
  statusCode: "inversify-express-utils:statuscode",
18
18
  path: "inversify-express-utils:path",
19
19
  };
20
+ exports.RENDER_METADATA_KEY = Symbol("Render");
20
21
  var PARAMETER_TYPE;
21
22
  (function (PARAMETER_TYPE) {
22
23
  PARAMETER_TYPE[PARAMETER_TYPE["REQUEST"] = 0] = "REQUEST";
@@ -1,6 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.params = exports.principal = exports.next = exports.cookies = exports.headers = exports.body = exports.query = exports.param = exports.response = exports.request = exports.httpMethod = exports.Delete = exports.Head = exports.Patch = exports.Put = exports.Post = exports.Get = exports.All = exports.Http = exports.controller = exports.injectHttpContext = void 0;
3
+ exports.principal = exports.next = exports.cookies = exports.headers = exports.body = exports.query = exports.param = exports.response = exports.request = exports.injectHttpContext = void 0;
4
+ exports.controller = controller;
5
+ exports.Http = Http;
6
+ exports.All = All;
7
+ exports.Get = Get;
8
+ exports.Post = Post;
9
+ exports.Put = Put;
10
+ exports.Patch = Patch;
11
+ exports.Head = Head;
12
+ exports.Delete = Delete;
13
+ exports.httpMethod = httpMethod;
14
+ exports.params = params;
15
+ exports.Render = Render;
16
+ exports.getRenderMetadata = getRenderMetadata;
4
17
  require("reflect-metadata");
5
18
  const inversify_1 = require("inversify");
6
19
  const constants_1 = require("./constants");
@@ -37,7 +50,6 @@ function controller(path, ...middleware) {
37
50
  Reflect.defineMetadata(constants_1.METADATA_KEY.controller, newMetadata, Reflect);
38
51
  };
39
52
  }
40
- exports.controller = controller;
41
53
  /**
42
54
  * Http decorator to define the status code for a route
43
55
  * @param code
@@ -65,7 +77,6 @@ function Http(code) {
65
77
  Reflect.defineMetadata(constants_1.HTTP_CODE_METADATA.statusCode, httpCodeMetadata, Reflect);
66
78
  };
67
79
  }
68
- exports.Http = Http;
69
80
  /**
70
81
  * Decorator to allow accept all HTTP methods
71
82
  * @param path route path, wildcard
@@ -74,7 +85,6 @@ exports.Http = Http;
74
85
  function All(path, ...middleware) {
75
86
  return httpMethod("all", path, ...middleware);
76
87
  }
77
- exports.All = All;
78
88
  /**
79
89
  * Decorator to allow GET HTTP method
80
90
  * @param path route path
@@ -83,7 +93,6 @@ exports.All = All;
83
93
  function Get(path, ...middleware) {
84
94
  return enhancedHttpMethod("get", path, ...middleware);
85
95
  }
86
- exports.Get = Get;
87
96
  /**
88
97
  * Decorator to allow POST HTTP method
89
98
  * @param path route path
@@ -92,7 +101,6 @@ exports.Get = Get;
92
101
  function Post(path, ...middleware) {
93
102
  return httpMethod("post", path, ...middleware);
94
103
  }
95
- exports.Post = Post;
96
104
  /**
97
105
  * Decorator to allow PUT HTTP method
98
106
  * @param path route path
@@ -101,7 +109,6 @@ exports.Post = Post;
101
109
  function Put(path, ...middleware) {
102
110
  return enhancedHttpMethod("put", path, ...middleware);
103
111
  }
104
- exports.Put = Put;
105
112
  /**
106
113
  * Decorator to allow PATCH HTTP method
107
114
  * @param path route path
@@ -110,7 +117,6 @@ exports.Put = Put;
110
117
  function Patch(path, ...middleware) {
111
118
  return enhancedHttpMethod("patch", path, ...middleware);
112
119
  }
113
- exports.Patch = Patch;
114
120
  /**
115
121
  * Decorator to allow HEAD HTTP method
116
122
  * @param path route path
@@ -119,7 +125,6 @@ exports.Patch = Patch;
119
125
  function Head(path, ...middleware) {
120
126
  return httpMethod("head", path, ...middleware);
121
127
  }
122
- exports.Head = Head;
123
128
  /**
124
129
  * Decorator to allow DELETE HTTP method
125
130
  * @param path route path
@@ -128,7 +133,6 @@ exports.Head = Head;
128
133
  function Delete(path, ...middleware) {
129
134
  return enhancedHttpMethod("delete", path, ...middleware);
130
135
  }
131
- exports.Delete = Delete;
132
136
  /**
133
137
  * Decorator to allow OPTIONS HTTP method
134
138
  * @param path route path
@@ -219,7 +223,6 @@ function httpMethod(method, path, ...middleware) {
219
223
  metadataList.push(metadata);
220
224
  };
221
225
  }
222
- exports.httpMethod = httpMethod;
223
226
  /**
224
227
  * Parameter decorator to inject the request object
225
228
  * @returns ParameterDecorator
@@ -300,7 +303,21 @@ function params(type, parameterName) {
300
303
  Reflect.defineMetadata(constants_1.METADATA_KEY.controllerParameter, metadataList, target.constructor);
301
304
  };
302
305
  }
303
- exports.params = params;
306
+ /**
307
+ * Render decorator to define the template and default data for a route
308
+ * @param template The template to render
309
+ * @param defaultData The default data to pass to the template
310
+ * @returns
311
+ */
312
+ function Render(template, defaultData) {
313
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
314
+ return (target, propertyKey, descriptor) => {
315
+ Reflect.defineMetadata(constants_1.RENDER_METADATA_KEY, { template, defaultData }, target, propertyKey);
316
+ };
317
+ }
318
+ function getRenderMetadata(target, propertyKey) {
319
+ return Reflect.getMetadata(constants_1.RENDER_METADATA_KEY, target, propertyKey) || {};
320
+ }
304
321
  /**
305
322
  * Converts a string value to the specified type.
306
323
  * @param value The value to convert.
@@ -30,6 +30,7 @@ const base_middleware_1 = require("./base-middleware");
30
30
  const utils_1 = require("./utils");
31
31
  const constants_1 = require("./constants");
32
32
  const httpResponseMessage_1 = require("./httpResponseMessage");
33
+ const decorators_1 = require("./decorators");
33
34
  class InversifyExpressServer {
34
35
  /**
35
36
  * Wrapper for the express server.
@@ -182,8 +183,14 @@ class InversifyExpressServer {
182
183
  const httpContext = this._getHttpContext(req);
183
184
  httpContext.container.bind(constants_1.TYPE.HttpContext).toConstantValue(httpContext);
184
185
  // invoke controller's action
185
- const value = await httpContext.container.getNamed(constants_1.TYPE.Controller, controllerName)[key](...args);
186
- if (value instanceof httpResponseMessage_1.HttpResponseMessage) {
186
+ const controller = httpContext.container.getNamed(constants_1.TYPE.Controller, controllerName);
187
+ const value = await controller[key](...args);
188
+ const { template, defaultData } = (0, decorators_1.getRenderMetadata)(controller, key);
189
+ if (template) {
190
+ const data = value || defaultData || {};
191
+ res.render(template, data);
192
+ }
193
+ else if (value instanceof httpResponseMessage_1.HttpResponseMessage) {
187
194
  await this.handleHttpResponseMessage(value, res);
188
195
  }
189
196
  else if ((0, utils_1.instanceOfIHttpActionResult)(value)) {
@@ -194,10 +201,9 @@ class InversifyExpressServer {
194
201
  value();
195
202
  }
196
203
  else if (!res.headersSent) {
197
- if (value === undefined) {
198
- res.status(204);
204
+ if (value !== undefined) {
205
+ res.send(value);
199
206
  }
200
- res.send(value);
201
207
  }
202
208
  }
203
209
  catch (err) {
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.instanceOfIHttpActionResult = exports.cleanUpMetadata = exports.getControllerParameterMetadata = exports.getControllerMethodMetadata = exports.getControllerMetadata = exports.getControllersFromMetadata = exports.getControllersFromContainer = void 0;
3
+ exports.getControllersFromContainer = getControllersFromContainer;
4
+ exports.getControllersFromMetadata = getControllersFromMetadata;
5
+ exports.getControllerMetadata = getControllerMetadata;
6
+ exports.getControllerMethodMetadata = getControllerMethodMetadata;
7
+ exports.getControllerParameterMetadata = getControllerParameterMetadata;
8
+ exports.cleanUpMetadata = cleanUpMetadata;
9
+ exports.instanceOfIHttpActionResult = instanceOfIHttpActionResult;
4
10
  const constants_1 = require("./constants");
5
11
  function getControllersFromContainer(container, forceControllers) {
6
12
  if (container.isBound(constants_1.TYPE.Controller)) {
@@ -13,17 +19,14 @@ function getControllersFromContainer(container, forceControllers) {
13
19
  return [];
14
20
  }
15
21
  }
16
- exports.getControllersFromContainer = getControllersFromContainer;
17
22
  function getControllersFromMetadata() {
18
23
  const arrayOfControllerMetadata = Reflect.getMetadata(constants_1.METADATA_KEY.controller, Reflect) || [];
19
24
  return arrayOfControllerMetadata.map((metadata) => metadata.target);
20
25
  }
21
- exports.getControllersFromMetadata = getControllersFromMetadata;
22
26
  function getControllerMetadata(constructor) {
23
27
  const controllerMetadata = Reflect.getOwnMetadata(constants_1.METADATA_KEY.controller, constructor);
24
28
  return controllerMetadata;
25
29
  }
26
- exports.getControllerMetadata = getControllerMetadata;
27
30
  function getControllerMethodMetadata(constructor) {
28
31
  const methodMetadata = Reflect.getOwnMetadata(constants_1.METADATA_KEY.controllerMethod, constructor);
29
32
  const genericMetadata = Reflect.getMetadata(constants_1.METADATA_KEY.controllerMethod, Reflect.getPrototypeOf(constructor));
@@ -35,7 +38,6 @@ function getControllerMethodMetadata(constructor) {
35
38
  }
36
39
  return methodMetadata;
37
40
  }
38
- exports.getControllerMethodMetadata = getControllerMethodMetadata;
39
41
  function getControllerParameterMetadata(constructor) {
40
42
  const parameterMetadata = Reflect.getOwnMetadata(constants_1.METADATA_KEY.controllerParameter, constructor);
41
43
  const genericMetadata = Reflect.getMetadata(constants_1.METADATA_KEY.controllerParameter, Reflect.getPrototypeOf(constructor));
@@ -47,12 +49,9 @@ function getControllerParameterMetadata(constructor) {
47
49
  }
48
50
  return parameterMetadata;
49
51
  }
50
- exports.getControllerParameterMetadata = getControllerParameterMetadata;
51
52
  function cleanUpMetadata() {
52
53
  Reflect.defineMetadata(constants_1.METADATA_KEY.controller, [], Reflect);
53
54
  }
54
- exports.cleanUpMetadata = cleanUpMetadata;
55
55
  function instanceOfIHttpActionResult(value) {
56
56
  return value != null && typeof value.executeAsync === "function";
57
57
  }
58
- exports.instanceOfIHttpActionResult = instanceOfIHttpActionResult;
@@ -20,3 +20,4 @@ var application_express_1 = require("./application-express");
20
20
  Object.defineProperty(exports, "AppExpress", { enumerable: true, get: function () { return application_express_1.AppExpress; } });
21
21
  var application_express_types_1 = require("./application-express.types");
22
22
  Object.defineProperty(exports, "ServerEnvironment", { enumerable: true, get: function () { return application_express_types_1.ServerEnvironment; } });
23
+ __exportStar(require("./render"), exports);
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setEngineEjs = setEngineEjs;
4
+ const path_1 = require("path");
5
+ const resolve_render_1 = require("../resolve-render");
6
+ /**
7
+ * Ejs defaults
8
+ * @type {EjsOptions}
9
+ * @constant
10
+ * @default
11
+ */
12
+ const EJS_DEFAULTS = {
13
+ viewsDir: (0, path_1.join)(process.cwd(), "views"),
14
+ viewEngine: "ejs",
15
+ serverOptions: {},
16
+ };
17
+ /**
18
+ * Set Ejs as the view engine
19
+ * @param {Application} app - The express application
20
+ * @param {EjsOptions} [options=EJS_DEFAULTS] - The ejs options
21
+ */
22
+ async function setEngineEjs(app, options = EJS_DEFAULTS) {
23
+ (0, resolve_render_1.packageResolver)("ejs");
24
+ app.set("view engine", options.viewEngine || EJS_DEFAULTS.viewEngine);
25
+ app.set("views", options.viewsDir || EJS_DEFAULTS.viewsDir);
26
+ if (Array.isArray(options.viewsDir)) {
27
+ options.viewsDir.forEach((dir) => {
28
+ app.set("views", dir);
29
+ });
30
+ }
31
+ if (options.serverOptions) {
32
+ app.locals = {
33
+ ...app.locals,
34
+ ...options.serverOptions,
35
+ };
36
+ }
37
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Engine = void 0;
4
+ /**
5
+ * The supported view engines.
6
+ * @enum {string}
7
+ * @readonly
8
+ * @public
9
+ */
10
+ var Engine;
11
+ (function (Engine) {
12
+ Engine["HBS"] = "hbs";
13
+ Engine["EJS"] = "ejs";
14
+ Engine["PUG"] = "pug";
15
+ })(Engine || (exports.Engine = Engine = {}));
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setEngineHandlebars = setEngineHandlebars;
4
+ const path_1 = require("path");
5
+ const core_1 = require("@expressots/core");
6
+ const resolve_render_1 = require("../resolve-render");
7
+ /**
8
+ * Handlebars defaults
9
+ * @type {HandlebarsOptions}
10
+ * @constant
11
+ * @default
12
+ */
13
+ const HANDLEBARS_DEFAULTS = {
14
+ viewEngine: "hbs",
15
+ viewsDir: (0, path_1.join)(process.cwd(), "views"),
16
+ partialsDir: (0, path_1.join)(process.cwd(), "views/partials"),
17
+ };
18
+ /**
19
+ * Default partials directory
20
+ */
21
+ const DEFAULT_PARTIALS_DIR = (0, path_1.join)(process.cwd(), "views/partials");
22
+ /**
23
+ * Set Handlebars as the view engine
24
+ * @param {express.Application} app - The express application
25
+ * @param {HandlebarsOptions} [options=HANDLEBARS_DEFAULTS] - The handlebars options
26
+ */
27
+ async function setEngineHandlebars(app, options = HANDLEBARS_DEFAULTS) {
28
+ const logger = new core_1.Logger();
29
+ try {
30
+ const hbs = (0, resolve_render_1.packageResolver)("hbs");
31
+ hbs.registerPartials(options.partialsDir || DEFAULT_PARTIALS_DIR);
32
+ app.set("view engine", options.viewEngine || HANDLEBARS_DEFAULTS.viewEngine);
33
+ app.set("views", options.viewsDir || HANDLEBARS_DEFAULTS.viewsDir);
34
+ }
35
+ catch (error) {
36
+ logger.error(error.message, "handlebars-config");
37
+ }
38
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Engine = void 0;
4
+ var engine_1 = require("./engine");
5
+ Object.defineProperty(exports, "Engine", { enumerable: true, get: function () { return engine_1.Engine; } });
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setEnginePug = setEnginePug;
4
+ const path_1 = require("path");
5
+ const resolve_render_1 = require("../resolve-render");
6
+ /**
7
+ * Pug defaults
8
+ * @type {PugOptions}
9
+ * @constant
10
+ * @default
11
+ */
12
+ const PUG_DEFAULTS = {
13
+ viewEngine: "pug",
14
+ viewsDir: (0, path_1.join)(process.cwd(), "views"),
15
+ };
16
+ /**
17
+ * Set Pug as the view engine
18
+ * @param {express.Application} app - The express application
19
+ * @param {PugOptions} [options=PUG_DEFAULTS] - The pug options
20
+ */
21
+ async function setEnginePug(app, options = PUG_DEFAULTS) {
22
+ (0, resolve_render_1.packageResolver)("pug");
23
+ app.set("view engine", options.viewEngine || PUG_DEFAULTS.viewEngine);
24
+ app.set("views", options.viewsDir || PUG_DEFAULTS.viewsDir);
25
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.packageResolver = packageResolver;
4
+ /* eslint-disable @typescript-eslint/no-explicit-any */
5
+ const core_1 = require("@expressots/core");
6
+ /**
7
+ * Resolve package from the current working directory.
8
+ * @param packageName
9
+ * @param options
10
+ * @returns
11
+ */
12
+ function packageResolver(packageName, ...options) {
13
+ const logger = new core_1.Logger();
14
+ try {
15
+ const hasPackage = require.resolve(packageName, {
16
+ paths: [process.cwd()],
17
+ });
18
+ if (hasPackage) {
19
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
20
+ const packageResolved = require(hasPackage);
21
+ if (typeof packageResolved === "function") {
22
+ return packageResolved(...options);
23
+ }
24
+ if (packageResolved.default && typeof packageResolved.default === "function") {
25
+ return packageResolved.default(...options);
26
+ }
27
+ return packageResolved;
28
+ }
29
+ }
30
+ catch (error) {
31
+ logger.warn(`Package [${packageName}] not installed. Please install it using your package manager.`, "package-resolver");
32
+ }
33
+ }
@@ -1,8 +1,9 @@
1
- import { IApplicationMessageToConsole, RenderTemplateOptions } from "@expressots/core";
1
+ import { IApplicationMessageToConsole } from "@expressots/core";
2
2
  import express from "express";
3
3
  import { Container } from "inversify";
4
4
  import { ApplicationBase } from "./application-express.base";
5
5
  import { IWebServer, ServerEnvironment } from "./application-express.types";
6
+ import { Engine, EngineOptions } from "./render/engine";
6
7
  /**
7
8
  * The AppExpress class provides methods for configuring and running an Express application.
8
9
  * @class AppExpress
@@ -23,6 +24,7 @@ declare class AppExpress extends ApplicationBase implements IWebServer {
23
24
  private globalPrefix;
24
25
  private middlewares;
25
26
  private console;
27
+ private renderOptions;
26
28
  protected configureServices(): void | Promise<void>;
27
29
  protected postServerInitialization(): void | Promise<void>;
28
30
  protected serverShutdown(): void | Promise<void>;
@@ -65,6 +67,10 @@ declare class AppExpress extends ApplicationBase implements IWebServer {
65
67
  *
66
68
  */
67
69
  setGlobalRoutePrefix(prefix: string): void;
70
+ /**
71
+ * Configures the application's view engine based on the provided configuration options.
72
+ */
73
+ private configEngine;
68
74
  /**
69
75
  * Configures the application's view engine based on the provided configuration options.
70
76
  *
@@ -72,11 +78,10 @@ declare class AppExpress extends ApplicationBase implements IWebServer {
72
78
  * @method setEngine
73
79
  * @template T - A generic type extending from RenderTemplateOptions.
74
80
  *
75
- * @param {T} options - An object of type T (must be an object that extends RenderTemplateOptions)
76
- * that provides the configuration options for setting the view engine.
77
- * This includes the extension name, view path, and the engine function itself.
81
+ * @param {Engine} engine - The view engine to set
82
+ * @param {EngineOptions} [options] - The configuration options for the view engine
78
83
  */
79
- setEngine<T extends RenderTemplateOptions>(options: T): void;
84
+ setEngine<T extends EngineOptions>(engine: Engine, options?: T): Promise<void>;
80
85
  /**
81
86
  * Verifies if the current environment is development.
82
87
  *
@@ -1,5 +1,5 @@
1
+ import { IApplicationMessageToConsole } from "@expressots/core";
1
2
  import express from "express";
2
- import { IApplicationMessageToConsole, RenderTemplateOptions } from "@expressots/core";
3
3
  import { ServerEnvironment } from "./application-express.types";
4
4
  /**
5
5
  * Public Interface for the WebServer application.
@@ -12,18 +12,6 @@ export interface IWebServerPublic {
12
12
  * @param consoleMessage - Optional message to display in the console.
13
13
  */
14
14
  listen(port: number, environment: ServerEnvironment, consoleMessage?: IApplicationMessageToConsole): Promise<void>;
15
- /**
16
- * Configures the application's view engine based on the provided configuration options.
17
- *
18
- * @public
19
- * @method setEngine
20
- * @template T - A generic type extending from RenderTemplateOptions.
21
- *
22
- * @param {T} options - An object of type T (must be an object that extends RenderTemplateOptions)
23
- * that provides the configuration options for setting the view engine.
24
- * This includes the extension name, view path, and the engine function itself.
25
- */
26
- setEngine<T extends RenderTemplateOptions>(options: T): void;
27
15
  /**
28
16
  * Get the underlying HTTP server. (default: Express.js)
29
17
  * @returns The underlying HTTP server after initialization.
@@ -1,13 +1,14 @@
1
1
  import express, { Request, Response, NextFunction } from "express";
2
- import { IApplicationMessageToConsole, RenderTemplateOptions } from "@expressots/core";
2
+ import { IApplicationMessageToConsole } from "@expressots/core";
3
3
  import { Container } from "inversify";
4
+ import { Engine, EngineOptions } from "./render/engine";
4
5
  /**
5
6
  * Interface for the WebServer application implementation.
6
7
  */
7
8
  export interface IWebServer {
8
9
  configure(container: Container): Promise<void>;
9
10
  listen(port: number, environment: ServerEnvironment, consoleMessage?: IApplicationMessageToConsole): Promise<void>;
10
- setEngine<T extends RenderTemplateOptions>(options: T): void;
11
+ setEngine<T extends EngineOptions>(engine: Engine, options?: T): Promise<void>;
11
12
  }
12
13
  /**
13
14
  * Constructor type for IWebServer.
@@ -14,6 +14,7 @@ export declare const HTTP_CODE_METADATA: {
14
14
  statusCode: string;
15
15
  path: string;
16
16
  };
17
+ export declare const RENDER_METADATA_KEY: unique symbol;
17
18
  export declare enum PARAMETER_TYPE {
18
19
  REQUEST = 0,
19
20
  RESPONSE = 1,
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { OutgoingHttpHeaders } from "node:http";
3
2
  export declare abstract class HttpContent {
4
3
  private _headers;
@@ -1,7 +1,7 @@
1
1
  import "reflect-metadata";
2
2
  import { PARAMETER_TYPE, HTTP_VERBS_ENUM } from "./constants";
3
3
  import type { HandlerDecorator, Middleware } from "./interfaces";
4
- export declare const injectHttpContext: (target: import("inversify/lib/annotation/decorator_utils").DecoratorTarget<unknown>, targetKey?: string | symbol, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<unknown>) => void;
4
+ export declare const injectHttpContext: (target: import("inversify/lib/annotation/decorator_utils").DecoratorTarget<unknown>, targetKey?: string | symbol | undefined, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<unknown>) => void;
5
5
  /**
6
6
  * Controller decorator to define a new controller
7
7
  * @param path route path
@@ -121,3 +121,14 @@ export declare const principal: () => ParameterDecorator;
121
121
  * @returns ParameterDecorator
122
122
  */
123
123
  export declare function params(type: PARAMETER_TYPE, parameterName?: string): ParameterDecorator;
124
+ /**
125
+ * Render decorator to define the template and default data for a route
126
+ * @param template The template to render
127
+ * @param defaultData The default data to pass to the template
128
+ * @returns
129
+ */
130
+ export declare function Render(template: string, defaultData?: Record<string, unknown>): MethodDecorator;
131
+ export declare function getRenderMetadata(target: object, propertyKey: string | symbol): {
132
+ template?: string;
133
+ defaultData?: Record<string, unknown>;
134
+ };
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { OutgoingHttpHeaders } from "node:http";
3
2
  import { HttpContent } from "./content/httpContent";
4
3
  export declare class HttpResponseMessage {
@@ -2,3 +2,4 @@ export * from "./express-utils";
2
2
  export { AppExpress } from "./application-express";
3
3
  export { IWebServerPublic } from "./application-express.interface";
4
4
  export { IWebServer, IWebServerConstructor, ServerEnvironment } from "./application-express.types";
5
+ export * from "./render";
@@ -0,0 +1,21 @@
1
+ import { Application } from "express";
2
+ import { Options } from "./ejs.types";
3
+ /**
4
+ * Ejs options
5
+ * @typedef {Object} EjsOptions
6
+ * @property {string | Array<string>} viewsDir - The path to the views folder
7
+ * @property {string} viewEngine - The view engine
8
+ * @property {ejs.Options} [serverOptions] - The server options
9
+ *
10
+ */
11
+ export type EjsOptions = {
12
+ viewsDir?: string | Array<string>;
13
+ viewEngine?: string;
14
+ serverOptions?: Options;
15
+ };
16
+ /**
17
+ * Set Ejs as the view engine
18
+ * @param {Application} app - The express application
19
+ * @param {EjsOptions} [options=EJS_DEFAULTS] - The ejs options
20
+ */
21
+ export declare function setEngineEjs(app: Application, options?: EjsOptions): Promise<void>;
@@ -0,0 +1,169 @@
1
+ /**
2
+ * An object where {@link filename} is the final parsed path or {@link template} is the content of the included template
3
+ */
4
+ export type IncluderResult = {
5
+ filename: string;
6
+ template?: never;
7
+ } | {
8
+ template: string;
9
+ filename?: never;
10
+ };
11
+ /**
12
+ * @param originalPath the path as it appears in the include statement
13
+ * @param parsedPath the previously resolved path
14
+ *
15
+ * @return An {@link IncluderResult} object containing the filename or template data.
16
+ */
17
+ type IncluderCallback = (originalPath: string, parsedPath: string) => IncluderResult;
18
+ /**
19
+ * Escapes a string using HTML/XML escaping rules.
20
+ *
21
+ * Returns the empty string for `null` or `undefined`.
22
+ *
23
+ * @param markup Input string
24
+ * @return Escaped string
25
+ */
26
+ type EscapeCallback = (markup?: any) => string;
27
+ export interface Options {
28
+ /**
29
+ * Log the generated JavaScript source for the EJS template to the console.
30
+ *
31
+ * @default false
32
+ */
33
+ debug?: boolean | undefined;
34
+ /**
35
+ * Include additional runtime debugging information in generated template
36
+ * functions.
37
+ *
38
+ * @default true
39
+ */
40
+ compileDebug?: boolean | undefined;
41
+ /**
42
+ * Whether or not to use `with () {}` construct in the generated template
43
+ * functions. If set to `false`, data is still accessible through the object
44
+ * whose name is specified by `ejs.localsName` (defaults to `locals`).
45
+ *
46
+ * @default true
47
+ */
48
+ _with?: boolean | undefined;
49
+ /**
50
+ * Whether to run in strict mode or not.
51
+ * Enforces `_with=false`.
52
+ *
53
+ * @default false
54
+ */
55
+ strict?: boolean | undefined;
56
+ /**
57
+ * An array of local variables that are always destructured from `localsName`,
58
+ * available even in strict mode.
59
+ *
60
+ * @default []
61
+ */
62
+ destructuredLocals?: Array<string> | undefined;
63
+ /**
64
+ * Remove all safe-to-remove whitespace, including leading and trailing
65
+ * whitespace. It also enables a safer version of `-%>` line slurping for all
66
+ * scriptlet tags (it does not strip new lines of tags in the middle of a
67
+ * line).
68
+ *
69
+ * @default false
70
+ */
71
+ rmWhitespace?: boolean | undefined;
72
+ /**
73
+ * Whether or not to compile a `ClientFunction` that can be rendered
74
+ * in the browser without depending on ejs.js. Otherwise, a `TemplateFunction`
75
+ * will be compiled.
76
+ *
77
+ * @default false
78
+ */
79
+ client?: boolean | undefined;
80
+ /**
81
+ * The escaping function used with `<%=` construct. It is used in rendering
82
+ * and is `.toString()`ed in the generation of client functions.
83
+ *
84
+ * @default ejs.escapeXML
85
+ */
86
+ escape?: EscapeCallback | undefined;
87
+ /**
88
+ * The filename of the template. Required for inclusion and caching unless
89
+ * you are using `renderFile`. Also used for error reporting.
90
+ *
91
+ * @default undefined
92
+ */
93
+ filename?: string | undefined;
94
+ /**
95
+ * The path to templates root(s). When this is set, absolute paths for includes
96
+ * (/filename.ejs) will be relative to the templates root(s).
97
+ *
98
+ * @default undefined
99
+ */
100
+ root?: Array<string> | string | undefined;
101
+ /**
102
+ * The opening delimiter for all statements. This allows you to clearly delinate
103
+ * the difference between template code and existing delimiters. (It is recommended
104
+ * to synchronize this with the closeDelimiter property.)
105
+ *
106
+ * @default ejs.openDelimiter
107
+ */
108
+ openDelimiter?: string | undefined;
109
+ /**
110
+ * The closing delimiter for all statements. This allows to to clearly delinate
111
+ * the difference between template code and existing delimiters. (It is recommended
112
+ * to synchronize this with the openDelimiter property.)
113
+ *
114
+ * @default ejs.closeDelimiter
115
+ */
116
+ closeDelimiter?: string | undefined;
117
+ /**
118
+ * Character to use with angle brackets for open/close
119
+ * @default '%'
120
+ */
121
+ delimiter?: string | undefined;
122
+ /**
123
+ * Whether or not to enable caching of template functions. Beware that
124
+ * the options of compilation are not checked as being the same, so
125
+ * special handling is required if, for example, you want to cache client
126
+ * and regular functions of the same file.
127
+ *
128
+ * Requires `filename` to be set. Only works with rendering function.
129
+ *
130
+ * @default false
131
+ */
132
+ cache?: boolean | undefined;
133
+ /**
134
+ * The Object to which `this` is set during rendering.
135
+ *
136
+ * @default this
137
+ */
138
+ context?: any;
139
+ /**
140
+ * Whether or not to create an async function instead of a regular function.
141
+ * This requires language support.
142
+ *
143
+ * @default false
144
+ */
145
+ async?: boolean | undefined;
146
+ /**
147
+ * Make sure to set this to 'false' in order to skip UglifyJS parsing,
148
+ * when using ES6 features (`const`, etc) as UglifyJS doesn't understand them.
149
+ * @default true
150
+ */
151
+ beautify?: boolean | undefined;
152
+ /**
153
+ * Name to use for the object storing local variables when not using `with` or destructuring.
154
+ *
155
+ * @default ejs.localsName
156
+ */
157
+ localsName?: string | undefined;
158
+ /** Set to a string (e.g., 'echo' or 'print') for a function to print output inside scriptlet tags. */
159
+ outputFunctionName?: string | undefined;
160
+ /**
161
+ * An array of paths to use when resolving includes with relative paths
162
+ */
163
+ views?: Array<string> | undefined;
164
+ /**
165
+ * Custom function to handle EJS includes
166
+ */
167
+ includer?: IncluderCallback;
168
+ }
169
+ export {};
@@ -0,0 +1,28 @@
1
+ import { EjsOptions } from "./ejs/ejs.config";
2
+ import { HandlebarsOptions } from "./handlebars/hbs.config";
3
+ /**
4
+ * The configuration options for the view engine.
5
+ * @typedef {HandlebarsOptions | EjsOptions} EngineOptions
6
+ * @private
7
+ */
8
+ export type RenderOptions = {
9
+ engine: Engine;
10
+ options?: EngineOptions;
11
+ };
12
+ /**
13
+ * The supported view engines.
14
+ * @enum {string}
15
+ * @readonly
16
+ * @public
17
+ */
18
+ export declare enum Engine {
19
+ HBS = "hbs",
20
+ EJS = "ejs",
21
+ PUG = "pug"
22
+ }
23
+ /**
24
+ * The configuration options for the view engine.
25
+ * @typedef {HandlebarsOptions | EjsOptions} EngineOptions
26
+ * @public
27
+ */
28
+ export type EngineOptions = HandlebarsOptions | EjsOptions;
@@ -0,0 +1,20 @@
1
+ import express from "express";
2
+ /**
3
+ * Handlebars options
4
+ * @typedef {Object} HandlebarsOptions
5
+ * @property {string} viewsDir - The path to the views folder
6
+ * @property {string} viewEngine - The view engine to be used
7
+ * @property {ConfigOptions} [serverOptions] - The server options
8
+ *
9
+ */
10
+ export type HandlebarsOptions = {
11
+ viewEngine?: string;
12
+ viewsDir?: string;
13
+ partialsDir?: string;
14
+ };
15
+ /**
16
+ * Set Handlebars as the view engine
17
+ * @param {express.Application} app - The express application
18
+ * @param {HandlebarsOptions} [options=HANDLEBARS_DEFAULTS] - The handlebars options
19
+ */
20
+ export declare function setEngineHandlebars(app: express.Application, options?: HandlebarsOptions): Promise<void>;
@@ -0,0 +1,4 @@
1
+ export { EjsOptions as EJS } from "./ejs/ejs.config";
2
+ export { HandlebarsOptions as HBS } from "./handlebars/hbs.config";
3
+ export { PugOptions as PUG } from "./pug/pug.config";
4
+ export { Engine } from "./engine";
@@ -0,0 +1,17 @@
1
+ import { Application } from "express";
2
+ /**
3
+ * Pug options
4
+ * @typedef {Object} PugOptions
5
+ * @property {string} viewEngine - The view engine to be used
6
+ * @property {string} viewsDir - The path to the views folder
7
+ */
8
+ export type PugOptions = {
9
+ viewEngine?: string;
10
+ viewsDir?: string;
11
+ };
12
+ /**
13
+ * Set Pug as the view engine
14
+ * @param {express.Application} app - The express application
15
+ * @param {PugOptions} [options=PUG_DEFAULTS] - The pug options
16
+ */
17
+ export declare function setEnginePug(app: Application, options?: PugOptions): Promise<void>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Resolve package from the current working directory.
3
+ * @param packageName
4
+ * @param options
5
+ * @returns
6
+ */
7
+ export declare function packageResolver(packageName: string, ...options: Array<any>): any;
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expressots/adapter-express",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "Expressots - modern, fast, lightweight nodejs web framework (@adapter-express)",
5
5
  "author": "",
6
6
  "main": "./lib/cjs/index.js",
@@ -47,10 +47,10 @@
47
47
  "server-side"
48
48
  ],
49
49
  "engines": {
50
- "node": ">=18.10.0"
50
+ "node": ">=18.18.0"
51
51
  },
52
52
  "scripts": {
53
- "prepare": "husky install",
53
+ "prepare": "husky",
54
54
  "clean": "node scripts/rm.js lib",
55
55
  "copy": "node scripts/copy.js package.json README.md CHANGELOG.md lib",
56
56
  "build": "npm run clean && npm run build:cjs && npm run copy",
@@ -73,25 +73,24 @@
73
73
  },
74
74
  "devDependencies": {
75
75
  "@codecov/vite-plugin": "^0.0.1-beta.6",
76
- "@commitlint/cli": "18.0.0",
76
+ "@commitlint/cli": "19.2.1",
77
77
  "@commitlint/config-conventional": "19.2.2",
78
- "@expressots/core": "latest",
79
- "@release-it/conventional-changelog": "7.0.2",
78
+ "@expressots/core": "2.15.0",
79
+ "@release-it/conventional-changelog": "8.0.1",
80
80
  "@types/express": "4.17.21",
81
- "@types/node": "20.4.9",
82
- "@typescript-eslint/eslint-plugin": "6.6.0",
83
- "@typescript-eslint/parser": "6.6.0",
84
- "@vitest/coverage-v8": "^1.4.0",
85
- "eslint": "8.48.0",
81
+ "@types/node": "20.14.10",
82
+ "@typescript-eslint/eslint-plugin": "7.16.1",
83
+ "@typescript-eslint/parser": "7.16.1",
84
+ "@vitest/coverage-v8": "2.0.3",
85
+ "eslint": "8.57.0",
86
86
  "eslint-config-prettier": "9.1.0",
87
- "husky": "9.0.11",
88
- "prettier": "3.3.2",
89
- "release-it": "16.3.0",
90
- "ts-jest": "29.0.5",
91
- "typescript": "5.2.2",
92
- "vite": "^5.2.8",
93
- "vite-tsconfig-paths": "^4.3.2",
94
- "vitest": "^1.4.0"
87
+ "husky": "9.1.1",
88
+ "prettier": "3.3.3",
89
+ "release-it": "17.6.0",
90
+ "typescript": "5.5.3",
91
+ "vite": "5.3.4",
92
+ "vite-tsconfig-paths": "4.3.2",
93
+ "vitest": "2.0.3"
95
94
  },
96
95
  "release-it": {
97
96
  "git": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expressots/adapter-express",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "Expressots - modern, fast, lightweight nodejs web framework (@adapter-express)",
5
5
  "author": "",
6
6
  "main": "./lib/cjs/index.js",
@@ -47,10 +47,10 @@
47
47
  "server-side"
48
48
  ],
49
49
  "engines": {
50
- "node": ">=18.10.0"
50
+ "node": ">=18.18.0"
51
51
  },
52
52
  "scripts": {
53
- "prepare": "husky install",
53
+ "prepare": "husky",
54
54
  "clean": "node scripts/rm.js lib",
55
55
  "copy": "node scripts/copy.js package.json README.md CHANGELOG.md lib",
56
56
  "build": "npm run clean && npm run build:cjs && npm run copy",
@@ -73,25 +73,24 @@
73
73
  },
74
74
  "devDependencies": {
75
75
  "@codecov/vite-plugin": "^0.0.1-beta.6",
76
- "@commitlint/cli": "18.0.0",
76
+ "@commitlint/cli": "19.2.1",
77
77
  "@commitlint/config-conventional": "19.2.2",
78
- "@expressots/core": "latest",
79
- "@release-it/conventional-changelog": "7.0.2",
78
+ "@expressots/core": "2.15.0",
79
+ "@release-it/conventional-changelog": "8.0.1",
80
80
  "@types/express": "4.17.21",
81
- "@types/node": "20.4.9",
82
- "@typescript-eslint/eslint-plugin": "6.6.0",
83
- "@typescript-eslint/parser": "6.6.0",
84
- "@vitest/coverage-v8": "^1.4.0",
85
- "eslint": "8.48.0",
81
+ "@types/node": "20.14.10",
82
+ "@typescript-eslint/eslint-plugin": "7.16.1",
83
+ "@typescript-eslint/parser": "7.16.1",
84
+ "@vitest/coverage-v8": "2.0.3",
85
+ "eslint": "8.57.0",
86
86
  "eslint-config-prettier": "9.1.0",
87
- "husky": "9.0.11",
88
- "prettier": "3.3.2",
89
- "release-it": "16.3.0",
90
- "ts-jest": "29.0.5",
91
- "typescript": "5.2.2",
92
- "vite": "^5.2.8",
93
- "vite-tsconfig-paths": "^4.3.2",
94
- "vitest": "^1.4.0"
87
+ "husky": "9.1.1",
88
+ "prettier": "3.3.3",
89
+ "release-it": "17.6.0",
90
+ "typescript": "5.5.3",
91
+ "vite": "5.3.4",
92
+ "vite-tsconfig-paths": "4.3.2",
93
+ "vitest": "2.0.3"
95
94
  },
96
95
  "release-it": {
97
96
  "git": {