vatts 1.2.1 → 1.2.3

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.
Files changed (42) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +11 -7
  3. package/dist/api/console.js +1 -1
  4. package/dist/api/framework.js +16 -0
  5. package/dist/bin/vatts.js +1 -1
  6. package/dist/builder.d.ts +0 -12
  7. package/dist/builder.js +79 -265
  8. package/dist/client/clientRouter.js +1 -1
  9. package/dist/client/rpc.js +1 -1
  10. package/dist/env/env.js +16 -0
  11. package/dist/global/global.d.ts +1 -1
  12. package/dist/helpers.js +1 -1
  13. package/dist/hotReload.js +3 -2
  14. package/dist/index.js +1 -1
  15. package/dist/loaders.js +1 -1
  16. package/dist/react/BuildingPage.js +52 -31
  17. package/dist/react/DefaultNotFound.js +39 -33
  18. package/dist/react/DevIndicator.js +16 -0
  19. package/dist/react/ErrorModal.js +1 -1
  20. package/dist/react/Link.js +1 -1
  21. package/dist/react/client.js +1 -1
  22. package/dist/react/entry.client.js +1 -1
  23. package/dist/react/image/Image.js +16 -0
  24. package/dist/react/react.build.d.ts +24 -0
  25. package/dist/react/react.build.js +95 -0
  26. package/dist/react/renderer-react.js +1 -1
  27. package/dist/router.js +1 -1
  28. package/dist/rpc/server.js +1 -1
  29. package/dist/rpc/types.js +1 -1
  30. package/dist/tsconfigPaths.js +1 -1
  31. package/dist/vue/App.vue +56 -44
  32. package/dist/vue/BuildingPage.vue +46 -37
  33. package/dist/vue/DefaultNotFound.vue +60 -38
  34. package/dist/vue/DevIndicator.vue +16 -0
  35. package/dist/vue/ErrorModal.vue +16 -0
  36. package/dist/vue/Link.vue +16 -0
  37. package/dist/vue/client.js +1 -1
  38. package/dist/vue/entry.client.js +13 -2
  39. package/dist/vue/image/Image.vue +1 -1
  40. package/dist/vue/vue.build.d.ts +24 -0
  41. package/dist/vue/vue.build.js +160 -0
  42. package/package.json +1 -1
package/dist/vue/Link.vue CHANGED
@@ -1,3 +1,19 @@
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
+ -->
1
17
  <script setup>
2
18
  import { router } from '../client/clientRouter';
3
19
 
@@ -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 itsmuzin
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.
@@ -5,7 +5,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  /*
7
7
  * This file is part of the Vatts.js Project.
8
- * Copyright (c) 2026 itsmuzin
8
+ * Copyright (c) 2026 mfraz
9
+ *
10
+ * Licensed under the Apache License, Version 2.0 (the "License");
11
+ * you may not use this file except in compliance with the License.
12
+ * You may obtain a copy of the License at
13
+ *
14
+ * http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
9
21
  */
10
22
  const vue_1 = require("vue");
11
23
  const App_vue_1 = __importDefault(require("./App.vue"));
@@ -70,7 +82,6 @@ function initializeClient() {
70
82
  initialParams: initialData.initialParams,
71
83
  layoutComponent: window.__VATTS_LAYOUT__
72
84
  });
73
- console.log(initialData, componentMap);
74
85
  // Salva a referência globalmente
75
86
  window.__VATTS_APP__ = app;
76
87
  // Monta no elemento #root
@@ -1,6 +1,6 @@
1
1
  <!--
2
2
  * This file is part of the Vatts.js Project.
3
- * Copyright (c) 2026 itsmuzin
3
+ * Copyright (c) 2026 mfraz
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Cria a configuração do Rollup otimizada para Vue
3
+ * @param {string} entryPoint - Arquivo de entrada
4
+ * @param {string} outdir - Diretório de saída
5
+ * @param {boolean} isProduction - Flag de produção
6
+ * @param {Object} plugins - Objeto contendo arrays de plugins
7
+ * @param {Array} plugins.prePlugins - Plugins para rodar ANTES do framework (TSConfig, etc)
8
+ * @param {Array} plugins.postPlugins - Plugins para rodar DEPOIS do framework (CSS, Assets, Markdown)
9
+ */
10
+ export function createVueConfig(entryPoint: string, outdir: string, isProduction: boolean, { prePlugins, postPlugins }?: {
11
+ prePlugins: any[];
12
+ postPlugins: any[];
13
+ }): Promise<{
14
+ input: string;
15
+ treeshake: {
16
+ moduleSideEffects: string;
17
+ preset: string;
18
+ };
19
+ cache: boolean;
20
+ perf: boolean;
21
+ maxParallelFileOps: number;
22
+ plugins: any[];
23
+ onwarn(warning: any, warn: any): void;
24
+ }>;
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ /*
3
+ * This file is part of the Vatts.js Project.
4
+ * Copyright (c) 2026 mfraz
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ const nodeResolve = require('@rollup/plugin-node-resolve').default;
19
+ const commonjs = require('@rollup/plugin-commonjs').default;
20
+ const replace = require('@rollup/plugin-replace').default;
21
+ const esbuild = require('rollup-plugin-esbuild').default;
22
+ const jsonPlugin = require("@rollup/plugin-json").default;
23
+ const Console = require("../api/console").default;
24
+ /**
25
+ * [CORREÇÃO] Plugin que injeta 'export default {}' se estiver faltando.
26
+ * Resolve o problema de rotas que exportam apenas 'config' mas não o componente.
27
+ */
28
+ const vueScriptFixPlugin = () => {
29
+ return {
30
+ name: 'vatts-vue-script-fix',
31
+ transform(code, id) {
32
+ // Intercepta arquivos virtuais de script TS do Vue
33
+ if (id.includes('?vue&type=script') && id.includes('lang.ts')) {
34
+ if (!code.includes('export default')) {
35
+ return {
36
+ code: code + '\nexport default {};',
37
+ map: null
38
+ };
39
+ }
40
+ }
41
+ return null;
42
+ }
43
+ };
44
+ };
45
+ /**
46
+ * Cria a configuração do Rollup otimizada para Vue
47
+ * @param {string} entryPoint - Arquivo de entrada
48
+ * @param {string} outdir - Diretório de saída
49
+ * @param {boolean} isProduction - Flag de produção
50
+ * @param {Object} plugins - Objeto contendo arrays de plugins
51
+ * @param {Array} plugins.prePlugins - Plugins para rodar ANTES do framework (TSConfig, etc)
52
+ * @param {Array} plugins.postPlugins - Plugins para rodar DEPOIS do framework (CSS, Assets, Markdown)
53
+ */
54
+ async function createVueConfig(entryPoint, outdir, isProduction, { prePlugins = [], postPlugins = [] } = {}) {
55
+ const replaceValues = {
56
+ 'process.env.NODE_ENV': JSON.stringify(isProduction ? 'production' : 'development'),
57
+ 'process.env.PORT': JSON.stringify(process.vatts?.port || 3000),
58
+ '__VUE_OPTIONS_API__': JSON.stringify(true),
59
+ '__VUE_PROD_DEVTOOLS__': JSON.stringify(!isProduction)
60
+ };
61
+ let vuePlugin = null;
62
+ try {
63
+ let vuePkg;
64
+ try {
65
+ vuePkg = require('rollup-plugin-vue');
66
+ }
67
+ catch (e) {
68
+ if (e.code === 'ERR_REQUIRE_ESM') {
69
+ vuePkg = await import('rollup-plugin-vue');
70
+ }
71
+ else {
72
+ throw e;
73
+ }
74
+ }
75
+ const vueFactory = vuePkg.default || vuePkg;
76
+ if (typeof vueFactory === 'function') {
77
+ vuePlugin = vueFactory({
78
+ compilerOptions: {
79
+ isCustomElement: (tag) => tag.includes('-')
80
+ }
81
+ });
82
+ }
83
+ }
84
+ catch (e) {
85
+ Console.warn("Vue detected but failed to load rollup-plugin-vue:", e.message);
86
+ }
87
+ const extensions = ['.vue', '.mjs', '.js', '.json', '.node', '.jsx', '.tsx', '.ts'];
88
+ const esbuildLoaders = {
89
+ '.js': 'jsx',
90
+ '.ts': 'ts',
91
+ '.tsx': 'tsx',
92
+ '.vue': 'ts'
93
+ };
94
+ return {
95
+ input: entryPoint,
96
+ treeshake: {
97
+ moduleSideEffects: 'no-external',
98
+ preset: isProduction ? 'recommended' : 'smallest'
99
+ },
100
+ cache: isProduction ? true : false,
101
+ perf: false,
102
+ maxParallelFileOps: 20,
103
+ plugins: [
104
+ replace({
105
+ preventAssignment: true,
106
+ values: replaceValues
107
+ }),
108
+ // Plugins de Infra (TSConfig, etc)
109
+ ...prePlugins,
110
+ {
111
+ name: 'block-volar-artifacts',
112
+ load(id) {
113
+ if (/\.vue\.(js|ts|d\.ts|map)$/.test(id)) {
114
+ return 'export default {};';
115
+ }
116
+ return null;
117
+ }
118
+ },
119
+ nodeResolve({
120
+ extensions,
121
+ preferBuiltins: true,
122
+ browser: true,
123
+ dedupe: ['vue']
124
+ }),
125
+ // Vue Plugin processa os arquivos .vue aqui
126
+ ...(vuePlugin ? [vuePlugin] : []),
127
+ vueScriptFixPlugin(),
128
+ commonjs({
129
+ sourceMap: !isProduction,
130
+ requireReturnsDefault: 'auto',
131
+ ignoreTryCatch: true
132
+ }),
133
+ // Plugins de Assets/CSS rodam DEPOIS do Vue ter gerado os arquivos virtuais de estilo
134
+ ...postPlugins,
135
+ jsonPlugin(),
136
+ esbuild({
137
+ include: /\.[jt]sx?$|\.vue\?vue.*lang\.ts/,
138
+ exclude: /node_modules/,
139
+ sourceMap: !isProduction,
140
+ minify: isProduction,
141
+ legalComments: 'none',
142
+ treeShaking: isProduction,
143
+ target: 'esnext',
144
+ jsx: 'automatic',
145
+ define: { __VERSION__: '"1.0.0"' },
146
+ loaders: esbuildLoaders
147
+ })
148
+ ],
149
+ onwarn(warning, warn) {
150
+ if (warning.code === 'MODULE_LEVEL_DIRECTIVE')
151
+ return;
152
+ if (warning.code === 'THIS_IS_UNDEFINED')
153
+ return;
154
+ if (warning.code === 'CIRCULAR_DEPENDENCY' && warning.message.includes('node_modules'))
155
+ return;
156
+ warn(warning);
157
+ }
158
+ };
159
+ }
160
+ module.exports = { createVueConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vatts",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
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",