astro 4.6.3 → 4.6.4
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/components/ViewTransitions.astro +9 -2
- package/dist/assets/endpoint/generic.js +2 -2
- package/dist/assets/endpoint/node.js +2 -2
- package/dist/assets/utils/emitAsset.d.ts +6 -1
- package/dist/assets/utils/emitAsset.js +15 -9
- package/dist/assets/vite-plugin-assets.js +6 -1
- package/dist/config/index.js +2 -2
- package/dist/content/runtime-assets.d.ts +1 -1
- package/dist/content/runtime-assets.js +2 -2
- package/dist/content/runtime.d.ts +1 -1
- package/dist/content/utils.d.ts +1 -1
- package/dist/content/utils.js +2 -2
- package/dist/content/vite-plugin-content-imports.js +10 -2
- package/dist/core/app/createOutgoingHttpHeaders.d.ts +1 -0
- package/dist/core/config/schema.d.ts +332 -289
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/runtime/server/astro-island.js +132 -137
- package/dist/runtime/server/astro-island.prebuilt-dev.d.ts +1 -1
- package/dist/runtime/server/astro-island.prebuilt-dev.js +1 -1
- package/dist/runtime/server/astro-island.prebuilt.d.ts +1 -1
- package/dist/runtime/server/astro-island.prebuilt.js +1 -1
- package/dist/transitions/router.js +0 -1
- package/dist/vite-plugin-markdown/images.d.ts +0 -1
- package/dist/vite-plugin-markdown/images.js +1 -4
- package/dist/vite-plugin-markdown/index.js +8 -2
- package/package.json +46 -49
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
|
|
|
23
23
|
base: restart.container.settings.config.base
|
|
24
24
|
})
|
|
25
25
|
);
|
|
26
|
-
const currentVersion = "4.6.
|
|
26
|
+
const currentVersion = "4.6.4";
|
|
27
27
|
if (currentVersion.includes("-")) {
|
|
28
28
|
logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
|
|
29
29
|
}
|
package/dist/core/messages.js
CHANGED
|
@@ -36,7 +36,7 @@ function serverStart({
|
|
|
36
36
|
host,
|
|
37
37
|
base
|
|
38
38
|
}) {
|
|
39
|
-
const version = "4.6.
|
|
39
|
+
const version = "4.6.4";
|
|
40
40
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
41
41
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
42
42
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -261,7 +261,7 @@ function printHelp({
|
|
|
261
261
|
message.push(
|
|
262
262
|
linebreak(),
|
|
263
263
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
264
|
-
`v${"4.6.
|
|
264
|
+
`v${"4.6.4"}`
|
|
265
265
|
)} ${headline}`
|
|
266
266
|
);
|
|
267
267
|
}
|
|
@@ -22,146 +22,141 @@
|
|
|
22
22
|
return raw;
|
|
23
23
|
return Object.fromEntries(Object.entries(raw).map(([key, value]) => [key, reviveTuple(value)]));
|
|
24
24
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (this.lastChild?.nodeType === Node.COMMENT_NODE && this.lastChild.nodeValue === "astro:end") {
|
|
47
|
-
this.lastChild.remove();
|
|
48
|
-
onConnected();
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
mo.observe(this, { childList: true });
|
|
52
|
-
document.addEventListener("DOMContentLoaded", onConnected);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
async childrenConnectedCallback() {
|
|
56
|
-
let beforeHydrationUrl = this.getAttribute("before-hydration-url");
|
|
57
|
-
if (beforeHydrationUrl) {
|
|
58
|
-
await import(beforeHydrationUrl);
|
|
59
|
-
}
|
|
60
|
-
this.start();
|
|
61
|
-
}
|
|
62
|
-
async start() {
|
|
63
|
-
const opts = JSON.parse(this.getAttribute("opts"));
|
|
64
|
-
const directive = this.getAttribute("client");
|
|
65
|
-
if (Astro[directive] === void 0) {
|
|
66
|
-
window.addEventListener(`astro:${directive}`, () => this.start(), { once: true });
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
try {
|
|
70
|
-
await Astro[directive](
|
|
71
|
-
async () => {
|
|
72
|
-
const rendererUrl = this.getAttribute("renderer-url");
|
|
73
|
-
const [componentModule, { default: hydrator }] = await Promise.all([
|
|
74
|
-
import(this.getAttribute("component-url")),
|
|
75
|
-
rendererUrl ? import(rendererUrl) : () => () => {
|
|
76
|
-
}
|
|
77
|
-
]);
|
|
78
|
-
const componentExport = this.getAttribute("component-export") || "default";
|
|
79
|
-
if (!componentExport.includes(".")) {
|
|
80
|
-
this.Component = componentModule[componentExport];
|
|
81
|
-
} else {
|
|
82
|
-
this.Component = componentModule;
|
|
83
|
-
for (const part of componentExport.split(".")) {
|
|
84
|
-
this.Component = this.Component[part];
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
this.hydrator = hydrator;
|
|
88
|
-
return this.hydrate;
|
|
89
|
-
},
|
|
90
|
-
opts,
|
|
91
|
-
this
|
|
92
|
-
);
|
|
93
|
-
} catch (e) {
|
|
94
|
-
console.error(
|
|
95
|
-
`[astro-island] Error hydrating ${this.getAttribute("component-url")}`,
|
|
96
|
-
e
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
hydrate = async () => {
|
|
101
|
-
if (!this.hydrator)
|
|
102
|
-
return;
|
|
103
|
-
if (!this.isConnected)
|
|
104
|
-
return;
|
|
105
|
-
const parentSsrIsland = this.parentElement?.closest("astro-island[ssr]");
|
|
106
|
-
if (parentSsrIsland) {
|
|
107
|
-
parentSsrIsland.addEventListener("astro:hydrate", this.hydrate, { once: true });
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
const slotted = this.querySelectorAll("astro-slot");
|
|
111
|
-
const slots = {};
|
|
112
|
-
const templates = this.querySelectorAll("template[data-astro-template]");
|
|
113
|
-
for (const template of templates) {
|
|
114
|
-
const closest = template.closest(this.tagName);
|
|
115
|
-
if (!closest?.isSameNode(this))
|
|
116
|
-
continue;
|
|
117
|
-
slots[template.getAttribute("data-astro-template") || "default"] = template.innerHTML;
|
|
118
|
-
template.remove();
|
|
119
|
-
}
|
|
120
|
-
for (const slot of slotted) {
|
|
121
|
-
const closest = slot.closest(this.tagName);
|
|
122
|
-
if (!closest?.isSameNode(this))
|
|
123
|
-
continue;
|
|
124
|
-
slots[slot.getAttribute("name") || "default"] = slot.innerHTML;
|
|
25
|
+
class AstroIsland extends HTMLElement {
|
|
26
|
+
Component;
|
|
27
|
+
hydrator;
|
|
28
|
+
static observedAttributes = ["props"];
|
|
29
|
+
disconnectedCallback() {
|
|
30
|
+
document.removeEventListener("astro:after-swap", this.unmount);
|
|
31
|
+
document.addEventListener("astro:after-swap", this.unmount, { once: true });
|
|
32
|
+
}
|
|
33
|
+
connectedCallback() {
|
|
34
|
+
if (!this.hasAttribute("await-children") || document.readyState === "interactive" || document.readyState === "complete") {
|
|
35
|
+
this.childrenConnectedCallback();
|
|
36
|
+
} else {
|
|
37
|
+
const onConnected = () => {
|
|
38
|
+
document.removeEventListener("DOMContentLoaded", onConnected);
|
|
39
|
+
mo.disconnect();
|
|
40
|
+
this.childrenConnectedCallback();
|
|
41
|
+
};
|
|
42
|
+
const mo = new MutationObserver(() => {
|
|
43
|
+
if (this.lastChild?.nodeType === Node.COMMENT_NODE && this.lastChild.nodeValue === "astro:end") {
|
|
44
|
+
this.lastChild.remove();
|
|
45
|
+
onConnected();
|
|
125
46
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
47
|
+
});
|
|
48
|
+
mo.observe(this, { childList: true });
|
|
49
|
+
document.addEventListener("DOMContentLoaded", onConnected);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async childrenConnectedCallback() {
|
|
53
|
+
let beforeHydrationUrl = this.getAttribute("before-hydration-url");
|
|
54
|
+
if (beforeHydrationUrl) {
|
|
55
|
+
await import(beforeHydrationUrl);
|
|
56
|
+
}
|
|
57
|
+
this.start();
|
|
58
|
+
}
|
|
59
|
+
async start() {
|
|
60
|
+
const opts = JSON.parse(this.getAttribute("opts"));
|
|
61
|
+
const directive = this.getAttribute("client");
|
|
62
|
+
if (Astro[directive] === void 0) {
|
|
63
|
+
window.addEventListener(`astro:${directive}`, () => this.start(), { once: true });
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
await Astro[directive](
|
|
68
|
+
async () => {
|
|
69
|
+
const rendererUrl = this.getAttribute("renderer-url");
|
|
70
|
+
const [componentModule, { default: hydrator }] = await Promise.all([
|
|
71
|
+
import(this.getAttribute("component-url")),
|
|
72
|
+
rendererUrl ? import(rendererUrl) : () => () => {
|
|
73
|
+
}
|
|
74
|
+
]);
|
|
75
|
+
const componentExport = this.getAttribute("component-export") || "default";
|
|
76
|
+
if (!componentExport.includes(".")) {
|
|
77
|
+
this.Component = componentModule[componentExport];
|
|
78
|
+
} else {
|
|
79
|
+
this.Component = componentModule;
|
|
80
|
+
for (const part of componentExport.split(".")) {
|
|
81
|
+
this.Component = this.Component[part];
|
|
82
|
+
}
|
|
134
83
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
84
|
+
this.hydrator = hydrator;
|
|
85
|
+
return this.hydrate;
|
|
86
|
+
},
|
|
87
|
+
opts,
|
|
88
|
+
this
|
|
89
|
+
);
|
|
90
|
+
} catch (e) {
|
|
91
|
+
console.error(`[astro-island] Error hydrating ${this.getAttribute("component-url")}`, e);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
hydrate = async () => {
|
|
95
|
+
if (!this.hydrator)
|
|
96
|
+
return;
|
|
97
|
+
if (!this.isConnected)
|
|
98
|
+
return;
|
|
99
|
+
const parentSsrIsland = this.parentElement?.closest("astro-island[ssr]");
|
|
100
|
+
if (parentSsrIsland) {
|
|
101
|
+
parentSsrIsland.addEventListener("astro:hydrate", this.hydrate, { once: true });
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const slotted = this.querySelectorAll("astro-slot");
|
|
105
|
+
const slots = {};
|
|
106
|
+
const templates = this.querySelectorAll("template[data-astro-template]");
|
|
107
|
+
for (const template of templates) {
|
|
108
|
+
const closest = template.closest(this.tagName);
|
|
109
|
+
if (!closest?.isSameNode(this))
|
|
110
|
+
continue;
|
|
111
|
+
slots[template.getAttribute("data-astro-template") || "default"] = template.innerHTML;
|
|
112
|
+
template.remove();
|
|
113
|
+
}
|
|
114
|
+
for (const slot of slotted) {
|
|
115
|
+
const closest = slot.closest(this.tagName);
|
|
116
|
+
if (!closest?.isSameNode(this))
|
|
117
|
+
continue;
|
|
118
|
+
slots[slot.getAttribute("name") || "default"] = slot.innerHTML;
|
|
119
|
+
}
|
|
120
|
+
let props;
|
|
121
|
+
try {
|
|
122
|
+
props = this.hasAttribute("props") ? reviveObject(JSON.parse(this.getAttribute("props"))) : {};
|
|
123
|
+
} catch (e) {
|
|
124
|
+
let componentName = this.getAttribute("component-url") || "<unknown>";
|
|
125
|
+
const componentExport = this.getAttribute("component-export");
|
|
126
|
+
if (componentExport) {
|
|
127
|
+
componentName += ` (export ${componentExport})`;
|
|
159
128
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
129
|
+
console.error(
|
|
130
|
+
`[hydrate] Error parsing props for component ${componentName}`,
|
|
131
|
+
this.getAttribute("props"),
|
|
132
|
+
e
|
|
133
|
+
);
|
|
134
|
+
throw e;
|
|
164
135
|
}
|
|
165
|
-
|
|
136
|
+
let hydrationTimeStart;
|
|
137
|
+
const hydrator = this.hydrator(this);
|
|
138
|
+
if (process.env.NODE_ENV === "development")
|
|
139
|
+
hydrationTimeStart = performance.now();
|
|
140
|
+
await hydrator(this.Component, props, slots, {
|
|
141
|
+
client: this.getAttribute("client")
|
|
142
|
+
});
|
|
143
|
+
if (process.env.NODE_ENV === "development" && hydrationTimeStart)
|
|
144
|
+
this.setAttribute(
|
|
145
|
+
"client-render-time",
|
|
146
|
+
(performance.now() - hydrationTimeStart).toString()
|
|
147
|
+
);
|
|
148
|
+
this.removeAttribute("ssr");
|
|
149
|
+
this.dispatchEvent(new CustomEvent("astro:hydrate"));
|
|
150
|
+
};
|
|
151
|
+
attributeChangedCallback() {
|
|
152
|
+
this.hydrate();
|
|
153
|
+
}
|
|
154
|
+
unmount = () => {
|
|
155
|
+
if (!this.isConnected)
|
|
156
|
+
this.dispatchEvent(new CustomEvent("astro:unmount"));
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
if (!customElements.get("astro-island")) {
|
|
160
|
+
customElements.define("astro-island", AstroIsland);
|
|
166
161
|
}
|
|
167
162
|
}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Do not edit this directly, but instead edit that file and rerun the prebuild
|
|
4
4
|
* to generate this file.
|
|
5
5
|
*/
|
|
6
|
-
declare const _default: "(()=>{var
|
|
6
|
+
declare const _default: "(()=>{var A=Object.defineProperty;var g=(a,o,i)=>o in a?A(a,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[o]=i;var l=(a,o,i)=>(g(a,typeof o!=\"symbol\"?o+\"\":o,i),i);{let a={0:t=>y(t),1:t=>i(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(i(t)),5:t=>new Set(i(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t)},o=t=>{let[h,e]=t;return h in a?a[h](e):void 0},i=t=>t.map(o),y=t=>typeof t!=\"object\"||t===null?t:Object.fromEntries(Object.entries(t).map(([h,e])=>[h,o(e)]));class f extends HTMLElement{constructor(){super(...arguments);l(this,\"Component\");l(this,\"hydrator\");l(this,\"hydrate\",async()=>{var b;if(!this.hydrator||!this.isConnected)return;let e=(b=this.parentElement)==null?void 0:b.closest(\"astro-island[ssr]\");if(e){e.addEventListener(\"astro:hydrate\",this.hydrate,{once:!0});return}let c=this.querySelectorAll(\"astro-slot\"),n={},p=this.querySelectorAll(\"template[data-astro-template]\");for(let r of p){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute(\"data-astro-template\")||\"default\"]=r.innerHTML,r.remove())}for(let r of c){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute(\"name\")||\"default\"]=r.innerHTML)}let u;try{u=this.hasAttribute(\"props\")?y(JSON.parse(this.getAttribute(\"props\"))):{}}catch(r){let s=this.getAttribute(\"component-url\")||\"<unknown>\",v=this.getAttribute(\"component-export\");throw v&&(s+=` (export ${v})`),console.error(`[hydrate] Error parsing props for component ${s}`,this.getAttribute(\"props\"),r),r}let d,m=this.hydrator(this);d=performance.now(),await m(this.Component,u,n,{client:this.getAttribute(\"client\")}),d&&this.setAttribute(\"client-render-time\",(performance.now()-d).toString()),this.removeAttribute(\"ssr\"),this.dispatchEvent(new CustomEvent(\"astro:hydrate\"))});l(this,\"unmount\",()=>{this.isConnected||this.dispatchEvent(new CustomEvent(\"astro:unmount\"))})}disconnectedCallback(){document.removeEventListener(\"astro:after-swap\",this.unmount),document.addEventListener(\"astro:after-swap\",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute(\"await-children\")||document.readyState===\"interactive\"||document.readyState===\"complete\")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener(\"DOMContentLoaded\",e),c.disconnect(),this.childrenConnectedCallback()},c=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue===\"astro:end\"&&(this.lastChild.remove(),e())});c.observe(this,{childList:!0}),document.addEventListener(\"DOMContentLoaded\",e)}}async childrenConnectedCallback(){let e=this.getAttribute(\"before-hydration-url\");e&&await import(e),this.start()}async start(){let e=JSON.parse(this.getAttribute(\"opts\")),c=this.getAttribute(\"client\");if(Astro[c]===void 0){window.addEventListener(`astro:${c}`,()=>this.start(),{once:!0});return}try{await Astro[c](async()=>{let n=this.getAttribute(\"renderer-url\"),[p,{default:u}]=await Promise.all([import(this.getAttribute(\"component-url\")),n?import(n):()=>()=>{}]),d=this.getAttribute(\"component-export\")||\"default\";if(!d.includes(\".\"))this.Component=p[d];else{this.Component=p;for(let m of d.split(\".\"))this.Component=this.Component[m]}return this.hydrator=u,this.hydrate},e,this)}catch(n){console.error(`[astro-island] Error hydrating ${this.getAttribute(\"component-url\")}`,n)}}attributeChangedCallback(){this.hydrate()}}l(f,\"observedAttributes\",[\"props\"]),customElements.get(\"astro-island\")||customElements.define(\"astro-island\",f)}})();";
|
|
7
7
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var astro_island_prebuilt_dev_default = `(()=>{var
|
|
1
|
+
var astro_island_prebuilt_dev_default = `(()=>{var A=Object.defineProperty;var g=(a,o,i)=>o in a?A(a,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[o]=i;var l=(a,o,i)=>(g(a,typeof o!="symbol"?o+"":o,i),i);{let a={0:t=>y(t),1:t=>i(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(i(t)),5:t=>new Set(i(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t)},o=t=>{let[h,e]=t;return h in a?a[h](e):void 0},i=t=>t.map(o),y=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([h,e])=>[h,o(e)]));class f extends HTMLElement{constructor(){super(...arguments);l(this,"Component");l(this,"hydrator");l(this,"hydrate",async()=>{var b;if(!this.hydrator||!this.isConnected)return;let e=(b=this.parentElement)==null?void 0:b.closest("astro-island[ssr]");if(e){e.addEventListener("astro:hydrate",this.hydrate,{once:!0});return}let c=this.querySelectorAll("astro-slot"),n={},p=this.querySelectorAll("template[data-astro-template]");for(let r of p){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute("data-astro-template")||"default"]=r.innerHTML,r.remove())}for(let r of c){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute("name")||"default"]=r.innerHTML)}let u;try{u=this.hasAttribute("props")?y(JSON.parse(this.getAttribute("props"))):{}}catch(r){let s=this.getAttribute("component-url")||"<unknown>",v=this.getAttribute("component-export");throw v&&(s+=\` (export \${v})\`),console.error(\`[hydrate] Error parsing props for component \${s}\`,this.getAttribute("props"),r),r}let d,m=this.hydrator(this);d=performance.now(),await m(this.Component,u,n,{client:this.getAttribute("client")}),d&&this.setAttribute("client-render-time",(performance.now()-d).toString()),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))});l(this,"unmount",()=>{this.isConnected||this.dispatchEvent(new CustomEvent("astro:unmount"))})}disconnectedCallback(){document.removeEventListener("astro:after-swap",this.unmount),document.addEventListener("astro:after-swap",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute("await-children")||document.readyState==="interactive"||document.readyState==="complete")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener("DOMContentLoaded",e),c.disconnect(),this.childrenConnectedCallback()},c=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue==="astro:end"&&(this.lastChild.remove(),e())});c.observe(this,{childList:!0}),document.addEventListener("DOMContentLoaded",e)}}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}async start(){let e=JSON.parse(this.getAttribute("opts")),c=this.getAttribute("client");if(Astro[c]===void 0){window.addEventListener(\`astro:\${c}\`,()=>this.start(),{once:!0});return}try{await Astro[c](async()=>{let n=this.getAttribute("renderer-url"),[p,{default:u}]=await Promise.all([import(this.getAttribute("component-url")),n?import(n):()=>()=>{}]),d=this.getAttribute("component-export")||"default";if(!d.includes("."))this.Component=p[d];else{this.Component=p;for(let m of d.split("."))this.Component=this.Component[m]}return this.hydrator=u,this.hydrate},e,this)}catch(n){console.error(\`[astro-island] Error hydrating \${this.getAttribute("component-url")}\`,n)}}attributeChangedCallback(){this.hydrate()}}l(f,"observedAttributes",["props"]),customElements.get("astro-island")||customElements.define("astro-island",f)}})();`;
|
|
2
2
|
export {
|
|
3
3
|
astro_island_prebuilt_dev_default as default
|
|
4
4
|
};
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Do not edit this directly, but instead edit that file and rerun the prebuild
|
|
4
4
|
* to generate this file.
|
|
5
5
|
*/
|
|
6
|
-
declare const _default: "(()=>{var
|
|
6
|
+
declare const _default: "(()=>{var A=Object.defineProperty;var g=(a,o,i)=>o in a?A(a,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[o]=i;var d=(a,o,i)=>(g(a,typeof o!=\"symbol\"?o+\"\":o,i),i);{let a={0:t=>m(t),1:t=>i(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(i(t)),5:t=>new Set(i(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t)},o=t=>{let[l,e]=t;return l in a?a[l](e):void 0},i=t=>t.map(o),m=t=>typeof t!=\"object\"||t===null?t:Object.fromEntries(Object.entries(t).map(([l,e])=>[l,o(e)]));class y extends HTMLElement{constructor(){super(...arguments);d(this,\"Component\");d(this,\"hydrator\");d(this,\"hydrate\",async()=>{var b;if(!this.hydrator||!this.isConnected)return;let e=(b=this.parentElement)==null?void 0:b.closest(\"astro-island[ssr]\");if(e){e.addEventListener(\"astro:hydrate\",this.hydrate,{once:!0});return}let c=this.querySelectorAll(\"astro-slot\"),n={},h=this.querySelectorAll(\"template[data-astro-template]\");for(let r of h){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute(\"data-astro-template\")||\"default\"]=r.innerHTML,r.remove())}for(let r of c){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute(\"name\")||\"default\"]=r.innerHTML)}let p;try{p=this.hasAttribute(\"props\")?m(JSON.parse(this.getAttribute(\"props\"))):{}}catch(r){let s=this.getAttribute(\"component-url\")||\"<unknown>\",v=this.getAttribute(\"component-export\");throw v&&(s+=` (export ${v})`),console.error(`[hydrate] Error parsing props for component ${s}`,this.getAttribute(\"props\"),r),r}let u;await this.hydrator(this)(this.Component,p,n,{client:this.getAttribute(\"client\")}),this.removeAttribute(\"ssr\"),this.dispatchEvent(new CustomEvent(\"astro:hydrate\"))});d(this,\"unmount\",()=>{this.isConnected||this.dispatchEvent(new CustomEvent(\"astro:unmount\"))})}disconnectedCallback(){document.removeEventListener(\"astro:after-swap\",this.unmount),document.addEventListener(\"astro:after-swap\",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute(\"await-children\")||document.readyState===\"interactive\"||document.readyState===\"complete\")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener(\"DOMContentLoaded\",e),c.disconnect(),this.childrenConnectedCallback()},c=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue===\"astro:end\"&&(this.lastChild.remove(),e())});c.observe(this,{childList:!0}),document.addEventListener(\"DOMContentLoaded\",e)}}async childrenConnectedCallback(){let e=this.getAttribute(\"before-hydration-url\");e&&await import(e),this.start()}async start(){let e=JSON.parse(this.getAttribute(\"opts\")),c=this.getAttribute(\"client\");if(Astro[c]===void 0){window.addEventListener(`astro:${c}`,()=>this.start(),{once:!0});return}try{await Astro[c](async()=>{let n=this.getAttribute(\"renderer-url\"),[h,{default:p}]=await Promise.all([import(this.getAttribute(\"component-url\")),n?import(n):()=>()=>{}]),u=this.getAttribute(\"component-export\")||\"default\";if(!u.includes(\".\"))this.Component=h[u];else{this.Component=h;for(let f of u.split(\".\"))this.Component=this.Component[f]}return this.hydrator=p,this.hydrate},e,this)}catch(n){console.error(`[astro-island] Error hydrating ${this.getAttribute(\"component-url\")}`,n)}}attributeChangedCallback(){this.hydrate()}}d(y,\"observedAttributes\",[\"props\"]),customElements.get(\"astro-island\")||customElements.define(\"astro-island\",y)}})();";
|
|
7
7
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var astro_island_prebuilt_default = `(()=>{var
|
|
1
|
+
var astro_island_prebuilt_default = `(()=>{var A=Object.defineProperty;var g=(a,o,i)=>o in a?A(a,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[o]=i;var d=(a,o,i)=>(g(a,typeof o!="symbol"?o+"":o,i),i);{let a={0:t=>m(t),1:t=>i(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(i(t)),5:t=>new Set(i(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t)},o=t=>{let[l,e]=t;return l in a?a[l](e):void 0},i=t=>t.map(o),m=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([l,e])=>[l,o(e)]));class y extends HTMLElement{constructor(){super(...arguments);d(this,"Component");d(this,"hydrator");d(this,"hydrate",async()=>{var b;if(!this.hydrator||!this.isConnected)return;let e=(b=this.parentElement)==null?void 0:b.closest("astro-island[ssr]");if(e){e.addEventListener("astro:hydrate",this.hydrate,{once:!0});return}let c=this.querySelectorAll("astro-slot"),n={},h=this.querySelectorAll("template[data-astro-template]");for(let r of h){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute("data-astro-template")||"default"]=r.innerHTML,r.remove())}for(let r of c){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute("name")||"default"]=r.innerHTML)}let p;try{p=this.hasAttribute("props")?m(JSON.parse(this.getAttribute("props"))):{}}catch(r){let s=this.getAttribute("component-url")||"<unknown>",v=this.getAttribute("component-export");throw v&&(s+=\` (export \${v})\`),console.error(\`[hydrate] Error parsing props for component \${s}\`,this.getAttribute("props"),r),r}let u;await this.hydrator(this)(this.Component,p,n,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))});d(this,"unmount",()=>{this.isConnected||this.dispatchEvent(new CustomEvent("astro:unmount"))})}disconnectedCallback(){document.removeEventListener("astro:after-swap",this.unmount),document.addEventListener("astro:after-swap",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute("await-children")||document.readyState==="interactive"||document.readyState==="complete")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener("DOMContentLoaded",e),c.disconnect(),this.childrenConnectedCallback()},c=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue==="astro:end"&&(this.lastChild.remove(),e())});c.observe(this,{childList:!0}),document.addEventListener("DOMContentLoaded",e)}}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}async start(){let e=JSON.parse(this.getAttribute("opts")),c=this.getAttribute("client");if(Astro[c]===void 0){window.addEventListener(\`astro:\${c}\`,()=>this.start(),{once:!0});return}try{await Astro[c](async()=>{let n=this.getAttribute("renderer-url"),[h,{default:p}]=await Promise.all([import(this.getAttribute("component-url")),n?import(n):()=>()=>{}]),u=this.getAttribute("component-export")||"default";if(!u.includes("."))this.Component=h[u];else{this.Component=h;for(let f of u.split("."))this.Component=this.Component[f]}return this.hydrator=p,this.hydrate},e,this)}catch(n){console.error(\`[astro-island] Error hydrating \${this.getAttribute("component-url")}\`,n)}}attributeChangedCallback(){this.hydrate()}}d(y,"observedAttributes",["props"]),customElements.get("astro-island")||customElements.define("astro-island",y)}})();`;
|
|
2
2
|
export {
|
|
3
3
|
astro_island_prebuilt_default as default
|
|
4
4
|
};
|
|
@@ -269,7 +269,6 @@ async function updateDOM(preparationEvent, options, historyState, fallback) {
|
|
|
269
269
|
return style.animationIterationCount === "infinite";
|
|
270
270
|
}
|
|
271
271
|
const currentAnimations = document.getAnimations();
|
|
272
|
-
await new Promise((r) => setTimeout(r));
|
|
273
272
|
document.documentElement.setAttribute(OLD_NEW_ATTR, phase);
|
|
274
273
|
const nextAnimations = document.getAnimations();
|
|
275
274
|
const newAnimations = nextAnimations.filter(
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
function getMarkdownCodeForImages(imagePaths, html) {
|
|
2
2
|
return `
|
|
3
3
|
import { getImage } from "astro:assets";
|
|
4
|
-
${imagePaths.map((entry) => {
|
|
5
|
-
const prefix = entry.raw.includes("/") ? "" : "./";
|
|
6
|
-
return `import Astro__${entry.safeName} from ${JSON.stringify(prefix + entry.raw)};`;
|
|
7
|
-
}).join("\n")}
|
|
4
|
+
${imagePaths.map((entry) => `import Astro__${entry.safeName} from ${JSON.stringify(entry.raw)};`).join("\n")}
|
|
8
5
|
|
|
9
6
|
const images = async function(html) {
|
|
10
7
|
const imageSources = {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
2
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
3
|
import {
|
|
5
4
|
InvalidAstroDataError,
|
|
@@ -29,6 +28,14 @@ function markdown({ settings, logger }) {
|
|
|
29
28
|
buildEnd() {
|
|
30
29
|
processor = void 0;
|
|
31
30
|
},
|
|
31
|
+
async resolveId(source, importer, options) {
|
|
32
|
+
if (importer?.endsWith(".md") && source[0] !== "/") {
|
|
33
|
+
let resolved = await this.resolve(source, importer, options);
|
|
34
|
+
if (!resolved)
|
|
35
|
+
resolved = await this.resolve("./" + source, importer, options);
|
|
36
|
+
return resolved;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
32
39
|
// Why not the "transform" hook instead of "load" + readFile?
|
|
33
40
|
// A: Vite transforms all "import.meta.env" references to their values before
|
|
34
41
|
// passing to the transform hook. This lets us get the truly raw value
|
|
@@ -60,7 +67,6 @@ function markdown({ settings, logger }) {
|
|
|
60
67
|
for (const imagePath of rawImagePaths.values()) {
|
|
61
68
|
imagePaths.push({
|
|
62
69
|
raw: imagePath,
|
|
63
|
-
resolved: (await this.resolve(imagePath, id))?.id ?? path.join(path.dirname(id), imagePath),
|
|
64
70
|
safeName: shorthash(imagePath)
|
|
65
71
|
});
|
|
66
72
|
}
|