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
package/LICENSE
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
Copyright 2026 mfraz
|
|
2
|
-
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License.
|
|
5
|
-
You may obtain a copy of the License at
|
|
6
|
-
|
|
7
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
|
|
9
|
-
Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
See the License for the specific language governing permissions and
|
|
1
|
+
Copyright 2026 mfraz
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
13
|
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mfrazlab/vatts.js/docs/public/logo.png">
|
|
4
|
-
<img alt="Vatts.js logo" src="https://raw.githubusercontent.com/mfrazlab/vatts.js/docs/public/logo.png" width="128">
|
|
5
|
-
</picture>
|
|
6
|
-
<h1>Vatts.js</h1>
|
|
7
|
-
|
|
8
|
-
[](https://www.npmjs.com/package/vatts)
|
|
9
|
-
[](./LICENSE)
|
|
10
|
-
[](https://github.com/mfrazlab/vatts.js)
|
|
11
|
-
|
|
12
|
-
[](#)
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
## Getting Started
|
|
21
|
-
|
|
22
|
-
**Vatts.js** is a modern, full-featured web framework for **Node.js** with first-class support for **React and Vue**.
|
|
23
|
-
|
|
24
|
-
It is the first framework to offer native HTTP/3 support out of the box, powered by a Go-based HTTP server with built-in SSL termination. Applications run directly on the latest web transport protocol, without proxies or external layers.
|
|
25
|
-
|
|
26
|
-
Vatts.js is a **multi-framework platform**, allowing you to build applications using **either React or Vue per project** — not both at the same time.
|
|
27
|
-
This keeps the ecosystem clean, predictable, and optimized for performance and tooling.
|
|
28
|
-
|
|
29
|
-
Vatts removes unnecessary configuration and complex abstractions, allowing you to focus on what truly matters: **building fast, secure, and scalable applications**.
|
|
30
|
-
|
|
31
|
-
### Why choose Vatts.js?
|
|
32
|
-
- **Native HTTP** — modern, secure, and high-performance networking with **HTTP/3 support**
|
|
33
|
-
- Extremely fast — architecture optimized for low overhead
|
|
34
|
-
- Intuitive API — easy to learn and pleasant to use
|
|
35
|
-
- Productivity from the first minute — zero unnecessary boilerplate
|
|
36
|
-
- Multi-framework — choose **React or Vue per project**
|
|
37
|
-
- Full integration between backend and frontend
|
|
38
|
-
- Built for modern projects — TypeScript-friendly, modular, and extensible
|
|
39
|
-
|
|
40
|
-
___
|
|
41
|
-
|
|
42
|
-
## Documentation
|
|
43
|
-
|
|
44
|
-
Visit [https://vatts.mfraz.ovh](https://vatts.mfraz.ovh) to view the full documentation.
|
|
45
|
-
|
|
46
|
-
___
|
|
47
|
-
|
|
48
|
-
## Community
|
|
49
|
-
|
|
50
|
-
The Vatts.js community can be found on [GitHub Discussions](https://github.com/mfraz/vatts.js), where you can ask questions, share ideas, and showcase your projects with others.
|
|
51
|
-
|
|
52
|
-
___
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
## Security
|
|
56
|
-
|
|
57
|
-
Vatts.js is engineered with a security-first architecture centered around an internal proxy layer that mediates all application traffic. This proxy is designed to support modern transports such as native HTTP/3 when SSL is enabled, while consistently enforcing built-in security guarantees at the protocol and application boundaries. Even in local or non-TLS environments, the proxy remains active, preserving request isolation, and secure handling by default.
|
|
58
|
-
|
|
59
|
-
If you believe you have found a security vulnerability in Vatts.js, we encourage you to **responsibly disclose it and NOT open a public issue**.
|
|
60
|
-
|
|
61
|
-
To participate in our vulnerability disclosure program, please email [helpers@mfraz.ovh](mailto:help@mfraz.ovh). We will add you to the program and provide further instructions for submitting your report.
|
|
62
|
-
|
|
63
|
-
___
|
|
1
|
+
<div align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mfrazlab/vatts.js/docs/public/logo.png">
|
|
4
|
+
<img alt="Vatts.js logo" src="https://raw.githubusercontent.com/mfrazlab/vatts.js/docs/public/logo.png" width="128">
|
|
5
|
+
</picture>
|
|
6
|
+
<h1>Vatts.js</h1>
|
|
7
|
+
|
|
8
|
+
[](https://www.npmjs.com/package/vatts)
|
|
9
|
+
[](./LICENSE)
|
|
10
|
+
[](https://github.com/mfrazlab/vatts.js)
|
|
11
|
+
|
|
12
|
+
[](#)
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Getting Started
|
|
21
|
+
|
|
22
|
+
**Vatts.js** is a modern, full-featured web framework for **Node.js** with first-class support for **React and Vue**.
|
|
23
|
+
|
|
24
|
+
It is the first framework to offer native HTTP/3 support out of the box, powered by a Go-based HTTP server with built-in SSL termination. Applications run directly on the latest web transport protocol, without proxies or external layers.
|
|
25
|
+
|
|
26
|
+
Vatts.js is a **multi-framework platform**, allowing you to build applications using **either React or Vue per project** — not both at the same time.
|
|
27
|
+
This keeps the ecosystem clean, predictable, and optimized for performance and tooling.
|
|
28
|
+
|
|
29
|
+
Vatts removes unnecessary configuration and complex abstractions, allowing you to focus on what truly matters: **building fast, secure, and scalable applications**.
|
|
30
|
+
|
|
31
|
+
### Why choose Vatts.js?
|
|
32
|
+
- **Native HTTP** — modern, secure, and high-performance networking with **HTTP/3 support**
|
|
33
|
+
- Extremely fast — architecture optimized for low overhead
|
|
34
|
+
- Intuitive API — easy to learn and pleasant to use
|
|
35
|
+
- Productivity from the first minute — zero unnecessary boilerplate
|
|
36
|
+
- Multi-framework — choose **React or Vue per project**
|
|
37
|
+
- Full integration between backend and frontend
|
|
38
|
+
- Built for modern projects — TypeScript-friendly, modular, and extensible
|
|
39
|
+
|
|
40
|
+
___
|
|
41
|
+
|
|
42
|
+
## Documentation
|
|
43
|
+
|
|
44
|
+
Visit [https://vatts.mfraz.ovh](https://vatts.mfraz.ovh) to view the full documentation.
|
|
45
|
+
|
|
46
|
+
___
|
|
47
|
+
|
|
48
|
+
## Community
|
|
49
|
+
|
|
50
|
+
The Vatts.js community can be found on [GitHub Discussions](https://github.com/mfraz/vatts.js), where you can ask questions, share ideas, and showcase your projects with others.
|
|
51
|
+
|
|
52
|
+
___
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## Security
|
|
56
|
+
|
|
57
|
+
Vatts.js is engineered with a security-first architecture centered around an internal proxy layer that mediates all application traffic. This proxy is designed to support modern transports such as native HTTP/3 when SSL is enabled, while consistently enforcing built-in security guarantees at the protocol and application boundaries. Even in local or non-TLS environments, the proxy remains active, preserving request isolation, and secure handling by default.
|
|
58
|
+
|
|
59
|
+
If you believe you have found a security vulnerability in Vatts.js, we encourage you to **responsibly disclose it and NOT open a public issue**.
|
|
60
|
+
|
|
61
|
+
To participate in our vulnerability disclosure program, please email [helpers@mfraz.ovh](mailto:help@mfraz.ovh). We will add you to the program and provide further instructions for submitting your report.
|
|
62
|
+
|
|
63
|
+
___
|
|
@@ -24,7 +24,7 @@ class NativeServer {
|
|
|
24
24
|
const platform = os_1.default.platform();
|
|
25
25
|
const arch = os_1.default.arch();
|
|
26
26
|
let osName = '';
|
|
27
|
-
let ext = '.node';
|
|
27
|
+
let ext = '.node'; // Mantido .node conforme solicitado
|
|
28
28
|
switch (platform) {
|
|
29
29
|
case 'win32':
|
|
30
30
|
osName = 'win';
|
|
@@ -55,15 +55,26 @@ class NativeServer {
|
|
|
55
55
|
static loadLibrary(customPath) {
|
|
56
56
|
if (this.lib)
|
|
57
57
|
return;
|
|
58
|
-
const
|
|
58
|
+
// Alterado de const para let para permitir reatribuição se cair no fallback
|
|
59
|
+
let libPath = customPath || this.getLibPath();
|
|
59
60
|
if (!fs_1.default.existsSync(libPath)) {
|
|
61
|
+
// Tenta resolver relativo ao CWD se não achar no __dirname
|
|
60
62
|
const altPath = path_1.default.resolve(process.cwd(), libPath);
|
|
61
|
-
|
|
63
|
+
// Ou tenta buscar direto pelo nome do arquivo no CWD caso o path relativo esteja errado
|
|
64
|
+
const altPathSimple = path_1.default.resolve(process.cwd(), path_1.default.basename(libPath));
|
|
65
|
+
if (fs_1.default.existsSync(altPath)) {
|
|
66
|
+
libPath = altPath; // <--- AQUI ESTAVA O ERRO: Atualiza libPath para o caminho que existe
|
|
67
|
+
}
|
|
68
|
+
else if (fs_1.default.existsSync(altPathSimple)) {
|
|
69
|
+
libPath = altPathSimple; // <--- Fallback extra de segurança
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
62
72
|
console.warn(`Native Server Library not found at: ${libPath}`);
|
|
63
73
|
return;
|
|
64
74
|
}
|
|
65
75
|
}
|
|
66
76
|
try {
|
|
77
|
+
// Agora o koffi carrega o caminho correto (libPath atualizado)
|
|
67
78
|
this.lib = koffi_1.default.load(libPath);
|
|
68
79
|
// func StartServer(..., onData, onClose)
|
|
69
80
|
this.startFunc = this.lib.func('StartServer', 'str', [
|
|
@@ -79,7 +90,7 @@ class NativeServer {
|
|
|
79
90
|
this.closeConnFunc = this.lib.func('CloseConn', 'void', ['int']);
|
|
80
91
|
}
|
|
81
92
|
catch (error) {
|
|
82
|
-
throw new Error(`Failed to load native library: ${error}`);
|
|
93
|
+
throw new Error(`Failed to load native library at ${libPath}: ${error}`);
|
|
83
94
|
}
|
|
84
95
|
}
|
|
85
96
|
static start(options) {
|
|
@@ -87,6 +98,16 @@ class NativeServer {
|
|
|
87
98
|
this.loadLibrary(customLibPath);
|
|
88
99
|
if (!this.startFunc)
|
|
89
100
|
return;
|
|
101
|
+
// Validação de certificados SSL ANTES de iniciar
|
|
102
|
+
const useSSL = certPath && keyPath;
|
|
103
|
+
if (useSSL) {
|
|
104
|
+
if (!fs_1.default.existsSync(certPath)) {
|
|
105
|
+
throw new Error(`SSL Certificate file not found at: ${certPath}`);
|
|
106
|
+
}
|
|
107
|
+
if (!fs_1.default.existsSync(keyPath)) {
|
|
108
|
+
throw new Error(`SSL Key file not found at: ${keyPath}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
90
111
|
// Callback de DADOS: Agora recebe pointer e length
|
|
91
112
|
const onDataPtr = koffi_1.default.register((connId, ptr, len) => {
|
|
92
113
|
try {
|
package/dist/builder.js
CHANGED
|
@@ -117,22 +117,22 @@ const virtualEntryPlugin = (options) => {
|
|
|
117
117
|
// [FIX] Removido 'dist' extra do caminho.
|
|
118
118
|
const entryClientFilename = 'entry.client.js';
|
|
119
119
|
const entryClientPath = path.join(__dirname, framework, entryClientFilename).replace(/\\/g, '/');
|
|
120
|
-
return `// Arquivo gerado virtualmente pelo vatts
|
|
121
|
-
${imports}
|
|
122
|
-
${layoutImport}
|
|
123
|
-
${notFoundImport}
|
|
124
|
-
import DefaultNotFound from '${defaultNotFoundPath}';
|
|
125
|
-
|
|
126
|
-
window.__VATTS_COMPONENTS__ = {
|
|
127
|
-
${componentRegistration}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
${layoutRegistration}
|
|
131
|
-
${notFoundRegistration}
|
|
132
|
-
|
|
133
|
-
window.__VATTS_DEFAULT_NOT_FOUND__ = DefaultNotFound;
|
|
134
|
-
|
|
135
|
-
import '${entryClientPath}';
|
|
120
|
+
return `// Arquivo gerado virtualmente pelo vatts
|
|
121
|
+
${imports}
|
|
122
|
+
${layoutImport}
|
|
123
|
+
${notFoundImport}
|
|
124
|
+
import DefaultNotFound from '${defaultNotFoundPath}';
|
|
125
|
+
|
|
126
|
+
window.__VATTS_COMPONENTS__ = {
|
|
127
|
+
${componentRegistration}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
${layoutRegistration}
|
|
131
|
+
${notFoundRegistration}
|
|
132
|
+
|
|
133
|
+
window.__VATTS_DEFAULT_NOT_FOUND__ = DefaultNotFound;
|
|
134
|
+
|
|
135
|
+
import '${entryClientPath}';
|
|
136
136
|
`;
|
|
137
137
|
}
|
|
138
138
|
return null;
|
|
@@ -258,23 +258,23 @@ const customPostCssPlugin = (isProduction, isWatch = false) => {
|
|
|
258
258
|
const safeId = uniqueName.replace(/[^a-zA-Z0-9-_]/g, '_');
|
|
259
259
|
const referenceId = this.emitFile({ type: 'asset', name: uniqueName, source: processedCss });
|
|
260
260
|
return {
|
|
261
|
-
code: `
|
|
262
|
-
const cssUrl = String(import.meta.ROLLUP_FILE_URL_${referenceId});
|
|
263
|
-
if (typeof document !== 'undefined') {
|
|
264
|
-
const linkId = 'vatts-css-' + "${safeId}";
|
|
265
|
-
let link = document.getElementById(linkId);
|
|
266
|
-
|
|
267
|
-
if (!link) {
|
|
268
|
-
link = document.createElement('link');
|
|
269
|
-
link.id = linkId;
|
|
270
|
-
link.rel = 'stylesheet';
|
|
271
|
-
document.head.appendChild(link);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
const timestamp = ${isWatch ? 'Date.now()' : 'null'};
|
|
275
|
-
link.href = timestamp ? (cssUrl + '?t=' + timestamp) : cssUrl;
|
|
276
|
-
}
|
|
277
|
-
export default cssUrl;
|
|
261
|
+
code: `
|
|
262
|
+
const cssUrl = String(import.meta.ROLLUP_FILE_URL_${referenceId});
|
|
263
|
+
if (typeof document !== 'undefined') {
|
|
264
|
+
const linkId = 'vatts-css-' + "${safeId}";
|
|
265
|
+
let link = document.getElementById(linkId);
|
|
266
|
+
|
|
267
|
+
if (!link) {
|
|
268
|
+
link = document.createElement('link');
|
|
269
|
+
link.id = linkId;
|
|
270
|
+
link.rel = 'stylesheet';
|
|
271
|
+
document.head.appendChild(link);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const timestamp = ${isWatch ? 'Date.now()' : 'null'};
|
|
275
|
+
link.href = timestamp ? (cssUrl + '?t=' + timestamp) : cssUrl;
|
|
276
|
+
}
|
|
277
|
+
export default cssUrl;
|
|
278
278
|
`,
|
|
279
279
|
map: { mappings: '' }
|
|
280
280
|
};
|
|
@@ -317,17 +317,17 @@ const smartAssetPlugin = (isProduction) => {
|
|
|
317
317
|
if (size < INLINE_LIMIT) {
|
|
318
318
|
const content = buffer.toString('utf8');
|
|
319
319
|
const base64 = buffer.toString('base64');
|
|
320
|
-
return `
|
|
321
|
-
export default "data:image/svg+xml;base64,${base64}";
|
|
322
|
-
export const svgContent = ${JSON.stringify(content)};
|
|
320
|
+
return `
|
|
321
|
+
export default "data:image/svg+xml;base64,${base64}";
|
|
322
|
+
export const svgContent = ${JSON.stringify(content)};
|
|
323
323
|
`;
|
|
324
324
|
}
|
|
325
325
|
else {
|
|
326
326
|
const referenceId = this.emitFile({ type: 'asset', name: uniqueName, source: buffer });
|
|
327
327
|
const content = buffer.toString('utf8');
|
|
328
|
-
return `
|
|
329
|
-
export default String(import.meta.ROLLUP_FILE_URL_${referenceId});
|
|
330
|
-
export const svgContent = ${JSON.stringify(content)};
|
|
328
|
+
return `
|
|
329
|
+
export default String(import.meta.ROLLUP_FILE_URL_${referenceId});
|
|
330
|
+
export const svgContent = ${JSON.stringify(content)};
|
|
331
331
|
`;
|
|
332
332
|
}
|
|
333
333
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|