vatts 2.2.6 → 2.3.0-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.
- package/LICENSE +12 -12
- package/README.md +65 -65
- package/dist/builder.js +79 -42
- package/dist/frameworks/FrontCore.d.ts +34 -0
- package/dist/frameworks/FrontCore.js +128 -0
- package/dist/{vue → frameworks/builds}/vue.build.js +1 -1
- package/dist/frameworks/react/client.d.ts +8 -0
- package/dist/{react → frameworks/react}/client.js +14 -14
- package/dist/{react → frameworks/react/components}/Link.js +2 -2
- package/dist/frameworks/react/entry.client.d.ts +14 -0
- package/dist/frameworks/react/entry.client.js +211 -0
- package/dist/frameworks/react/react-elements.d.ts +10 -0
- package/dist/{react → frameworks/renderers}/renderer-react.d.ts +2 -2
- package/dist/{react → frameworks/renderers}/renderer-react.js +53 -86
- package/dist/{vue → frameworks/renderers}/renderer.vue.d.ts +2 -2
- package/dist/frameworks/renderers/renderer.vue.js +193 -0
- package/dist/frameworks/themes/BuildingPage.d.ts +1 -0
- package/dist/frameworks/themes/BuildingPage.js +312 -0
- package/dist/frameworks/themes/DefaultNotFound.d.ts +1 -0
- package/dist/frameworks/themes/DefaultNotFound.js +330 -0
- package/dist/frameworks/themes/ErrorModal.d.ts +1 -0
- package/dist/frameworks/themes/ErrorModal.js +345 -0
- package/dist/frameworks/themes/ServerError.d.ts +1 -0
- package/dist/frameworks/themes/ServerError.js +401 -0
- package/dist/frameworks/themes/VattsDevBadge.d.ts +1 -0
- package/dist/frameworks/themes/VattsDevBadge.js +232 -0
- package/dist/frameworks/vue/App.vue +149 -0
- package/dist/frameworks/vue/client.d.ts +9 -0
- package/dist/{vue → frameworks/vue}/client.js +13 -11
- package/dist/{vue → frameworks/vue/components}/Link.vue +38 -38
- package/dist/{vue → frameworks/vue/components}/image/Image.vue +128 -128
- package/dist/frameworks/vue/entry.client.js +75 -0
- package/dist/global/global.d.ts +179 -180
- package/dist/hotReload.js +77 -77
- package/dist/index.js +12 -1
- package/dist/loaders.js +15 -15
- package/dist/renderer.js +2 -2
- package/dist/renderers/common.js +3 -3
- package/dist/utils/core-go.js +2 -2
- package/dist/utils/utils.js +5 -5
- package/package.json +10 -26
- package/dist/react/BuildingPage.d.ts +0 -2
- package/dist/react/BuildingPage.js +0 -270
- package/dist/react/DefaultNotFound.d.ts +0 -2
- package/dist/react/DefaultNotFound.js +0 -248
- package/dist/react/DevIndicator.d.ts +0 -5
- package/dist/react/DevIndicator.js +0 -203
- package/dist/react/ErrorModal.d.ts +0 -20
- package/dist/react/ErrorModal.js +0 -266
- package/dist/react/client.d.ts +0 -8
- package/dist/react/entry.client.d.ts +0 -6
- package/dist/react/entry.client.js +0 -325
- package/dist/react/server-error.d.ts +0 -8
- package/dist/react/server-error.js +0 -346
- package/dist/vue/App.vue +0 -199
- package/dist/vue/BuildingPage.vue +0 -281
- package/dist/vue/DefaultNotFound.vue +0 -329
- package/dist/vue/DevIndicator.vue +0 -226
- package/dist/vue/ErrorModal.vue +0 -317
- package/dist/vue/client.d.ts +0 -9
- package/dist/vue/entry.client.js +0 -110
- package/dist/vue/renderer.vue.js +0 -387
- package/dist/vue/server-error.vue +0 -351
- /package/dist/{react → frameworks/builds}/react.build.d.ts +0 -0
- /package/dist/{react → frameworks/builds}/react.build.js +0 -0
- /package/dist/{vue → frameworks/builds}/vue.build.d.ts +0 -0
- /package/dist/{react → frameworks/react/components}/Link.d.ts +0 -0
- /package/dist/{react → frameworks/react/components}/image/Image.d.ts +0 -0
- /package/dist/{react → frameworks/react/components}/image/Image.js +0 -0
- /package/dist/{vue → frameworks/vue}/entry.client.d.ts +0 -0
package/dist/global/global.d.ts
CHANGED
|
@@ -1,180 +1,179 @@
|
|
|
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
|
-
*
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
export
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
declare module '*.
|
|
179
|
-
declare module '*.
|
|
180
|
-
declare module '*.sass';
|
|
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
|
+
* Type declarations for asset imports
|
|
19
|
+
* This allows TypeScript to understand imports of various file types
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
// Markdown files
|
|
23
|
+
declare module "*.md" {
|
|
24
|
+
const content: string;
|
|
25
|
+
export default content;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Images
|
|
29
|
+
declare module "*.png" {
|
|
30
|
+
const src: string;
|
|
31
|
+
export default src;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare module "*.jpg" {
|
|
35
|
+
const src: string;
|
|
36
|
+
export default src;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare module "*.jpeg" {
|
|
40
|
+
const src: string;
|
|
41
|
+
export default src;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare module "*.gif" {
|
|
45
|
+
const src: string;
|
|
46
|
+
export default src;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare module "*.webp" {
|
|
50
|
+
const src: string;
|
|
51
|
+
export default src;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare module "*.avif" {
|
|
55
|
+
const src: string;
|
|
56
|
+
export default src;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
declare module "*.ico" {
|
|
60
|
+
const src: string;
|
|
61
|
+
export default src;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare module "*.bmp" {
|
|
65
|
+
const src: string;
|
|
66
|
+
export default src;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
declare module "*.tif" {
|
|
70
|
+
const src: string;
|
|
71
|
+
export default src;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare module "*.tiff" {
|
|
75
|
+
const src: string;
|
|
76
|
+
export default src;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// SVG (with additional export for raw content)
|
|
80
|
+
declare module "*.svg" {
|
|
81
|
+
const src: string;
|
|
82
|
+
export const svgContent: string;
|
|
83
|
+
export default src;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// JSON files
|
|
87
|
+
declare module "*.json" {
|
|
88
|
+
const value: any;
|
|
89
|
+
export default value;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Text files
|
|
93
|
+
declare module "*.txt" {
|
|
94
|
+
const content: string;
|
|
95
|
+
export default content;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Fonts
|
|
99
|
+
declare module "*.woff" {
|
|
100
|
+
const src: string;
|
|
101
|
+
export default src;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
declare module "*.woff2" {
|
|
105
|
+
const src: string;
|
|
106
|
+
export default src;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
declare module "*.ttf" {
|
|
110
|
+
const src: string;
|
|
111
|
+
export default src;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
declare module "*.otf" {
|
|
115
|
+
const src: string;
|
|
116
|
+
export default src;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare module "*.eot" {
|
|
120
|
+
const src: string;
|
|
121
|
+
export default src;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Audio files
|
|
125
|
+
declare module "*.mp3" {
|
|
126
|
+
const src: string;
|
|
127
|
+
export default src;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
declare module "*.wav" {
|
|
131
|
+
const src: string;
|
|
132
|
+
export default src;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
declare module "*.ogg" {
|
|
136
|
+
const src: string;
|
|
137
|
+
export default src;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
declare module "*.m4a" {
|
|
141
|
+
const src: string;
|
|
142
|
+
export default src;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
declare module "*.aac" {
|
|
146
|
+
const src: string;
|
|
147
|
+
export default src;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
declare module "*.flac" {
|
|
151
|
+
const src: string;
|
|
152
|
+
export default src;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Video files
|
|
156
|
+
declare module "*.mp4" {
|
|
157
|
+
const src: string;
|
|
158
|
+
export default src;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
declare module "*.webm" {
|
|
162
|
+
const src: string;
|
|
163
|
+
export default src;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
declare module "*.ogv" {
|
|
167
|
+
const src: string;
|
|
168
|
+
export default src;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* eslint-disable */
|
|
172
|
+
declare module '*.vue' {
|
|
173
|
+
// Usamos import('vue') para não transformar o arquivo em um módulo
|
|
174
|
+
const component: import('vue').DefineComponent<{}, {}, any>
|
|
175
|
+
export default component
|
|
176
|
+
}
|
|
177
|
+
declare module '*.css';
|
|
178
|
+
declare module '*.scss';
|
|
179
|
+
declare module '*.sass';
|
package/dist/hotReload.js
CHANGED
|
@@ -439,83 +439,83 @@ class HotReloadManager {
|
|
|
439
439
|
deadClients.forEach(ws => this.cleanupClient(ws));
|
|
440
440
|
}
|
|
441
441
|
getClientScript() {
|
|
442
|
-
return `
|
|
443
|
-
<script>
|
|
444
|
-
(function() {
|
|
445
|
-
if (typeof window !== 'undefined') {
|
|
446
|
-
let ws;
|
|
447
|
-
let reconnectAttempts = 0;
|
|
448
|
-
let isConnected = false;
|
|
449
|
-
|
|
450
|
-
function dispatch(name, detail) {
|
|
451
|
-
try { window.dispatchEvent(new CustomEvent(name, { detail: detail || {} })); } catch(e) {}
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
function connect() {
|
|
455
|
-
const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
|
|
456
|
-
const port = protocol === "wss:" ? "${helpers_1.config?.ssl?.http3Port}" : "${helpers_1.config?.port}"
|
|
457
|
-
const wsUrl = protocol + '//' + window.location.hostname + ':' + port + '/hweb-hotreload/';
|
|
458
|
-
|
|
459
|
-
if (ws && (ws.readyState === WebSocket.CONNECTING || ws.readyState === WebSocket.OPEN)) return;
|
|
460
|
-
|
|
461
|
-
try {
|
|
462
|
-
ws = new WebSocket(wsUrl);
|
|
463
|
-
ws.onopen = function() {
|
|
464
|
-
console.log('\\u001b[32m[vatts]\\u001b[0m Hot-reload connected');
|
|
465
|
-
isConnected = true;
|
|
466
|
-
reconnectAttempts = 0;
|
|
467
|
-
ws.send(JSON.stringify({ type: 'status-request', ts: Date.now() }));
|
|
468
|
-
};
|
|
469
|
-
|
|
470
|
-
ws.onmessage = function(event) {
|
|
471
|
-
try {
|
|
472
|
-
const message = JSON.parse(event.data);
|
|
473
|
-
switch(message.type) {
|
|
474
|
-
case 'build-start':
|
|
475
|
-
window.__VATTS_HOT_RELOAD__ = { state: 'reloading', payload: message.data, ts: Date.now() };
|
|
476
|
-
dispatch('vatts:hotreload', window.__VATTS_HOT_RELOAD__);
|
|
477
|
-
break;
|
|
478
|
-
case 'frontend-reload':
|
|
479
|
-
case 'backend-api-reload':
|
|
480
|
-
case 'server-ready':
|
|
481
|
-
console.log('[vatts] Changes applied, reloading page...');
|
|
482
|
-
dispatch('vatts:hmr-ready', { files: message.data?.files });
|
|
483
|
-
|
|
484
|
-
window.__VATTS_HOT_RELOAD__ = { state: 'idle', payload: { success: true }, ts: Date.now() };
|
|
485
|
-
dispatch('vatts:hotreload', window.__VATTS_HOT_RELOAD__);
|
|
486
|
-
|
|
487
|
-
setTimeout(() => window.location.reload(), 150);
|
|
488
|
-
break;
|
|
489
|
-
case 'build-error':
|
|
490
|
-
window.__VATTS_HOT_RELOAD__ = { state: 'build-error', payload: message.data, ts: Date.now() };
|
|
491
|
-
dispatch('vatts:hotreload', window.__VATTS_HOT_RELOAD__);
|
|
492
|
-
dispatch('vatts:build-error', message.data);
|
|
493
|
-
console.error('[vatts] Build Error:', message.data);
|
|
494
|
-
break;
|
|
495
|
-
case 'build-complete':
|
|
496
|
-
window.__VATTS_HOT_RELOAD__ = { state: 'idle', payload: { build: 'ok' }, ts: Date.now() };
|
|
497
|
-
dispatch('vatts:hotreload', window.__VATTS_HOT_RELOAD__);
|
|
498
|
-
dispatch('vatts:build-ok', { ts: Date.now() });
|
|
499
|
-
break;
|
|
500
|
-
}
|
|
501
|
-
} catch (e) {
|
|
502
|
-
console.error('[vatts] Error processing msg:', e);
|
|
503
|
-
}
|
|
504
|
-
};
|
|
505
|
-
|
|
506
|
-
ws.onclose = function(event) {
|
|
507
|
-
isConnected = false;
|
|
508
|
-
if (event.code === 1000) return;
|
|
509
|
-
setTimeout(connect, Math.min(1000 * Math.pow(1.5, reconnectAttempts++), 30000));
|
|
510
|
-
};
|
|
511
|
-
} catch (error) { setTimeout(connect, 1000); }
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
document.addEventListener('visibilitychange', function() { if (!document.hidden && !isConnected) { reconnectAttempts = 0; connect(); } });
|
|
515
|
-
connect();
|
|
516
|
-
}
|
|
517
|
-
})();
|
|
518
|
-
</script>
|
|
442
|
+
return `
|
|
443
|
+
<script>
|
|
444
|
+
(function() {
|
|
445
|
+
if (typeof window !== 'undefined') {
|
|
446
|
+
let ws;
|
|
447
|
+
let reconnectAttempts = 0;
|
|
448
|
+
let isConnected = false;
|
|
449
|
+
|
|
450
|
+
function dispatch(name, detail) {
|
|
451
|
+
try { window.dispatchEvent(new CustomEvent(name, { detail: detail || {} })); } catch(e) {}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
function connect() {
|
|
455
|
+
const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
|
|
456
|
+
const port = protocol === "wss:" ? "${helpers_1.config?.ssl?.http3Port}" : "${helpers_1.config?.port}"
|
|
457
|
+
const wsUrl = protocol + '//' + window.location.hostname + ':' + port + '/hweb-hotreload/';
|
|
458
|
+
|
|
459
|
+
if (ws && (ws.readyState === WebSocket.CONNECTING || ws.readyState === WebSocket.OPEN)) return;
|
|
460
|
+
|
|
461
|
+
try {
|
|
462
|
+
ws = new WebSocket(wsUrl);
|
|
463
|
+
ws.onopen = function() {
|
|
464
|
+
console.log('\\u001b[32m[vatts]\\u001b[0m Hot-reload connected');
|
|
465
|
+
isConnected = true;
|
|
466
|
+
reconnectAttempts = 0;
|
|
467
|
+
ws.send(JSON.stringify({ type: 'status-request', ts: Date.now() }));
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
ws.onmessage = function(event) {
|
|
471
|
+
try {
|
|
472
|
+
const message = JSON.parse(event.data);
|
|
473
|
+
switch(message.type) {
|
|
474
|
+
case 'build-start':
|
|
475
|
+
window.__VATTS_HOT_RELOAD__ = { state: 'reloading', payload: message.data, ts: Date.now() };
|
|
476
|
+
dispatch('vatts:hotreload', window.__VATTS_HOT_RELOAD__);
|
|
477
|
+
break;
|
|
478
|
+
case 'frontend-reload':
|
|
479
|
+
case 'backend-api-reload':
|
|
480
|
+
case 'server-ready':
|
|
481
|
+
console.log('[vatts] Changes applied, reloading page...');
|
|
482
|
+
dispatch('vatts:hmr-ready', { files: message.data?.files });
|
|
483
|
+
|
|
484
|
+
window.__VATTS_HOT_RELOAD__ = { state: 'idle', payload: { success: true }, ts: Date.now() };
|
|
485
|
+
dispatch('vatts:hotreload', window.__VATTS_HOT_RELOAD__);
|
|
486
|
+
|
|
487
|
+
setTimeout(() => window.location.reload(), 150);
|
|
488
|
+
break;
|
|
489
|
+
case 'build-error':
|
|
490
|
+
window.__VATTS_HOT_RELOAD__ = { state: 'build-error', payload: message.data, ts: Date.now() };
|
|
491
|
+
dispatch('vatts:hotreload', window.__VATTS_HOT_RELOAD__);
|
|
492
|
+
dispatch('vatts:build-error', message.data);
|
|
493
|
+
console.error('[vatts] Build Error:', message.data);
|
|
494
|
+
break;
|
|
495
|
+
case 'build-complete':
|
|
496
|
+
window.__VATTS_HOT_RELOAD__ = { state: 'idle', payload: { build: 'ok' }, ts: Date.now() };
|
|
497
|
+
dispatch('vatts:hotreload', window.__VATTS_HOT_RELOAD__);
|
|
498
|
+
dispatch('vatts:build-ok', { ts: Date.now() });
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
} catch (e) {
|
|
502
|
+
console.error('[vatts] Error processing msg:', e);
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
ws.onclose = function(event) {
|
|
507
|
+
isConnected = false;
|
|
508
|
+
if (event.code === 1000) return;
|
|
509
|
+
setTimeout(connect, Math.min(1000 * Math.pow(1.5, reconnectAttempts++), 30000));
|
|
510
|
+
};
|
|
511
|
+
} catch (error) { setTimeout(connect, 1000); }
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
document.addEventListener('visibilitychange', function() { if (!document.hidden && !isConnected) { reconnectAttempts = 0; connect(); } });
|
|
515
|
+
connect();
|
|
516
|
+
}
|
|
517
|
+
})();
|
|
518
|
+
</script>
|
|
519
519
|
`;
|
|
520
520
|
}
|
|
521
521
|
clearBackendCache(filePath) {
|
package/dist/index.js
CHANGED
|
@@ -723,7 +723,18 @@ function vatts(options) {
|
|
|
723
723
|
// Se o stream já começou, não dá pra enviar erro 500 limpo.
|
|
724
724
|
// O renderAsStream tenta lidar com isso no onError.
|
|
725
725
|
if (!rawRes.headersSent) {
|
|
726
|
-
|
|
726
|
+
const { getServerErrorHtml } = require("./frameworks/themes/ServerError");
|
|
727
|
+
// Gera o HTML bonitão passando o erro real
|
|
728
|
+
const errorHtml = getServerErrorHtml({
|
|
729
|
+
title: 'Critical SSR Error',
|
|
730
|
+
error: error,
|
|
731
|
+
requestUrl: pathname,
|
|
732
|
+
hint: 'The page crashed before or during the rendering process on the server.'
|
|
733
|
+
});
|
|
734
|
+
// Configura a resposta como HTML e envia a tela de erro
|
|
735
|
+
rawRes.statusCode = 500;
|
|
736
|
+
rawRes.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
737
|
+
rawRes.end(errorHtml);
|
|
727
738
|
}
|
|
728
739
|
}
|
|
729
740
|
};
|
package/dist/loaders.js
CHANGED
|
@@ -211,21 +211,21 @@ function registerLoaders(options = {}) {
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
// 4. Montagem do Código Final (ESM Virtual)
|
|
214
|
-
finalEsm = `
|
|
215
|
-
${scriptContent}
|
|
216
|
-
${templateContent}
|
|
217
|
-
|
|
218
|
-
// Anexa a função de renderização SSR ao componente principal
|
|
219
|
-
if (typeof _sfc_main !== 'undefined') {
|
|
220
|
-
if (typeof ssrRender !== 'undefined') {
|
|
221
|
-
_sfc_main.ssrRender = ssrRender;
|
|
222
|
-
}
|
|
223
|
-
if (typeof render !== 'undefined') {
|
|
224
|
-
_sfc_main.render = render;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
export default _sfc_main;
|
|
214
|
+
finalEsm = `
|
|
215
|
+
${scriptContent}
|
|
216
|
+
${templateContent}
|
|
217
|
+
|
|
218
|
+
// Anexa a função de renderização SSR ao componente principal
|
|
219
|
+
if (typeof _sfc_main !== 'undefined') {
|
|
220
|
+
if (typeof ssrRender !== 'undefined') {
|
|
221
|
+
_sfc_main.ssrRender = ssrRender;
|
|
222
|
+
}
|
|
223
|
+
if (typeof render !== 'undefined') {
|
|
224
|
+
_sfc_main.render = render;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export default _sfc_main;
|
|
229
229
|
`;
|
|
230
230
|
// 5. Transformação final para CommonJS (Node.js) via Esbuild
|
|
231
231
|
const result = esbuild.transformSync(finalEsm, {
|
package/dist/renderer.js
CHANGED
|
@@ -9,11 +9,11 @@ const framework_1 = require("./api/framework");
|
|
|
9
9
|
async function renderAsStream(params) {
|
|
10
10
|
if (framework_1.cachedFramework === 'react') {
|
|
11
11
|
// Import dinâmico garante que o código do React só seja avaliado se necessário
|
|
12
|
-
const { render } = await import("./
|
|
12
|
+
const { render } = await import("./frameworks/renderers/renderer-react.js");
|
|
13
13
|
return await render(params);
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
|
-
const { renderVue } = await import("./
|
|
16
|
+
const { renderVue } = await import("./frameworks/renderers/renderer.vue.js");
|
|
17
17
|
return await renderVue(params);
|
|
18
18
|
}
|
|
19
19
|
}
|
package/dist/renderers/common.js
CHANGED
|
@@ -236,9 +236,9 @@ function generateMetaTags(metadata) {
|
|
|
236
236
|
if (metadata.canonical)
|
|
237
237
|
tags.push(`<link rel="canonical" href="${metadata.canonical}">`);
|
|
238
238
|
if (metadata.faviconDark) {
|
|
239
|
-
tags.push(`
|
|
240
|
-
<link rel="icon" href="${metadata.favicon}" media="(prefers-color-scheme: light)">
|
|
241
|
-
<link rel="icon" href="${metadata.faviconDark}" media="(prefers-color-scheme: dark)">
|
|
239
|
+
tags.push(`
|
|
240
|
+
<link rel="icon" href="${metadata.favicon}" media="(prefers-color-scheme: light)">
|
|
241
|
+
<link rel="icon" href="${metadata.faviconDark}" media="(prefers-color-scheme: dark)">
|
|
242
242
|
`);
|
|
243
243
|
}
|
|
244
244
|
else if (metadata.favicon) {
|
package/dist/utils/core-go.js
CHANGED
|
@@ -16,8 +16,8 @@ class CoreGoManager {
|
|
|
16
16
|
versionFilePath;
|
|
17
17
|
constructor(currentVattsVersion, customBinDir) {
|
|
18
18
|
this.currentVattsVersion = currentVattsVersion;
|
|
19
|
-
this.registryUrl = "https://
|
|
20
|
-
this.s3BaseUrl = "https://
|
|
19
|
+
this.registryUrl = "https://s3-server.br-1.mfraz.ovh/vatts-go/registry.json";
|
|
20
|
+
this.s3BaseUrl = "https://s3-server.br-1.mfraz.ovh/vatts-go/";
|
|
21
21
|
// Pasta onde o binário será salvo (padrão: mesma pasta desse script, mas pode ser node_modules)
|
|
22
22
|
this.binDir = customBinDir || node_path_1.default.join(__dirname, '..', '..', 'core-go-bin');
|
|
23
23
|
this.versionFilePath = node_path_1.default.join(this.binDir, "core-go.version.json");
|
package/dist/utils/utils.js
CHANGED
|
@@ -59,10 +59,10 @@ async function showTitle() {
|
|
|
59
59
|
message = `${console_1.Colors.FgGreen} You are on the latest version${console_1.Colors.FgMagenta}`;
|
|
60
60
|
}
|
|
61
61
|
// JS STICK LETTERS
|
|
62
|
-
console.log(`${console_1.Colors.Bright + console_1.Colors.FgCyan}
|
|
63
|
-
${console_1.Colors.Bright + console_1.Colors.FgCyan} ___ ___ __ ${console_1.Colors.FgWhite} __
|
|
64
|
-
${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${currentVersion}) - mfraz
|
|
65
|
-
${console_1.Colors.Bright + console_1.Colors.FgCyan} \\/ /~~\\ | | .__/ .${console_1.Colors.FgWhite} \\__/ .__/ ${message}
|
|
66
|
-
|
|
62
|
+
console.log(`${console_1.Colors.Bright + console_1.Colors.FgCyan}
|
|
63
|
+
${console_1.Colors.Bright + console_1.Colors.FgCyan} ___ ___ __ ${console_1.Colors.FgWhite} __
|
|
64
|
+
${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${currentVersion}) - mfraz
|
|
65
|
+
${console_1.Colors.Bright + console_1.Colors.FgCyan} \\/ /~~\\ | | .__/ .${console_1.Colors.FgWhite} \\__/ .__/ ${message}
|
|
66
|
+
|
|
67
67
|
`);
|
|
68
68
|
}
|