neo.mjs 10.3.0 → 10.3.1

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.
@@ -33,7 +33,9 @@ This new feature is built on a core Neo.mjs principle: **a commitment to a zero-
33
33
  To achieve both developer convenience and production performance, the framework uses a sophisticated dual-mode approach:
34
34
 
35
35
  1. **Development Mode:** Templates are parsed live in the browser using `parse5`. This parser is **only loaded if templates are actually used**, ensuring zero overhead for applications that stick to the JSON VDOM.
36
- 2. **Production Mode:** For `dist/esm`, `dist/dev`, and `dist/prod` builds, a powerful **build-time AST transformation** converts templates directly into optimized VDOM objects. This eliminates the `parse5` dependency from production builds entirely, resulting in **zero runtime parsing overhead** and maximum performance.
36
+ 2. **Production Mode:** For `dist/esm`, `dist/dev`, and `dist/prod` builds, a powerful **build-time AST transformation** converts templates directly into optimized VDOM objects. This eliminates the `parse5` dependency from production builds entirely, resulting in **zero runtime parsing overhead** and maximum performance. The `enableHtmlTemplates` flag is also automatically set to `false` in production environments, ensuring that the runtime parser is never accidentally used.
37
+
38
+ As a developer convenience, if you name your template-generating method `render()`, the build process will automatically rename it to `createVdom()` for you, aligning with the framework's lifecycle methods while providing a familiar entry point.
37
39
 
38
40
  ## Foundational Enhancements
39
41
 
@@ -51,4 +53,19 @@ To support this major new feature, we have added two comprehensive guides:
51
53
  - [Using HTML Templates](../learn/guides/uibuildingblocks/HtmlTemplates.md): A guide focused on the syntax, features, and best practices for using the new template system.
52
54
  - [Under the Hood: HTML Templates](../learn/guides/uibuildingblocks/HtmlTemplatesUnderTheHood.md): A deep dive into the philosophy and the dual-mode architecture, explaining how templates work in both development and production environments.
53
55
 
56
+ All changes combined into 1 commit: https://github.com/neomjs/neo/commit/0841e7e1a715c7afe67d07eebb8229e54828eedd
57
+
54
58
  We are incredibly excited about this release and believe it makes Neo.mjs more powerful and accessible than ever. Please explore the new feature, read the documentation, and share your feedback!
59
+
60
+ Try it out by yourself:</br>
61
+ https://neomjs.com/examples/functional/nestedTemplateComponent/
62
+
63
+ <img width="1603" height="1292" alt="Screenshot 2025-08-02 at 17 01 25" src="https://github.com/user-attachments/assets/79cb4aad-b791-4b03-bf25-7147bbeeed39" />
64
+
65
+ https://neomjs.com/dist/esm/examples/functional/nestedTemplateComponent/
66
+
67
+ <img width="1606" height="1062" alt="Screenshot 2025-08-02 at 17 00 12" src="https://github.com/user-attachments/assets/7a21638f-cb68-4f28-ba04-6ebaccb3b3f3" />
68
+
69
+ https://neomjs.com/dist/development/examples/functional/nestedTemplateComponent/
70
+
71
+ <img width="1602" height="1179" alt="Screenshot 2025-08-02 at 17 06 24" src="https://github.com/user-attachments/assets/2c1d3ef7-2008-41a1-9025-2859d907ce2d" />
@@ -0,0 +1,14 @@
1
+ # Neo.mjs v10.3.1: Build Process Reliability
2
+
3
+ This is a patch release focused on improving the stability and reliability of the core build process.
4
+
5
+ ## Key Fix: Build Process Dependency Order
6
+
7
+ ### The Problem
8
+ The main `buildAll.mjs` script could fail on a clean repository checkout. The build steps that process HTML templates (e.g., `buildESModules`) have a dependency on the `dist/parse5.mjs` bundle. However, the script did not guarantee that this bundle was created before it was needed, leading to a potential crash.
9
+
10
+ ### The Solution
11
+ We have updated `buildAll.mjs` to explicitly run the `bundleParse5.mjs` script as one of its first actions, immediately after the optional `npm install`.
12
+
13
+ ### The Impact
14
+ This change ensures the `parse5` dependency is always available for subsequent build tasks. It makes the build process more robust and predictable, particularly for developers setting up the project for the first time.
package/ServiceWorker.mjs CHANGED
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='10.3.0'
23
+ * @member {String} version='10.3.1'
24
24
  */
25
- version: '10.3.0'
25
+ version: '10.3.1'
26
26
  }
27
27
 
28
28
  /**
@@ -108,7 +108,7 @@ class FooterContainer extends Container {
108
108
  }, {
109
109
  module: Component,
110
110
  cls : ['neo-version'],
111
- text : 'v10.3.0'
111
+ text : 'v10.3.1'
112
112
  }]
113
113
  }],
114
114
  /**
@@ -129,6 +129,10 @@ if (programOpts.info) {
129
129
  childProcess.status && process.exit(childProcess.status);
130
130
  }
131
131
 
132
+ console.log(chalk.blue('Bundling parse5...'));
133
+ childProcess = spawnSync('node', [`${neoPath}/buildScripts/bundleParse5.mjs`], cpOpts);
134
+ childProcess.status && process.exit(childProcess.status);
135
+
132
136
  if (themes === 'yes') {
133
137
  childProcess = spawnSync('node', [`${neoPath}/buildScripts/buildThemes.mjs`].concat(cpArgs), cpOpts);
134
138
  childProcess.status && process.exit(childProcess.status);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "10.3.0",
3
+ "version": "10.3.1",
4
4
  "description": "Neo.mjs: The multi-threaded UI framework for building ultra-fast, desktop-like web applications with uncompromised responsiveness, inherent security, and a transpilation-free dev mode.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -29,7 +29,6 @@
29
29
  "inject-package-version": "node ./buildScripts/injectPackageVersion.mjs",
30
30
  "server-start": "webpack serve -c ./buildScripts/webpack/webpack.server.config.mjs --open",
31
31
  "test": "echo \"Error: no test specified\" && exit 1",
32
- "build-single-file": "node ./buildScripts/buildSingleFile.mjs",
33
32
  "watch-themes": "node ./buildScripts/watchThemes.mjs"
34
33
  },
35
34
  "keywords": [
@@ -299,12 +299,12 @@ const DefaultConfig = {
299
299
  useVdomWorker: true,
300
300
  /**
301
301
  * buildScripts/injectPackageVersion.mjs will update this value
302
- * @default '10.3.0'
302
+ * @default '10.3.1'
303
303
  * @memberOf! module:Neo
304
304
  * @name config.version
305
305
  * @type String
306
306
  */
307
- version: '10.3.0'
307
+ version: '10.3.1'
308
308
  };
309
309
 
310
310
  Object.assign(DefaultConfig, {
@@ -1,46 +0,0 @@
1
- /**
2
- * A regex to check if a string is a valid JavaScript identifier.
3
- * @member {RegExp} validIdentifierRegex=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/
4
- */
5
- const validIdentifierRegex = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;
6
-
7
- /**
8
- * Serializes a VDOM object into a JavaScript object literal string.
9
- * This is a custom implementation to ensure keys are unquoted if they are
10
- * valid identifiers, and correctly quoted otherwise. It also handles
11
- * special placeholders for runtime expressions.
12
- * @param {Object} vdom The VDOM object to serialize.
13
- * @returns {String} The string representation of the VDOM.
14
- */
15
- export function vdomToString(vdom) {
16
- if (vdom === null) {
17
- return 'null';
18
- }
19
- if (typeof vdom !== 'object') {
20
- // It's a primitive value (string, number, boolean)
21
- // Check for our special expression placeholder
22
- if (typeof vdom === 'string') {
23
- const match = vdom.match(/##__NEO_EXPR__(.*)##__NEO_EXPR__##/);
24
- if (match) {
25
- return match[1]; // Return the raw expression
26
- }
27
- }
28
- // Otherwise, stringify it normally
29
- return JSON.stringify(vdom);
30
- }
31
-
32
- if (Array.isArray(vdom)) {
33
- return `[${vdom.map(vdomToString).join(',')}]`;
34
- }
35
-
36
- const parts = [];
37
- for (const key in vdom) {
38
- if (Object.prototype.hasOwnProperty.call(vdom, key)) {
39
- const value = vdom[key];
40
- const keyString = validIdentifierRegex.test(key) ? key : `'${key}'`;
41
- parts.push(`${keyString}:${vdomToString(value)}`);
42
- }
43
- }
44
-
45
- return `{${parts.join(',')}}`;
46
- }