pawa-ssr 1.3.18 → 1.3.20

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
@@ -5,7 +5,7 @@ import { propsValidator, evaluateExpr,extractAtExpressions, reArrangeAttri,resum
5
5
  import {AsyncLocalStorage} from'node:async_hooks'
6
6
  import { If,For,State,Switch, Key } from'./power.js';
7
7
  import PawaElement from'./pawaElement.js'
8
- import { pluginsMap, lazyComponents } from "/pawajs";
8
+ import { pluginsMap, lazyComponents } from "pawajs/index.js";
9
9
 
10
10
  const PAWA_STORE_SYMBOL = Symbol.for('pawa.ssr.store');
11
11
 
@@ -1023,6 +1023,7 @@ export const render =async (el, contexts = {},stream) => {
1023
1023
  if (isStream) {
1024
1024
  stream(`<script>document.title='${el.querySelector('title').textContent || ''}'</script>`)
1025
1025
  }
1026
+ return
1026
1027
  }
1027
1028
  Array.from(el.children).forEach(child => {
1028
1029
  el.ownerDocument.head.appendChild(child)
@@ -1115,16 +1116,22 @@ export const render =async (el, contexts = {},stream) => {
1115
1116
  return
1116
1117
  }
1117
1118
  if (el._componentName) {
1118
- if(el._lazy && lazyComponents.has(el.tagName)){
1119
- const lazyComponent=lazyComponents.get(el.tagName)
1120
- const {name,component} =lazyComponent()
1119
+ // console.log(el._lazy , lazyComponents.has(el.tagName),components.has(el.tagName));
1120
+ if(el._lazy && lazyComponents.has(splitAndAdd(el.tagName)) && !components.has(splitAndAdd(el.tagName))){
1121
+ try {
1122
+ const lazyComponent=lazyComponents.get(splitAndAdd(el.tagName))
1123
+ const {name,component} =lazyComponent
1121
1124
  const compo=await component()
1122
1125
  if(compo[name]){
1126
+
1123
1127
  components.set(name,compo[name])
1124
1128
  el._component.component=compo[name]
1125
1129
  el._component.validPropRule=compo[name]?.validateProps || {};
1126
1130
  lazyComponents.delete(el.tagName)
1127
1131
  }
1132
+ } catch (error) {
1133
+ throw new Error(`lazy component ${el.tagName} : Error from the component - ${error.message}`,error.message)
1134
+ }
1128
1135
  }
1129
1136
  if(isStream){
1130
1137
  await streamingComponent(el,stream)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pawa-ssr",
3
- "version": "1.3.18",
3
+ "version": "1.3.20",
4
4
  "type":"module",
5
5
  "description": "pawajs ssr libary",
6
6
  "main": "index.js",
@@ -25,6 +25,6 @@
25
25
  "homepage": "https://github.com/Allisboy/pawajs-ssr#readme",
26
26
  "dependencies": {
27
27
  "linkedom": "^0.18.11",
28
- "pawajs": "^1.4.36"
28
+ "pawajs": "^1.4.39"
29
29
  }
30
30
  }
package/pawaElement.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { HTMLElement, parseHTML } from "linkedom"
2
2
  import {getPawaAttributes, getDevelopment } from "./index.js"
3
- import {components,lazyComponents} from 'pawajs'
3
+ import {components,lazyComponents} from 'pawajs/index.js'
4
4
  import PawaComponent from "./pawaComponent.js"
5
5
  import { evaluateExpr, splitAndAdd,replaceTemplateOperators } from "./utils.js"
6
6
 
@@ -56,6 +56,7 @@ class PawaElement {
56
56
  * @property{any}
57
57
  * Object of Html Attributes for Rest Attributes
58
58
  */
59
+ this.checkLazy()
59
60
  this._restProps={}
60
61
  this._componentChildren=null
61
62
  this.getComponent()