pawa-ssr 1.0.7 → 1.0.9
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 +27 -11
- package/package.json +1 -1
- package/utils.js +1 -1
package/index.js
CHANGED
|
@@ -26,17 +26,33 @@ export const $state=(arg)=>{
|
|
|
26
26
|
*/
|
|
27
27
|
export const allServerAttr=['server-if','server-else','server-else-if','server-for']
|
|
28
28
|
|
|
29
|
-
export const RegisterComponent=(...
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
export const RegisterComponent = (...args) => {
|
|
30
|
+
// Handle new signature from plugin: RegisterComponent('Name1', Func1, 'Name2', Func2, ...)
|
|
31
|
+
if (typeof args[0] === 'string') {
|
|
32
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
33
|
+
const name = args[i];
|
|
34
|
+
const component = args[i + 1];
|
|
35
|
+
if (typeof name === 'string' && typeof component === 'function') {
|
|
36
|
+
if (components.has(name.toUpperCase())) continue;
|
|
37
|
+
components.set(name.toUpperCase(), component);
|
|
38
|
+
} else {
|
|
39
|
+
console.warn('Mismatched arguments for RegisterComponent. Expected pairs of (string, function).');
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Handle old signature for dev mode: RegisterComponent(ComponentFunc1, ComponentFunc2, ...)
|
|
47
|
+
args.forEach((component) => {
|
|
48
|
+
if (typeof component === 'function' && component.name) {
|
|
49
|
+
if (components.has(component.name.toUpperCase())) return;
|
|
50
|
+
components.set(component.name.toUpperCase(), component);
|
|
51
|
+
} else {
|
|
52
|
+
console.warn('Component registration failed: Component must be a named function. This might happen in production builds without the pawajs Vite plugin.');
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
};
|
|
40
56
|
|
|
41
57
|
const compoBeforeCall = new Set()
|
|
42
58
|
const compoAfterCall=new Set()
|
package/package.json
CHANGED