astro 6.1.8 → 6.1.10
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/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/content/content-layer.js +3 -3
- package/dist/core/app/base.js +5 -1
- package/dist/core/app/manifest.js +2 -0
- package/dist/core/app/node.js +2 -1
- package/dist/core/base-pipeline.js +7 -0
- package/dist/core/cache/memory-provider.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +2 -2
- package/dist/core/dev/restart.d.ts +1 -1
- package/dist/core/encryption.d.ts +6 -2
- package/dist/core/encryption.js +12 -18
- package/dist/core/errors/errors.d.ts +1 -1
- package/dist/core/errors/overlay.js +7 -5
- package/dist/core/messages/runtime.js +1 -1
- package/dist/core/server-islands/endpoint.js +7 -3
- package/dist/core/session/runtime.js +1 -1
- package/dist/preferences/dlv.js +5 -1
- package/dist/runtime/client/dev-toolbar/apps/audit/index.js +4 -1
- package/dist/runtime/server/astro-island.js +10 -1
- 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/runtime/server/render/server-islands.js +7 -3
- package/dist/runtime/server/serialize.d.ts +1 -1
- package/dist/toolbar/vite-plugin-dev-toolbar.js +23 -1
- package/dist/vite-plugin-environment/index.js +2 -1
- package/dist/vite-plugin-markdown/index.js +1 -1
- package/package.json +9 -8
|
@@ -192,7 +192,7 @@ ${contentConfig.error.message}`
|
|
|
192
192
|
logger.info("Content config changed");
|
|
193
193
|
shouldClear = true;
|
|
194
194
|
}
|
|
195
|
-
if (previousAstroVersion && previousAstroVersion !== "6.1.
|
|
195
|
+
if (previousAstroVersion && previousAstroVersion !== "6.1.10") {
|
|
196
196
|
logger.info("Astro version changed");
|
|
197
197
|
shouldClear = true;
|
|
198
198
|
}
|
|
@@ -200,8 +200,8 @@ ${contentConfig.error.message}`
|
|
|
200
200
|
logger.info("Clearing content store");
|
|
201
201
|
this.#store.clearAll();
|
|
202
202
|
}
|
|
203
|
-
if ("6.1.
|
|
204
|
-
this.#store.metaStore().set("astro-version", "6.1.
|
|
203
|
+
if ("6.1.10") {
|
|
204
|
+
this.#store.metaStore().set("astro-version", "6.1.10");
|
|
205
205
|
}
|
|
206
206
|
if (currentConfigDigest) {
|
|
207
207
|
this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
package/dist/core/app/base.js
CHANGED
|
@@ -184,7 +184,11 @@ class BaseApp {
|
|
|
184
184
|
pathname = prependForwardSlash(
|
|
185
185
|
joinPaths(normalizeTheLocale(locale), this.removeBase(url.pathname))
|
|
186
186
|
);
|
|
187
|
-
if (
|
|
187
|
+
if (this.manifest.trailingSlash === "always") {
|
|
188
|
+
pathname = appendForwardSlash(pathname);
|
|
189
|
+
} else if (this.manifest.trailingSlash === "never") {
|
|
190
|
+
pathname = removeTrailingForwardSlash(pathname);
|
|
191
|
+
} else if (url.pathname.endsWith("/")) {
|
|
188
192
|
pathname = appendForwardSlash(pathname);
|
|
189
193
|
}
|
|
190
194
|
}
|
|
@@ -64,6 +64,8 @@ function deserializeRouteData(rawRouteData) {
|
|
|
64
64
|
return {
|
|
65
65
|
route: rawRouteData.route,
|
|
66
66
|
type: rawRouteData.type,
|
|
67
|
+
// nosemgrep: javascript.lang.security.audit.detect-non-literal-regexp.detect-non-literal-regexp
|
|
68
|
+
// This pattern is serialized from Astro's own route manifest.
|
|
67
69
|
pattern: new RegExp(rawRouteData.pattern),
|
|
68
70
|
params: rawRouteData.params,
|
|
69
71
|
component: rawRouteData.component,
|
package/dist/core/app/node.js
CHANGED
|
@@ -122,7 +122,8 @@ async function writeResponse(source, destination) {
|
|
|
122
122
|
destination.on("close", () => {
|
|
123
123
|
reader.cancel().catch((err) => {
|
|
124
124
|
console.error(
|
|
125
|
-
|
|
125
|
+
"There was an uncaught error in the middle of the stream while rendering %s.",
|
|
126
|
+
destination.req.url,
|
|
126
127
|
err
|
|
127
128
|
);
|
|
128
129
|
});
|
|
@@ -10,6 +10,7 @@ import { RouteCache } from "./render/route-cache.js";
|
|
|
10
10
|
import { createDefaultRoutes } from "./routing/default.js";
|
|
11
11
|
import { NodePool } from "../runtime/server/render/queue/pool.js";
|
|
12
12
|
import { HTMLStringCache } from "../runtime/server/html-string-cache.js";
|
|
13
|
+
import { FORBIDDEN_PATH_KEYS } from "@astrojs/internal-helpers/object";
|
|
13
14
|
class Pipeline {
|
|
14
15
|
internalMiddleware;
|
|
15
16
|
resolvedMiddleware = void 0;
|
|
@@ -169,6 +170,12 @@ class Pipeline {
|
|
|
169
170
|
);
|
|
170
171
|
}
|
|
171
172
|
for (const key of pathKeys) {
|
|
173
|
+
if (FORBIDDEN_PATH_KEYS.has(key)) {
|
|
174
|
+
throw new AstroError({
|
|
175
|
+
...ActionNotFoundError,
|
|
176
|
+
message: ActionNotFoundError.message(pathKeys.join("."))
|
|
177
|
+
});
|
|
178
|
+
}
|
|
172
179
|
if (!Object.hasOwn(server, key)) {
|
|
173
180
|
throw new AstroError({
|
|
174
181
|
...ActionNotFoundError,
|
|
@@ -96,7 +96,7 @@ function parseVaryHeader(response) {
|
|
|
96
96
|
return headers.length > 0 ? headers : void 0;
|
|
97
97
|
}
|
|
98
98
|
function getVaryValues(request, varyHeaders) {
|
|
99
|
-
const values =
|
|
99
|
+
const values = /* @__PURE__ */ Object.create(null);
|
|
100
100
|
for (const header of varyHeaders) {
|
|
101
101
|
values[header] = request.headers.get(header) ?? "";
|
|
102
102
|
}
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -37,7 +37,7 @@ async function dev(inlineConfig) {
|
|
|
37
37
|
await telemetry.record([]);
|
|
38
38
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
39
39
|
const logger = restart.container.logger;
|
|
40
|
-
const currentVersion = "6.1.
|
|
40
|
+
const currentVersion = "6.1.10";
|
|
41
41
|
const isPrerelease = currentVersion.includes("-");
|
|
42
42
|
if (!isPrerelease) {
|
|
43
43
|
try {
|
|
@@ -89,7 +89,7 @@ async function dev(inlineConfig) {
|
|
|
89
89
|
});
|
|
90
90
|
contentLayer.watchContentConfig();
|
|
91
91
|
await contentLayer.sync();
|
|
92
|
-
} else {
|
|
92
|
+
} else if (config.status !== "does-not-exist") {
|
|
93
93
|
logger.warn("content", "Content config not loaded");
|
|
94
94
|
}
|
|
95
95
|
const devServerAddressInfo = await startContainer(restart.container);
|
|
@@ -3,7 +3,7 @@ import type { AstroInlineConfig } from '../../types/public/config.js';
|
|
|
3
3
|
import type { Container } from './container.js';
|
|
4
4
|
interface CreateContainerWithAutomaticRestart {
|
|
5
5
|
inlineConfig?: AstroInlineConfig;
|
|
6
|
-
fs
|
|
6
|
+
fs?: typeof nodeFs;
|
|
7
7
|
}
|
|
8
8
|
interface Restart {
|
|
9
9
|
container: Container;
|
|
@@ -22,12 +22,16 @@ export declare function encodeKey(key: CryptoKey): Promise<string>;
|
|
|
22
22
|
export declare function decodeKey(encoded: string): Promise<CryptoKey>;
|
|
23
23
|
/**
|
|
24
24
|
* Using a CryptoKey, encrypt a string into a base64 string.
|
|
25
|
+
* @param additionalData Optional authenticated context (e.g. "props:ComponentName") that is
|
|
26
|
+
* verified during decryption but not included in the ciphertext. Both sides must agree on
|
|
27
|
+
* the same value or decryption will fail.
|
|
25
28
|
*/
|
|
26
|
-
export declare function encryptString(key: CryptoKey, raw: string): Promise<string>;
|
|
29
|
+
export declare function encryptString(key: CryptoKey, raw: string, additionalData?: string): Promise<string>;
|
|
27
30
|
/**
|
|
28
31
|
* Takes a base64 encoded string, decodes it and returns the decrypted text.
|
|
32
|
+
* @param additionalData Must match the value used during encryption, or decryption will fail.
|
|
29
33
|
*/
|
|
30
|
-
export declare function decryptString(key: CryptoKey, encoded: string): Promise<string>;
|
|
34
|
+
export declare function decryptString(key: CryptoKey, encoded: string, additionalData?: string): Promise<string>;
|
|
31
35
|
/**
|
|
32
36
|
* Generates an SHA-256 digest of the given string.
|
|
33
37
|
* @param {string} data The string to hash.
|
package/dist/core/encryption.js
CHANGED
|
@@ -43,30 +43,24 @@ async function decodeKey(encoded) {
|
|
|
43
43
|
const encoder = new TextEncoder();
|
|
44
44
|
const decoder = new TextDecoder();
|
|
45
45
|
const IV_LENGTH = 24;
|
|
46
|
-
async function encryptString(key, raw) {
|
|
46
|
+
async function encryptString(key, raw, additionalData) {
|
|
47
47
|
const iv = crypto.getRandomValues(new Uint8Array(IV_LENGTH / 2));
|
|
48
48
|
const data = encoder.encode(raw);
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
key,
|
|
55
|
-
data
|
|
56
|
-
);
|
|
49
|
+
const params = { name: ALGORITHM, iv };
|
|
50
|
+
if (additionalData) {
|
|
51
|
+
params.additionalData = encoder.encode(additionalData);
|
|
52
|
+
}
|
|
53
|
+
const buffer = await crypto.subtle.encrypt(params, key, data);
|
|
57
54
|
return encodeHexUpperCase(iv) + encodeBase64(new Uint8Array(buffer));
|
|
58
55
|
}
|
|
59
|
-
async function decryptString(key, encoded) {
|
|
56
|
+
async function decryptString(key, encoded, additionalData) {
|
|
60
57
|
const iv = decodeHex(encoded.slice(0, IV_LENGTH));
|
|
61
58
|
const dataArray = decodeBase64(encoded.slice(IV_LENGTH));
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
key,
|
|
68
|
-
dataArray
|
|
69
|
-
);
|
|
59
|
+
const params = { name: ALGORITHM, iv };
|
|
60
|
+
if (additionalData) {
|
|
61
|
+
params.additionalData = encoder.encode(additionalData);
|
|
62
|
+
}
|
|
63
|
+
const decryptedBuffer = await crypto.subtle.decrypt(params, key, dataArray);
|
|
70
64
|
const decryptedString = decoder.decode(decryptedBuffer);
|
|
71
65
|
return decryptedString;
|
|
72
66
|
}
|
|
@@ -683,11 +683,13 @@ class ErrorOverlay extends HTMLElement {
|
|
|
683
683
|
errorLine.parentElement.parentElement.scrollTop = errorLine.offsetTop - errorLine.parentElement.parentElement.offsetTop - 8;
|
|
684
684
|
}
|
|
685
685
|
if (err.loc?.column) {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
686
|
+
const caretLine = document.createElement("span");
|
|
687
|
+
caretLine.className = "line error-caret";
|
|
688
|
+
const caret = document.createElement("span");
|
|
689
|
+
caret.style.paddingLeft = `${err.loc.column - 1}ch`;
|
|
690
|
+
caret.textContent = "^";
|
|
691
|
+
caretLine.append(caret);
|
|
692
|
+
errorLine.insertAdjacentElement("afterend", caretLine);
|
|
691
693
|
}
|
|
692
694
|
}
|
|
693
695
|
});
|
|
@@ -112,7 +112,11 @@ function createEndpoint(manifest) {
|
|
|
112
112
|
const key = await manifest.key;
|
|
113
113
|
let componentExport;
|
|
114
114
|
try {
|
|
115
|
-
componentExport = await decryptString(
|
|
115
|
+
componentExport = await decryptString(
|
|
116
|
+
key,
|
|
117
|
+
data.encryptedComponentExport,
|
|
118
|
+
`export:${componentId}`
|
|
119
|
+
);
|
|
116
120
|
} catch (_e) {
|
|
117
121
|
return badRequest("Encrypted componentExport value is invalid.");
|
|
118
122
|
}
|
|
@@ -120,7 +124,7 @@ function createEndpoint(manifest) {
|
|
|
120
124
|
let props = {};
|
|
121
125
|
if (encryptedProps !== "") {
|
|
122
126
|
try {
|
|
123
|
-
const propString = await decryptString(key, encryptedProps);
|
|
127
|
+
const propString = await decryptString(key, encryptedProps, `props:${componentId}`);
|
|
124
128
|
props = JSON.parse(propString);
|
|
125
129
|
} catch (_e) {
|
|
126
130
|
return badRequest("Encrypted props value is invalid.");
|
|
@@ -130,7 +134,7 @@ function createEndpoint(manifest) {
|
|
|
130
134
|
const encryptedSlots = data.encryptedSlots;
|
|
131
135
|
if (encryptedSlots !== "") {
|
|
132
136
|
try {
|
|
133
|
-
const slotsString = await decryptString(key, encryptedSlots);
|
|
137
|
+
const slotsString = await decryptString(key, encryptedSlots, `slots:${componentId}`);
|
|
134
138
|
decryptedSlots = JSON.parse(slotsString);
|
|
135
139
|
} catch (_e) {
|
|
136
140
|
return badRequest("Encrypted slots value is invalid.");
|
|
@@ -231,7 +231,7 @@ class AstroSession {
|
|
|
231
231
|
if (this.#toDestroy.size > 0) {
|
|
232
232
|
const cleanupPromises = [...this.#toDestroy].map(
|
|
233
233
|
(sessionId) => storage.removeItem(sessionId).catch((err) => {
|
|
234
|
-
console.error(
|
|
234
|
+
console.error("Failed to clean up session %s:", sessionId, err);
|
|
235
235
|
})
|
|
236
236
|
);
|
|
237
237
|
await Promise.all(cleanupPromises);
|
package/dist/preferences/dlv.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { FORBIDDEN_PATH_KEYS } from "@astrojs/internal-helpers/object";
|
|
1
2
|
function dlv(obj, key) {
|
|
2
3
|
for (const k of key.split(".")) {
|
|
3
|
-
obj
|
|
4
|
+
if (FORBIDDEN_PATH_KEYS.has(k) || !obj || typeof obj !== "object" || !Object.hasOwn(obj, k)) {
|
|
5
|
+
return void 0;
|
|
6
|
+
}
|
|
7
|
+
obj = obj[k];
|
|
4
8
|
}
|
|
5
9
|
return obj;
|
|
6
10
|
}
|
|
@@ -147,7 +147,10 @@ var audit_default = {
|
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
149
|
if (originalElement.nodeName === "IMG" && !originalElement.complete) {
|
|
150
|
-
|
|
150
|
+
await new Promise((resolve) => {
|
|
151
|
+
originalElement.addEventListener("load", () => resolve(), { once: true });
|
|
152
|
+
originalElement.addEventListener("error", () => resolve(), { once: true });
|
|
153
|
+
});
|
|
151
154
|
}
|
|
152
155
|
audits.push({
|
|
153
156
|
auditedElement: originalElement,
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
const FORBIDDEN_COMPONENT_EXPORT_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
1
2
|
{
|
|
2
3
|
const propTypes = {
|
|
3
4
|
0: (value) => reviveObject(value),
|
|
4
5
|
1: (value) => reviveArray(value),
|
|
6
|
+
// nosemgrep: javascript.lang.security.audit.detect-non-literal-regexp.detect-non-literal-regexp
|
|
7
|
+
// Regex props are serialized by Astro and revived here on the client.
|
|
5
8
|
2: (value) => new RegExp(value),
|
|
6
9
|
3: (value) => new Date(value),
|
|
7
10
|
4: (value) => new Map(reviveArray(value)),
|
|
@@ -74,10 +77,16 @@
|
|
|
74
77
|
]);
|
|
75
78
|
const componentExport = this.getAttribute("component-export") || "default";
|
|
76
79
|
if (!componentExport.includes(".")) {
|
|
80
|
+
if (FORBIDDEN_COMPONENT_EXPORT_KEYS.has(componentExport)) {
|
|
81
|
+
throw new Error(`Invalid component export path: ${componentExport}`);
|
|
82
|
+
}
|
|
77
83
|
this.Component = componentModule[componentExport];
|
|
78
84
|
} else {
|
|
79
85
|
this.Component = componentModule;
|
|
80
86
|
for (const part of componentExport.split(".")) {
|
|
87
|
+
if (FORBIDDEN_COMPONENT_EXPORT_KEYS.has(part) || !this.Component || typeof this.Component !== "object" && typeof this.Component !== "function" || !Object.hasOwn(this.Component, part)) {
|
|
88
|
+
throw new Error(`Invalid component export path: ${componentExport}`);
|
|
89
|
+
}
|
|
81
90
|
this.Component = this.Component[part];
|
|
82
91
|
}
|
|
83
92
|
}
|
|
@@ -88,7 +97,7 @@
|
|
|
88
97
|
this
|
|
89
98
|
);
|
|
90
99
|
} catch (e) {
|
|
91
|
-
console.error(
|
|
100
|
+
console.error("[astro-island] Error hydrating %s", this.getAttribute("component-url"), e);
|
|
92
101
|
}
|
|
93
102
|
}
|
|
94
103
|
hydrate = async () => {
|
|
@@ -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 A=Object.defineProperty;var
|
|
6
|
+
declare const _default: "(()=>{var A=Object.defineProperty;var C=(a,r,c)=>r in a?A(a,r,{enumerable:!0,configurable:!0,writable:!0,value:c}):a[r]=c;var l=(a,r,c)=>C(a,typeof r!=\"symbol\"?r+\"\":r,c);var E=new Set([\"__proto__\",\"constructor\",\"prototype\"]);{let a={0:t=>y(t),1:t=>c(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(c(t)),5:t=>new Set(c(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),11:t=>Number.POSITIVE_INFINITY*t},r=t=>{let[p,e]=t;return p in a?a[p](e):void 0},c=t=>t.map(r),y=t=>typeof t!=\"object\"||t===null?t:Object.fromEntries(Object.entries(t).map(([p,e])=>[p,r(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 d=this.querySelectorAll(\"astro-slot\"),n={},u=this.querySelectorAll(\"template[data-astro-template]\");for(let o of u){let i=o.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[o.getAttribute(\"data-astro-template\")||\"default\"]=o.innerHTML,o.remove())}for(let o of d){let i=o.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[o.getAttribute(\"name\")||\"default\"]=o.innerHTML)}let m;try{m=this.hasAttribute(\"props\")?y(JSON.parse(this.getAttribute(\"props\"))):{}}catch(o){let i=this.getAttribute(\"component-url\")||\"<unknown>\",v=this.getAttribute(\"component-export\");throw v&&(i+=` (export ${v})`),console.error(`[hydrate] Error parsing props for component ${i}`,this.getAttribute(\"props\"),o),o}let s,h=this.hydrator(this);s=performance.now(),await h(this.Component,m,n,{client:this.getAttribute(\"client\")}),s&&this.setAttribute(\"client-render-time\",(performance.now()-s).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),d.disconnect(),this.childrenConnectedCallback()},d=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue===\"astro:end\"&&(this.lastChild.remove(),e())});d.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\")),d=this.getAttribute(\"client\");if(Astro[d]===void 0){window.addEventListener(`astro:${d}`,()=>this.start(),{once:!0});return}try{await Astro[d](async()=>{let n=this.getAttribute(\"renderer-url\"),[u,{default:m}]=await Promise.all([import(this.getAttribute(\"component-url\")),n?import(n):()=>()=>{}]),s=this.getAttribute(\"component-export\")||\"default\";if(s.includes(\".\")){this.Component=u;for(let h of s.split(\".\")){if(E.has(h)||!this.Component||typeof this.Component!=\"object\"&&typeof this.Component!=\"function\"||!Object.hasOwn(this.Component,h))throw new Error(`Invalid component export path: ${s}`);this.Component=this.Component[h]}}else{if(E.has(s))throw new Error(`Invalid component export path: ${s}`);this.Component=u[s]}return this.hydrator=m,this.hydrate},e,this)}catch(n){console.error(\"[astro-island] Error hydrating %s\",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 A=Object.defineProperty;var
|
|
1
|
+
var astro_island_prebuilt_dev_default = `(()=>{var A=Object.defineProperty;var C=(a,r,c)=>r in a?A(a,r,{enumerable:!0,configurable:!0,writable:!0,value:c}):a[r]=c;var l=(a,r,c)=>C(a,typeof r!="symbol"?r+"":r,c);var E=new Set(["__proto__","constructor","prototype"]);{let a={0:t=>y(t),1:t=>c(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(c(t)),5:t=>new Set(c(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),11:t=>Number.POSITIVE_INFINITY*t},r=t=>{let[p,e]=t;return p in a?a[p](e):void 0},c=t=>t.map(r),y=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([p,e])=>[p,r(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 d=this.querySelectorAll("astro-slot"),n={},u=this.querySelectorAll("template[data-astro-template]");for(let o of u){let i=o.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[o.getAttribute("data-astro-template")||"default"]=o.innerHTML,o.remove())}for(let o of d){let i=o.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[o.getAttribute("name")||"default"]=o.innerHTML)}let m;try{m=this.hasAttribute("props")?y(JSON.parse(this.getAttribute("props"))):{}}catch(o){let i=this.getAttribute("component-url")||"<unknown>",v=this.getAttribute("component-export");throw v&&(i+=\` (export \${v})\`),console.error(\`[hydrate] Error parsing props for component \${i}\`,this.getAttribute("props"),o),o}let s,h=this.hydrator(this);s=performance.now(),await h(this.Component,m,n,{client:this.getAttribute("client")}),s&&this.setAttribute("client-render-time",(performance.now()-s).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),d.disconnect(),this.childrenConnectedCallback()},d=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue==="astro:end"&&(this.lastChild.remove(),e())});d.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")),d=this.getAttribute("client");if(Astro[d]===void 0){window.addEventListener(\`astro:\${d}\`,()=>this.start(),{once:!0});return}try{await Astro[d](async()=>{let n=this.getAttribute("renderer-url"),[u,{default:m}]=await Promise.all([import(this.getAttribute("component-url")),n?import(n):()=>()=>{}]),s=this.getAttribute("component-export")||"default";if(s.includes(".")){this.Component=u;for(let h of s.split(".")){if(E.has(h)||!this.Component||typeof this.Component!="object"&&typeof this.Component!="function"||!Object.hasOwn(this.Component,h))throw new Error(\`Invalid component export path: \${s}\`);this.Component=this.Component[h]}}else{if(E.has(s))throw new Error(\`Invalid component export path: \${s}\`);this.Component=u[s]}return this.hydrator=m,this.hydrate},e,this)}catch(n){console.error("[astro-island] Error hydrating %s",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 A=Object.defineProperty;var
|
|
6
|
+
declare const _default: "(()=>{var A=Object.defineProperty;var C=(i,o,a)=>o in i?A(i,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[o]=a;var l=(i,o,a)=>C(i,typeof o!=\"symbol\"?o+\"\":o,a);var E=new Set([\"__proto__\",\"constructor\",\"prototype\"]);{let i={0:t=>y(t),1:t=>a(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(a(t)),5:t=>new Set(a(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),11:t=>Number.POSITIVE_INFINITY*t},o=t=>{let[h,e]=t;return h in i?i[h](e):void 0},a=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;await this.hydrator(this)(this.Component,u,n,{client:this.getAttribute(\"client\")}),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;for(let m of d.split(\".\")){if(E.has(m)||!this.Component||typeof this.Component!=\"object\"&&typeof this.Component!=\"function\"||!Object.hasOwn(this.Component,m))throw new Error(`Invalid component export path: ${d}`);this.Component=this.Component[m]}}else{if(E.has(d))throw new Error(`Invalid component export path: ${d}`);this.Component=p[d]}return this.hydrator=u,this.hydrate},e,this)}catch(n){console.error(\"[astro-island] Error hydrating %s\",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_default = `(()=>{var A=Object.defineProperty;var
|
|
1
|
+
var astro_island_prebuilt_default = `(()=>{var A=Object.defineProperty;var C=(i,o,a)=>o in i?A(i,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[o]=a;var l=(i,o,a)=>C(i,typeof o!="symbol"?o+"":o,a);var E=new Set(["__proto__","constructor","prototype"]);{let i={0:t=>y(t),1:t=>a(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(a(t)),5:t=>new Set(a(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),11:t=>Number.POSITIVE_INFINITY*t},o=t=>{let[h,e]=t;return h in i?i[h](e):void 0},a=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;await this.hydrator(this)(this.Component,u,n,{client:this.getAttribute("client")}),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;for(let m of d.split(".")){if(E.has(m)||!this.Component||typeof this.Component!="object"&&typeof this.Component!="function"||!Object.hasOwn(this.Component,m))throw new Error(\`Invalid component export path: \${d}\`);this.Component=this.Component[m]}}else{if(E.has(d))throw new Error(\`Invalid component export path: \${d}\`);this.Component=p[d]}return this.hydrator=u,this.hydrate},e,this)}catch(n){console.error("[astro-island] Error hydrating %s",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_default as default
|
|
4
4
|
};
|
|
@@ -126,9 +126,13 @@ class ServerIslandComponent {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
const key = await this.result.key;
|
|
129
|
-
const componentExportEncrypted = await encryptString(
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
const componentExportEncrypted = await encryptString(
|
|
130
|
+
key,
|
|
131
|
+
componentExport,
|
|
132
|
+
`export:${componentId}`
|
|
133
|
+
);
|
|
134
|
+
const propsEncrypted = Object.keys(this.props).length === 0 ? "" : await encryptString(key, JSON.stringify(this.props), `props:${componentId}`);
|
|
135
|
+
const slotsEncrypted = Object.keys(renderedSlots).length === 0 ? "" : await encryptString(key, JSON.stringify(renderedSlots), `slots:${componentId}`);
|
|
132
136
|
const hostId = await this.getHostId();
|
|
133
137
|
const slash = this.result.base.endsWith("/") ? "" : "/";
|
|
134
138
|
let serverIslandUrl = `${this.result.base}${slash}_server-islands/${componentId}${this.result.trailingSlash === "always" ? "/" : ""}`;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { AstroComponentMetadata } from '../../types/public/internal.js';
|
|
2
|
-
export declare function serializeProps(props: any, metadata
|
|
2
|
+
export declare function serializeProps(props: any, metadata?: AstroComponentMetadata): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
1
2
|
import { telemetry } from "../events/index.js";
|
|
2
3
|
import { eventAppToggled } from "../events/toolbar.js";
|
|
3
4
|
const VIRTUAL_MODULE_ID = "astro:toolbar:internal";
|
|
@@ -14,7 +15,28 @@ function astroDevToolbar({ settings, logger }) {
|
|
|
14
15
|
"astro > aria-query",
|
|
15
16
|
"astro > axobject-query",
|
|
16
17
|
...settings.devToolbarApps.length > 0 ? ["astro/toolbar"] : []
|
|
17
|
-
]
|
|
18
|
+
],
|
|
19
|
+
esbuildOptions: {
|
|
20
|
+
plugins: [
|
|
21
|
+
{
|
|
22
|
+
name: "astro:strip-toolbar-sourcemap",
|
|
23
|
+
setup(build) {
|
|
24
|
+
build.onEnd((result) => {
|
|
25
|
+
if (!result.metafile) return;
|
|
26
|
+
for (const outputPath of Object.keys(result.metafile.outputs)) {
|
|
27
|
+
if (!outputPath.includes("entrypoint") || !outputPath.endsWith(".js"))
|
|
28
|
+
continue;
|
|
29
|
+
const code = readFileSync(outputPath, "utf-8");
|
|
30
|
+
const stripped = code.replace(/\/\/# sourceMappingURL=.*$/m, "");
|
|
31
|
+
if (stripped !== code) {
|
|
32
|
+
writeFileSync(outputPath, stripped);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
18
40
|
}
|
|
19
41
|
};
|
|
20
42
|
},
|
|
@@ -60,7 +60,8 @@ function vitePluginEnvironment({
|
|
|
60
60
|
finalEnvironmentOptions.optimizeDeps = {
|
|
61
61
|
include: [
|
|
62
62
|
// For the dev toolbar
|
|
63
|
-
"astro > html-escaper"
|
|
63
|
+
"astro > html-escaper",
|
|
64
|
+
"astro/runtime/client/dev-toolbar/entrypoint.js"
|
|
64
65
|
],
|
|
65
66
|
exclude: ["astro:*", "virtual:astro:*", "astro/virtual-modules/prefetch.js"],
|
|
66
67
|
// Astro files can't be rendered on the client
|
|
@@ -137,7 +137,7 @@ function markdown({ settings, logger }) {
|
|
|
137
137
|
'server:root': true,
|
|
138
138
|
}, {
|
|
139
139
|
'default': () => render\`\${unescapeHTML(html())}\`
|
|
140
|
-
})}\`;` : `render\`${charset}\${maybeRenderHead(
|
|
140
|
+
})}\`;` : `render\`${charset}\${maybeRenderHead()}\${unescapeHTML(html())}\`;`}
|
|
141
141
|
});
|
|
142
142
|
export default Content;
|
|
143
143
|
`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.10",
|
|
4
4
|
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "withastro",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"p-queue": "^9.1.0",
|
|
133
133
|
"package-manager-detector": "^1.6.0",
|
|
134
134
|
"piccolore": "^0.1.3",
|
|
135
|
-
"picomatch": "^4.0.
|
|
135
|
+
"picomatch": "^4.0.4",
|
|
136
136
|
"rehype": "^13.0.2",
|
|
137
137
|
"semver": "^7.7.4",
|
|
138
138
|
"shiki": "^4.0.2",
|
|
@@ -145,15 +145,15 @@
|
|
|
145
145
|
"ultrahtml": "^1.6.0",
|
|
146
146
|
"unifont": "~0.7.4",
|
|
147
147
|
"unist-util-visit": "^5.1.0",
|
|
148
|
-
"unstorage": "^1.17.
|
|
148
|
+
"unstorage": "^1.17.5",
|
|
149
149
|
"vfile": "^6.0.3",
|
|
150
|
-
"vite": "^7.3.
|
|
150
|
+
"vite": "^7.3.2",
|
|
151
151
|
"vitefu": "^1.1.2",
|
|
152
152
|
"xxhash-wasm": "^1.1.0",
|
|
153
153
|
"yargs-parser": "^22.0.0",
|
|
154
154
|
"zod": "^4.3.6",
|
|
155
|
-
"@astrojs/internal-helpers": "0.
|
|
156
|
-
"@astrojs/markdown-remark": "7.1.
|
|
155
|
+
"@astrojs/internal-helpers": "0.9.0",
|
|
156
|
+
"@astrojs/markdown-remark": "7.1.1",
|
|
157
157
|
"@astrojs/telemetry": "3.3.1"
|
|
158
158
|
},
|
|
159
159
|
"optionalDependencies": {
|
|
@@ -167,6 +167,7 @@
|
|
|
167
167
|
"@types/html-escaper": "3.0.4",
|
|
168
168
|
"@types/http-cache-semantics": "^4.2.0",
|
|
169
169
|
"@types/js-yaml": "^4.0.9",
|
|
170
|
+
"@types/parse-srcset": "^1.0.0",
|
|
170
171
|
"@types/picomatch": "^4.0.2",
|
|
171
172
|
"@types/semver": "^7.7.1",
|
|
172
173
|
"@types/yargs-parser": "^21.0.3",
|
|
@@ -188,8 +189,8 @@
|
|
|
188
189
|
"undici": "^7.22.0",
|
|
189
190
|
"unified": "^11.0.5",
|
|
190
191
|
"vitest": "^4.1.0",
|
|
191
|
-
"
|
|
192
|
-
"
|
|
192
|
+
"@astrojs/check": "0.9.9",
|
|
193
|
+
"astro-scripts": "0.0.14"
|
|
193
194
|
},
|
|
194
195
|
"engines": {
|
|
195
196
|
"node": ">=22.12.0",
|