astro 7.0.7 → 7.0.9
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/dev/background.js +2 -17
- package/dist/cli/dev/index.js +19 -10
- package/dist/cli/dev/stop.js +2 -22
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/content/content-layer.js +3 -3
- package/dist/content/vite-plugin-content-virtual-mod.js +8 -6
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/dev/lockfile.d.ts +8 -0
- package/dist/core/dev/lockfile.js +19 -0
- package/dist/core/head-propagation/buffer.d.ts +6 -7
- package/dist/core/head-propagation/buffer.js +9 -15
- package/dist/core/messages/runtime.js +1 -1
- package/dist/core/preview/index.js +1 -0
- package/dist/core/routing/params.js +4 -0
- package/dist/runtime/server/astro-island.js +1 -3
- 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/types/public/context.d.ts +20 -14
- package/dist/types/public/preview.d.ts +5 -0
- package/package.json +4 -4
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
readLockFile,
|
|
10
10
|
removeLockFile,
|
|
11
11
|
isProcessAlive,
|
|
12
|
-
|
|
12
|
+
killDevServer
|
|
13
13
|
} from "../../core/dev/lockfile.js";
|
|
14
14
|
import { resolveRoot } from "../../core/config/config.js";
|
|
15
15
|
const require2 = createRequire(import.meta.url);
|
|
@@ -40,22 +40,7 @@ async function background({
|
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
if (existing && flags.force) {
|
|
43
|
-
|
|
44
|
-
process.kill(existing.pid, "SIGTERM");
|
|
45
|
-
} catch {
|
|
46
|
-
}
|
|
47
|
-
const deadline2 = Date.now() + GRACEFUL_SHUTDOWN_TIMEOUT;
|
|
48
|
-
while (Date.now() < deadline2) {
|
|
49
|
-
if (!isProcessAlive(existing.pid)) break;
|
|
50
|
-
await new Promise((r) => setTimeout(r, 100));
|
|
51
|
-
}
|
|
52
|
-
if (isProcessAlive(existing.pid)) {
|
|
53
|
-
try {
|
|
54
|
-
process.kill(existing.pid, "SIGKILL");
|
|
55
|
-
} catch {
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
removeLockFile(root);
|
|
43
|
+
await killDevServer(root, existing);
|
|
59
44
|
}
|
|
60
45
|
const args = ["dev"];
|
|
61
46
|
if (flags.port) args.push("--port", String(flags.port));
|
package/dist/cli/dev/index.js
CHANGED
|
@@ -2,7 +2,12 @@ import { detectAgenticEnvironment } from "am-i-vibing";
|
|
|
2
2
|
import colors from "piccolore";
|
|
3
3
|
import devServer from "../../core/dev/index.js";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
checkExistingServer,
|
|
7
|
+
killDevServer,
|
|
8
|
+
removeLockFile,
|
|
9
|
+
writeLockFile
|
|
10
|
+
} from "../../core/dev/lockfile.js";
|
|
6
11
|
import { resolveRoot } from "../../core/config/config.js";
|
|
7
12
|
import { printHelp } from "../../core/messages/runtime.js";
|
|
8
13
|
import { createLoggerFromFlags, flagsToAstroInlineConfig } from "../flags.js";
|
|
@@ -83,15 +88,19 @@ Run \`astro dev --help\` to see available commands.`
|
|
|
83
88
|
const root = pathToFileURL(resolveRoot(flags.root) + "/");
|
|
84
89
|
const existingServer = checkExistingServer(root);
|
|
85
90
|
if (existingServer) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
if (flags.force) {
|
|
92
|
+
await killDevServer(root, existingServer);
|
|
93
|
+
} else {
|
|
94
|
+
const message = [
|
|
95
|
+
"Another astro dev server is already running.",
|
|
96
|
+
"",
|
|
97
|
+
` URL: ${existingServer.url}`,
|
|
98
|
+
` PID: ${existingServer.pid}`,
|
|
99
|
+
"",
|
|
100
|
+
`Run \`astro dev stop\` to stop it, or use \`astro dev --force\` to replace it.`
|
|
101
|
+
].join("\n");
|
|
102
|
+
throw new Error(message);
|
|
103
|
+
}
|
|
95
104
|
}
|
|
96
105
|
const inlineConfig = flagsToAstroInlineConfig(flags);
|
|
97
106
|
const server = await devServer(inlineConfig);
|
package/dist/cli/dev/stop.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { pathToFileURL } from "node:url";
|
|
2
|
-
import {
|
|
3
|
-
checkExistingServer,
|
|
4
|
-
removeLockFile,
|
|
5
|
-
isProcessAlive,
|
|
6
|
-
GRACEFUL_SHUTDOWN_TIMEOUT
|
|
7
|
-
} from "../../core/dev/lockfile.js";
|
|
2
|
+
import { checkExistingServer, killDevServer } from "../../core/dev/lockfile.js";
|
|
8
3
|
import { resolveRoot } from "../../core/config/config.js";
|
|
9
4
|
function formatStopOutput(result) {
|
|
10
5
|
return JSON.stringify(result);
|
|
@@ -19,22 +14,7 @@ async function stop({
|
|
|
19
14
|
logger.info("SKIP_FORMAT", "No dev server is running.");
|
|
20
15
|
return;
|
|
21
16
|
}
|
|
22
|
-
|
|
23
|
-
process.kill(existing.pid, "SIGTERM");
|
|
24
|
-
} catch {
|
|
25
|
-
}
|
|
26
|
-
const deadline = Date.now() + GRACEFUL_SHUTDOWN_TIMEOUT;
|
|
27
|
-
while (Date.now() < deadline) {
|
|
28
|
-
if (!isProcessAlive(existing.pid)) break;
|
|
29
|
-
await new Promise((r) => setTimeout(r, 100));
|
|
30
|
-
}
|
|
31
|
-
if (isProcessAlive(existing.pid)) {
|
|
32
|
-
try {
|
|
33
|
-
process.kill(existing.pid, "SIGKILL");
|
|
34
|
-
} catch {
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
removeLockFile(root);
|
|
17
|
+
await killDevServer(root, existing);
|
|
38
18
|
logger.info("SKIP_FORMAT", `Stopped dev server (pid ${existing.pid}).`);
|
|
39
19
|
}
|
|
40
20
|
export {
|
|
@@ -197,7 +197,7 @@ ${contentConfig.error.message}`
|
|
|
197
197
|
logger.info("Content config changed");
|
|
198
198
|
shouldClear = true;
|
|
199
199
|
}
|
|
200
|
-
if (previousAstroVersion && previousAstroVersion !== "7.0.
|
|
200
|
+
if (previousAstroVersion && previousAstroVersion !== "7.0.9") {
|
|
201
201
|
logger.info("Astro version changed");
|
|
202
202
|
shouldClear = true;
|
|
203
203
|
}
|
|
@@ -205,8 +205,8 @@ ${contentConfig.error.message}`
|
|
|
205
205
|
logger.info("Clearing content store");
|
|
206
206
|
this.#store.clearAll();
|
|
207
207
|
}
|
|
208
|
-
if ("7.0.
|
|
209
|
-
this.#store.metaStore().set("astro-version", "7.0.
|
|
208
|
+
if ("7.0.9") {
|
|
209
|
+
this.#store.metaStore().set("astro-version", "7.0.9");
|
|
210
210
|
}
|
|
211
211
|
if (currentConfigDigest) {
|
|
212
212
|
this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
|
@@ -43,7 +43,7 @@ function invalidateAssetImports(viteServer, filePath) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
function invalidateDataStore(viteServer) {
|
|
46
|
+
function invalidateDataStore(viteServer, { notifyClient = true } = {}) {
|
|
47
47
|
const environment = viteServer.environments[ASTRO_VITE_ENVIRONMENT_NAMES.ssr];
|
|
48
48
|
const module = environment.moduleGraph.getModuleById(RESOLVED_DATA_STORE_VIRTUAL_ID);
|
|
49
49
|
if (module) {
|
|
@@ -59,10 +59,12 @@ function invalidateDataStore(viteServer) {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
environment.hot.send("astro:content-changed", {});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
if (notifyClient) {
|
|
63
|
+
viteServer.environments.client.hot.send({
|
|
64
|
+
type: "full-reload",
|
|
65
|
+
path: "*"
|
|
66
|
+
});
|
|
67
|
+
}
|
|
66
68
|
}
|
|
67
69
|
function astroContentVirtualModPlugin({
|
|
68
70
|
settings,
|
|
@@ -92,7 +94,7 @@ function astroContentVirtualModPlugin({
|
|
|
92
94
|
const assetImportsPath = fileURLToPath(new URL(ASSET_IMPORTS_FILE, settings.dotAstroDir));
|
|
93
95
|
devServer.watcher.add(fileURLToPath(dataStoreFile));
|
|
94
96
|
devServer.watcher.add(assetImportsPath);
|
|
95
|
-
invalidateDataStore(devServer);
|
|
97
|
+
invalidateDataStore(devServer, { notifyClient: false });
|
|
96
98
|
invalidateAssetImports(devServer, assetImportsPath);
|
|
97
99
|
}
|
|
98
100
|
},
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -26,7 +26,7 @@ async function dev(inlineConfig) {
|
|
|
26
26
|
await telemetry.record([]);
|
|
27
27
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
28
28
|
const logger = restart.container.logger;
|
|
29
|
-
const currentVersion = "7.0.
|
|
29
|
+
const currentVersion = "7.0.9";
|
|
30
30
|
const isPrerelease = currentVersion.includes("-");
|
|
31
31
|
if (!isPrerelease) {
|
|
32
32
|
try {
|
|
@@ -48,6 +48,14 @@ export declare function removeLockFile(root: URL): void;
|
|
|
48
48
|
* This is the pure decision logic, separated from I/O for testability.
|
|
49
49
|
*/
|
|
50
50
|
export declare function evaluateExistingServer(data: LockFileData | null, alive: boolean): ExistingServer | null;
|
|
51
|
+
/**
|
|
52
|
+
* Kill the dev server identified by `data` and clean up its lock file.
|
|
53
|
+
*
|
|
54
|
+
* Sends SIGTERM and waits up to {@link GRACEFUL_SHUTDOWN_TIMEOUT} for the
|
|
55
|
+
* process to exit, escalating to SIGKILL if it is still alive. The lock file
|
|
56
|
+
* is always removed afterwards so a new server can start.
|
|
57
|
+
*/
|
|
58
|
+
export declare function killDevServer(root: URL, data: LockFileData): Promise<void>;
|
|
51
59
|
/**
|
|
52
60
|
* Check for an existing dev server by reading the lock file and checking process liveness.
|
|
53
61
|
* Automatically cleans up stale lock files.
|
|
@@ -80,6 +80,24 @@ function evaluateExistingServer(data, alive) {
|
|
|
80
80
|
}
|
|
81
81
|
return { data, stale: !alive };
|
|
82
82
|
}
|
|
83
|
+
async function killDevServer(root, data) {
|
|
84
|
+
try {
|
|
85
|
+
process.kill(data.pid, "SIGTERM");
|
|
86
|
+
} catch {
|
|
87
|
+
}
|
|
88
|
+
const deadline = Date.now() + GRACEFUL_SHUTDOWN_TIMEOUT;
|
|
89
|
+
while (Date.now() < deadline) {
|
|
90
|
+
if (!isProcessAlive(data.pid)) break;
|
|
91
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
92
|
+
}
|
|
93
|
+
if (isProcessAlive(data.pid)) {
|
|
94
|
+
try {
|
|
95
|
+
process.kill(data.pid, "SIGKILL");
|
|
96
|
+
} catch {
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
removeLockFile(root);
|
|
100
|
+
}
|
|
83
101
|
function checkExistingServer(root) {
|
|
84
102
|
const data = readLockFile(root);
|
|
85
103
|
const result = evaluateExistingServer(data, data !== null && isProcessAlive(data.pid));
|
|
@@ -98,6 +116,7 @@ export {
|
|
|
98
116
|
evaluateExistingServer,
|
|
99
117
|
getLogFileURL,
|
|
100
118
|
isProcessAlive,
|
|
119
|
+
killDevServer,
|
|
101
120
|
parseLockFile,
|
|
102
121
|
readLockFile,
|
|
103
122
|
removeLockFile,
|
|
@@ -10,14 +10,13 @@ export interface HeadPropagator {
|
|
|
10
10
|
* its children, and one of those children may be a `self` component that emits
|
|
11
11
|
* styles. Slots add a second way to find them — a slot whose markup contains an
|
|
12
12
|
* `await` only reaches the components after that `await` once it resolves, so
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* the pending slot pre-renders are fully drained before moving on to the next
|
|
14
|
+
* propagator.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* additions.
|
|
16
|
+
* A single pass over the live `Set` reaches every late registration: a `Set`
|
|
17
|
+
* iterator visits entries added during iteration (in insertion order), and
|
|
18
|
+
* because slots are drained before the iterator advances, nothing can register
|
|
19
|
+
* a propagator after the iterator has reported `done`.
|
|
21
20
|
*
|
|
22
21
|
* @example
|
|
23
22
|
* If a layout initializes and discovers a nested component that also emits
|
|
@@ -1,25 +1,19 @@
|
|
|
1
1
|
async function collectPropagatedHeadParts(input) {
|
|
2
2
|
const collectedHeadParts = [];
|
|
3
|
-
const seen = /* @__PURE__ */ new Set();
|
|
4
3
|
const pendingSlotEvaluations = input.result._metadata?.pendingSlotEvaluations ?? [];
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const drainPendingSlots = async () => {
|
|
5
|
+
while (pendingSlotEvaluations.length > 0) {
|
|
7
6
|
const batch = pendingSlotEvaluations.splice(0, pendingSlotEvaluations.length);
|
|
8
7
|
await Promise.all(batch);
|
|
9
|
-
continue;
|
|
10
8
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (input.isHeadAndContent(returnValue) && returnValue.head) {
|
|
18
|
-
collectedHeadParts.push(returnValue.head);
|
|
19
|
-
}
|
|
20
|
-
break;
|
|
9
|
+
};
|
|
10
|
+
await drainPendingSlots();
|
|
11
|
+
for (const propagator of input.propagators) {
|
|
12
|
+
const returnValue = await propagator.init(input.result);
|
|
13
|
+
if (input.isHeadAndContent(returnValue) && returnValue.head) {
|
|
14
|
+
collectedHeadParts.push(returnValue.head);
|
|
21
15
|
}
|
|
22
|
-
|
|
16
|
+
await drainPendingSlots();
|
|
23
17
|
}
|
|
24
18
|
return collectedHeadParts;
|
|
25
19
|
}
|
|
@@ -69,6 +69,7 @@ async function preview(inlineConfig) {
|
|
|
69
69
|
logger: new AstroIntegrationLogger(logger.options, settings.adapter.name),
|
|
70
70
|
headers: settings.config.server.headers,
|
|
71
71
|
allowedHosts: settings.config.server.allowedHosts,
|
|
72
|
+
open: settings.config.server.open,
|
|
72
73
|
root: settings.config.root
|
|
73
74
|
});
|
|
74
75
|
return server;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { hasFileExtension } from "@astrojs/internal-helpers/path";
|
|
1
2
|
import { trimSlashes } from "../path.js";
|
|
2
3
|
import { getRouteGenerator } from "./generator.js";
|
|
3
4
|
import { validateGetStaticPathsParameter } from "./internal/validation.js";
|
|
4
5
|
function stringifyParams(params, route, trailingSlash) {
|
|
6
|
+
if (route.type === "endpoint" && hasFileExtension(route.route)) {
|
|
7
|
+
trailingSlash = "never";
|
|
8
|
+
}
|
|
5
9
|
const validatedParams = {};
|
|
6
10
|
for (const [key, value] of Object.entries(params)) {
|
|
7
11
|
validateGetStaticPathsParameter([key, value], route.component);
|
|
@@ -61,9 +61,7 @@ const FORBIDDEN_COMPONENT_EXPORT_KEYS = /* @__PURE__ */ new Set(["__proto__", "c
|
|
|
61
61
|
}
|
|
62
62
|
getRetryImportUrl(url) {
|
|
63
63
|
const parsed = new URL(url, document.baseURI);
|
|
64
|
-
|
|
65
|
-
const currentHash = parsed.hash.replace(/^#/, "");
|
|
66
|
-
parsed.hash = currentHash ? `${currentHash}&${retryToken}` : retryToken;
|
|
64
|
+
parsed.searchParams.set("astro-retry", Date.now().toString());
|
|
67
65
|
return parsed.toString();
|
|
68
66
|
}
|
|
69
67
|
async importWithRetry(url) {
|
|
@@ -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 g=Object.defineProperty;var w=(
|
|
6
|
+
declare const _default: "(()=>{var g=Object.defineProperty;var w=(c,s,d)=>s in c?g(c,s,{enumerable:!0,configurable:!0,writable:!0,value:d}):c[s]=d;var l=(c,s,d)=>w(c,typeof s!=\"symbol\"?s+\"\":s,d);var E=new Set([\"__proto__\",\"constructor\",\"prototype\"]);{let c={0:t=>y(t),1:t=>d(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(d(t)),5:t=>new Set(d(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},s=t=>{let[p,e]=t;return p in c?c[p](e):void 0},d=t=>t.map(s),y=t=>typeof t!=\"object\"||t===null?t:Object.fromEntries(Object.entries(t).map(([p,e])=>[p,s(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 r=this.querySelectorAll(\"astro-slot\"),n={},h=this.querySelectorAll(\"template[data-astro-template]\");for(let o of h){let a=o.closest(this.tagName);a!=null&&a.isSameNode(this)&&(n[o.getAttribute(\"data-astro-template\")||\"default\"]=o.innerHTML,o.remove())}for(let o of r){let a=o.closest(this.tagName);a!=null&&a.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 a=this.getAttribute(\"component-url\")||\"<unknown>\",v=this.getAttribute(\"component-export\");throw v&&(a+=` (export ${v})`),console.error(`[hydrate] Error parsing props for component ${a}`,this.getAttribute(\"props\"),o),o}let i,u=this.hydrator(this);i=performance.now(),await u(this.Component,m,n,{client:this.getAttribute(\"client\")}),i&&this.setAttribute(\"client-render-time\",(performance.now()-i).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),r.disconnect(),this.childrenConnectedCallback()},r=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue===\"astro:end\"&&(this.lastChild.remove(),e())});r.observe(this,{childList:!0}),document.addEventListener(\"DOMContentLoaded\",e)}}async childrenConnectedCallback(){let e=this.getAttribute(\"before-hydration-url\");e&&await import(e),this.start()}getRetryImportUrl(e){let r=new URL(e,document.baseURI);return r.searchParams.set(\"astro-retry\",Date.now().toString()),r.toString()}async importWithRetry(e){try{return await import(e)}catch(r){return await new Promise(n=>setTimeout(n,1e3)),import(this.getRetryImportUrl(e))}}handleHydrationError(e){let r=this.getAttribute(\"component-url\"),n=new CustomEvent(\"astro:hydration-error\",{cancelable:!0,bubbles:!0,composed:!0,detail:{error:e,componentUrl:r}});this.dispatchEvent(n)&&console.error(`[astro-island] Error hydrating ${r}`,e)}async start(){let e=JSON.parse(this.getAttribute(\"opts\")),r=this.getAttribute(\"client\");if(Astro[r]===void 0){window.addEventListener(`astro:${r}`,()=>this.start(),{once:!0});return}try{await Astro[r](async()=>{let n=this.getAttribute(\"renderer-url\");try{let[h,{default:m}]=await Promise.all([this.importWithRetry(this.getAttribute(\"component-url\")),n?this.importWithRetry(n):Promise.resolve({default:()=>()=>{}})]),i=this.getAttribute(\"component-export\")||\"default\";if(i.includes(\".\")){this.Component=h;for(let u of i.split(\".\")){if(E.has(u)||!this.Component||typeof this.Component!=\"object\"&&typeof this.Component!=\"function\"||!Object.hasOwn(this.Component,u))throw new Error(`Invalid component export path: ${i}`);this.Component=this.Component[u]}}else{if(E.has(i))throw new Error(`Invalid component export path: ${i}`);this.Component=h[i]}return this.hydrator=m,this.hydrate}catch(h){return this.handleHydrationError(h),()=>{}}},e,this)}catch(n){this.handleHydrationError(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 g=Object.defineProperty;var w=(
|
|
1
|
+
var astro_island_prebuilt_dev_default = `(()=>{var g=Object.defineProperty;var w=(c,s,d)=>s in c?g(c,s,{enumerable:!0,configurable:!0,writable:!0,value:d}):c[s]=d;var l=(c,s,d)=>w(c,typeof s!="symbol"?s+"":s,d);var E=new Set(["__proto__","constructor","prototype"]);{let c={0:t=>y(t),1:t=>d(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(d(t)),5:t=>new Set(d(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},s=t=>{let[p,e]=t;return p in c?c[p](e):void 0},d=t=>t.map(s),y=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([p,e])=>[p,s(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 r=this.querySelectorAll("astro-slot"),n={},h=this.querySelectorAll("template[data-astro-template]");for(let o of h){let a=o.closest(this.tagName);a!=null&&a.isSameNode(this)&&(n[o.getAttribute("data-astro-template")||"default"]=o.innerHTML,o.remove())}for(let o of r){let a=o.closest(this.tagName);a!=null&&a.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 a=this.getAttribute("component-url")||"<unknown>",v=this.getAttribute("component-export");throw v&&(a+=\` (export \${v})\`),console.error(\`[hydrate] Error parsing props for component \${a}\`,this.getAttribute("props"),o),o}let i,u=this.hydrator(this);i=performance.now(),await u(this.Component,m,n,{client:this.getAttribute("client")}),i&&this.setAttribute("client-render-time",(performance.now()-i).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),r.disconnect(),this.childrenConnectedCallback()},r=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue==="astro:end"&&(this.lastChild.remove(),e())});r.observe(this,{childList:!0}),document.addEventListener("DOMContentLoaded",e)}}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}getRetryImportUrl(e){let r=new URL(e,document.baseURI);return r.searchParams.set("astro-retry",Date.now().toString()),r.toString()}async importWithRetry(e){try{return await import(e)}catch(r){return await new Promise(n=>setTimeout(n,1e3)),import(this.getRetryImportUrl(e))}}handleHydrationError(e){let r=this.getAttribute("component-url"),n=new CustomEvent("astro:hydration-error",{cancelable:!0,bubbles:!0,composed:!0,detail:{error:e,componentUrl:r}});this.dispatchEvent(n)&&console.error(\`[astro-island] Error hydrating \${r}\`,e)}async start(){let e=JSON.parse(this.getAttribute("opts")),r=this.getAttribute("client");if(Astro[r]===void 0){window.addEventListener(\`astro:\${r}\`,()=>this.start(),{once:!0});return}try{await Astro[r](async()=>{let n=this.getAttribute("renderer-url");try{let[h,{default:m}]=await Promise.all([this.importWithRetry(this.getAttribute("component-url")),n?this.importWithRetry(n):Promise.resolve({default:()=>()=>{}})]),i=this.getAttribute("component-export")||"default";if(i.includes(".")){this.Component=h;for(let u of i.split(".")){if(E.has(u)||!this.Component||typeof this.Component!="object"&&typeof this.Component!="function"||!Object.hasOwn(this.Component,u))throw new Error(\`Invalid component export path: \${i}\`);this.Component=this.Component[u]}}else{if(E.has(i))throw new Error(\`Invalid component export path: \${i}\`);this.Component=h[i]}return this.hydrator=m,this.hydrate}catch(h){return this.handleHydrationError(h),()=>{}}},e,this)}catch(n){this.handleHydrationError(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 g=Object.defineProperty;var w=(
|
|
6
|
+
declare const _default: "(()=>{var g=Object.defineProperty;var w=(a,s,c)=>s in a?g(a,s,{enumerable:!0,configurable:!0,writable:!0,value:c}):a[s]=c;var l=(a,s,c)=>w(a,typeof s!=\"symbol\"?s+\"\":s,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},s=t=>{let[p,e]=t;return p in a?a[p](e):void 0},c=t=>t.map(s),y=t=>typeof t!=\"object\"||t===null?t:Object.fromEntries(Object.entries(t).map(([p,e])=>[p,s(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 r=this.querySelectorAll(\"astro-slot\"),n={},d=this.querySelectorAll(\"template[data-astro-template]\");for(let o of d){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 r){let i=o.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[o.getAttribute(\"name\")||\"default\"]=o.innerHTML)}let u;try{u=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 h;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),r.disconnect(),this.childrenConnectedCallback()},r=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue===\"astro:end\"&&(this.lastChild.remove(),e())});r.observe(this,{childList:!0}),document.addEventListener(\"DOMContentLoaded\",e)}}async childrenConnectedCallback(){let e=this.getAttribute(\"before-hydration-url\");e&&await import(e),this.start()}getRetryImportUrl(e){let r=new URL(e,document.baseURI);return r.searchParams.set(\"astro-retry\",Date.now().toString()),r.toString()}async importWithRetry(e){try{return await import(e)}catch(r){return await new Promise(n=>setTimeout(n,1e3)),import(this.getRetryImportUrl(e))}}handleHydrationError(e){let r=this.getAttribute(\"component-url\"),n=new CustomEvent(\"astro:hydration-error\",{cancelable:!0,bubbles:!0,composed:!0,detail:{error:e,componentUrl:r}});this.dispatchEvent(n)&&console.error(`[astro-island] Error hydrating ${r}`,e)}async start(){let e=JSON.parse(this.getAttribute(\"opts\")),r=this.getAttribute(\"client\");if(Astro[r]===void 0){window.addEventListener(`astro:${r}`,()=>this.start(),{once:!0});return}try{await Astro[r](async()=>{let n=this.getAttribute(\"renderer-url\");try{let[d,{default:u}]=await Promise.all([this.importWithRetry(this.getAttribute(\"component-url\")),n?this.importWithRetry(n):Promise.resolve({default:()=>()=>{}})]),h=this.getAttribute(\"component-export\")||\"default\";if(h.includes(\".\")){this.Component=d;for(let m of h.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: ${h}`);this.Component=this.Component[m]}}else{if(E.has(h))throw new Error(`Invalid component export path: ${h}`);this.Component=d[h]}return this.hydrator=u,this.hydrate}catch(d){return this.handleHydrationError(d),()=>{}}},e,this)}catch(n){this.handleHydrationError(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 g=Object.defineProperty;var w=(
|
|
1
|
+
var astro_island_prebuilt_default = `(()=>{var g=Object.defineProperty;var w=(a,s,c)=>s in a?g(a,s,{enumerable:!0,configurable:!0,writable:!0,value:c}):a[s]=c;var l=(a,s,c)=>w(a,typeof s!="symbol"?s+"":s,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},s=t=>{let[p,e]=t;return p in a?a[p](e):void 0},c=t=>t.map(s),y=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([p,e])=>[p,s(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 r=this.querySelectorAll("astro-slot"),n={},d=this.querySelectorAll("template[data-astro-template]");for(let o of d){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 r){let i=o.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[o.getAttribute("name")||"default"]=o.innerHTML)}let u;try{u=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 h;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),r.disconnect(),this.childrenConnectedCallback()},r=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue==="astro:end"&&(this.lastChild.remove(),e())});r.observe(this,{childList:!0}),document.addEventListener("DOMContentLoaded",e)}}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}getRetryImportUrl(e){let r=new URL(e,document.baseURI);return r.searchParams.set("astro-retry",Date.now().toString()),r.toString()}async importWithRetry(e){try{return await import(e)}catch(r){return await new Promise(n=>setTimeout(n,1e3)),import(this.getRetryImportUrl(e))}}handleHydrationError(e){let r=this.getAttribute("component-url"),n=new CustomEvent("astro:hydration-error",{cancelable:!0,bubbles:!0,composed:!0,detail:{error:e,componentUrl:r}});this.dispatchEvent(n)&&console.error(\`[astro-island] Error hydrating \${r}\`,e)}async start(){let e=JSON.parse(this.getAttribute("opts")),r=this.getAttribute("client");if(Astro[r]===void 0){window.addEventListener(\`astro:\${r}\`,()=>this.start(),{once:!0});return}try{await Astro[r](async()=>{let n=this.getAttribute("renderer-url");try{let[d,{default:u}]=await Promise.all([this.importWithRetry(this.getAttribute("component-url")),n?this.importWithRetry(n):Promise.resolve({default:()=>()=>{}})]),h=this.getAttribute("component-export")||"default";if(h.includes(".")){this.Component=d;for(let m of h.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: \${h}\`);this.Component=this.Component[m]}}else{if(E.has(h))throw new Error(\`Invalid component export path: \${h}\`);this.Component=d[h]}return this.hydrator=u,this.hydrate}catch(d){return this.handleHydrationError(d),()=>{}}},e,this)}catch(n){this.handleHydrationError(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
|
};
|
|
@@ -120,6 +120,25 @@ export interface AstroGlobal<Props extends Record<string, any> = Record<string,
|
|
|
120
120
|
render(slotName: string, args?: any[]): Promise<string>;
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* A type containing functions for logging messages.
|
|
125
|
+
*
|
|
126
|
+
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#logger)
|
|
127
|
+
*/
|
|
128
|
+
export interface AstroRuntimeLogger {
|
|
129
|
+
/**
|
|
130
|
+
* Logs a message with `info` level.
|
|
131
|
+
*/
|
|
132
|
+
info: (msg: string) => void;
|
|
133
|
+
/**
|
|
134
|
+
* Logs a message with `warn` level.
|
|
135
|
+
*/
|
|
136
|
+
warn: (msg: string) => void;
|
|
137
|
+
/**
|
|
138
|
+
* Logs a message with `error` level.
|
|
139
|
+
*/
|
|
140
|
+
error: (msg: string) => void;
|
|
141
|
+
}
|
|
123
142
|
/**
|
|
124
143
|
* The `APIContext` is the object made available to endpoints and middleware.
|
|
125
144
|
* It is a subset of the `Astro` global object available in pages.
|
|
@@ -533,20 +552,7 @@ export interface APIContext<Props extends Record<string, any> = Record<string, a
|
|
|
533
552
|
/**
|
|
534
553
|
* It exposes utilities for logging messages.
|
|
535
554
|
*/
|
|
536
|
-
logger:
|
|
537
|
-
/**
|
|
538
|
-
* Logs a message with `info` level.
|
|
539
|
-
*/
|
|
540
|
-
info: (msg: string) => void;
|
|
541
|
-
/**
|
|
542
|
-
* Logs a message with `warn` level.
|
|
543
|
-
*/
|
|
544
|
-
warn: (msg: string) => void;
|
|
545
|
-
/**
|
|
546
|
-
* Logs a message with `error` level.
|
|
547
|
-
*/
|
|
548
|
-
error: (msg: string) => void;
|
|
549
|
-
};
|
|
555
|
+
logger: AstroRuntimeLogger;
|
|
550
556
|
/**
|
|
551
557
|
* The route currently rendered. It's stripped of the `srcDir` and the `pages` folder, and it doesn't contain the extension.
|
|
552
558
|
*
|
|
@@ -21,6 +21,11 @@ export interface PreviewServerParams {
|
|
|
21
21
|
* If the `Host` header doesn't match one of the allowed hosts, the server will return a 403 response.
|
|
22
22
|
*/
|
|
23
23
|
allowedHosts?: string[] | true;
|
|
24
|
+
/**
|
|
25
|
+
* Controls whether the preview server should open in the browser on startup.
|
|
26
|
+
* Pass a full URL string (e.g. "http://example.com") or a pathname (e.g. "/about") to specify the URL to open.
|
|
27
|
+
*/
|
|
28
|
+
open?: string | boolean;
|
|
24
29
|
root: URL;
|
|
25
30
|
}
|
|
26
31
|
export type CreatePreviewServer = (params: PreviewServerParams) => PreviewServer | Promise<PreviewServer>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.9",
|
|
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",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"README.md"
|
|
97
97
|
],
|
|
98
98
|
"dependencies": {
|
|
99
|
-
"@astrojs/compiler-rs": "^0.3.
|
|
99
|
+
"@astrojs/compiler-rs": "^0.3.1",
|
|
100
100
|
"@capsizecss/unpack": "^4.0.0",
|
|
101
101
|
"@clack/prompts": "^1.1.0",
|
|
102
102
|
"@oslojs/encoding": "^1.1.0",
|
|
@@ -146,8 +146,8 @@
|
|
|
146
146
|
"xxhash-wasm": "^1.1.0",
|
|
147
147
|
"yargs-parser": "^22.0.0",
|
|
148
148
|
"zod": "^4.3.6",
|
|
149
|
-
"@astrojs/markdown-satteri": "0.3.3",
|
|
150
149
|
"@astrojs/internal-helpers": "0.10.1",
|
|
150
|
+
"@astrojs/markdown-satteri": "0.3.4",
|
|
151
151
|
"@astrojs/telemetry": "3.3.3"
|
|
152
152
|
},
|
|
153
153
|
"optionalDependencies": {
|
|
@@ -186,8 +186,8 @@
|
|
|
186
186
|
"typescript": "^6.0.3",
|
|
187
187
|
"undici": "^7.22.0",
|
|
188
188
|
"vitest": "^4.1.0",
|
|
189
|
-
"@astrojs/markdown-remark": "7.2.1",
|
|
190
189
|
"@astrojs/check": "0.9.9",
|
|
190
|
+
"@astrojs/markdown-remark": "7.2.1",
|
|
191
191
|
"astro-scripts": "0.0.14"
|
|
192
192
|
},
|
|
193
193
|
"engines": {
|