sprint-es 0.0.69 → 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 +11 -13
- package/dist/esm/index.js +11 -13
- package/dist/types/sprint.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -161,22 +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
|
-
if (
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
169
|
+
if (finalConfig.openapi?.swaggerUi?.enabled) {
|
|
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, {
|
|
174
175
|
swaggerUrl: "/openapi.json"
|
|
175
176
|
}));
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
});
|
|
177
|
+
} catch (err) {
|
|
178
|
+
console.warn("[Sprint] Failed to load swagger-ui-express:", err);
|
|
179
|
+
}
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
if (finalConfig.autoListen) this.listen();
|
|
@@ -194,9 +194,7 @@ class Sprint {
|
|
|
194
194
|
}
|
|
195
195
|
try {
|
|
196
196
|
const routesCandidate = path.isAbsolute(this.routesPath) ? this.routesPath : path.join(callerDir, this.routesPath);
|
|
197
|
-
if (fs.existsSync(routesCandidate) && fs.statSync(routesCandidate).isDirectory())
|
|
198
|
-
await this.loadRoutes(routesCandidate);
|
|
199
|
-
}
|
|
197
|
+
if (fs.existsSync(routesCandidate) && fs.statSync(routesCandidate).isDirectory()) await this.loadRoutes(routesCandidate);
|
|
200
198
|
} catch (err) {
|
|
201
199
|
console.error("[Sprint] Failed to load routes:", err);
|
|
202
200
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -136,22 +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
|
-
if (
|
|
145
|
-
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
144
|
+
if (finalConfig.openapi?.swaggerUi?.enabled) {
|
|
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, {
|
|
149
150
|
swaggerUrl: "/openapi.json"
|
|
150
151
|
}));
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
});
|
|
152
|
+
} catch (err) {
|
|
153
|
+
console.warn("[Sprint] Failed to load swagger-ui-express:", err);
|
|
154
|
+
}
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
if (finalConfig.autoListen) this.listen();
|
|
@@ -169,9 +169,7 @@ class Sprint {
|
|
|
169
169
|
}
|
|
170
170
|
try {
|
|
171
171
|
const routesCandidate = path.isAbsolute(this.routesPath) ? this.routesPath : path.join(callerDir, this.routesPath);
|
|
172
|
-
if (fs.existsSync(routesCandidate) && fs.statSync(routesCandidate).isDirectory())
|
|
173
|
-
await this.loadRoutes(routesCandidate);
|
|
174
|
-
}
|
|
172
|
+
if (fs.existsSync(routesCandidate) && fs.statSync(routesCandidate).isDirectory()) await this.loadRoutes(routesCandidate);
|
|
175
173
|
} catch (err) {
|
|
176
174
|
console.error("[Sprint] Failed to load routes:", err);
|
|
177
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,SA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