astro 1.0.2 → 1.0.3
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/dist/core/add/index.js +2 -4
- package/dist/core/build/generate.js +1 -1
- package/dist/core/dev/index.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/render/dev/vite.js +4 -3
- package/dist/core/util.js +5 -2
- package/dist/runtime/client/idle.prebuilt.js +1 -11
- package/dist/runtime/client/load.prebuilt.js +1 -6
- package/dist/runtime/client/media.prebuilt.js +1 -14
- package/dist/runtime/client/only.prebuilt.js +1 -6
- package/dist/runtime/client/visible.prebuilt.js +1 -19
- package/dist/runtime/server/astro-global.js +1 -1
- package/dist/runtime/server/astro-island.prebuilt.js +1 -89
- package/dist/types/core/util.d.ts +2 -2
- package/dist/types/runtime/client/idle.prebuilt.d.ts +1 -1
- package/dist/types/runtime/client/load.prebuilt.d.ts +1 -1
- package/dist/types/runtime/client/media.prebuilt.d.ts +1 -1
- package/dist/types/runtime/client/only.prebuilt.d.ts +1 -1
- package/dist/types/runtime/client/visible.prebuilt.d.ts +1 -1
- package/dist/types/runtime/server/astro-island.prebuilt.d.ts +1 -1
- package/package.json +1 -1
package/dist/core/add/index.js
CHANGED
|
@@ -255,10 +255,8 @@ async function parseAstroConfig(configURL) {
|
|
|
255
255
|
return result;
|
|
256
256
|
}
|
|
257
257
|
const toIdent = (name) => {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}
|
|
261
|
-
return name;
|
|
258
|
+
const ident = name.trim().replace(/[-_\.]?astro(?:js)?[-_\.]?/g, "").replace(/\.js/, "").replace(/(?:[\.\-\_\/]+)([a-zA-Z])/g, (_, w) => w.toUpperCase()).replace(/^[^a-zA-Z$_]+/, "");
|
|
259
|
+
return `${ident[0].toLowerCase()}${ident.slice(1)}`;
|
|
262
260
|
};
|
|
263
261
|
function createPrettyError(err) {
|
|
264
262
|
err.message = `Astro could not update your astro.config.js file safely.
|
|
@@ -108,7 +108,7 @@ async function generatePage(opts, internals, pageData, ssrEntry, builtPaths) {
|
|
|
108
108
|
const timeEnd = performance.now();
|
|
109
109
|
const timeChange = getTimeStat(timeStart, timeEnd);
|
|
110
110
|
const timeIncrease = `(+${timeChange})`;
|
|
111
|
-
const filePath = getOutputFilename(opts.astroConfig, path);
|
|
111
|
+
const filePath = getOutputFilename(opts.astroConfig, path, pageData.route.type);
|
|
112
112
|
const lineIcon = i === paths.length - 1 ? "\u2514\u2500" : "\u251C\u2500";
|
|
113
113
|
info(opts.logging, null, ` ${cyan(lineIcon)} ${dim(filePath)} ${dim(timeIncrease)}`);
|
|
114
114
|
}
|
package/dist/core/dev/index.js
CHANGED
|
@@ -46,7 +46,7 @@ async function dev(config, options) {
|
|
|
46
46
|
https: !!((_a = viteConfig.server) == null ? void 0 : _a.https)
|
|
47
47
|
})
|
|
48
48
|
);
|
|
49
|
-
const currentVersion = "1.0.
|
|
49
|
+
const currentVersion = "1.0.3";
|
|
50
50
|
if (currentVersion.includes("-")) {
|
|
51
51
|
warn(options.logging, null, msg.prerelease({ currentVersion }));
|
|
52
52
|
}
|
package/dist/core/messages.js
CHANGED
|
@@ -47,7 +47,7 @@ function devStart({
|
|
|
47
47
|
https,
|
|
48
48
|
site
|
|
49
49
|
}) {
|
|
50
|
-
const version = "1.0.
|
|
50
|
+
const version = "1.0.3";
|
|
51
51
|
const rootPath = site ? site.pathname : "/";
|
|
52
52
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
53
53
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
@@ -226,7 +226,7 @@ function printHelp({
|
|
|
226
226
|
message.push(
|
|
227
227
|
linebreak(),
|
|
228
228
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
229
|
-
`v${"1.0.
|
|
229
|
+
`v${"1.0.3"}`
|
|
230
230
|
)} ${headline}`
|
|
231
231
|
);
|
|
232
232
|
}
|
|
@@ -2,6 +2,7 @@ import npath from "path";
|
|
|
2
2
|
import { unwrapId } from "../../util.js";
|
|
3
3
|
import { STYLE_EXTENSIONS } from "../util.js";
|
|
4
4
|
const fileExtensionsToSSR = /* @__PURE__ */ new Set([".astro", ".md"]);
|
|
5
|
+
const STRIP_QUERY_PARAMS_REGEX = /\?.*$/;
|
|
5
6
|
async function* crawlGraph(viteServer, _id, isFile, scanned = /* @__PURE__ */ new Set()) {
|
|
6
7
|
const id = unwrapId(_id);
|
|
7
8
|
const importedModules = /* @__PURE__ */ new Set();
|
|
@@ -15,11 +16,11 @@ async function* crawlGraph(viteServer, _id, isFile, scanned = /* @__PURE__ */ ne
|
|
|
15
16
|
const entryIsStyle = STYLE_EXTENSIONS.has(npath.extname(id));
|
|
16
17
|
for (const importedModule of entry.importedModules) {
|
|
17
18
|
if (importedModule.id) {
|
|
18
|
-
const
|
|
19
|
-
if (entryIsStyle && !STYLE_EXTENSIONS.has(npath.extname(
|
|
19
|
+
const importedModulePathname = importedModule.id.replace(STRIP_QUERY_PARAMS_REGEX, "");
|
|
20
|
+
if (entryIsStyle && !STYLE_EXTENSIONS.has(npath.extname(importedModulePathname))) {
|
|
20
21
|
continue;
|
|
21
22
|
}
|
|
22
|
-
if (fileExtensionsToSSR.has(npath.extname(
|
|
23
|
+
if (fileExtensionsToSSR.has(npath.extname(importedModulePathname))) {
|
|
23
24
|
const mod = viteServer.moduleGraph.getModuleById(importedModule.id);
|
|
24
25
|
if (!(mod == null ? void 0 : mod.ssrModule)) {
|
|
25
26
|
await viteServer.ssrLoadModule(importedModule.id);
|
package/dist/core/util.js
CHANGED
|
@@ -5,7 +5,7 @@ import resolve from "resolve";
|
|
|
5
5
|
import slash from "slash";
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
7
7
|
import { prependForwardSlash, removeTrailingForwardSlash } from "./path.js";
|
|
8
|
-
const ASTRO_VERSION = "1.0.
|
|
8
|
+
const ASTRO_VERSION = "1.0.3";
|
|
9
9
|
function isObject(value) {
|
|
10
10
|
return typeof value === "object" && value != null;
|
|
11
11
|
}
|
|
@@ -18,7 +18,10 @@ function padMultilineString(source, n = 2) {
|
|
|
18
18
|
`);
|
|
19
19
|
}
|
|
20
20
|
const STATUS_CODE_REGEXP = /^\/?[0-9]{3}$/;
|
|
21
|
-
function getOutputFilename(astroConfig, name) {
|
|
21
|
+
function getOutputFilename(astroConfig, name, type) {
|
|
22
|
+
if (type === "endpoint") {
|
|
23
|
+
return name;
|
|
24
|
+
}
|
|
22
25
|
if (name === "/" || name === "") {
|
|
23
26
|
return path.posix.join(name, "index.html");
|
|
24
27
|
}
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
var idle_prebuilt_default = `(self.Astro
|
|
2
|
-
const cb = async () => {
|
|
3
|
-
let hydrate = await getHydrateCallback();
|
|
4
|
-
await hydrate();
|
|
5
|
-
};
|
|
6
|
-
if ("requestIdleCallback" in window) {
|
|
7
|
-
window.requestIdleCallback(cb);
|
|
8
|
-
} else {
|
|
9
|
-
setTimeout(cb, 200);
|
|
10
|
-
}
|
|
11
|
-
};`;
|
|
1
|
+
var idle_prebuilt_default = `(self.Astro=self.Astro||{}).idle=a=>{const e=async()=>{await(await a())()};"requestIdleCallback"in window?window.requestIdleCallback(e):setTimeout(e,200)};`;
|
|
12
2
|
export {
|
|
13
3
|
idle_prebuilt_default as default
|
|
14
4
|
};
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
var load_prebuilt_default = `(self.Astro
|
|
2
|
-
(async () => {
|
|
3
|
-
let hydrate = await getHydrateCallback();
|
|
4
|
-
await hydrate();
|
|
5
|
-
})();
|
|
6
|
-
};`;
|
|
1
|
+
var load_prebuilt_default = `(self.Astro=self.Astro||{}).load=a=>{(async()=>await(await a())())()};`;
|
|
7
2
|
export {
|
|
8
3
|
load_prebuilt_default as default
|
|
9
4
|
};
|
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
var media_prebuilt_default = `(self.Astro
|
|
2
|
-
const cb = async () => {
|
|
3
|
-
let hydrate = await getHydrateCallback();
|
|
4
|
-
await hydrate();
|
|
5
|
-
};
|
|
6
|
-
if (options.value) {
|
|
7
|
-
const mql = matchMedia(options.value);
|
|
8
|
-
if (mql.matches) {
|
|
9
|
-
cb();
|
|
10
|
-
} else {
|
|
11
|
-
mql.addEventListener("change", cb, { once: true });
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
};`;
|
|
1
|
+
var media_prebuilt_default = `(self.Astro=self.Astro||{}).media=(s,a)=>{const t=async()=>{await(await s())()};if(a.value){const e=matchMedia(a.value);e.matches?t():e.addEventListener("change",t,{once:!0})}};`;
|
|
15
2
|
export {
|
|
16
3
|
media_prebuilt_default as default
|
|
17
4
|
};
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
var only_prebuilt_default = `(self.Astro
|
|
2
|
-
(async () => {
|
|
3
|
-
let hydrate = await getHydrateCallback();
|
|
4
|
-
await hydrate();
|
|
5
|
-
})();
|
|
6
|
-
};`;
|
|
1
|
+
var only_prebuilt_default = `(self.Astro=self.Astro||{}).only=a=>{(async()=>await(await a())())()};`;
|
|
7
2
|
export {
|
|
8
3
|
only_prebuilt_default as default
|
|
9
4
|
};
|
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
var visible_prebuilt_default = `(self.Astro
|
|
2
|
-
const cb = async () => {
|
|
3
|
-
let hydrate = await getHydrateCallback();
|
|
4
|
-
await hydrate();
|
|
5
|
-
};
|
|
6
|
-
let io = new IntersectionObserver((entries) => {
|
|
7
|
-
for (const entry of entries) {
|
|
8
|
-
if (!entry.isIntersecting)
|
|
9
|
-
continue;
|
|
10
|
-
io.disconnect();
|
|
11
|
-
cb();
|
|
12
|
-
break;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
for (let i = 0; i < root.children.length; i++) {
|
|
16
|
-
const child = root.children[i];
|
|
17
|
-
io.observe(child);
|
|
18
|
-
}
|
|
19
|
-
};`;
|
|
1
|
+
var visible_prebuilt_default = `(self.Astro=self.Astro||{}).visible=(i,c,n)=>{const r=async()=>{await(await i())()};let s=new IntersectionObserver(e=>{for(const t of e)if(!!t.isIntersecting){s.disconnect(),r();break}});for(let e=0;e<n.children.length;e++){const t=n.children[e];s.observe(t)}};`;
|
|
20
2
|
export {
|
|
21
3
|
visible_prebuilt_default as default
|
|
22
4
|
};
|
|
@@ -1,92 +1,4 @@
|
|
|
1
|
-
var astro_island_prebuilt_default = `var
|
|
2
|
-
{
|
|
3
|
-
const propTypes = {
|
|
4
|
-
0: (value) => value,
|
|
5
|
-
1: (value) => JSON.parse(value, reviver),
|
|
6
|
-
2: (value) => new RegExp(value),
|
|
7
|
-
3: (value) => new Date(value),
|
|
8
|
-
4: (value) => new Map(JSON.parse(value, reviver)),
|
|
9
|
-
5: (value) => new Set(JSON.parse(value, reviver)),
|
|
10
|
-
6: (value) => BigInt(value),
|
|
11
|
-
7: (value) => new URL(value)
|
|
12
|
-
};
|
|
13
|
-
const reviver = (propKey, raw) => {
|
|
14
|
-
if (propKey === "" || !Array.isArray(raw))
|
|
15
|
-
return raw;
|
|
16
|
-
const [type, value] = raw;
|
|
17
|
-
return type in propTypes ? propTypes[type](value) : void 0;
|
|
18
|
-
};
|
|
19
|
-
if (!customElements.get("astro-island")) {
|
|
20
|
-
customElements.define(
|
|
21
|
-
"astro-island",
|
|
22
|
-
(_a = class extends HTMLElement {
|
|
23
|
-
constructor() {
|
|
24
|
-
super(...arguments);
|
|
25
|
-
this.hydrate = () => {
|
|
26
|
-
if (!this.hydrator || this.parentElement?.closest("astro-island[ssr]")) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const slotted = this.querySelectorAll("astro-slot");
|
|
30
|
-
const slots = {};
|
|
31
|
-
const templates = this.querySelectorAll("template[data-astro-template]");
|
|
32
|
-
for (const template of templates) {
|
|
33
|
-
if (!template.closest(this.tagName)?.isSameNode(this))
|
|
34
|
-
continue;
|
|
35
|
-
slots[template.getAttribute("data-astro-template") || "default"] = template.innerHTML;
|
|
36
|
-
template.remove();
|
|
37
|
-
}
|
|
38
|
-
for (const slot of slotted) {
|
|
39
|
-
if (!slot.closest(this.tagName)?.isSameNode(this))
|
|
40
|
-
continue;
|
|
41
|
-
slots[slot.getAttribute("name") || "default"] = slot.innerHTML;
|
|
42
|
-
}
|
|
43
|
-
const props = this.hasAttribute("props") ? JSON.parse(this.getAttribute("props"), reviver) : {};
|
|
44
|
-
this.hydrator(this)(this.Component, props, slots, {
|
|
45
|
-
client: this.getAttribute("client")
|
|
46
|
-
});
|
|
47
|
-
this.removeAttribute("ssr");
|
|
48
|
-
window.removeEventListener("astro:hydrate", this.hydrate);
|
|
49
|
-
window.dispatchEvent(new CustomEvent("astro:hydrate"));
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
connectedCallback() {
|
|
53
|
-
if (!this.hasAttribute("await-children") || this.firstChild) {
|
|
54
|
-
this.childrenConnectedCallback();
|
|
55
|
-
} else {
|
|
56
|
-
new MutationObserver((_, mo) => {
|
|
57
|
-
mo.disconnect();
|
|
58
|
-
this.childrenConnectedCallback();
|
|
59
|
-
}).observe(this, { childList: true });
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async childrenConnectedCallback() {
|
|
63
|
-
window.addEventListener("astro:hydrate", this.hydrate);
|
|
64
|
-
await import(this.getAttribute("before-hydration-url"));
|
|
65
|
-
const opts = JSON.parse(this.getAttribute("opts"));
|
|
66
|
-
Astro[this.getAttribute("client")](
|
|
67
|
-
async () => {
|
|
68
|
-
const rendererUrl = this.getAttribute("renderer-url");
|
|
69
|
-
const [componentModule, { default: hydrator }] = await Promise.all([
|
|
70
|
-
import(this.getAttribute("component-url")),
|
|
71
|
-
rendererUrl ? import(rendererUrl) : () => () => {
|
|
72
|
-
}
|
|
73
|
-
]);
|
|
74
|
-
this.Component = componentModule[this.getAttribute("component-export") || "default"];
|
|
75
|
-
this.hydrator = hydrator;
|
|
76
|
-
return this.hydrate;
|
|
77
|
-
},
|
|
78
|
-
opts,
|
|
79
|
-
this
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
attributeChangedCallback() {
|
|
83
|
-
if (this.hydrator)
|
|
84
|
-
this.hydrate();
|
|
85
|
-
}
|
|
86
|
-
}, _a.observedAttributes = ["props"], _a)
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
}`;
|
|
1
|
+
var astro_island_prebuilt_default = `var a;{const l={0:t=>t,1:t=>JSON.parse(t,n),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(JSON.parse(t,n)),5:t=>new Set(JSON.parse(t,n)),6:t=>BigInt(t),7:t=>new URL(t)},n=(t,r)=>{if(t===""||!Array.isArray(r))return r;const[e,i]=r;return e in l?l[e](i):void 0};customElements.get("astro-island")||customElements.define("astro-island",(a=class extends HTMLElement{constructor(){super(...arguments);this.hydrate=()=>{if(!this.hydrator||this.parentElement?.closest("astro-island[ssr]"))return;const r=this.querySelectorAll("astro-slot"),e={},i=this.querySelectorAll("template[data-astro-template]");for(const s of i)!s.closest(this.tagName)?.isSameNode(this)||(e[s.getAttribute("data-astro-template")||"default"]=s.innerHTML,s.remove());for(const s of r)!s.closest(this.tagName)?.isSameNode(this)||(e[s.getAttribute("name")||"default"]=s.innerHTML);const o=this.hasAttribute("props")?JSON.parse(this.getAttribute("props"),n):{};this.hydrator(this)(this.Component,o,e,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),window.removeEventListener("astro:hydrate",this.hydrate),window.dispatchEvent(new CustomEvent("astro:hydrate"))}}connectedCallback(){!this.hasAttribute("await-children")||this.firstChild?this.childrenConnectedCallback():new MutationObserver((r,e)=>{e.disconnect(),this.childrenConnectedCallback()}).observe(this,{childList:!0})}async childrenConnectedCallback(){window.addEventListener("astro:hydrate",this.hydrate),await import(this.getAttribute("before-hydration-url"));const r=JSON.parse(this.getAttribute("opts"));Astro[this.getAttribute("client")](async()=>{const e=this.getAttribute("renderer-url"),[i,{default:o}]=await Promise.all([import(this.getAttribute("component-url")),e?import(e):()=>()=>{}]);return this.Component=i[this.getAttribute("component-export")||"default"],this.hydrator=o,this.hydrate},r,this)}attributeChangedCallback(){this.hydrator&&this.hydrate()}},a.observedAttributes=["props"],a))}`;
|
|
90
2
|
export {
|
|
91
3
|
astro_island_prebuilt_default as default
|
|
92
4
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ErrorPayload, ViteDevServer } from 'vite';
|
|
2
|
-
import type { AstroConfig } from '../@types/astro';
|
|
2
|
+
import type { AstroConfig, RouteType } from '../@types/astro';
|
|
3
3
|
export declare const ASTRO_VERSION: string;
|
|
4
4
|
/** Returns true if argument is an object of any prototype/class (but not null). */
|
|
5
5
|
export declare function isObject(value: unknown): value is Record<string, any>;
|
|
@@ -11,7 +11,7 @@ export declare function padMultilineString(source: string, n?: number): string;
|
|
|
11
11
|
* Handles both "/foo" and "foo" `name` formats.
|
|
12
12
|
* Handles `/404` and `/` correctly.
|
|
13
13
|
*/
|
|
14
|
-
export declare function getOutputFilename(astroConfig: AstroConfig, name: string): string;
|
|
14
|
+
export declare function getOutputFilename(astroConfig: AstroConfig, name: string, type: RouteType): string;
|
|
15
15
|
/** is a specifier an npm package? */
|
|
16
16
|
export declare function parseNpmName(spec: string): {
|
|
17
17
|
scope?: string;
|
|
@@ -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: "(self.Astro
|
|
6
|
+
declare const _default: "(self.Astro=self.Astro||{}).idle=a=>{const e=async()=>{await(await a())()};\"requestIdleCallback\"in window?window.requestIdleCallback(e):setTimeout(e,200)};";
|
|
7
7
|
export default _default;
|
|
@@ -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: "(self.Astro
|
|
6
|
+
declare const _default: "(self.Astro=self.Astro||{}).load=a=>{(async()=>await(await a())())()};";
|
|
7
7
|
export default _default;
|
|
@@ -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: "(self.Astro
|
|
6
|
+
declare const _default: "(self.Astro=self.Astro||{}).media=(s,a)=>{const t=async()=>{await(await s())()};if(a.value){const e=matchMedia(a.value);e.matches?t():e.addEventListener(\"change\",t,{once:!0})}};";
|
|
7
7
|
export default _default;
|
|
@@ -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: "(self.Astro
|
|
6
|
+
declare const _default: "(self.Astro=self.Astro||{}).only=a=>{(async()=>await(await a())())()};";
|
|
7
7
|
export default _default;
|
|
@@ -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: "(self.Astro
|
|
6
|
+
declare const _default: "(self.Astro=self.Astro||{}).visible=(i,c,n)=>{const r=async()=>{await(await i())()};let s=new IntersectionObserver(e=>{for(const t of e)if(!!t.isIntersecting){s.disconnect(),r();break}});for(let e=0;e<n.children.length;e++){const t=n.children[e];s.observe(t)}};";
|
|
7
7
|
export default _default;
|
|
@@ -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;{const l={0:t=>t,1:t=>JSON.parse(t,n),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(JSON.parse(t,n)),5:t=>new Set(JSON.parse(t,n)),6:t=>BigInt(t),7:t=>new URL(t)},n=(t,r)=>{if(t===\"\"||!Array.isArray(r))return r;const[e,i]=r;return e in l?l[e](i):void 0};customElements.get(\"astro-island\")||customElements.define(\"astro-island\",(a=class extends HTMLElement{constructor(){super(...arguments);this.hydrate=()=>{if(!this.hydrator||this.parentElement?.closest(\"astro-island[ssr]\"))return;const r=this.querySelectorAll(\"astro-slot\"),e={},i=this.querySelectorAll(\"template[data-astro-template]\");for(const s of i)!s.closest(this.tagName)?.isSameNode(this)||(e[s.getAttribute(\"data-astro-template\")||\"default\"]=s.innerHTML,s.remove());for(const s of r)!s.closest(this.tagName)?.isSameNode(this)||(e[s.getAttribute(\"name\")||\"default\"]=s.innerHTML);const o=this.hasAttribute(\"props\")?JSON.parse(this.getAttribute(\"props\"),n):{};this.hydrator(this)(this.Component,o,e,{client:this.getAttribute(\"client\")}),this.removeAttribute(\"ssr\"),window.removeEventListener(\"astro:hydrate\",this.hydrate),window.dispatchEvent(new CustomEvent(\"astro:hydrate\"))}}connectedCallback(){!this.hasAttribute(\"await-children\")||this.firstChild?this.childrenConnectedCallback():new MutationObserver((r,e)=>{e.disconnect(),this.childrenConnectedCallback()}).observe(this,{childList:!0})}async childrenConnectedCallback(){window.addEventListener(\"astro:hydrate\",this.hydrate),await import(this.getAttribute(\"before-hydration-url\"));const r=JSON.parse(this.getAttribute(\"opts\"));Astro[this.getAttribute(\"client\")](async()=>{const e=this.getAttribute(\"renderer-url\"),[i,{default:o}]=await Promise.all([import(this.getAttribute(\"component-url\")),e?import(e):()=>()=>{}]);return this.Component=i[this.getAttribute(\"component-export\")||\"default\"],this.hydrator=o,this.hydrate},r,this)}attributeChangedCallback(){this.hydrator&&this.hydrate()}},a.observedAttributes=[\"props\"],a))}";
|
|
7
7
|
export default _default;
|