sprint-es 0.0.60 → 0.0.62

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.
@@ -97,14 +97,13 @@ async function loadSprintConfig() {
97
97
  const configFiles = ["sprint.config.ts", "sprint.config.js"];
98
98
  for (const configFile of configFiles) {
99
99
  const configPath = path.join(projectRoot, configFile);
100
- if (fs.existsSync(configPath)) {
101
- try {
102
- const moduleUrl = url.pathToFileURL(configPath).href;
103
- const config = await import(moduleUrl);
104
- return config.default || config;
105
- } catch (err) {
106
- console.warn(`[Sprint] Failed to load config from ${configPath}:`, err);
107
- }
100
+ if (!fs.existsSync(configPath)) continue;
101
+ try {
102
+ const moduleUrl = url.pathToFileURL(configPath).href;
103
+ const module2 = await import(moduleUrl);
104
+ return module2.default ?? module2.config ?? module2 ?? null;
105
+ } catch (err) {
106
+ console.warn(`[Sprint] Failed to load config from ${configPath}:`, err);
108
107
  }
109
108
  }
110
109
  return null;
@@ -130,9 +129,9 @@ class Sprint {
130
129
  loadSprintConfig().then((config) => {
131
130
  const defaults = {
132
131
  port: process.env.PORT,
133
- routesPath: "./routes",
134
- middlewaresPath: "./middlewares",
135
- cronjobsPath: "./cronjobs",
132
+ routesPath: "./src/routes",
133
+ middlewaresPath: "./src/middlewares",
134
+ cronjobsPath: "./src/cronjobs",
136
135
  jsonLimit: "50mb",
137
136
  urlEncodedLimit: "50mb",
138
137
  prefix: "",
@@ -144,13 +143,11 @@ class Sprint {
144
143
  }
145
144
  }
146
145
  };
147
- console.log("PROJECT ROOT:", process.cwd());
148
- console.log("CONFIG LOADED:", config);
149
146
  const finalConfig = deepMerge(defaults, config || {});
150
147
  this.port = finalConfig.port;
151
- this.routesPath = finalConfig.routesPath || "./routes";
152
- this.middlewaresPath = finalConfig.middlewaresPath || "./middlewares";
153
- this.cronjobsPath = finalConfig.cronjobsPath || "./cronjobs";
148
+ this.routesPath = finalConfig.routesPath || "./src/routes";
149
+ this.middlewaresPath = finalConfig.middlewaresPath || "./src/middlewares";
150
+ this.cronjobsPath = finalConfig.cronjobsPath || "./src/cronjobs";
154
151
  this.jsonLimit = finalConfig.jsonLimit || "50mb";
155
152
  this.urlEncodedLimit = finalConfig.urlEncodedLimit || "50mb";
156
153
  this.prefix = finalConfig.prefix ? "/" + finalConfig.prefix.replace(/^\/+|\/+$/g, "") : "";
@@ -164,21 +161,23 @@ class Sprint {
164
161
  this.loadDefaults();
165
162
  this.loadHealthcheck();
166
163
  this.routesLoaded = this.init();
167
- if (this.openapi.generateOnBuild) {
168
- this.app.get("/openapi.json", (_, res) => {
169
- res.json(this.generateOpenAPISpec());
170
- });
171
- if (this.openapi.swaggerUi.enabled) {
172
- import("swagger-ui-express").then((swaggerUi) => {
173
- this.app.use("/swagger", swaggerUi.serve, swaggerUi.setup(void 0, {
174
- swaggerUrl: "/openapi.json"
175
- }));
176
- }).catch(() => {
177
- console.error(`[Sprint] ⚠️ swagger-ui-express is not installed. Run "npm install swagger-ui-express" to enable Swagger UI.`);
164
+ this.routesLoaded.then(() => {
165
+ if (this.openapi.generateOnBuild) {
166
+ this.app.get("/openapi.json", (_, res) => {
167
+ res.json(this.generateOpenAPISpec());
178
168
  });
169
+ if (this.openapi.swaggerUi.enabled) {
170
+ import("swagger-ui-express").then((swaggerUi) => {
171
+ this.app.use("/swagger", swaggerUi.serve, swaggerUi.setup(void 0, {
172
+ swaggerUrl: "/openapi.json"
173
+ }));
174
+ }).catch(() => {
175
+ console.error(`[Sprint] ⚠️ swagger-ui-express is not installed. Run "npm install swagger-ui-express" to enable Swagger UI.`);
176
+ });
177
+ }
179
178
  }
180
- }
181
- if (finalConfig.autoListen) this.routesLoaded.then(() => this.listen());
179
+ if (finalConfig.autoListen) this.listen();
180
+ });
182
181
  });
183
182
  }
184
183
  async init() {
package/dist/esm/index.js CHANGED
@@ -72,14 +72,13 @@ async function loadSprintConfig() {
72
72
  const configFiles = ["sprint.config.ts", "sprint.config.js"];
73
73
  for (const configFile of configFiles) {
74
74
  const configPath = path.join(projectRoot, configFile);
75
- if (fs.existsSync(configPath)) {
76
- try {
77
- const moduleUrl = pathToFileURL(configPath).href;
78
- const config = await import(moduleUrl);
79
- return config.default || config;
80
- } catch (err) {
81
- console.warn(`[Sprint] Failed to load config from ${configPath}:`, err);
82
- }
75
+ if (!fs.existsSync(configPath)) continue;
76
+ try {
77
+ const moduleUrl = pathToFileURL(configPath).href;
78
+ const module = await import(moduleUrl);
79
+ return module.default ?? module.config ?? module ?? null;
80
+ } catch (err) {
81
+ console.warn(`[Sprint] Failed to load config from ${configPath}:`, err);
83
82
  }
84
83
  }
85
84
  return null;
@@ -105,9 +104,9 @@ class Sprint {
105
104
  loadSprintConfig().then((config) => {
106
105
  const defaults = {
107
106
  port: process.env.PORT,
108
- routesPath: "./routes",
109
- middlewaresPath: "./middlewares",
110
- cronjobsPath: "./cronjobs",
107
+ routesPath: "./src/routes",
108
+ middlewaresPath: "./src/middlewares",
109
+ cronjobsPath: "./src/cronjobs",
111
110
  jsonLimit: "50mb",
112
111
  urlEncodedLimit: "50mb",
113
112
  prefix: "",
@@ -119,13 +118,11 @@ class Sprint {
119
118
  }
120
119
  }
121
120
  };
122
- console.log("PROJECT ROOT:", process.cwd());
123
- console.log("CONFIG LOADED:", config);
124
121
  const finalConfig = deepMerge(defaults, config || {});
125
122
  this.port = finalConfig.port;
126
- this.routesPath = finalConfig.routesPath || "./routes";
127
- this.middlewaresPath = finalConfig.middlewaresPath || "./middlewares";
128
- this.cronjobsPath = finalConfig.cronjobsPath || "./cronjobs";
123
+ this.routesPath = finalConfig.routesPath || "./src/routes";
124
+ this.middlewaresPath = finalConfig.middlewaresPath || "./src/middlewares";
125
+ this.cronjobsPath = finalConfig.cronjobsPath || "./src/cronjobs";
129
126
  this.jsonLimit = finalConfig.jsonLimit || "50mb";
130
127
  this.urlEncodedLimit = finalConfig.urlEncodedLimit || "50mb";
131
128
  this.prefix = finalConfig.prefix ? "/" + finalConfig.prefix.replace(/^\/+|\/+$/g, "") : "";
@@ -139,21 +136,23 @@ class Sprint {
139
136
  this.loadDefaults();
140
137
  this.loadHealthcheck();
141
138
  this.routesLoaded = this.init();
142
- if (this.openapi.generateOnBuild) {
143
- this.app.get("/openapi.json", (_, res) => {
144
- res.json(this.generateOpenAPISpec());
145
- });
146
- if (this.openapi.swaggerUi.enabled) {
147
- import("swagger-ui-express").then((swaggerUi) => {
148
- this.app.use("/swagger", swaggerUi.serve, swaggerUi.setup(void 0, {
149
- swaggerUrl: "/openapi.json"
150
- }));
151
- }).catch(() => {
152
- console.error(`[Sprint] ⚠️ swagger-ui-express is not installed. Run "npm install swagger-ui-express" to enable Swagger UI.`);
139
+ this.routesLoaded.then(() => {
140
+ if (this.openapi.generateOnBuild) {
141
+ this.app.get("/openapi.json", (_, res) => {
142
+ res.json(this.generateOpenAPISpec());
153
143
  });
144
+ if (this.openapi.swaggerUi.enabled) {
145
+ import("swagger-ui-express").then((swaggerUi) => {
146
+ this.app.use("/swagger", swaggerUi.serve, swaggerUi.setup(void 0, {
147
+ swaggerUrl: "/openapi.json"
148
+ }));
149
+ }).catch(() => {
150
+ console.error(`[Sprint] ⚠️ swagger-ui-express is not installed. Run "npm install swagger-ui-express" to enable Swagger UI.`);
151
+ });
152
+ }
154
153
  }
155
- }
156
- if (finalConfig.autoListen) this.routesLoaded.then(() => this.listen());
154
+ if (finalConfig.autoListen) this.listen();
155
+ });
157
156
  });
158
157
  }
159
158
  async init() {
@@ -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;AAoCnC,qBAAa,MAAM;IACR,GAAG,EAAE,WAAW,CAAC;I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AM,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.60",
3
+ "version": "0.0.62",
4
4
  "description": "Sprint - Quickly API",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",