onelaraveljs 1.2.2 → 1.2.4

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/index.js CHANGED
@@ -17,4 +17,4 @@ export {
17
17
  // Default export
18
18
  export default App;
19
19
 
20
- export { default as ViewRegistryPlugin } from './src/plugins/ViewRegistryPlugin.js';
20
+
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "onelaraveljs",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "OneLaravel JS Framework Core & Compiler",
5
5
  "main": "index.js",
6
+ "exports": {
7
+ ".": "./index.js",
8
+ "./plugins": "./plugins.js"
9
+ },
6
10
  "bin": {
7
11
  "onejs-build": "./bin/onejs-build.js"
8
12
  },
package/plugins.js ADDED
@@ -0,0 +1 @@
1
+ export { default as ViewRegistryPlugin } from './src/plugins/ViewRegistryPlugin.js';
@@ -13,6 +13,7 @@ class PHPToJSConverter:
13
13
 
14
14
  def convert_php_expression_to_js(self, expr: str) -> str:
15
15
  """Convert PHP expression to JavaScript"""
16
+ # print(f"DEBUG_CONVERT: {expr}")
16
17
  if not expr or not expr.strip():
17
18
  return "''"
18
19
 
@@ -34,7 +35,9 @@ class PHPToJSConverter:
34
35
  pass # Skip string concatenation for ternary operators
35
36
  # Check if this is object access pattern (var->method) - skip if so
36
37
  # Pattern: anything->anything (not just $var->method)
37
- elif not re.search(r'[a-zA-Z_][a-zA-Z0-9_]*->[a-zA-Z_][a-zA-Z0-9_]*', expr):
38
+ # Also skip if it looks like JS object access (obj.prop)
39
+ elif not re.search(r'[a-zA-Z_][a-zA-Z0-9_]*->[a-zA-Z_][a-zA-Z0-9_]*', expr) and \
40
+ not re.search(r'[a-zA-Z_][a-zA-Z0-9_]*\.[a-zA-Z_][a-zA-Z0-9_]*', expr):
38
41
  expr = self._handle_string_concatenation(expr)
39
42
  # Restore ++ and -- operators
40
43
  expr = expr.replace('__INC_OPERATOR__', '++')
@@ -457,6 +460,12 @@ class PHPToJSConverter:
457
460
  # Skip ternary operators like condition ? value1 : value2
458
461
  if re.search(r'\?.*:', expr):
459
462
  return expr
463
+
464
+ # Skip JS style property access (obj.prop)
465
+ # This prevents converting console.log to console+log
466
+ if re.search(r'\b[a-zA-Z_][a-zA-Z0-9_]*\.[a-zA-Z_][a-zA-Z0-9_]*\b', expr_without_strings):
467
+ return expr
468
+
460
469
  # Also skip object method calls like now().format() or App.Helper.now().format()
461
470
  # Pattern: method().method() or object.method().method()
462
471
  if re.search(r'[a-zA-Z_][a-zA-Z0-9_]*\s*\([^)]*\)\s*\.\s*[a-zA-Z_][a-zA-Z0-9_]*\s*\(', expr):