sprint-es 0.0.70 → 0.0.72
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.
- package/dist/cjs/index.cjs +10 -9
- package/dist/esm/index.js +10 -9
- package/dist/types/sprint.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -161,19 +161,22 @@ 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
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
try {
|
|
171
|
+
const swaggerUi = await import("swagger-ui-express");
|
|
172
|
+
const ui = swaggerUi.default;
|
|
173
|
+
this.app.get("/swagger", (_, res) => res.redirect("/swagger/"));
|
|
174
|
+
this.app.use("/swagger", ui.serve, ui.setup(void 0, {
|
|
175
|
+
swaggerUrl: "/openapi.json"
|
|
173
176
|
}));
|
|
174
|
-
}
|
|
177
|
+
} catch (err) {
|
|
175
178
|
console.warn("[Sprint] Failed to load swagger-ui-express:", err);
|
|
176
|
-
}
|
|
179
|
+
}
|
|
177
180
|
}
|
|
178
181
|
}
|
|
179
182
|
if (finalConfig.autoListen) this.listen();
|
|
@@ -191,9 +194,7 @@ class Sprint {
|
|
|
191
194
|
}
|
|
192
195
|
try {
|
|
193
196
|
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
|
-
}
|
|
197
|
+
if (fs.existsSync(routesCandidate) && fs.statSync(routesCandidate).isDirectory()) await this.loadRoutes(routesCandidate);
|
|
197
198
|
} catch (err) {
|
|
198
199
|
console.error("[Sprint] Failed to load routes:", err);
|
|
199
200
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -136,19 +136,22 @@ 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
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
try {
|
|
146
|
+
const swaggerUi = await import("swagger-ui-express");
|
|
147
|
+
const ui = swaggerUi.default;
|
|
148
|
+
this.app.get("/swagger", (_, res) => res.redirect("/swagger/"));
|
|
149
|
+
this.app.use("/swagger", ui.serve, ui.setup(void 0, {
|
|
150
|
+
swaggerUrl: "/openapi.json"
|
|
148
151
|
}));
|
|
149
|
-
}
|
|
152
|
+
} catch (err) {
|
|
150
153
|
console.warn("[Sprint] Failed to load swagger-ui-express:", err);
|
|
151
|
-
}
|
|
154
|
+
}
|
|
152
155
|
}
|
|
153
156
|
}
|
|
154
157
|
if (finalConfig.autoListen) this.listen();
|
|
@@ -166,9 +169,7 @@ class Sprint {
|
|
|
166
169
|
}
|
|
167
170
|
try {
|
|
168
171
|
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
|
-
}
|
|
172
|
+
if (fs.existsSync(routesCandidate) && fs.statSync(routesCandidate).isDirectory()) await this.loadRoutes(routesCandidate);
|
|
172
173
|
} catch (err) {
|
|
173
174
|
console.error("[Sprint] Failed to load routes:", err);
|
|
174
175
|
}
|
|
@@ -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;;
|
|
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,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