vatts 2.0.2 → 2.0.3-canary.1

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.
@@ -1,177 +1,177 @@
1
- /*
2
- * This file is part of the Vatts.js Project.
3
- * Copyright (c) 2026 mfraz
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- /**
19
- * Type declarations for asset imports
20
- * This allows TypeScript to understand imports of various file types
21
- */
22
-
23
- // Markdown files
24
- declare module "*.md" {
25
- const content: string;
26
- export default content;
27
- }
28
-
29
- // Images
30
- declare module "*.png" {
31
- const src: string;
32
- export default src;
33
- }
34
-
35
- declare module "*.jpg" {
36
- const src: string;
37
- export default src;
38
- }
39
-
40
- declare module "*.jpeg" {
41
- const src: string;
42
- export default src;
43
- }
44
-
45
- declare module "*.gif" {
46
- const src: string;
47
- export default src;
48
- }
49
-
50
- declare module "*.webp" {
51
- const src: string;
52
- export default src;
53
- }
54
-
55
- declare module "*.avif" {
56
- const src: string;
57
- export default src;
58
- }
59
-
60
- declare module "*.ico" {
61
- const src: string;
62
- export default src;
63
- }
64
-
65
- declare module "*.bmp" {
66
- const src: string;
67
- export default src;
68
- }
69
-
70
- declare module "*.tif" {
71
- const src: string;
72
- export default src;
73
- }
74
-
75
- declare module "*.tiff" {
76
- const src: string;
77
- export default src;
78
- }
79
-
80
- // SVG (with additional export for raw content)
81
- declare module "*.svg" {
82
- const src: string;
83
- export const svgContent: string;
84
- export default src;
85
- }
86
-
87
- // JSON files
88
- declare module "*.json" {
89
- const value: any;
90
- export default value;
91
- }
92
-
93
- // Text files
94
- declare module "*.txt" {
95
- const content: string;
96
- export default content;
97
- }
98
-
99
- // Fonts
100
- declare module "*.woff" {
101
- const src: string;
102
- export default src;
103
- }
104
-
105
- declare module "*.woff2" {
106
- const src: string;
107
- export default src;
108
- }
109
-
110
- declare module "*.ttf" {
111
- const src: string;
112
- export default src;
113
- }
114
-
115
- declare module "*.otf" {
116
- const src: string;
117
- export default src;
118
- }
119
-
120
- declare module "*.eot" {
121
- const src: string;
122
- export default src;
123
- }
124
-
125
- // Audio files
126
- declare module "*.mp3" {
127
- const src: string;
128
- export default src;
129
- }
130
-
131
- declare module "*.wav" {
132
- const src: string;
133
- export default src;
134
- }
135
-
136
- declare module "*.ogg" {
137
- const src: string;
138
- export default src;
139
- }
140
-
141
- declare module "*.m4a" {
142
- const src: string;
143
- export default src;
144
- }
145
-
146
- declare module "*.aac" {
147
- const src: string;
148
- export default src;
149
- }
150
-
151
- declare module "*.flac" {
152
- const src: string;
153
- export default src;
154
- }
155
-
156
- // Video files
157
- declare module "*.mp4" {
158
- const src: string;
159
- export default src;
160
- }
161
-
162
- declare module "*.webm" {
163
- const src: string;
164
- export default src;
165
- }
166
-
167
- declare module "*.ogv" {
168
- const src: string;
169
- export default src;
170
- }
171
-
172
- /* eslint-disable */
173
- declare module '*.vue' {
174
- // Usamos import('vue') para não transformar o arquivo em um módulo
175
- const component: import('vue').DefineComponent<{}, {}, any>
176
- export default component
1
+ /*
2
+ * This file is part of the Vatts.js Project.
3
+ * Copyright (c) 2026 mfraz
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ /**
19
+ * Type declarations for asset imports
20
+ * This allows TypeScript to understand imports of various file types
21
+ */
22
+
23
+ // Markdown files
24
+ declare module "*.md" {
25
+ const content: string;
26
+ export default content;
27
+ }
28
+
29
+ // Images
30
+ declare module "*.png" {
31
+ const src: string;
32
+ export default src;
33
+ }
34
+
35
+ declare module "*.jpg" {
36
+ const src: string;
37
+ export default src;
38
+ }
39
+
40
+ declare module "*.jpeg" {
41
+ const src: string;
42
+ export default src;
43
+ }
44
+
45
+ declare module "*.gif" {
46
+ const src: string;
47
+ export default src;
48
+ }
49
+
50
+ declare module "*.webp" {
51
+ const src: string;
52
+ export default src;
53
+ }
54
+
55
+ declare module "*.avif" {
56
+ const src: string;
57
+ export default src;
58
+ }
59
+
60
+ declare module "*.ico" {
61
+ const src: string;
62
+ export default src;
63
+ }
64
+
65
+ declare module "*.bmp" {
66
+ const src: string;
67
+ export default src;
68
+ }
69
+
70
+ declare module "*.tif" {
71
+ const src: string;
72
+ export default src;
73
+ }
74
+
75
+ declare module "*.tiff" {
76
+ const src: string;
77
+ export default src;
78
+ }
79
+
80
+ // SVG (with additional export for raw content)
81
+ declare module "*.svg" {
82
+ const src: string;
83
+ export const svgContent: string;
84
+ export default src;
85
+ }
86
+
87
+ // JSON files
88
+ declare module "*.json" {
89
+ const value: any;
90
+ export default value;
91
+ }
92
+
93
+ // Text files
94
+ declare module "*.txt" {
95
+ const content: string;
96
+ export default content;
97
+ }
98
+
99
+ // Fonts
100
+ declare module "*.woff" {
101
+ const src: string;
102
+ export default src;
103
+ }
104
+
105
+ declare module "*.woff2" {
106
+ const src: string;
107
+ export default src;
108
+ }
109
+
110
+ declare module "*.ttf" {
111
+ const src: string;
112
+ export default src;
113
+ }
114
+
115
+ declare module "*.otf" {
116
+ const src: string;
117
+ export default src;
118
+ }
119
+
120
+ declare module "*.eot" {
121
+ const src: string;
122
+ export default src;
123
+ }
124
+
125
+ // Audio files
126
+ declare module "*.mp3" {
127
+ const src: string;
128
+ export default src;
129
+ }
130
+
131
+ declare module "*.wav" {
132
+ const src: string;
133
+ export default src;
134
+ }
135
+
136
+ declare module "*.ogg" {
137
+ const src: string;
138
+ export default src;
139
+ }
140
+
141
+ declare module "*.m4a" {
142
+ const src: string;
143
+ export default src;
144
+ }
145
+
146
+ declare module "*.aac" {
147
+ const src: string;
148
+ export default src;
149
+ }
150
+
151
+ declare module "*.flac" {
152
+ const src: string;
153
+ export default src;
154
+ }
155
+
156
+ // Video files
157
+ declare module "*.mp4" {
158
+ const src: string;
159
+ export default src;
160
+ }
161
+
162
+ declare module "*.webm" {
163
+ const src: string;
164
+ export default src;
165
+ }
166
+
167
+ declare module "*.ogv" {
168
+ const src: string;
169
+ export default src;
170
+ }
171
+
172
+ /* eslint-disable */
173
+ declare module '*.vue' {
174
+ // Usamos import('vue') para não transformar o arquivo em um módulo
175
+ const component: import('vue').DefineComponent<{}, {}, any>
176
+ export default component
177
177
  }
package/dist/helpers.js CHANGED
@@ -361,6 +361,12 @@ async function initNativeServer(vattsApp, options, hostname, vattsConfig) {
361
361
  res.setHeader('X-Frame-Options', 'DENY');
362
362
  res.setHeader('X-XSS-Protection', '1; mode=block');
363
363
  res.setHeader('Referrer-Policy', 'strict-origin-when-cross-origin');
364
+ // [NOVO] Injeção Alt-Svc se HTTP/3 estiver ativo
365
+ // O Go irá propagar este header para o cliente
366
+ if (vattsConfig.ssl && vattsConfig.ssl.http3Port) {
367
+ console.log("setando header alt-svc para HTTP/3 na porta", vattsConfig.ssl.http3Port);
368
+ res.setHeader('Alt-Svc', `h3=":${vattsConfig.ssl.http3Port}"; ma=2592000`);
369
+ }
364
370
  // Aplica headers de segurança configurados
365
371
  if (vattsConfig.security?.contentSecurityPolicy) {
366
372
  res.setHeader('Content-Security-Policy', vattsConfig.security.contentSecurityPolicy);
@@ -616,8 +622,12 @@ async function initNativeServer(vattsApp, options, hostname, vattsConfig) {
616
622
  setInterval(() => { }, 2147483647);
617
623
  }
618
624
  catch (e) {
619
- console_1.default.error(`${console_1.Colors.FgRed}[Critical] Failed to start Native Server:${console_1.Colors.Reset} ${e.message}`);
620
- process.exit(1);
625
+ console_1.default.error(`${console_1.Colors.FgRed}[Critical] Failed to start Native Server:`, e);
626
+ // Graceful shutdown
627
+ console.log(`${console_1.Colors.FgGray}Shutting down gracefully...${console_1.Colors.Reset}`);
628
+ setTimeout(() => {
629
+ process.exit(1);
630
+ }, 1000);
621
631
  }
622
632
  // Configura WebSocket (Funciona através do Proxy pois ele suporta upgrade de conexão via raw bytes)
623
633
  vattsApp.setupWebSocket(server);
@@ -713,11 +723,11 @@ function app(options = {}) {
713
723
  message = `${console_1.Colors.FgGreen} You are on the latest version${console_1.Colors.FgMagenta}`;
714
724
  }
715
725
  // JS STICK LETTERS
716
- console.log(`${console_1.Colors.Bright + console_1.Colors.FgCyan}
717
- ${console_1.Colors.Bright + console_1.Colors.FgCyan} ___ ___ __ ${console_1.Colors.FgWhite} __
718
- ${console_1.Colors.Bright + console_1.Colors.FgCyan} \\ / /\\ | | /__\`${console_1.Colors.FgWhite} | /__\` ${console_1.Colors.Bright + console_1.Colors.FgCyan}Vatts${console_1.Colors.FgWhite}.js ${console_1.Colors.FgGray}(v${require('../package.json').version}) - mfraz
719
- ${console_1.Colors.Bright + console_1.Colors.FgCyan} \\/ /~~\\ | | .__/ .${console_1.Colors.FgWhite} \\__/ .__/ ${message}
720
-
726
+ console.log(`${console_1.Colors.Bright + console_1.Colors.FgCyan}
727
+ ${console_1.Colors.Bright + console_1.Colors.FgCyan} ___ ___ __ ${console_1.Colors.FgWhite} __
728
+ ${console_1.Colors.Bright + console_1.Colors.FgCyan} \\ / /\\ | | /__\`${console_1.Colors.FgWhite} | /__\` ${console_1.Colors.Bright + console_1.Colors.FgCyan}Vatts${console_1.Colors.FgWhite}.js ${console_1.Colors.FgGray}(v${require('../package.json').version}) - mfraz
729
+ ${console_1.Colors.Bright + console_1.Colors.FgCyan} \\/ /~~\\ | | .__/ .${console_1.Colors.FgWhite} \\__/ .__/ ${message}
730
+
721
731
  `);
722
732
  const actualHostname = options.hostname || "0.0.0.0";
723
733
  if (framework !== 'native') {