sprint-es 0.0.130 → 0.0.132

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.
@@ -140,7 +140,7 @@ class Sprint {
140
140
  path: "/graphql",
141
141
  graphiql: {
142
142
  enabled: false,
143
- path: "/grapiql"
143
+ path: "/graphiql"
144
144
  }
145
145
  };
146
146
  this.graphqlSchema = null;
@@ -369,12 +369,12 @@ class Sprint {
369
369
  * Load all middleware files from the middlewares folder
370
370
  */
371
371
  async loadMiddlewares(middlewaresPath) {
372
- const fileExt = isProd ? ".js" : ".ts";
372
+ const fileExtensions = isProd ? [".js", ".mjs"] : [".ts"];
373
373
  const files = await fs.promises.readdir(middlewaresPath);
374
374
  for (const file of files) {
375
375
  const filePath = path.join(middlewaresPath, file);
376
376
  const stat = await fs.promises.stat(filePath);
377
- if (stat.isFile() && file.endsWith(fileExt)) {
377
+ if (stat.isFile() && fileExtensions.some((ext) => file.endsWith(ext))) {
378
378
  try {
379
379
  const moduleUrl = url.pathToFileURL(filePath).href;
380
380
  const module2 = await import(moduleUrl);
@@ -783,6 +783,10 @@ class Sprint {
783
783
  console.log(` ${dim}Local:${reset} http://localhost:${bold}${port}${reset}`);
784
784
  console.log(` ${dim}Prefix:${reset} ${bold}${prefixInfo}${reset}`);
785
785
  console.log(` ${dim}Healthcheck:${reset} http://localhost:${port}/healthcheck ${dim}(also available at /health)${reset}`);
786
+ console.log("");
787
+ console.log(` ${dim}Loaded routes:${reset} ${bold}${this.registeredRoutes.length}${reset}`);
788
+ console.log(` ${dim}Loaded middlewares:${reset} ${bold}${this.loadedMiddlewares.length}${reset}`);
789
+ console.log(` ${dim}Healthcheck:${reset} http://localhost:${port}/healthcheck ${dim}(also available at /health)${reset}`);
786
790
  if (this.openapi.generateOnBuild || this.openapi.swaggerUi.enabled) console.log("");
787
791
  if (this.openapi.generateOnBuild) console.log(` ${dim}OpenAPI Spec:${reset} http://localhost:${port}${this.openapi.path}`);
788
792
  if (this.openapi.swaggerUi.enabled) console.log(` ${dim}Swagger UI:${reset} http://localhost:${port}${this.openapi.swaggerUi.path}`);
package/dist/esm/index.js CHANGED
@@ -115,7 +115,7 @@ class Sprint {
115
115
  path: "/graphql",
116
116
  graphiql: {
117
117
  enabled: false,
118
- path: "/grapiql"
118
+ path: "/graphiql"
119
119
  }
120
120
  };
121
121
  this.graphqlSchema = null;
@@ -344,12 +344,12 @@ class Sprint {
344
344
  * Load all middleware files from the middlewares folder
345
345
  */
346
346
  async loadMiddlewares(middlewaresPath) {
347
- const fileExt = isProd ? ".js" : ".ts";
347
+ const fileExtensions = isProd ? [".js", ".mjs"] : [".ts"];
348
348
  const files = await fs.promises.readdir(middlewaresPath);
349
349
  for (const file of files) {
350
350
  const filePath = path.join(middlewaresPath, file);
351
351
  const stat = await fs.promises.stat(filePath);
352
- if (stat.isFile() && file.endsWith(fileExt)) {
352
+ if (stat.isFile() && fileExtensions.some((ext) => file.endsWith(ext))) {
353
353
  try {
354
354
  const moduleUrl = pathToFileURL(filePath).href;
355
355
  const module = await import(moduleUrl);
@@ -758,6 +758,10 @@ class Sprint {
758
758
  console.log(` ${dim}Local:${reset} http://localhost:${bold}${port}${reset}`);
759
759
  console.log(` ${dim}Prefix:${reset} ${bold}${prefixInfo}${reset}`);
760
760
  console.log(` ${dim}Healthcheck:${reset} http://localhost:${port}/healthcheck ${dim}(also available at /health)${reset}`);
761
+ console.log("");
762
+ console.log(` ${dim}Loaded routes:${reset} ${bold}${this.registeredRoutes.length}${reset}`);
763
+ console.log(` ${dim}Loaded middlewares:${reset} ${bold}${this.loadedMiddlewares.length}${reset}`);
764
+ console.log(` ${dim}Healthcheck:${reset} http://localhost:${port}/healthcheck ${dim}(also available at /health)${reset}`);
761
765
  if (this.openapi.generateOnBuild || this.openapi.swaggerUi.enabled) console.log("");
762
766
  if (this.openapi.generateOnBuild) console.log(` ${dim}OpenAPI Spec:${reset} http://localhost:${port}${this.openapi.path}`);
763
767
  if (this.openapi.swaggerUi.enabled) console.log(` ${dim}Swagger UI:${reset} http://localhost:${port}${this.openapi.swaggerUi.path}`);
@@ -1 +1 @@
1
- {"version":3,"file":"sprint.d.ts","sourceRoot":"","sources":["../../src/sprint.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAA+B,gBAAgB,EAAoB,MAAM,SAAS,CAAC;AACnG,OAAO,OAAO,EAAE,EAAE,WAAW,EAAoD,MAAM,SAAS,CAAC;AAejG,eAAO,MAAM,aAAa,SAAQ,CAAC;AACnC,eAAO,MAAM,YAAY,SAAS,CAAC;AA8CnC,qBAAa,MAAM;IACR,GAAG,EAAE,WAAW,CAAC;IACxB,OAAO,CAAC,IAAI,CAAwD;IACpE,OAAO,CAAC,UAAU,CAAsB;IACxC,OAAO,CAAC,eAAe,CAA2B;IAClD,OAAO,CAAC,YAAY,CAAwB;IAC5C,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,YAAY,CAAiB;IACrC,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,iBAAiB,CAA0B;IACnD,OAAO,CAAC,OAAO,CAcb;IACF,OAAO,CAAC,OAAO,CAcb;IACF,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,gBAAgB,CAIhB;;YAsJM,IAAI;IA0ClB,OAAO,CAAC,YAAY;IAiDpB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA4B9B;;OAEG;YACW,eAAe;IAiC7B,OAAO,CAAC,eAAe;YAiBT,UAAU;YAkFV,YAAY;IAoB1B,OAAO,CAAC,YAAY;IAgCpB,+BAA+B;IAC/B,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,mBAAmB;IA+K3B,OAAO,CAAC,kBAAkB;IAqC1B,OAAO,CAAC,kBAAkB;IA8B1B,OAAO,CAAC,mBAAmB;IA+BpB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO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AsJM,IAAI;IA0ClB,OAAO,CAAC,YAAY;IAiDpB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA4B9B;;OAEG;YACW,eAAe;IAiC7B,OAAO,CAAC,eAAe;YAiBT,UAAU;YAkFV,YAAY;IAoB1B,OAAO,CAAC,YAAY;IAgCpB,+BAA+B;IAC/B,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,mBAAmB;IA+K3B,OAAO,CAAC,kBAAkB;IAqC1B,OAAO,CAAC,kBAAkB;IA8B1B,OAAO,CAAC,mBAAmB;IA+BpB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAClC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IACnC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAClC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IACrC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IACpC,GAAG,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,GAAG,gBAAgB,EAAE,YAAY,CAAC,EAAE,OAAO;IAY9E,gBAAgB,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI;IAIvC,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI;CAmEzC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprint-es",
3
- "version": "0.0.130",
3
+ "version": "0.0.132",
4
4
  "description": "Sprint - Quickly API",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",