sprint-es 0.0.59 → 0.0.61

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: "",
@@ -146,9 +145,9 @@ class Sprint {
146
145
  };
147
146
  const finalConfig = deepMerge(defaults, config || {});
148
147
  this.port = finalConfig.port;
149
- this.routesPath = finalConfig.routesPath || "./routes";
150
- this.middlewaresPath = finalConfig.middlewaresPath || "./middlewares";
151
- 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";
152
151
  this.jsonLimit = finalConfig.jsonLimit || "50mb";
153
152
  this.urlEncodedLimit = finalConfig.urlEncodedLimit || "50mb";
154
153
  this.prefix = finalConfig.prefix ? "/" + finalConfig.prefix.replace(/^\/+|\/+$/g, "") : "";
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: "",
@@ -121,9 +120,9 @@ class Sprint {
121
120
  };
122
121
  const finalConfig = deepMerge(defaults, config || {});
123
122
  this.port = finalConfig.port;
124
- this.routesPath = finalConfig.routesPath || "./routes";
125
- this.middlewaresPath = finalConfig.middlewaresPath || "./middlewares";
126
- 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";
127
126
  this.jsonLimit = finalConfig.jsonLimit || "50mb";
128
127
  this.urlEncodedLimit = finalConfig.urlEncodedLimit || "50mb";
129
128
  this.prefix = finalConfig.prefix ? "/" + finalConfig.prefix.replace(/^\/+|\/+$/g, "") : "";
@@ -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;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;;YAkEM,IAAI;IA+BlB,OAAO,CAAC,YAAY;IAiDpB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA4B9B;;OAEG;YACW,eAAe;IAgC7B,OAAO,CAAC,eAAe;YAcT,UAAU;YA2EV,YAAY;IAmB1B,OAAO,CAAC,YAAY;IAgCpB,+BAA+B;IAC/B,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,mBAAmB;IA6BpB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,E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,OAAO,CAAC,eAAe;YAcT,UAAU;YA2EV,YAAY;IAmB1B,OAAO,CAAC,YAAY;IAgCpB,+BAA+B;IAC/B,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,mBAAmB;IA6BpB,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.59",
3
+ "version": "0.0.61",
4
4
  "description": "Sprint - Quickly API",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",