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.
- package/LICENSE +12 -12
- package/README.md +63 -63
- package/dist/api/native-server.js +25 -4
- package/dist/builder.js +39 -39
- package/dist/core-go/core-linux-arm64.node +0 -0
- package/dist/core-go/core-linux-x64.node +0 -0
- package/dist/core-go/core-win-x64.node +0 -0
- package/dist/global/global.d.ts +176 -176
- package/dist/helpers.js +17 -7
- package/dist/hotReload.js +205 -205
- package/dist/loaders.js +15 -15
- package/dist/react/BuildingPage.js +201 -201
- package/dist/react/DefaultNotFound.js +15 -15
- package/dist/react/DevIndicator.js +101 -101
- package/dist/react/entry.client.js +7 -7
- package/dist/react/renderer-react.js +172 -33
- package/dist/react/server-error.d.ts +8 -0
- package/dist/react/server-error.js +64 -0
- package/dist/vue/App.vue +191 -191
- package/dist/vue/BuildingPage.vue +280 -280
- package/dist/vue/DefaultNotFound.vue +328 -328
- package/dist/vue/DevIndicator.vue +225 -225
- package/dist/vue/ErrorModal.vue +316 -316
- package/dist/vue/Link.vue +38 -38
- package/dist/vue/entry.client.js +7 -7
- package/dist/vue/image/Image.vue +106 -106
- package/dist/vue/renderer.vue.js +190 -46
- package/dist/vue/server-error.vue +119 -0
- package/package.json +1 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="vatts-ssr-error">
|
|
3
|
+
<div class="container">
|
|
4
|
+
<h1>{{ titleComputed }}</h1>
|
|
5
|
+
|
|
6
|
+
<p v-if="requestUrl" class="muted">
|
|
7
|
+
URL:
|
|
8
|
+
<code>{{ requestUrl }}</code>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p v-if="hint" class="muted">{{ hint }}</p>
|
|
12
|
+
|
|
13
|
+
<div class="panel">
|
|
14
|
+
<div class="label">Mensagem</div>
|
|
15
|
+
<pre class="pre">{{ message }}</pre>
|
|
16
|
+
|
|
17
|
+
<template v-if="stack">
|
|
18
|
+
<div class="label" style="margin-top: 16px">Stack</div>
|
|
19
|
+
<pre class="pre stack">{{ stack }}</pre>
|
|
20
|
+
</template>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<p class="footer">
|
|
24
|
+
Dica: em desenvolvimento isso aparece para debugar. Em produção o SSR falha de forma silenciosa e o cliente assume
|
|
25
|
+
a renderização.
|
|
26
|
+
</p>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script setup lang="ts">
|
|
32
|
+
import { computed } from 'vue';
|
|
33
|
+
|
|
34
|
+
const props = defineProps<{
|
|
35
|
+
title?: string;
|
|
36
|
+
error?: unknown;
|
|
37
|
+
hint?: string;
|
|
38
|
+
requestUrl?: string;
|
|
39
|
+
}>();
|
|
40
|
+
|
|
41
|
+
function formatUnknownError(error: unknown): { message: string; stack?: string } {
|
|
42
|
+
if (!error) return { message: 'Erro desconhecido no SSR.' };
|
|
43
|
+
|
|
44
|
+
if (error instanceof Error) {
|
|
45
|
+
return { message: error.message || String(error), stack: error.stack };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (typeof error === 'string') {
|
|
49
|
+
return { message: error };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
return { message: JSON.stringify(error, null, 2) };
|
|
54
|
+
} catch {
|
|
55
|
+
return { message: String(error) };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const formatted = computed(() => formatUnknownError(props.error));
|
|
60
|
+
const titleComputed = computed(() => props.title || 'Erro no Server-Side Renderer');
|
|
61
|
+
const message = computed(() => formatted.value.message);
|
|
62
|
+
const stack = computed(() => formatted.value.stack);
|
|
63
|
+
const hint = computed(() => props.hint);
|
|
64
|
+
const requestUrl = computed(() => props.requestUrl);
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<style scoped>
|
|
68
|
+
.vatts-ssr-error {
|
|
69
|
+
font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, Apple Color Emoji,
|
|
70
|
+
Segoe UI Emoji;
|
|
71
|
+
padding: 24px;
|
|
72
|
+
color: #0f172a;
|
|
73
|
+
background: #ffffff;
|
|
74
|
+
}
|
|
75
|
+
.container {
|
|
76
|
+
max-width: 980px;
|
|
77
|
+
margin: 0 auto;
|
|
78
|
+
}
|
|
79
|
+
h1 {
|
|
80
|
+
font-size: 20px;
|
|
81
|
+
margin: 0;
|
|
82
|
+
}
|
|
83
|
+
.muted {
|
|
84
|
+
margin-top: 8px;
|
|
85
|
+
margin-bottom: 0;
|
|
86
|
+
color: #334155;
|
|
87
|
+
}
|
|
88
|
+
code {
|
|
89
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
90
|
+
}
|
|
91
|
+
.panel {
|
|
92
|
+
margin-top: 16px;
|
|
93
|
+
padding: 16px;
|
|
94
|
+
border: 1px solid #e2e8f0;
|
|
95
|
+
border-radius: 10px;
|
|
96
|
+
background: #f8fafc;
|
|
97
|
+
}
|
|
98
|
+
.label {
|
|
99
|
+
font-size: 12px;
|
|
100
|
+
color: #64748b;
|
|
101
|
+
margin-bottom: 8px;
|
|
102
|
+
}
|
|
103
|
+
.pre {
|
|
104
|
+
white-space: pre-wrap;
|
|
105
|
+
overflow-wrap: anywhere;
|
|
106
|
+
margin: 0;
|
|
107
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
108
|
+
font-size: 13px;
|
|
109
|
+
}
|
|
110
|
+
.pre.stack {
|
|
111
|
+
font-size: 12px;
|
|
112
|
+
color: #334155;
|
|
113
|
+
}
|
|
114
|
+
.footer {
|
|
115
|
+
margin-top: 16px;
|
|
116
|
+
color: #475569;
|
|
117
|
+
font-size: 13px;
|
|
118
|
+
}
|
|
119
|
+
</style>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vatts",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3-canary.1",
|
|
4
4
|
"description": "Vatts.js is a high-level framework for building web applications with ease and speed. It provides a robust set of tools and features to streamline development and enhance productivity.",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"author": "mfraz",
|