chore: support Astro 4

This commit is contained in:
Ayo 2023-12-07 15:38:35 +01:00
parent 6be7424e07
commit 9107b00a6f
3 changed files with 1533 additions and 1639 deletions

3150
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -35,6 +35,6 @@
"devalue": "^4.3.2" "devalue": "^4.3.2"
}, },
"peerDependencies": { "peerDependencies": {
"astro": "^3.1.1" "astro": "^4.0.3"
} }
} }

View file

@ -21,4 +21,24 @@ export type Data = typeof data;
const data = deserialize<Data>('my-data', parse); const data = deserialize<Data>('my-data', parse);
console.log(data); console.log(data);
Object.keys(data).forEach(key => console.log(key, data[key], typeof data[key]))
// render table to render-here
const table = document.createElement('table');
const tbody = document.createElement('tbody');
table.appendChild(tbody);
Object.keys(data).forEach(key => {
const tr = document.createElement('tr');
const tdKey = document.createElement('td');
const tdValue = document.createElement('td');
tdKey.textContent = key;
tdValue.textContent = data[key];
tr.appendChild(tdKey);
tr.appendChild(tdValue);
tbody.appendChild(tr);
});
document.getElementById('render-here').appendChild(table);
</script> </script>