vaderjs 1.9.5 → 1.9.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.
- package/index.ts +13 -8
- package/main.js +3 -1
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -37,13 +37,15 @@ declare global {
|
|
|
37
37
|
//@ts-ignore
|
|
38
38
|
globalThis.isServer = typeof window === "undefined";
|
|
39
39
|
//@ts-ignore
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
40
|
+
if(isServer){
|
|
41
|
+
globalThis.params = {
|
|
42
|
+
[Symbol.iterator]: function* () {
|
|
43
|
+
for (const key in this) {
|
|
44
|
+
yield [key, this[key]];
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
47
49
|
|
|
48
50
|
|
|
49
51
|
|
|
@@ -153,9 +155,12 @@ export const e = (element, props, ...children) => {
|
|
|
153
155
|
firstEl = { type: "div", props: { key: instance.key, ...props }, children };
|
|
154
156
|
firstEl.props = { key: instance.key, ...firstEl.props, ...props };
|
|
155
157
|
firstEl.props["idKey"] = instance.key;
|
|
156
|
-
instance.props = firstEl.props;
|
|
158
|
+
instance.props = firstEl.props;
|
|
157
159
|
return firstEl;
|
|
158
160
|
default:
|
|
161
|
+
if(!element) {
|
|
162
|
+
return "";
|
|
163
|
+
}
|
|
159
164
|
let el = { type: element, props: props || {}, children: children || [] };
|
|
160
165
|
if (el.type !== "head") {
|
|
161
166
|
el.props = { idKey: crypto.randomUUID(), ...el.props };
|
package/main.js
CHANGED
|
@@ -216,11 +216,13 @@ async function generateApp() {
|
|
|
216
216
|
r = r.replace(process.cwd().replace(/\\/g, '/') + '/app', '')
|
|
217
217
|
r = r.replace('.jsx', '.js').replace('.tsx', '.js')
|
|
218
218
|
fs.mkdirSync(path.join(process.cwd() + '/dist', path.dirname(r)), { recursive: true })
|
|
219
|
+
let params = routes.match(route).params || {}
|
|
220
|
+
// handle route params multiple and
|
|
219
221
|
fs.writeFileSync(process.cwd() + '/dist/' + path.dirname(r) + '/' + path.basename(r), `
|
|
220
222
|
let route = window.location.pathname.split('/').filter(v => v !== '')
|
|
221
223
|
let params = {
|
|
222
224
|
${Object.keys(routes.match(route).params || {}).length > 0 ? Object.keys(routes.match(route).params || {}).map(p => {
|
|
223
|
-
return `${p}: route[${Object.keys(routes.match(route).params).indexOf(p)
|
|
225
|
+
return `${p}: route[${Object.keys(routes.match(route).params || {}).indexOf(p)}]`
|
|
224
226
|
}).join(',') : ""}
|
|
225
227
|
}
|
|
226
228
|
\n${code}
|