sprint-es 0.0.70 → 0.0.73

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.
@@ -161,19 +161,21 @@ class Sprint {
161
161
  this.loadDefaults();
162
162
  this.loadHealthcheck();
163
163
  this.routesLoaded = this.init();
164
- this.routesLoaded.then(() => {
164
+ this.routesLoaded.then(async () => {
165
165
  if (this.openapi.generateOnBuild) {
166
166
  this.app.get("/openapi.json", (_, res) => {
167
167
  res.json(this.generateOpenAPISpec());
168
168
  });
169
169
  if (finalConfig.openapi?.swaggerUi?.enabled) {
170
- import("swagger-ui-express").then((swaggerUi) => {
171
- this.app.use("/swagger", ...swaggerUi.default.serve, swaggerUi.default.setup(void 0, {
172
- swaggerUrl: (this.prefix || "") + "/openapi.json"
170
+ try {
171
+ const swaggerUi = await import("swagger-ui-express");
172
+ const ui = swaggerUi.default;
173
+ this.app.use("/swagger", ui.serve, ui.setup(void 0, {
174
+ swaggerUrl: "/openapi.json"
173
175
  }));
174
- }).catch((err) => {
176
+ } catch (err) {
175
177
  console.warn("[Sprint] Failed to load swagger-ui-express:", err);
176
- });
178
+ }
177
179
  }
178
180
  }
179
181
  if (finalConfig.autoListen) this.listen();
@@ -191,9 +193,7 @@ class Sprint {
191
193
  }
192
194
  try {
193
195
  const routesCandidate = path.isAbsolute(this.routesPath) ? this.routesPath : path.join(callerDir, this.routesPath);
194
- if (fs.existsSync(routesCandidate) && fs.statSync(routesCandidate).isDirectory()) {
195
- await this.loadRoutes(routesCandidate);
196
- }
196
+ if (fs.existsSync(routesCandidate) && fs.statSync(routesCandidate).isDirectory()) await this.loadRoutes(routesCandidate);
197
197
  } catch (err) {
198
198
  console.error("[Sprint] Failed to load routes:", err);
199
199
  }
package/dist/esm/index.js CHANGED
@@ -136,19 +136,21 @@ class Sprint {
136
136
  this.loadDefaults();
137
137
  this.loadHealthcheck();
138
138
  this.routesLoaded = this.init();
139
- this.routesLoaded.then(() => {
139
+ this.routesLoaded.then(async () => {
140
140
  if (this.openapi.generateOnBuild) {
141
141
  this.app.get("/openapi.json", (_, res) => {
142
142
  res.json(this.generateOpenAPISpec());
143
143
  });
144
144
  if (finalConfig.openapi?.swaggerUi?.enabled) {
145
- import("swagger-ui-express").then((swaggerUi) => {
146
- this.app.use("/swagger", ...swaggerUi.default.serve, swaggerUi.default.setup(void 0, {
147
- swaggerUrl: (this.prefix || "") + "/openapi.json"
145
+ try {
146
+ const swaggerUi = await import("swagger-ui-express");
147
+ const ui = swaggerUi.default;
148
+ this.app.use("/swagger", ui.serve, ui.setup(void 0, {
149
+ swaggerUrl: "/openapi.json"
148
150
  }));
149
- }).catch((err) => {
151
+ } catch (err) {
150
152
  console.warn("[Sprint] Failed to load swagger-ui-express:", err);
151
- });
153
+ }
152
154
  }
153
155
  }
154
156
  if (finalConfig.autoListen) this.listen();
@@ -166,9 +168,7 @@ class Sprint {
166
168
  }
167
169
  try {
168
170
  const routesCandidate = path.isAbsolute(this.routesPath) ? this.routesPath : path.join(callerDir, this.routesPath);
169
- if (fs.existsSync(routesCandidate) && fs.statSync(routesCandidate).isDirectory()) {
170
- await this.loadRoutes(routesCandidate);
171
- }
171
+ if (fs.existsSync(routesCandidate) && fs.statSync(routesCandidate).isDirectory()) await this.loadRoutes(routesCandidate);
172
172
  } catch (err) {
173
173
  console.error("[Sprint] Failed to load routes:", err);
174
174
  }
@@ -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,OA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AE,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.70",
3
+ "version": "0.0.73",
4
4
  "description": "Sprint - Quickly API",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",