vatts 1.2.0 → 1.2.2
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 +1 -1
- package/README.md +11 -7
- package/dist/api/console.js +1 -1
- package/dist/api/framework.js +16 -0
- package/dist/bin/vatts.js +2 -1
- package/dist/builder.d.ts +0 -12
- package/dist/builder.js +79 -265
- package/dist/client/clientRouter.js +1 -1
- package/dist/client/rpc.js +1 -1
- package/dist/env/env.js +16 -0
- package/dist/global/global.d.ts +1 -1
- package/dist/helpers.js +1 -1
- package/dist/hotReload.js +1 -1
- package/dist/index.js +1 -1
- package/dist/loaders.js +1 -1
- package/dist/react/BuildingPage.js +16 -0
- package/dist/react/DefaultNotFound.js +1 -1
- package/dist/react/DevIndicator.js +16 -0
- package/dist/react/ErrorModal.js +1 -1
- package/dist/react/Link.js +1 -1
- package/dist/react/client.js +1 -1
- package/dist/react/entry.client.js +1 -1
- package/dist/react/image/Image.js +16 -0
- package/dist/react/react.build.d.ts +24 -0
- package/dist/react/react.build.js +95 -0
- package/dist/react/renderer-react.js +1 -2
- package/dist/router.js +1 -1
- package/dist/rpc/server.js +1 -1
- package/dist/rpc/types.js +1 -1
- package/dist/tsconfigPaths.js +1 -1
- package/dist/vue/App.vue +56 -44
- package/dist/vue/BuildingPage.vue +16 -0
- package/dist/vue/DefaultNotFound.vue +23 -11
- package/dist/vue/DevIndicator.vue +16 -0
- package/dist/vue/ErrorModal.vue +16 -0
- package/dist/vue/Link.vue +16 -0
- package/dist/vue/client.js +1 -1
- package/dist/vue/entry.client.js +13 -2
- package/dist/vue/image/Image.vue +1 -1
- package/dist/vue/vue.build.d.ts +24 -0
- package/dist/vue/vue.build.js +160 -0
- package/package.json +2 -2
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -14,16 +14,20 @@ ___
|
|
|
14
14
|
|
|
15
15
|
## Getting Started
|
|
16
16
|
|
|
17
|
-
**Vatts.js** is a modern, full-featured web framework for **Node.js
|
|
17
|
+
**Vatts.js** is a modern, full-featured web framework for **Node.js** with first-class support for **React and Vue**.
|
|
18
18
|
|
|
19
|
-
It
|
|
19
|
+
It is a **multi-framework platform**, allowing you to build applications using **either React or Vue per project** — not both at the same time.
|
|
20
|
+
This keeps the ecosystem clean, predictable, and optimized for performance and tooling.
|
|
21
|
+
|
|
22
|
+
Vatts removes unnecessary configuration and complex abstractions, allowing you to focus on what truly matters: **building fast, secure, and scalable applications**.
|
|
20
23
|
|
|
21
24
|
### Why choose Vatts.js?
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
25
|
+
- Extremely fast — architecture optimized for low overhead
|
|
26
|
+
- Intuitive API — easy to learn and pleasant to use
|
|
27
|
+
- Productivity from the first minute — zero unnecessary boilerplate
|
|
28
|
+
- Multi-framework — choose **React or Vue per project**
|
|
29
|
+
- Full integration between backend and frontend
|
|
30
|
+
- Built for modern projects — TypeScript-friendly, modular, and extensible
|
|
27
31
|
|
|
28
32
|
___
|
|
29
33
|
|
package/dist/api/console.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
3
|
* This file is part of the Vatts.js Project.
|
|
4
|
-
* Copyright (c) 2026
|
|
4
|
+
* Copyright (c) 2026 mfraz
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
package/dist/api/framework.js
CHANGED
|
@@ -5,6 +5,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.cachedFramework = void 0;
|
|
7
7
|
exports.default = detectFramework;
|
|
8
|
+
/*
|
|
9
|
+
* This file is part of the Vatts.js Project.
|
|
10
|
+
* Copyright (c) 2026 mfraz
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
8
24
|
const path_1 = __importDefault(require("path"));
|
|
9
25
|
const fs_1 = __importDefault(require("fs"));
|
|
10
26
|
// Variável para armazenar o resultado em memória
|
package/dist/bin/vatts.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
/*
|
|
4
4
|
* This file is part of the Vatts.js Project.
|
|
5
|
-
* Copyright (c) 2026
|
|
5
|
+
* Copyright (c) 2026 mfraz
|
|
6
6
|
*
|
|
7
7
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
8
|
* you may not use this file except in compliance with the License.
|
|
@@ -100,6 +100,7 @@ program
|
|
|
100
100
|
.option('--ssl', 'Activates HTTPS/SSL mode')
|
|
101
101
|
.option('--http-redirect-port <number>', 'Port for HTTP->HTTPS redirection', '80')
|
|
102
102
|
.action((options) => {
|
|
103
|
+
process.env.NODE_ENV = 'production';
|
|
103
104
|
initializeApp(options, false);
|
|
104
105
|
});
|
|
105
106
|
program
|
package/dist/builder.d.ts
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Builds a single entry point into a single output file (IIFE Format)
|
|
3
|
-
*/
|
|
4
1
|
export function build(entryPoint: any, outfile: any, isProduction?: boolean): Promise<void>;
|
|
5
|
-
/**
|
|
6
|
-
* Watches an entry point (Single File)
|
|
7
|
-
*/
|
|
8
2
|
export function watch(entryPoint: any, outfile: any, hotReloadManager?: null): Promise<import("rollup").RollupWatcher>;
|
|
9
|
-
/**
|
|
10
|
-
* Builds with code splitting into multiple chunks (ESM Format) - MODO PRODUÇÃO
|
|
11
|
-
*/
|
|
12
3
|
export function buildWithChunks(entryPoint: any, outdir: any, isProduction?: boolean): Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* Watches with code splitting enabled
|
|
15
|
-
*/
|
|
16
4
|
export function watchWithChunks(entryPoint: any, outdir: any, hotReloadManager?: null): Promise<import("rollup").RollupWatcher>;
|
package/dist/builder.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
3
|
* This file is part of the Vatts.js Project.
|
|
4
|
-
* Copyright (c) 2026
|
|
4
|
+
* Copyright (c) 2026 mfraz
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
|
@@ -28,29 +28,11 @@ const path = require('path');
|
|
|
28
28
|
const Console = require("./api/console").default;
|
|
29
29
|
const fs = require('fs');
|
|
30
30
|
const { readdir, stat, rm } = require("node:fs/promises");
|
|
31
|
-
// Plugins Oficiais do Rollup
|
|
32
|
-
const nodeResolve = require('@rollup/plugin-node-resolve').default;
|
|
33
|
-
const commonjs = require('@rollup/plugin-commonjs').default;
|
|
34
|
-
const replace = require('@rollup/plugin-replace').default;
|
|
35
|
-
const esbuild = require('rollup-plugin-esbuild').default;
|
|
36
|
-
const jsonPlugin = require("@rollup/plugin-json").default;
|
|
37
31
|
const { loadTsConfigPaths, resolveTsConfigAlias } = require('./tsconfigPaths');
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (fs.existsSync(pkgPath)) {
|
|
43
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
44
|
-
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
45
|
-
if (deps.react || deps['react-dom'])
|
|
46
|
-
return 'react';
|
|
47
|
-
if (deps.vue || deps['nuxt'])
|
|
48
|
-
return 'vue';
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
catch (e) { }
|
|
52
|
-
return 'react';
|
|
53
|
-
}
|
|
32
|
+
// Import Framework specific builders
|
|
33
|
+
const { createReactConfig } = require('./react/react.build');
|
|
34
|
+
const { createVueConfig } = require('./vue/vue.build');
|
|
35
|
+
// --- Common Plugins Definitions ---
|
|
54
36
|
const tsconfigPathsPlugin = (projectDir = process.cwd()) => {
|
|
55
37
|
const info = loadTsConfigPaths(projectDir);
|
|
56
38
|
return {
|
|
@@ -66,15 +48,6 @@ const tsconfigPathsPlugin = (projectDir = process.cwd()) => {
|
|
|
66
48
|
}
|
|
67
49
|
};
|
|
68
50
|
};
|
|
69
|
-
const nodeBuiltIns = [
|
|
70
|
-
'assert', 'buffer', 'child_process', 'cluster', 'crypto', 'dgram', 'dns',
|
|
71
|
-
'domain', 'events', 'fs', 'http', 'https', 'net', 'os', 'path', 'punycode',
|
|
72
|
-
'querystring', 'readline', 'stream', 'string_decoder', 'tls', 'tty', 'url',
|
|
73
|
-
'util', 'v8', 'vm', 'zlib', 'module', 'worker_threads', 'perf_hooks'
|
|
74
|
-
];
|
|
75
|
-
/**
|
|
76
|
-
* Plugin para Markdown
|
|
77
|
-
*/
|
|
78
51
|
const markdownPlugin = () => {
|
|
79
52
|
return {
|
|
80
53
|
name: 'markdown-loader',
|
|
@@ -88,32 +61,6 @@ const markdownPlugin = () => {
|
|
|
88
61
|
}
|
|
89
62
|
};
|
|
90
63
|
};
|
|
91
|
-
/**
|
|
92
|
-
* [CORREÇÃO] Plugin que injeta 'export default {}' se estiver faltando.
|
|
93
|
-
* Resolve o problema de rotas que exportam apenas 'config' mas não o componente.
|
|
94
|
-
*/
|
|
95
|
-
const vueScriptFixPlugin = () => {
|
|
96
|
-
return {
|
|
97
|
-
name: 'vatts-vue-script-fix',
|
|
98
|
-
transform(code, id) {
|
|
99
|
-
// Intercepta arquivos virtuais de script TS do Vue
|
|
100
|
-
if (id.includes('?vue&type=script') && id.includes('lang.ts')) {
|
|
101
|
-
// Se o código NÃO tem export default, a gente cria um objeto vazio
|
|
102
|
-
// Isso satisfaz o Rollup/Vue Plugin que espera um componente
|
|
103
|
-
if (!code.includes('export default')) {
|
|
104
|
-
return {
|
|
105
|
-
code: code + '\nexport default {};',
|
|
106
|
-
map: null // Sourcemap null pra simplificar
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Plugin para CSS/PostCSS Manual (Otimizado para RAM)
|
|
116
|
-
*/
|
|
117
64
|
const customPostCssPlugin = (isProduction) => {
|
|
118
65
|
let cachedProcessor = null;
|
|
119
66
|
let configLoaded = false;
|
|
@@ -148,8 +95,7 @@ const customPostCssPlugin = (isProduction) => {
|
|
|
148
95
|
plugins.push(...postcssConfig.plugins.map(p => {
|
|
149
96
|
if (typeof p === 'string') {
|
|
150
97
|
try {
|
|
151
|
-
|
|
152
|
-
return require(__rewriteRelativeImportExtension(resolved));
|
|
98
|
+
return require(__rewriteRelativeImportExtension(require.resolve(p, { paths: [projectDir] })));
|
|
153
99
|
}
|
|
154
100
|
catch {
|
|
155
101
|
return require(__rewriteRelativeImportExtension(p));
|
|
@@ -162,8 +108,7 @@ const customPostCssPlugin = (isProduction) => {
|
|
|
162
108
|
for (const [name, options] of Object.entries(postcssConfig.plugins)) {
|
|
163
109
|
try {
|
|
164
110
|
const resolvedPath = require.resolve(name, { paths: [projectDir] });
|
|
165
|
-
|
|
166
|
-
plugins.push(pluginModule(options || {}));
|
|
111
|
+
plugins.push(require(__rewriteRelativeImportExtension(resolvedPath))(options || {}));
|
|
167
112
|
}
|
|
168
113
|
catch (e) {
|
|
169
114
|
Console.warn(`Unable to load plugin ${name}:`, e.message);
|
|
@@ -190,11 +135,7 @@ const customPostCssPlugin = (isProduction) => {
|
|
|
190
135
|
let processedCss = code;
|
|
191
136
|
if (processor) {
|
|
192
137
|
try {
|
|
193
|
-
const result = await processor.process(code, {
|
|
194
|
-
from: id,
|
|
195
|
-
to: id,
|
|
196
|
-
map: false
|
|
197
|
-
});
|
|
138
|
+
const result = await processor.process(code, { from: id, to: id, map: false });
|
|
198
139
|
processedCss = result.css;
|
|
199
140
|
}
|
|
200
141
|
catch (e) {
|
|
@@ -202,11 +143,7 @@ const customPostCssPlugin = (isProduction) => {
|
|
|
202
143
|
}
|
|
203
144
|
}
|
|
204
145
|
const cleanName = path.basename(id).split('?')[0];
|
|
205
|
-
const referenceId = this.emitFile({
|
|
206
|
-
type: 'asset',
|
|
207
|
-
name: cleanName,
|
|
208
|
-
source: processedCss
|
|
209
|
-
});
|
|
146
|
+
const referenceId = this.emitFile({ type: 'asset', name: cleanName, source: processedCss });
|
|
210
147
|
return {
|
|
211
148
|
code: `
|
|
212
149
|
const cssUrl = String(import.meta.ROLLUP_FILE_URL_${referenceId});
|
|
@@ -223,9 +160,6 @@ const customPostCssPlugin = (isProduction) => {
|
|
|
223
160
|
}
|
|
224
161
|
};
|
|
225
162
|
};
|
|
226
|
-
/**
|
|
227
|
-
* Plugin Inteligente para Assets (Otimizado para RAM)
|
|
228
|
-
*/
|
|
229
163
|
const smartAssetPlugin = (isProduction) => {
|
|
230
164
|
const INLINE_LIMIT = 4096;
|
|
231
165
|
return {
|
|
@@ -259,20 +193,14 @@ const smartAssetPlugin = (isProduction) => {
|
|
|
259
193
|
if (size < INLINE_LIMIT) {
|
|
260
194
|
const content = buffer.toString('utf8');
|
|
261
195
|
const base64 = buffer.toString('base64');
|
|
262
|
-
buffer = null;
|
|
263
196
|
return `
|
|
264
197
|
export default "data:image/svg+xml;base64,${base64}";
|
|
265
198
|
export const svgContent = ${JSON.stringify(content)};
|
|
266
199
|
`;
|
|
267
200
|
}
|
|
268
201
|
else {
|
|
269
|
-
const referenceId = this.emitFile({
|
|
270
|
-
type: 'asset',
|
|
271
|
-
name: path.basename(cleanId),
|
|
272
|
-
source: buffer
|
|
273
|
-
});
|
|
202
|
+
const referenceId = this.emitFile({ type: 'asset', name: path.basename(cleanId), source: buffer });
|
|
274
203
|
const content = buffer.toString('utf8');
|
|
275
|
-
buffer = null;
|
|
276
204
|
return `
|
|
277
205
|
export default String(import.meta.ROLLUP_FILE_URL_${referenceId});
|
|
278
206
|
export const svgContent = ${JSON.stringify(content)};
|
|
@@ -281,163 +209,76 @@ const smartAssetPlugin = (isProduction) => {
|
|
|
281
209
|
}
|
|
282
210
|
if (size < INLINE_LIMIT) {
|
|
283
211
|
const base64 = buffer.toString('base64');
|
|
284
|
-
buffer = null;
|
|
285
212
|
return `export default "data:${type};base64,${base64}";`;
|
|
286
213
|
}
|
|
287
214
|
else {
|
|
288
|
-
const referenceId = this.emitFile({
|
|
289
|
-
type: 'asset',
|
|
290
|
-
name: path.basename(cleanId),
|
|
291
|
-
source: buffer
|
|
292
|
-
});
|
|
293
|
-
buffer = null;
|
|
215
|
+
const referenceId = this.emitFile({ type: 'asset', name: path.basename(cleanId), source: buffer });
|
|
294
216
|
return `export default String(import.meta.ROLLUP_FILE_URL_${referenceId});`;
|
|
295
217
|
}
|
|
296
218
|
}
|
|
297
219
|
};
|
|
298
220
|
};
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
221
|
+
const nodeBuiltIns = [
|
|
222
|
+
'assert', 'buffer', 'child_process', 'cluster', 'crypto', 'dgram', 'dns',
|
|
223
|
+
'domain', 'events', 'fs', 'http', 'https', 'net', 'os', 'path', 'punycode',
|
|
224
|
+
'querystring', 'readline', 'stream', 'string_decoder', 'tls', 'tty', 'url',
|
|
225
|
+
'util', 'v8', 'vm', 'zlib', 'module', 'worker_threads', 'perf_hooks'
|
|
226
|
+
];
|
|
227
|
+
// --- Core Logic ---
|
|
228
|
+
function detectFramework(projectDir = process.cwd()) {
|
|
229
|
+
try {
|
|
230
|
+
const pkgPath = path.join(projectDir, 'package.json');
|
|
231
|
+
if (fs.existsSync(pkgPath)) {
|
|
232
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
233
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
234
|
+
if (deps.react || deps['react-dom'])
|
|
235
|
+
return 'react';
|
|
236
|
+
if (deps.vue || deps['nuxt'])
|
|
237
|
+
return 'vue';
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
catch (e) { }
|
|
241
|
+
return 'react';
|
|
242
|
+
}
|
|
243
|
+
async function getFrameworkConfig(entryPoint, outdir, isProduction) {
|
|
303
244
|
const framework = detectFramework();
|
|
304
|
-
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
replaceValues['__VUE_PROD_DEVTOOLS__'] = JSON.stringify(!isProduction);
|
|
314
|
-
try {
|
|
315
|
-
let vuePkg;
|
|
316
|
-
try {
|
|
317
|
-
vuePkg = require('rollup-plugin-vue');
|
|
318
|
-
}
|
|
319
|
-
catch (e) {
|
|
320
|
-
if (e.code === 'ERR_REQUIRE_ESM') {
|
|
321
|
-
vuePkg = await import('rollup-plugin-vue');
|
|
245
|
+
// Plugins que rodam ANTES da resolução de módulos (Configuração, Bloqueios de Framework incorreto)
|
|
246
|
+
const prePlugins = [
|
|
247
|
+
tsconfigPathsPlugin(process.cwd()),
|
|
248
|
+
{
|
|
249
|
+
name: 'block-vue-artifacts-generic',
|
|
250
|
+
load(id) {
|
|
251
|
+
// Se não for vue, bloqueia artifacts. O build.vue lida com o inverso.
|
|
252
|
+
if (framework !== 'vue' && (id.endsWith('.vue') || id.endsWith('.vue.js'))) {
|
|
253
|
+
return 'export default {};';
|
|
322
254
|
}
|
|
323
|
-
|
|
324
|
-
throw e;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
const vueFactory = vuePkg.default || vuePkg;
|
|
328
|
-
if (typeof vueFactory === 'function') {
|
|
329
|
-
vuePlugin = vueFactory({
|
|
330
|
-
compilerOptions: {
|
|
331
|
-
isCustomElement: (tag) => tag.includes('-')
|
|
332
|
-
}
|
|
333
|
-
});
|
|
255
|
+
return null;
|
|
334
256
|
}
|
|
335
257
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
258
|
+
];
|
|
259
|
+
// Plugins que rodam DEPOIS da transformação do Framework (Markdown, CSS, Assets)
|
|
260
|
+
// Isso é crucial para o Vue, pois o CSS é gerado dinamicamente e precisa ser pego aqui.
|
|
261
|
+
const postPlugins = [
|
|
262
|
+
markdownPlugin(),
|
|
263
|
+
customPostCssPlugin(isProduction),
|
|
264
|
+
smartAssetPlugin(isProduction)
|
|
265
|
+
];
|
|
266
|
+
const pluginConfig = { prePlugins, postPlugins };
|
|
267
|
+
if (framework === 'vue') {
|
|
268
|
+
Console.info("Framework detected: Vue.js");
|
|
269
|
+
return await createVueConfig(entryPoint, outdir, isProduction, pluginConfig);
|
|
348
270
|
}
|
|
349
271
|
else {
|
|
350
|
-
|
|
272
|
+
Console.info("Framework detected: React/Standard");
|
|
273
|
+
return await createReactConfig(entryPoint, outdir, isProduction, pluginConfig);
|
|
351
274
|
}
|
|
352
|
-
const esbuildLoaders = {
|
|
353
|
-
'.js': 'jsx',
|
|
354
|
-
'.ts': 'ts',
|
|
355
|
-
'.tsx': 'tsx',
|
|
356
|
-
'.vue': 'ts'
|
|
357
|
-
};
|
|
358
|
-
return {
|
|
359
|
-
input: entryPoint,
|
|
360
|
-
external: nodeBuiltIns,
|
|
361
|
-
treeshake: {
|
|
362
|
-
moduleSideEffects: 'no-external',
|
|
363
|
-
preset: isProduction ? 'recommended' : 'smallest'
|
|
364
|
-
},
|
|
365
|
-
cache: isProduction ? true : false,
|
|
366
|
-
perf: false,
|
|
367
|
-
maxParallelFileOps: 20,
|
|
368
|
-
plugins: [
|
|
369
|
-
replace({
|
|
370
|
-
preventAssignment: true,
|
|
371
|
-
values: replaceValues
|
|
372
|
-
}),
|
|
373
|
-
tsconfigPathsPlugin(process.cwd()),
|
|
374
|
-
{
|
|
375
|
-
name: 'block-volar-artifacts',
|
|
376
|
-
load(id) {
|
|
377
|
-
if (/\.vue\.(js|ts|d\.ts|map)$/.test(id)) {
|
|
378
|
-
return 'export default {};';
|
|
379
|
-
}
|
|
380
|
-
return null;
|
|
381
|
-
}
|
|
382
|
-
},
|
|
383
|
-
{
|
|
384
|
-
name: 'block-vue-artifacts',
|
|
385
|
-
load(id) {
|
|
386
|
-
if (!hasVue && (id.endsWith('.vue') || id.endsWith('.vue.js'))) {
|
|
387
|
-
return 'export default {};';
|
|
388
|
-
}
|
|
389
|
-
return null;
|
|
390
|
-
}
|
|
391
|
-
},
|
|
392
|
-
nodeResolve({
|
|
393
|
-
extensions,
|
|
394
|
-
preferBuiltins: true,
|
|
395
|
-
browser: true,
|
|
396
|
-
dedupe: hasReact ? ['react', 'react-dom'] : (hasVue ? ['vue'] : [])
|
|
397
|
-
}),
|
|
398
|
-
...(hasVue && vuePlugin ? [vuePlugin] : []),
|
|
399
|
-
// AQUI ESTÁ A MÁGICA: Plugin que corrige a falta do export default
|
|
400
|
-
...(hasVue ? [vueScriptFixPlugin()] : []),
|
|
401
|
-
commonjs({
|
|
402
|
-
sourceMap: !isProduction,
|
|
403
|
-
requireReturnsDefault: 'auto',
|
|
404
|
-
ignoreTryCatch: true
|
|
405
|
-
}),
|
|
406
|
-
markdownPlugin(),
|
|
407
|
-
customPostCssPlugin(isProduction),
|
|
408
|
-
smartAssetPlugin(isProduction),
|
|
409
|
-
jsonPlugin(),
|
|
410
|
-
esbuild({
|
|
411
|
-
include: esbuildInclude,
|
|
412
|
-
exclude: /node_modules/,
|
|
413
|
-
sourceMap: !isProduction,
|
|
414
|
-
minify: isProduction,
|
|
415
|
-
legalComments: 'none',
|
|
416
|
-
treeShaking: isProduction,
|
|
417
|
-
target: 'esnext',
|
|
418
|
-
jsx: 'automatic',
|
|
419
|
-
define: { __VERSION__: '"1.0.0"' },
|
|
420
|
-
loaders: esbuildLoaders
|
|
421
|
-
})
|
|
422
|
-
],
|
|
423
|
-
onwarn(warning, warn) {
|
|
424
|
-
if (warning.code === 'MODULE_LEVEL_DIRECTIVE')
|
|
425
|
-
return;
|
|
426
|
-
if (warning.code === 'THIS_IS_UNDEFINED')
|
|
427
|
-
return;
|
|
428
|
-
if (warning.code === 'CIRCULAR_DEPENDENCY' && warning.message.includes('node_modules'))
|
|
429
|
-
return;
|
|
430
|
-
warn(warning);
|
|
431
|
-
}
|
|
432
|
-
};
|
|
433
275
|
}
|
|
434
|
-
|
|
435
|
-
* Builds with code splitting into multiple chunks (ESM Format) - MODO PRODUÇÃO
|
|
436
|
-
*/
|
|
276
|
+
// --- Build Functions ---
|
|
437
277
|
async function buildWithChunks(entryPoint, outdir, isProduction = false) {
|
|
438
278
|
await cleanDirectoryExcept(outdir, 'temp');
|
|
439
279
|
try {
|
|
440
|
-
const inputOptions = await
|
|
280
|
+
const inputOptions = await getFrameworkConfig(entryPoint, outdir, isProduction);
|
|
281
|
+
inputOptions.external = nodeBuiltIns;
|
|
441
282
|
const outputOptions = {
|
|
442
283
|
dir: outdir,
|
|
443
284
|
format: 'es',
|
|
@@ -449,18 +290,14 @@ async function buildWithChunks(entryPoint, outdir, isProduction = false) {
|
|
|
449
290
|
manualChunks(id) {
|
|
450
291
|
if (id.includes('node_modules')) {
|
|
451
292
|
const normalizedId = id.replace(/\\/g, '/');
|
|
452
|
-
if (/\/node_modules\/(react|react-dom|scheduler|prop-types|loose-envify|object-assign)\//.test(normalizedId))
|
|
293
|
+
if (/\/node_modules\/(react|react-dom|scheduler|prop-types|loose-envify|object-assign)\//.test(normalizedId))
|
|
453
294
|
return 'vendor-react';
|
|
454
|
-
|
|
455
|
-
if (/\/node_modules\/(vue|@vue)\//.test(normalizedId)) {
|
|
295
|
+
if (/\/node_modules\/(vue|@vue)\//.test(normalizedId))
|
|
456
296
|
return 'vendor-vue';
|
|
457
|
-
|
|
458
|
-
if (id.includes('framer-motion') || id.includes('@radix-ui') || id.includes('@headlessui')) {
|
|
297
|
+
if (id.includes('framer-motion') || id.includes('@radix-ui') || id.includes('@headlessui'))
|
|
459
298
|
return 'vendor-ui';
|
|
460
|
-
|
|
461
|
-
if (id.includes('lodash') || id.includes('date-fns') || id.includes('axios')) {
|
|
299
|
+
if (id.includes('lodash') || id.includes('date-fns') || id.includes('axios'))
|
|
462
300
|
return 'vendor-utils';
|
|
463
|
-
}
|
|
464
301
|
return 'vendor';
|
|
465
302
|
}
|
|
466
303
|
}
|
|
@@ -474,14 +311,12 @@ async function buildWithChunks(entryPoint, outdir, isProduction = false) {
|
|
|
474
311
|
process.exit(1);
|
|
475
312
|
}
|
|
476
313
|
}
|
|
477
|
-
/**
|
|
478
|
-
* Builds a single entry point into a single output file (IIFE Format)
|
|
479
|
-
*/
|
|
480
314
|
async function build(entryPoint, outfile, isProduction = false) {
|
|
481
315
|
const outdir = path.dirname(outfile);
|
|
482
316
|
await cleanDirectoryExcept(outdir, 'temp');
|
|
483
317
|
try {
|
|
484
|
-
const inputOptions = await
|
|
318
|
+
const inputOptions = await getFrameworkConfig(entryPoint, outdir, isProduction);
|
|
319
|
+
inputOptions.external = nodeBuiltIns;
|
|
485
320
|
const outputOptions = {
|
|
486
321
|
file: outfile,
|
|
487
322
|
format: 'iife',
|
|
@@ -499,9 +334,7 @@ async function build(entryPoint, outfile, isProduction = false) {
|
|
|
499
334
|
process.exit(1);
|
|
500
335
|
}
|
|
501
336
|
}
|
|
502
|
-
|
|
503
|
-
* Helper para lidar com notificações do Watcher
|
|
504
|
-
*/
|
|
337
|
+
// --- Watch Functions ---
|
|
505
338
|
function handleWatcherEvents(watcher, hotReloadManager, resolveFirstBuild) {
|
|
506
339
|
let currentBuildId = 0;
|
|
507
340
|
let lastStartedBuildId = 0;
|
|
@@ -527,29 +360,25 @@ function handleWatcherEvents(watcher, hotReloadManager, resolveFirstBuild) {
|
|
|
527
360
|
loc: event.error?.loc,
|
|
528
361
|
buildId: currentBuildId
|
|
529
362
|
};
|
|
530
|
-
if (hotReloadManager)
|
|
363
|
+
if (hotReloadManager)
|
|
531
364
|
hotReloadManager.onBuildComplete(false, errDetails);
|
|
532
|
-
}
|
|
533
365
|
else
|
|
534
366
|
Console.error("Build Error:", event.error);
|
|
535
367
|
if (resolveFirstBuild)
|
|
536
368
|
resolveFirstBuild();
|
|
537
369
|
}
|
|
538
|
-
if (event.code === 'BUNDLE_END')
|
|
370
|
+
if (event.code === 'BUNDLE_END')
|
|
539
371
|
event.result.close();
|
|
540
|
-
}
|
|
541
372
|
if (event.code === 'END') {
|
|
542
373
|
const endBuildId = currentBuildId;
|
|
543
374
|
const hadError = erroredBuildIds.has(endBuildId);
|
|
544
375
|
if (endBuildId === lastStartedBuildId && !hadError) {
|
|
545
|
-
if (hotReloadManager)
|
|
376
|
+
if (hotReloadManager)
|
|
546
377
|
hotReloadManager.onBuildComplete(true, { buildId: endBuildId });
|
|
547
|
-
}
|
|
548
378
|
}
|
|
549
|
-
for (const id of erroredBuildIds)
|
|
379
|
+
for (const id of erroredBuildIds)
|
|
550
380
|
if (id < lastStartedBuildId)
|
|
551
381
|
erroredBuildIds.delete(id);
|
|
552
|
-
}
|
|
553
382
|
if (resolveFirstBuild) {
|
|
554
383
|
resolveFirstBuild();
|
|
555
384
|
resolveFirstBuild = null;
|
|
@@ -557,13 +386,11 @@ function handleWatcherEvents(watcher, hotReloadManager, resolveFirstBuild) {
|
|
|
557
386
|
}
|
|
558
387
|
});
|
|
559
388
|
}
|
|
560
|
-
/**
|
|
561
|
-
* Watches with code splitting enabled
|
|
562
|
-
*/
|
|
563
389
|
async function watchWithChunks(entryPoint, outdir, hotReloadManager = null) {
|
|
564
390
|
await cleanDirectoryExcept(outdir, 'temp');
|
|
565
391
|
try {
|
|
566
|
-
const inputOptions = await
|
|
392
|
+
const inputOptions = await getFrameworkConfig(entryPoint, outdir, false);
|
|
393
|
+
inputOptions.external = nodeBuiltIns;
|
|
567
394
|
const outputOptions = {
|
|
568
395
|
dir: outdir,
|
|
569
396
|
format: 'es',
|
|
@@ -573,12 +400,7 @@ async function watchWithChunks(entryPoint, outdir, hotReloadManager = null) {
|
|
|
573
400
|
const watchOptions = {
|
|
574
401
|
...inputOptions,
|
|
575
402
|
output: outputOptions,
|
|
576
|
-
watch: {
|
|
577
|
-
exclude: 'node_modules/**',
|
|
578
|
-
clearScreen: false,
|
|
579
|
-
skipWrite: false,
|
|
580
|
-
buildDelay: 100
|
|
581
|
-
}
|
|
403
|
+
watch: { exclude: 'node_modules/**', clearScreen: false, skipWrite: false, buildDelay: 100 }
|
|
582
404
|
};
|
|
583
405
|
const watcher = rollupWatch(watchOptions);
|
|
584
406
|
await new Promise((resolve) => handleWatcherEvents(watcher, hotReloadManager, resolve));
|
|
@@ -591,13 +413,11 @@ async function watchWithChunks(entryPoint, outdir, hotReloadManager = null) {
|
|
|
591
413
|
throw error;
|
|
592
414
|
}
|
|
593
415
|
}
|
|
594
|
-
/**
|
|
595
|
-
* Watches an entry point (Single File)
|
|
596
|
-
*/
|
|
597
416
|
async function watch(entryPoint, outfile, hotReloadManager = null) {
|
|
598
417
|
const outdir = path.dirname(outfile);
|
|
599
418
|
try {
|
|
600
|
-
const inputOptions = await
|
|
419
|
+
const inputOptions = await getFrameworkConfig(entryPoint, outdir, false);
|
|
420
|
+
inputOptions.external = nodeBuiltIns;
|
|
601
421
|
const outputOptions = {
|
|
602
422
|
file: outfile,
|
|
603
423
|
format: 'es',
|
|
@@ -606,11 +426,7 @@ async function watch(entryPoint, outfile, hotReloadManager = null) {
|
|
|
606
426
|
const watchOptions = {
|
|
607
427
|
...inputOptions,
|
|
608
428
|
output: outputOptions,
|
|
609
|
-
watch: {
|
|
610
|
-
exclude: 'node_modules/**',
|
|
611
|
-
clearScreen: false,
|
|
612
|
-
buildDelay: 100
|
|
613
|
-
}
|
|
429
|
+
watch: { exclude: 'node_modules/**', clearScreen: false, buildDelay: 100 }
|
|
614
430
|
};
|
|
615
431
|
const watcher = rollupWatch(watchOptions);
|
|
616
432
|
await new Promise((resolve) => handleWatcherEvents(watcher, hotReloadManager, resolve));
|
|
@@ -637,9 +453,7 @@ async function cleanDirectoryExcept(dirPath, excludeFolder) {
|
|
|
637
453
|
const info = await stat(itemPath);
|
|
638
454
|
await rm(itemPath, { recursive: info.isDirectory(), force: true });
|
|
639
455
|
}
|
|
640
|
-
catch (e) {
|
|
641
|
-
// Ignora erro se arquivo sumir
|
|
642
|
-
}
|
|
456
|
+
catch (e) { }
|
|
643
457
|
}
|
|
644
458
|
}
|
|
645
459
|
catch (e) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
3
|
* This file is part of the Vatts.js Project.
|
|
4
|
-
* Copyright (c) 2026
|
|
4
|
+
* Copyright (c) 2026 mfraz
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
package/dist/client/rpc.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
3
|
* This file is part of the Vatts.js Project.
|
|
4
|
-
* Copyright (c) 2026
|
|
4
|
+
* Copyright (c) 2026 mfraz
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|