@rettangoli/fe 0.0.7-rc10 → 0.0.7-rc12
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/package.json +2 -2
- package/src/cli/build.js +12 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rettangoli/fe",
|
|
3
|
-
"version": "0.0.7-
|
|
3
|
+
"version": "0.0.7-rc12",
|
|
4
4
|
"description": "Frontend framework for building reactive web components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"esbuild": "^0.25.5",
|
|
31
31
|
"immer": "^10.1.1",
|
|
32
|
-
"jempl": "0.1.2-
|
|
32
|
+
"jempl": "0.1.2-rc3",
|
|
33
33
|
"js-yaml": "^4.1.0",
|
|
34
34
|
"rxjs": "^7.8.2",
|
|
35
35
|
"snabbdom": "^3.6.2",
|
package/src/cli/build.js
CHANGED
|
@@ -18,7 +18,7 @@ function capitalize(word) {
|
|
|
18
18
|
// Function to process view files - loads YAML and creates temporary JS file
|
|
19
19
|
export const writeViewFile = (view, category, component) => {
|
|
20
20
|
// const { category, component } = extractCategoryAndComponent(filePath);
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
const dir = `./.temp/${category}`;
|
|
23
23
|
if (!existsSync(dir)) {
|
|
24
24
|
mkdirSync(dir, { recursive: true });
|
|
@@ -30,12 +30,12 @@ export const writeViewFile = (view, category, component) => {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export const bundleFile = async (options) => {
|
|
33
|
-
const { outfile = "./vt/static/main.js" } = options;
|
|
33
|
+
const { outfile = "./vt/static/main.js", development = false } = options;
|
|
34
34
|
await esbuild.build({
|
|
35
35
|
entryPoints: ["./.temp/dynamicImport.js"],
|
|
36
36
|
bundle: true,
|
|
37
|
-
minify:
|
|
38
|
-
sourcemap:
|
|
37
|
+
minify: !development,
|
|
38
|
+
sourcemap: !!development,
|
|
39
39
|
outfile: outfile,
|
|
40
40
|
format: "esm",
|
|
41
41
|
loader: {
|
|
@@ -47,7 +47,7 @@ export const bundleFile = async (options) => {
|
|
|
47
47
|
const buildRettangoliFrontend = async (options) => {
|
|
48
48
|
console.log("running build with options", options);
|
|
49
49
|
|
|
50
|
-
const { dirs = ["./example"], outfile = "./vt/static/main.js", setup = "setup.js" } = options;
|
|
50
|
+
const { dirs = ["./example"], outfile = "./vt/static/main.js", setup = "setup.js", development = false } = options;
|
|
51
51
|
|
|
52
52
|
const allFiles = getAllFiles(dirs).filter((filePath) => {
|
|
53
53
|
return (
|
|
@@ -93,7 +93,12 @@ const buildRettangoliFrontend = async (options) => {
|
|
|
93
93
|
count++;
|
|
94
94
|
} else if (["view"].includes(fileType)) {
|
|
95
95
|
const view = loadYaml(readFileSync(filePath, "utf8"));
|
|
96
|
-
|
|
96
|
+
try {
|
|
97
|
+
view.template = parse(view.template);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
console.error(`Error parsing template in file: ${filePath}`);
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
97
102
|
writeViewFile(view, category, component);
|
|
98
103
|
output += `import ${component}${capitalize(
|
|
99
104
|
fileType,
|
|
@@ -125,7 +130,7 @@ Object.keys(imports).forEach(category => {
|
|
|
125
130
|
|
|
126
131
|
writeFileSync("./.temp/dynamicImport.js", output);
|
|
127
132
|
|
|
128
|
-
await bundleFile({ outfile });
|
|
133
|
+
await bundleFile({ outfile, development });
|
|
129
134
|
|
|
130
135
|
console.log(`Build complete. Output file: ${outfile}`);
|
|
131
136
|
};
|