@nitronjs/framework 0.3.2 → 0.3.3

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.
@@ -25,7 +25,7 @@ const ICONS = {
25
25
  };
26
26
 
27
27
  const PATTERNS = {
28
- views: ["resources/views/**/*.tsx"],
28
+ views: ["resources/views/**/*.tsx", "resources/views/**/*.ts"],
29
29
  css: ["resources/css/**/*.css"],
30
30
  restart: ["config/**/*.js", "app/Kernel.js", "app/Models/**/*.js", "routes/**/*.js", "app.js", "app/Controllers/**/*.js", "app/Middlewares/**/*.js"],
31
31
  framework: ["lib/View/Templates/**/*.tsx"]
@@ -111,7 +111,18 @@ class DateTime {
111
111
  date.setHours(date.getHours() + hours);
112
112
  return date.toISOString().slice(0, 19).replace('T', ' ');
113
113
  }
114
-
114
+
115
+ /**
116
+ * Add minutes to current date
117
+ * @param {number} minutes - Number of minutes to add
118
+ * @returns {string} SQL formatted datetime
119
+ */
120
+ static addMinutes(minutes) {
121
+ const date = this.#getDate();
122
+ date.setMinutes(date.getMinutes() + minutes);
123
+ return date.toISOString().slice(0, 19).replace('T', ' ');
124
+ }
125
+
115
126
  /**
116
127
  * Subtract days from current date
117
128
  * @param {number} days - Number of days to subtract
@@ -120,7 +131,7 @@ class DateTime {
120
131
  static subDays(days) {
121
132
  return this.addDays(-days);
122
133
  }
123
-
134
+
124
135
  /**
125
136
  * Subtract hours from current date
126
137
  * @param {number} hours - Number of hours to subtract
@@ -129,6 +140,15 @@ class DateTime {
129
140
  static subHours(hours) {
130
141
  return this.addHours(-hours);
131
142
  }
143
+
144
+ /**
145
+ * Subtract minutes from current date
146
+ * @param {number} minutes - Number of minutes to subtract
147
+ * @returns {string} SQL formatted datetime
148
+ */
149
+ static subMinutes(minutes) {
150
+ return this.addMinutes(-minutes);
151
+ }
132
152
  }
133
153
 
134
154
  export default DateTime;
@@ -29,7 +29,8 @@ class DevIndicator {
29
29
  const route = devData?.route;
30
30
  const timing = devData ? buildTimingSummary(devData) : null;
31
31
  const mwCount = devData?.middlewareTiming?.length || 0;
32
- const propsInfo = devData?.rawProps ? buildPropsSummary(devData) : null;
32
+ const hasProps = devData?.rawProps && Object.keys(devData.rawProps).length > 0;
33
+ const propsInfo = hasProps ? buildPropsSummary(devData) : null;
33
34
 
34
35
  const totalMs = timing ? parseFloat(timing.total) : 0;
35
36
  const timingWarnClass = totalMs >= 300 ? " ndi-critical" : totalMs >= 100 ? " ndi-warn" : "";
package/lib/View/View.js CHANGED
@@ -723,11 +723,6 @@ class View {
723
723
 
724
724
  let runtimeScript = `<script${nonceAttr}>window.__NITRON_RUNTIME__=${JSON.stringify(runtimeData)};`;
725
725
 
726
- if (hasFlightPayload) {
727
- const escapedPayload = flightPayload.replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
728
- runtimeScript += `window.__NITRON_FLIGHT__=${JSON.stringify(escapedPayload)};`;
729
- }
730
-
731
726
  if (translations && Object.keys(translations).length > 0) {
732
727
  const escapedTranslations = JSON.stringify(translations).replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
733
728
  runtimeScript += `window.__NITRON_TRANSLATIONS__=${escapedTranslations};`;
@@ -735,6 +730,11 @@ class View {
735
730
 
736
731
  runtimeScript += `</script>`;
737
732
 
733
+ if (hasFlightPayload) {
734
+ const escapedPayload = flightPayload.replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
735
+ runtimeScript += `<script${nonceAttr}>window.__NITRON_FLIGHT__=${JSON.stringify(escapedPayload)};</script>`;
736
+ }
737
+
738
738
  const vendorScript = `<script src="/storage/js/vendor.js"${nonceAttr}></script>`;
739
739
 
740
740
  const hmrScript = this.#isDev
package/lib/index.d.ts CHANGED
@@ -273,8 +273,10 @@ export class DateTime {
273
273
  static getDate(timestamp?: string | number | null, format?: string): string;
274
274
  static addDays(days: number): string;
275
275
  static addHours(hours: number): string;
276
+ static addMinutes(minutes: number): string;
276
277
  static subDays(days: number): string;
277
278
  static subHours(hours: number): string;
279
+ static subMinutes(minutes: number): string;
278
280
  }
279
281
 
280
282
  export class Str {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitronjs/framework",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "NitronJS is a modern and extensible Node.js MVC framework built on Fastify. It focuses on clean architecture, modular structure, and developer productivity, offering built-in routing, middleware, configuration management, CLI tooling, and native React integration for scalable full-stack applications.",
5
5
  "bin": {
6
6
  "njs": "./cli/njs.js"