astro 4.6.3 → 4.7.0
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/@types/astro.d.ts +48 -6
- 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/cli/add/index.js +1 -41
- package/dist/cli/install-package.d.ts +9 -0
- package/dist/cli/install-package.js +64 -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/build/static-build.js +4 -0
- package/dist/core/config/schema.d.ts +332 -289
- package/dist/core/config/settings.js +3 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.js +1 -1
- package/dist/core/dev/dev.js +34 -2
- package/dist/core/dev/restart.js +5 -1
- package/dist/core/dev/update-check.d.ts +4 -0
- package/dist/core/dev/update-check.js +36 -0
- package/dist/core/logger/core.d.ts +1 -1
- package/dist/core/messages.d.ts +3 -0
- package/dist/core/messages.js +11 -2
- package/dist/integrations/index.d.ts +28 -0
- package/dist/integrations/index.js +40 -1
- package/dist/preferences/defaults.d.ts +9 -0
- package/dist/preferences/defaults.js +9 -0
- package/dist/preferences/index.d.ts +12 -4
- package/dist/preferences/index.js +11 -4
- package/dist/runtime/client/dev-toolbar/apps/astro.d.ts +1 -1
- package/dist/runtime/client/dev-toolbar/apps/astro.js +3 -0
- package/dist/runtime/client/dev-toolbar/apps/audit/index.d.ts +1 -1
- package/dist/runtime/client/dev-toolbar/apps/settings.d.ts +1 -1
- package/dist/runtime/client/dev-toolbar/apps/xray.d.ts +1 -1
- package/dist/runtime/client/dev-toolbar/entrypoint.js +3 -2
- package/dist/runtime/client/dev-toolbar/helpers.d.ts +61 -0
- package/dist/runtime/client/dev-toolbar/helpers.js +87 -0
- package/dist/runtime/client/dev-toolbar/toolbar.d.ts +3 -2
- package/dist/runtime/client/dev-toolbar/toolbar.js +2 -1
- 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/toolbar/index.d.ts +2 -0
- package/dist/toolbar/index.js +6 -0
- package/dist/{vite-plugin-dev-toolbar → toolbar}/vite-plugin-dev-toolbar.js +33 -12
- package/dist/transitions/router.js +0 -1
- package/dist/vite-plugin-astro-server/pipeline.js +1 -0
- 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 +48 -50
- package/tsconfigs/strictest.json +1 -3
- /package/dist/{vite-plugin-dev-toolbar → toolbar}/vite-plugin-dev-toolbar.d.ts +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ResolvedDevToolbarApp as DevToolbarAppDefinition } from '../../../@types/astro.js';
|
|
2
|
+
import { type ToolbarAppEventTarget } from './helpers.js';
|
|
2
3
|
import { type Icon } from './ui-library/icons.js';
|
|
3
4
|
import { type Placement } from './ui-library/window.js';
|
|
4
5
|
export type DevToolbarApp = DevToolbarAppDefinition & {
|
|
@@ -9,7 +10,7 @@ export type DevToolbarApp = DevToolbarAppDefinition & {
|
|
|
9
10
|
state: boolean;
|
|
10
11
|
level?: 'error' | 'warning' | 'info';
|
|
11
12
|
};
|
|
12
|
-
eventTarget:
|
|
13
|
+
eventTarget: ToolbarAppEventTarget;
|
|
13
14
|
};
|
|
14
15
|
export declare class AstroDevToolbar extends HTMLElement {
|
|
15
16
|
shadowRoot: ShadowRoot;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { serverHelpers } from "./helpers.js";
|
|
1
2
|
import { settings } from "./settings.js";
|
|
2
3
|
import { getIconElement, isDefinedIcon } from "./ui-library/icons.js";
|
|
3
4
|
import {} from "./ui-library/window.js";
|
|
@@ -340,7 +341,7 @@ class AstroDevToolbar extends HTMLElement {
|
|
|
340
341
|
app.status = "loading";
|
|
341
342
|
try {
|
|
342
343
|
settings.logger.verboseLog(`Initializing app ${app.id}`);
|
|
343
|
-
await app.init?.(shadowRoot, app.eventTarget);
|
|
344
|
+
await app.init?.(shadowRoot, app.eventTarget, serverHelpers);
|
|
344
345
|
app.status = "ready";
|
|
345
346
|
if (import.meta.hot) {
|
|
346
347
|
import.meta.hot.send(`${WS_EVENT_NAME}:${app.id}:initialized`);
|
|
@@ -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
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { telemetry } from "../events/index.js";
|
|
2
2
|
import { eventAppToggled } from "../events/toolbar.js";
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const PRIVATE_VIRTUAL_MODULE_ID = "astro:toolbar:internal";
|
|
4
|
+
const resolvedPrivateVirtualModuleId = "\0" + PRIVATE_VIRTUAL_MODULE_ID;
|
|
5
5
|
function astroDevToolbar({ settings, logger }) {
|
|
6
6
|
let telemetryTimeout;
|
|
7
7
|
return {
|
|
@@ -15,8 +15,8 @@ function astroDevToolbar({ settings, logger }) {
|
|
|
15
15
|
};
|
|
16
16
|
},
|
|
17
17
|
resolveId(id) {
|
|
18
|
-
if (id ===
|
|
19
|
-
return
|
|
18
|
+
if (id === PRIVATE_VIRTUAL_MODULE_ID) {
|
|
19
|
+
return resolvedPrivateVirtualModuleId;
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
configureServer(server) {
|
|
@@ -49,22 +49,43 @@ ${args.error}`
|
|
|
49
49
|
});
|
|
50
50
|
},
|
|
51
51
|
async load(id) {
|
|
52
|
-
if (id ===
|
|
52
|
+
if (id === resolvedPrivateVirtualModuleId) {
|
|
53
53
|
return `
|
|
54
54
|
export const loadDevToolbarApps = async () => {
|
|
55
55
|
return (await Promise.all([${settings.devToolbarApps.map(
|
|
56
|
-
(plugin) => `safeLoadPlugin(
|
|
56
|
+
(plugin) => `safeLoadPlugin(${JSON.stringify(
|
|
57
57
|
plugin
|
|
58
|
-
)}
|
|
59
|
-
|
|
58
|
+
)}, async () => (await import(${JSON.stringify(
|
|
59
|
+
typeof plugin === "string" ? plugin : plugin.entrypoint
|
|
60
|
+
)})).default, ${JSON.stringify(
|
|
61
|
+
typeof plugin === "string" ? plugin : plugin.entrypoint
|
|
62
|
+
)})`
|
|
63
|
+
).join(",")}]));
|
|
60
64
|
};
|
|
61
65
|
|
|
62
|
-
async function safeLoadPlugin(importEntrypoint, entrypoint) {
|
|
66
|
+
async function safeLoadPlugin(appDefinition, importEntrypoint, entrypoint) {
|
|
63
67
|
try {
|
|
64
|
-
|
|
68
|
+
let app;
|
|
69
|
+
if (typeof appDefinition === 'string') {
|
|
70
|
+
app = await importEntrypoint();
|
|
65
71
|
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
if (typeof app !== 'object' || !app.id || !app.name) {
|
|
73
|
+
throw new Error("Apps must default export an object with an id, and a name.");
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
app = appDefinition;
|
|
77
|
+
|
|
78
|
+
if (typeof app !== 'object' || !app.id || !app.name || !app.entrypoint) {
|
|
79
|
+
throw new Error("Apps must be an object with an id, a name and an entrypoint.");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const loadedApp = await importEntrypoint();
|
|
83
|
+
|
|
84
|
+
if (typeof loadedApp !== 'object') {
|
|
85
|
+
throw new Error("App entrypoint must default export an object.");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
app = { ...app, ...loadedApp };
|
|
68
89
|
}
|
|
69
90
|
|
|
70
91
|
return app;
|
|
@@ -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(
|
|
@@ -56,6 +56,7 @@ class DevPipeline extends Pipeline {
|
|
|
56
56
|
const additionalMetadata = {
|
|
57
57
|
root: url.fileURLToPath(settings.config.root),
|
|
58
58
|
version: ASTRO_VERSION,
|
|
59
|
+
latestAstroVersion: settings.latestAstroVersion,
|
|
59
60
|
debugInfo: await getInfoOutput({ userConfig: settings.config, print: false })
|
|
60
61
|
};
|
|
61
62
|
const children = `window.__astro_dev_toolbar__ = ${JSON.stringify(additionalMetadata)}`;
|
|
@@ -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
|
}
|