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/dist/env/env.js
CHANGED
|
@@ -4,6 +4,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.loadEnv = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* This file is part of the Vatts.js Project.
|
|
9
|
+
* Copyright (c) 2026 mfraz
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
7
23
|
const fs_1 = __importDefault(require("fs"));
|
|
8
24
|
const path_1 = __importDefault(require("path"));
|
|
9
25
|
const console_1 = __importDefault(require("../api/console"));
|
package/dist/global/global.d.ts
CHANGED
package/dist/helpers.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.
|
package/dist/hotReload.js
CHANGED
|
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.HotReloadManager = void 0;
|
|
40
40
|
/*
|
|
41
41
|
* This file is part of the Vatts.js Project.
|
|
42
|
-
* Copyright (c) 2026
|
|
42
|
+
* Copyright (c) 2026 mfraz
|
|
43
43
|
*
|
|
44
44
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
45
45
|
* you may not use this file except in compliance with the License.
|
package/dist/index.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/loaders.js
CHANGED
|
@@ -4,6 +4,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.default = BuildingScreen;
|
|
7
|
+
/*
|
|
8
|
+
* This file is part of the Vatts.js Project.
|
|
9
|
+
* Copyright (c) 2026 mfraz
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
7
23
|
const react_1 = __importDefault(require("react"));
|
|
8
24
|
function BuildingScreen() {
|
|
9
25
|
let version = "1.0.0";
|
|
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.default = ErrorPage;
|
|
37
37
|
/*
|
|
38
38
|
* This file is part of the Vatts.js Project.
|
|
39
|
-
* Copyright (c) 2026
|
|
39
|
+
* Copyright (c) 2026 mfraz
|
|
40
40
|
*
|
|
41
41
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
42
42
|
* you may not use this file except in compliance with the License.
|
|
@@ -34,6 +34,22 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.default = DevIndicator;
|
|
37
|
+
/*
|
|
38
|
+
* This file is part of the Vatts.js Project.
|
|
39
|
+
* Copyright (c) 2026 mfraz
|
|
40
|
+
*
|
|
41
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
42
|
+
* you may not use this file except in compliance with the License.
|
|
43
|
+
* You may obtain a copy of the License at
|
|
44
|
+
*
|
|
45
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
46
|
+
*
|
|
47
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
48
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
49
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
50
|
+
* See the License for the specific language governing permissions and
|
|
51
|
+
* limitations under the License.
|
|
52
|
+
*/
|
|
37
53
|
const react_1 = __importStar(require("react"));
|
|
38
54
|
const react_dom_1 = require("react-dom");
|
|
39
55
|
function DevIndicator({ hasBuildError = false, onClickBuildError, }) {
|
package/dist/react/ErrorModal.js
CHANGED
|
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.ErrorModal = ErrorModal;
|
|
37
37
|
/*
|
|
38
38
|
* This file is part of the Vatts.js Project.
|
|
39
|
-
* Copyright (c) 2026
|
|
39
|
+
* Copyright (c) 2026 mfraz
|
|
40
40
|
*
|
|
41
41
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
42
42
|
* you may not use this file except in compliance with the License.
|
package/dist/react/Link.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Link = Link;
|
|
7
7
|
/*
|
|
8
8
|
* This file is part of the Vatts.js Project.
|
|
9
|
-
* Copyright (c) 2026
|
|
9
|
+
* Copyright (c) 2026 mfraz
|
|
10
10
|
*
|
|
11
11
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
12
|
* you may not use this file except in compliance with the License.
|
package/dist/react/client.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.
|
|
@@ -38,7 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
/*
|
|
40
40
|
* This file is part of the Vatts.js Project.
|
|
41
|
-
* Copyright (c) 2026
|
|
41
|
+
* Copyright (c) 2026 mfraz
|
|
42
42
|
*
|
|
43
43
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
44
44
|
* you may not use this file except in compliance with the License.
|
|
@@ -3,6 +3,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
/*
|
|
7
|
+
* This file is part of the Vatts.js Project.
|
|
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.
|
|
21
|
+
*/
|
|
6
22
|
const react_1 = __importDefault(require("react"));
|
|
7
23
|
const Image = ({ src, width, height, quality = 75, priority = false, className, style, alt = "", ...props }) => {
|
|
8
24
|
function getBaseUrl() {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cria a configuração do Rollup otimizada para React
|
|
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
|
|
8
|
+
* @param {Array} plugins.postPlugins - Plugins para rodar DEPOIS do framework
|
|
9
|
+
*/
|
|
10
|
+
export function createReactConfig(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,95 @@
|
|
|
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
|
+
/**
|
|
24
|
+
* Cria a configuração do Rollup otimizada para React
|
|
25
|
+
* @param {string} entryPoint - Arquivo de entrada
|
|
26
|
+
* @param {string} outdir - Diretório de saída
|
|
27
|
+
* @param {boolean} isProduction - Flag de produção
|
|
28
|
+
* @param {Object} plugins - Objeto contendo arrays de plugins
|
|
29
|
+
* @param {Array} plugins.prePlugins - Plugins para rodar ANTES do framework
|
|
30
|
+
* @param {Array} plugins.postPlugins - Plugins para rodar DEPOIS do framework
|
|
31
|
+
*/
|
|
32
|
+
async function createReactConfig(entryPoint, outdir, isProduction, { prePlugins = [], postPlugins = [] } = {}) {
|
|
33
|
+
const replaceValues = {
|
|
34
|
+
'process.env.NODE_ENV': JSON.stringify(isProduction ? 'production' : 'development'),
|
|
35
|
+
'process.env.PORT': JSON.stringify(process.vatts?.port || 3000)
|
|
36
|
+
};
|
|
37
|
+
const extensions = ['.mjs', '.js', '.json', '.node', '.jsx', '.tsx', '.ts'];
|
|
38
|
+
const esbuildLoaders = {
|
|
39
|
+
'.js': 'jsx',
|
|
40
|
+
'.ts': 'ts',
|
|
41
|
+
'.tsx': 'tsx'
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
input: entryPoint,
|
|
45
|
+
treeshake: {
|
|
46
|
+
moduleSideEffects: 'no-external',
|
|
47
|
+
preset: isProduction ? 'recommended' : 'smallest'
|
|
48
|
+
},
|
|
49
|
+
cache: isProduction ? true : false,
|
|
50
|
+
perf: false,
|
|
51
|
+
maxParallelFileOps: 20,
|
|
52
|
+
plugins: [
|
|
53
|
+
replace({
|
|
54
|
+
preventAssignment: true,
|
|
55
|
+
values: replaceValues
|
|
56
|
+
}),
|
|
57
|
+
...prePlugins,
|
|
58
|
+
nodeResolve({
|
|
59
|
+
extensions,
|
|
60
|
+
preferBuiltins: true,
|
|
61
|
+
browser: true,
|
|
62
|
+
dedupe: ['react', 'react-dom']
|
|
63
|
+
}),
|
|
64
|
+
commonjs({
|
|
65
|
+
sourceMap: !isProduction,
|
|
66
|
+
requireReturnsDefault: 'auto',
|
|
67
|
+
ignoreTryCatch: true
|
|
68
|
+
}),
|
|
69
|
+
...postPlugins,
|
|
70
|
+
jsonPlugin(),
|
|
71
|
+
esbuild({
|
|
72
|
+
include: /\.[jt]sx?$/,
|
|
73
|
+
exclude: /node_modules/,
|
|
74
|
+
sourceMap: !isProduction,
|
|
75
|
+
minify: isProduction,
|
|
76
|
+
legalComments: 'none',
|
|
77
|
+
treeShaking: isProduction,
|
|
78
|
+
target: 'esnext',
|
|
79
|
+
jsx: 'automatic',
|
|
80
|
+
define: { __VERSION__: '"1.0.0"' },
|
|
81
|
+
loaders: esbuildLoaders
|
|
82
|
+
})
|
|
83
|
+
],
|
|
84
|
+
onwarn(warning, warn) {
|
|
85
|
+
if (warning.code === 'MODULE_LEVEL_DIRECTIVE')
|
|
86
|
+
return;
|
|
87
|
+
if (warning.code === 'THIS_IS_UNDEFINED')
|
|
88
|
+
return;
|
|
89
|
+
if (warning.code === 'CIRCULAR_DEPENDENCY' && warning.message.includes('node_modules'))
|
|
90
|
+
return;
|
|
91
|
+
warn(warning);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
module.exports = { createReactConfig };
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.render = render;
|
|
7
7
|
/*
|
|
8
8
|
* This file is part of the Vatts.js Project.
|
|
9
|
-
* Copyright (c) 2026
|
|
9
|
+
* Copyright (c) 2026 mfraz
|
|
10
10
|
*
|
|
11
11
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
12
|
* you may not use this file except in compliance with the License.
|
|
@@ -368,4 +368,3 @@ async function render({ req, res, route, params, allRoutes }) {
|
|
|
368
368
|
throw err;
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
|
-
// --- Componente de Tela de Building (Substituto do getBuildingHTML) ---
|
package/dist/router.js
CHANGED
|
@@ -19,7 +19,7 @@ exports.findMatchingWebSocketRoute = findMatchingWebSocketRoute;
|
|
|
19
19
|
exports.setupWebSocketUpgrade = setupWebSocketUpgrade;
|
|
20
20
|
/*
|
|
21
21
|
* This file is part of the Vatts.js Project.
|
|
22
|
-
* Copyright (c) 2026
|
|
22
|
+
* Copyright (c) 2026 mfraz
|
|
23
23
|
*
|
|
24
24
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
25
25
|
* you may not use this file except in compliance with the License.
|
package/dist/rpc/server.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/rpc/types.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/tsconfigPaths.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/vue/App.vue
CHANGED
|
@@ -1,27 +1,47 @@
|
|
|
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
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<!-- Se não tiver layout, renderiza o conteúdo direto -->
|
|
9
|
-
<component v-else :is="resolvedContent" v-bind="contentProps" :key="`page-${hmrTimestamp}`" />
|
|
10
|
-
|
|
11
|
-
<!-- Dev Tools / Indicadores -->
|
|
12
|
-
<DevIndicator
|
|
13
|
-
v-if="isDev"
|
|
14
|
-
:has-build-error="!!buildError"
|
|
15
|
-
@click-build-error="isErrorOpen = true"
|
|
18
|
+
<component :is="resolvedLayout" v-if="resolvedLayout">
|
|
19
|
+
<component
|
|
20
|
+
:is="resolvedContent"
|
|
21
|
+
v-bind="contentProps"
|
|
22
|
+
:key="`page-${hmrTimestamp}-${currentPathKey}`"
|
|
16
23
|
/>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
</component>
|
|
25
|
+
|
|
26
|
+
<component
|
|
27
|
+
v-else
|
|
28
|
+
:is="resolvedContent"
|
|
29
|
+
v-bind="contentProps"
|
|
30
|
+
:key="`page-${hmrTimestamp}-${currentPathKey}`"
|
|
31
|
+
/>
|
|
32
|
+
|
|
33
|
+
<DevIndicator
|
|
34
|
+
v-if="isDev"
|
|
35
|
+
:has-build-error="!!buildError"
|
|
36
|
+
@click-build-error="isErrorOpen = true"
|
|
37
|
+
/>
|
|
38
|
+
|
|
39
|
+
<ErrorModal
|
|
40
|
+
:error="buildError"
|
|
41
|
+
:is-open="isErrorOpen"
|
|
42
|
+
@close="isErrorOpen = false"
|
|
43
|
+
@copy="copyBuildError"
|
|
44
|
+
/>
|
|
25
45
|
</template>
|
|
26
46
|
|
|
27
47
|
<script setup>
|
|
@@ -35,13 +55,14 @@ const props = defineProps({
|
|
|
35
55
|
componentMap: Object,
|
|
36
56
|
routes: Array,
|
|
37
57
|
initialComponentPath: String,
|
|
38
|
-
initialParams: null,
|
|
39
|
-
layoutComponent: null
|
|
58
|
+
initialParams: null,
|
|
59
|
+
layoutComponent: null
|
|
40
60
|
});
|
|
41
61
|
|
|
42
62
|
// --- Estado ---
|
|
43
63
|
const hmrTimestamp = ref(Date.now());
|
|
44
|
-
|
|
64
|
+
const currentPathKey = ref(window.location.pathname); // Mantendo a correção da rota anterior
|
|
65
|
+
|
|
45
66
|
const buildError = ref(window.__VATTS_BUILD_ERROR__ || null);
|
|
46
67
|
const isErrorOpen = ref(!!window.__VATTS_BUILD_ERROR__);
|
|
47
68
|
const isDev = process.env.NODE_ENV !== 'production';
|
|
@@ -96,10 +117,14 @@ const params = ref({});
|
|
|
96
117
|
|
|
97
118
|
const updateRoute = () => {
|
|
98
119
|
const currentPath = window.location.pathname.replace("index.html", '');
|
|
99
|
-
const match = findRouteForPath(currentPath);
|
|
100
120
|
|
|
121
|
+
// Atualiza a chave para garantir re-render na mesma rota com params diferentes
|
|
122
|
+
currentPathKey.value = currentPath;
|
|
123
|
+
|
|
124
|
+
const match = findRouteForPath(currentPath);
|
|
101
125
|
if (match) {
|
|
102
126
|
CurrentPageComponent.value = props.componentMap[match.componentPath];
|
|
127
|
+
console.log(props.componentMap[match.componentPath] || 'null')
|
|
103
128
|
params.value = match.params;
|
|
104
129
|
|
|
105
130
|
if (match.metadata?.title != null) {
|
|
@@ -111,14 +136,14 @@ const updateRoute = () => {
|
|
|
111
136
|
}
|
|
112
137
|
};
|
|
113
138
|
|
|
114
|
-
// --- Computed
|
|
139
|
+
// --- Computed ---
|
|
115
140
|
const resolvedContent = computed(() => {
|
|
116
141
|
if (!CurrentPageComponent.value || props.initialComponentPath === '__404__') {
|
|
117
142
|
const NotFoundComponent = window.__VATTS_NOT_FOUND__;
|
|
118
143
|
if (NotFoundComponent) return NotFoundComponent;
|
|
119
144
|
|
|
120
145
|
const DefaultNotFound = window.__VATTS_DEFAULT_NOT_FOUND__;
|
|
121
|
-
return DefaultNotFound || 'div';
|
|
146
|
+
return DefaultNotFound || 'div';
|
|
122
147
|
}
|
|
123
148
|
return CurrentPageComponent.value;
|
|
124
149
|
});
|
|
@@ -132,43 +157,30 @@ const resolvedLayout = computed(() => {
|
|
|
132
157
|
return props.layoutComponent || null;
|
|
133
158
|
});
|
|
134
159
|
|
|
135
|
-
// --- Lifecycle
|
|
160
|
+
// --- Lifecycle ---
|
|
136
161
|
onMounted(() => {
|
|
137
|
-
// Inicializa rota
|
|
138
162
|
updateRoute();
|
|
139
163
|
|
|
140
|
-
// Listeners de Build
|
|
141
164
|
window.addEventListener('vatts:build-error', handleBuildError);
|
|
142
165
|
window.addEventListener('vatts:build-ok', handleBuildOk);
|
|
143
|
-
|
|
144
|
-
// Listeners de Rota
|
|
145
166
|
window.addEventListener('popstate', updateRoute);
|
|
167
|
+
|
|
146
168
|
const unsubscribeRouter = router.subscribe(updateRoute);
|
|
147
169
|
|
|
148
|
-
// HMR Listener
|
|
149
170
|
window.__HWEB_HMR__ = true;
|
|
150
171
|
const handleHMRUpdate = (event) => {
|
|
151
172
|
const { file, timestamp } = event.detail;
|
|
152
|
-
const fileName = file ? file.split('/').pop()?.split('\\').pop() : 'unknown';
|
|
153
|
-
console.log('🔥 HMR: Component Update Triggered', fileName);
|
|
154
|
-
|
|
155
173
|
try {
|
|
156
174
|
hmrTimestamp.value = timestamp;
|
|
157
175
|
window.__HMR_SUCCESS__ = true;
|
|
158
|
-
setTimeout(() => {
|
|
159
|
-
window.__HMR_SUCCESS__ = false;
|
|
160
|
-
}, 3000);
|
|
161
|
-
|
|
162
|
-
// Força update da rota caso o componente tenha mudado
|
|
176
|
+
setTimeout(() => { window.__HMR_SUCCESS__ = false; }, 3000);
|
|
163
177
|
updateRoute();
|
|
164
178
|
} catch (error) {
|
|
165
179
|
console.error('❌ HMR Error:', error);
|
|
166
|
-
window.__HMR_SUCCESS__ = false;
|
|
167
180
|
}
|
|
168
181
|
};
|
|
169
182
|
window.addEventListener('hmr:component-update', handleHMRUpdate);
|
|
170
183
|
|
|
171
|
-
// Cleanup
|
|
172
184
|
onUnmounted(() => {
|
|
173
185
|
window.removeEventListener('vatts:build-error', handleBuildError);
|
|
174
186
|
window.removeEventListener('vatts:build-ok', handleBuildOk);
|
|
@@ -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 { onMounted, ref } from 'vue';
|
|
3
19
|
|
|
@@ -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 { ref, onMounted } from 'vue';
|
|
3
19
|
|
|
@@ -87,18 +103,9 @@ const reload = () => {
|
|
|
87
103
|
box-sizing: border-box;
|
|
88
104
|
}
|
|
89
105
|
|
|
90
|
-
/*
|
|
91
|
-
|
|
106
|
+
/* REMOVIDO :global(body).
|
|
107
|
+
Os estilos globais foram movidos para .container para não afetar o resto do site.
|
|
92
108
|
*/
|
|
93
|
-
:global(body) {
|
|
94
|
-
margin: 0;
|
|
95
|
-
padding: 0;
|
|
96
|
-
background-color: #000000;
|
|
97
|
-
color: #ffffff;
|
|
98
|
-
overflow: hidden;
|
|
99
|
-
height: 100vh;
|
|
100
|
-
width: 100vw;
|
|
101
|
-
}
|
|
102
109
|
|
|
103
110
|
.container {
|
|
104
111
|
position: fixed;
|
|
@@ -113,7 +120,12 @@ const reload = () => {
|
|
|
113
120
|
justify-content: center;
|
|
114
121
|
width: 100vw;
|
|
115
122
|
height: 100vh;
|
|
123
|
+
/* Estilos que antes estavam no body: */
|
|
116
124
|
background: #000000;
|
|
125
|
+
color: #ffffff;
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
margin: 0;
|
|
128
|
+
padding: 0;
|
|
117
129
|
}
|
|
118
130
|
|
|
119
131
|
.card {
|
|
@@ -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 { ref, computed, onMounted, onUnmounted } from 'vue';
|
|
3
19
|
|
package/dist/vue/ErrorModal.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
|
<template>
|
|
2
18
|
<Teleport to="body">
|
|
3
19
|
<!-- Overlay -->
|