leanweb 3.0.6 → 3.0.7

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 (2) hide show
  1. package/commands/build.js +31 -27
  2. package/package.json +3 -3
package/commands/build.js CHANGED
@@ -45,34 +45,38 @@ const buildModule = (projectPath) => {
45
45
  };
46
46
 
47
47
  const buildHTML = () => {
48
- project.components.forEach(cmp => {
49
- const cmpName = utils.getComponentName(cmp);
50
- const htmlFilename = `${utils.dirs.build}/components/${cmp}/${cmpName}.html`;
51
- const htmlFileExists = fs.existsSync(htmlFilename);
52
- if (htmlFileExists) {
53
- const cssFilename = `${utils.dirs.build}/components/${cmp}/${cmpName}.css`;
54
- const cssFileExists = fs.existsSync(cssFilename);
55
- let cssString = `@import "global-styles.css";\n`;
56
- if (cssFileExists) {
57
- cssString += fs.readFileSync(cssFilename, 'utf8');
48
+ try {
49
+ project.components.forEach(cmp => {
50
+ const cmpName = utils.getComponentName(cmp);
51
+ const htmlFilename = `${utils.dirs.build}/components/${cmp}/${cmpName}.html`;
52
+ const htmlFileExists = fs.existsSync(htmlFilename);
53
+ if (htmlFileExists) {
54
+ const cssFilename = `${utils.dirs.build}/components/${cmp}/${cmpName}.css`;
55
+ const cssFileExists = fs.existsSync(cssFilename);
56
+ let cssString = `@import "global-styles.css";\n`;
57
+ if (cssFileExists) {
58
+ cssString += fs.readFileSync(cssFilename, 'utf8');
59
+ }
60
+ cssString += '\n[lw-false],[lw-for]{display:none !important;}\n';
61
+ const htmlString = fs.readFileSync(htmlFilename, 'utf8');
62
+ const minifiedHtml = minify(htmlString, {
63
+ caseSensitive: true,
64
+ collapseWhitespace: true,
65
+ minifyCSS: true,
66
+ minifyJS: true,
67
+ removeComments: true,
68
+ });
69
+ const ast = parser.parse(minifiedHtml);
70
+ ast.css = cssString;
71
+ ast.componentFullName = project.name + '-' + cmp.replace(/\//g, '-');
72
+ ast.runtimeVersion = project.version;
73
+ ast.builderVersion = leanwebPackageJSON.version;
74
+ utils.writeIfChanged(`${utils.dirs.build}/components/${cmp}/ast.js`, `export default ${JSON.stringify(ast, null, 0)};`);
58
75
  }
59
- cssString += '\n[lw-false],[lw-for]{display:none !important;}\n';
60
- const htmlString = fs.readFileSync(htmlFilename, 'utf8');
61
- const minifiedHtml = minify(htmlString, {
62
- caseSensitive: true,
63
- collapseWhitespace: true,
64
- minifyCSS: true,
65
- minifyJS: true,
66
- removeComments: true,
67
- });
68
- const ast = parser.parse(minifiedHtml);
69
- ast.css = cssString;
70
- ast.componentFullName = project.name + '-' + cmp.replace(/\//g, '-');
71
- ast.runtimeVersion = project.version;
72
- ast.builderVersion = leanwebPackageJSON.version;
73
- utils.writeIfChanged(`${utils.dirs.build}/components/${cmp}/ast.js`, `export default ${JSON.stringify(ast, null, 0)};`);
74
- }
75
- });
76
+ });
77
+ } catch (e) {
78
+ console.error('Error in buildHTML:', e);
79
+ }
76
80
  };
77
81
 
78
82
  copySrc();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leanweb",
3
- "version": "3.0.6",
3
+ "version": "3.0.7",
4
4
  "description": "Builds framework agnostic web components.",
5
5
  "bin": {
6
6
  "leanweb": "leanweb.js",
@@ -20,12 +20,12 @@
20
20
  "author": "Qian Chen",
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "@babel/parser": "^7.28.3",
23
+ "@babel/parser": "^7.28.4",
24
24
  "esbuild": "^0.25.9",
25
25
  "fs-extra": "^11.3.1",
26
26
  "globby": "^14.1.0",
27
27
  "html-minifier": "^4.0.0",
28
- "isomorphic-git": "^1.33.0",
28
+ "isomorphic-git": "^1.33.1",
29
29
  "live-server": "^1.2.2",
30
30
  "node-watch": "^0.7.4",
31
31
  "parse5": "^8.0.0",