sprint-es 0.0.68 → 0.0.70

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.
@@ -163,22 +163,18 @@ class Sprint {
163
163
  this.routesLoaded = this.init();
164
164
  this.routesLoaded.then(() => {
165
165
  if (this.openapi.generateOnBuild) {
166
- if (this.openapi.swaggerUi.enabled) {
167
- console.log(`[Sprint] Loading Swagger UI...`);
166
+ this.app.get("/openapi.json", (_, res) => {
167
+ res.json(this.generateOpenAPISpec());
168
+ });
169
+ if (finalConfig.openapi?.swaggerUi?.enabled) {
168
170
  import("swagger-ui-express").then((swaggerUi) => {
169
- console.log(`[Sprint] Swagger UI imported successfully`);
170
- this.app.use("/swagger", swaggerUi.serve);
171
- this.app.get("/swagger", swaggerUi.setup(void 0, {
172
- swaggerUrl: "/openapi.json"
171
+ this.app.use("/swagger", ...swaggerUi.default.serve, swaggerUi.default.setup(void 0, {
172
+ swaggerUrl: (this.prefix || "") + "/openapi.json"
173
173
  }));
174
- console.log(`[Sprint] Swagger UI mounted at /swagger`);
175
174
  }).catch((err) => {
176
- console.error(`[Sprint] ⚠️ swagger-ui-express error:`, err);
175
+ console.warn("[Sprint] Failed to load swagger-ui-express:", err);
177
176
  });
178
177
  }
179
- this.app.get("/openapi.json", (_, res) => {
180
- res.json(this.generateOpenAPISpec());
181
- });
182
178
  }
183
179
  if (finalConfig.autoListen) this.listen();
184
180
  });
@@ -195,11 +191,9 @@ class Sprint {
195
191
  }
196
192
  try {
197
193
  const routesCandidate = path.isAbsolute(this.routesPath) ? this.routesPath : path.join(callerDir, this.routesPath);
198
- console.log(`[Sprint] Looking for routes at: ${routesCandidate}`);
199
194
  if (fs.existsSync(routesCandidate) && fs.statSync(routesCandidate).isDirectory()) {
200
- console.log(`[Sprint] Routes directory found, loading...`);
201
195
  await this.loadRoutes(routesCandidate);
202
- } else console.log(`[Sprint] Routes folder not found at: ${routesCandidate}, skipping route loading.`);
196
+ }
203
197
  } catch (err) {
204
198
  console.error("[Sprint] Failed to load routes:", err);
205
199
  }
@@ -357,7 +351,6 @@ class Sprint {
357
351
  }
358
352
  }
359
353
  }
360
- console.log(`[Sprint] Registered routes for OpenAPI:`, this.registeredRoutes);
361
354
  }
362
355
  const routeMiddlewares = this.getMiddlewaresForRoute(routePath);
363
356
  if (routeMiddlewares.length > 0) {
package/dist/esm/index.js CHANGED
@@ -138,22 +138,18 @@ class Sprint {
138
138
  this.routesLoaded = this.init();
139
139
  this.routesLoaded.then(() => {
140
140
  if (this.openapi.generateOnBuild) {
141
- if (this.openapi.swaggerUi.enabled) {
142
- console.log(`[Sprint] Loading Swagger UI...`);
141
+ this.app.get("/openapi.json", (_, res) => {
142
+ res.json(this.generateOpenAPISpec());
143
+ });
144
+ if (finalConfig.openapi?.swaggerUi?.enabled) {
143
145
  import("swagger-ui-express").then((swaggerUi) => {
144
- console.log(`[Sprint] Swagger UI imported successfully`);
145
- this.app.use("/swagger", swaggerUi.serve);
146
- this.app.get("/swagger", swaggerUi.setup(void 0, {
147
- swaggerUrl: "/openapi.json"
146
+ this.app.use("/swagger", ...swaggerUi.default.serve, swaggerUi.default.setup(void 0, {
147
+ swaggerUrl: (this.prefix || "") + "/openapi.json"
148
148
  }));
149
- console.log(`[Sprint] Swagger UI mounted at /swagger`);
150
149
  }).catch((err) => {
151
- console.error(`[Sprint] ⚠️ swagger-ui-express error:`, err);
150
+ console.warn("[Sprint] Failed to load swagger-ui-express:", err);
152
151
  });
153
152
  }
154
- this.app.get("/openapi.json", (_, res) => {
155
- res.json(this.generateOpenAPISpec());
156
- });
157
153
  }
158
154
  if (finalConfig.autoListen) this.listen();
159
155
  });
@@ -170,11 +166,9 @@ class Sprint {
170
166
  }
171
167
  try {
172
168
  const routesCandidate = path.isAbsolute(this.routesPath) ? this.routesPath : path.join(callerDir, this.routesPath);
173
- console.log(`[Sprint] Looking for routes at: ${routesCandidate}`);
174
169
  if (fs.existsSync(routesCandidate) && fs.statSync(routesCandidate).isDirectory()) {
175
- console.log(`[Sprint] Routes directory found, loading...`);
176
170
  await this.loadRoutes(routesCandidate);
177
- } else console.log(`[Sprint] Routes folder not found at: ${routesCandidate}, skipping route loading.`);
171
+ }
178
172
  } catch (err) {
179
173
  console.error("[Sprint] Failed to load routes:", err);
180
174
  }
@@ -332,7 +326,6 @@ class Sprint {
332
326
  }
333
327
  }
334
328
  }
335
- console.log(`[Sprint] Registered routes for OpenAPI:`, this.registeredRoutes);
336
329
  }
337
330
  const routeMiddlewares = this.getMiddlewaresForRoute(routePath);
338
331
  if (routeMiddlewares.length > 0) {
@@ -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;AAwCnC,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,CAUb;IACF,OAAO,CAAC,gBAAgB,CAIhB;;YAyEM,IAAI;IAkClB,OAAO,CAAC,YAAY;IAiDpB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA4B9B;;OAEG;YACW,eAAe;IAgC7B,OAAO,CAAC,eAAe;YAcT,UAAU;YAoFV,Y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C7B,OAAO,CAAC,iBAAiB,CAA0B;IACnD,OAAO,CAAC,OAAO,CAUb;IACF,OAAO,CAAC,gBAAgB,CAIhB;;YAoEM,IAAI;IAgClB,OAAO,CAAC,YAAY;IAiDpB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA4B9B;;OAEG;YACW,eAAe;IAgC7B,OAAO,CAAC,eAAe;YAcT,UAAU;YAkFV,YAAY;IAmB1B,OAAO,CAAC,YAAY;IAgCpB,+BAA+B;IAC/B,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,mBAAmB;IA0D3B,OAAO,CAAC,kBAAkB;IAgD1B,OAAO,CAAC,kBAAkB;IAoCnB,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;IAYlF,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI;CA0DzC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprint-es",
3
- "version": "0.0.68",
3
+ "version": "0.0.70",
4
4
  "description": "Sprint - Quickly API",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",