create-astroid 0.3.5 → 0.3.6
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-astroid",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Scaffold a new Astroid site — an editable, multi-editor Astro app on Cloudflare Workers — in one command.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@better-auth/passkey": "^1.6.23",
|
|
34
34
|
"better-auth": "^1.6.23",
|
|
35
|
-
"louise-toolkit": "0.
|
|
36
|
-
"astroidjs": "0.
|
|
35
|
+
"louise-toolkit": "0.22.0",
|
|
36
|
+
"astroidjs": "0.6.0"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=24.0.0"
|
|
@@ -54,7 +54,26 @@ const realtimeOn = (astroidConfig.modules ?? []).includes("realtime");
|
|
|
54
54
|
// Users, backed by editorsRoute). When the page passes `versionedPageId`,
|
|
55
55
|
// the bar gains Save draft + Publish, and this page's `<Editable>` fields
|
|
56
56
|
// are edited in place — their changes stage a draft, promoted on Publish.
|
|
57
|
+
// The sections editor currently mounted on this <body>, and which boot
|
|
58
|
+
// owns it. `boot()` runs at parse AND on `astro:page-load` — which Astro's
|
|
59
|
+
// ClientRouter fires on the initial load, not only on navigations — so two
|
|
60
|
+
// boots race, and the second lands while the first one's dynamic import is
|
|
61
|
+
// still in flight. Without a guard both mount, and the page gets two
|
|
62
|
+
// on-canvas chromes, two toolbars and two Publish buttons over one store.
|
|
63
|
+
//
|
|
64
|
+
// mountLouise and mountSettings are idempotent per page; mountSections is
|
|
65
|
+
// not, and it is also the one that needs disposing on a view-transition
|
|
66
|
+
// nav so its flush and unsaved-changes listeners don't outlive the page.
|
|
67
|
+
// Annotated, not inferred: `= null` alone infers `null`, and `astro check`
|
|
68
|
+
// runs strict — the scaffold smoke fails on ts(7034)/ts(7005) before a
|
|
69
|
+
// scaffolded site ever builds.
|
|
70
|
+
let teardown: (() => void) | null = null;
|
|
71
|
+
let generation = 0;
|
|
72
|
+
|
|
57
73
|
function boot() {
|
|
74
|
+
const gen = ++generation;
|
|
75
|
+
teardown?.();
|
|
76
|
+
teardown = null;
|
|
58
77
|
const el = document.getElementById("louise-boot");
|
|
59
78
|
if (!el) return;
|
|
60
79
|
Promise.all([
|
|
@@ -63,6 +82,8 @@ const realtimeOn = (astroidConfig.modules ?? []).includes("realtime");
|
|
|
63
82
|
import("astroidjs/components/sections"),
|
|
64
83
|
])
|
|
65
84
|
.then(([client, settings, lib]) => {
|
|
85
|
+
// Superseded while importing — a later boot owns the page now.
|
|
86
|
+
if (gen !== generation) return;
|
|
66
87
|
settings.mountSettings({
|
|
67
88
|
userName: el.dataset.louiseUser || "Editor",
|
|
68
89
|
users: true,
|
|
@@ -90,7 +111,7 @@ const realtimeOn = (astroidConfig.modules ?? []).includes("realtime");
|
|
|
90
111
|
const host = document.querySelector<HTMLElement>("[data-louise-sections-host]");
|
|
91
112
|
const raw = el.dataset.louiseSections;
|
|
92
113
|
if (host && raw && pageId != null) {
|
|
93
|
-
client.mountSections(host, {
|
|
114
|
+
teardown = client.mountSections(host, {
|
|
94
115
|
catalog: lib.astroidSectionCatalog,
|
|
95
116
|
pageId,
|
|
96
117
|
initial: JSON.parse(raw),
|
|
@@ -113,7 +113,7 @@ if (editMode && page) {
|
|
|
113
113
|
<main>
|
|
114
114
|
{/* The page-builder sections, edited on-canvas. <Sections> resolves every
|
|
115
115
|
image's alt/caption from the media registry in ONE query for the whole
|
|
116
|
-
page, then hands each section its own path so `data-louise-
|
|
116
|
+
page, then hands each section its own path so `data-louise-node`
|
|
117
117
|
markers land at the right depth. */}
|
|
118
118
|
<Sections items={sections} db={env.DB} mediaBase={env.MEDIA_URL} />
|
|
119
119
|
|