astro 4.4.3 → 4.4.5
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/@types/astro.d.ts +2 -1
- package/dist/cli/index.js +11 -2
- package/dist/cli/install-package.js +15 -4
- package/dist/core/build/plugins/util.js +8 -7
- package/dist/core/build/static-build.js +1 -0
- package/dist/core/config/merge.js +6 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/preview/index.js +2 -1
- package/dist/core/render/result.js +1 -1
- package/dist/core/render-context.d.ts +4 -1
- package/dist/core/render-context.js +42 -22
- package/dist/core/request.d.ts +2 -1
- package/dist/core/request.js +8 -2
- package/dist/runtime/client/dev-toolbar/apps/astro.js +4 -2
- package/dist/runtime/client/dev-toolbar/apps/audit/index.js +3 -25
- package/dist/runtime/client/dev-toolbar/apps/settings.d.ts +1 -1
- package/dist/runtime/client/dev-toolbar/apps/settings.js +3 -2
- package/dist/runtime/client/dev-toolbar/apps/utils/window.d.ts +1 -0
- package/dist/runtime/client/dev-toolbar/apps/utils/window.js +26 -0
- package/dist/runtime/client/dev-toolbar/apps/xray.js +2 -26
- package/dist/runtime/server/escape.js +2 -0
- package/dist/runtime/server/render/util.js +2 -0
- package/dist/runtime/server/transition.js +3 -0
- package/dist/vite-plugin-astro-server/request.js +0 -6
- package/dist/vite-plugin-astro-server/route.js +2 -1
- package/package.json +1 -1
package/dist/@types/astro.d.ts
CHANGED
|
@@ -212,7 +212,7 @@ export interface AstroGlobal<Props extends Record<string, any> = Record<string,
|
|
|
212
212
|
* <Fragment set:html={html} />
|
|
213
213
|
* ```
|
|
214
214
|
*
|
|
215
|
-
* A second
|
|
215
|
+
* A second parameter can be used to pass arguments to a slotted callback
|
|
216
216
|
*
|
|
217
217
|
* Example usage:
|
|
218
218
|
* ```astro
|
|
@@ -2459,6 +2459,7 @@ export interface PreviewServerParams {
|
|
|
2459
2459
|
port: number;
|
|
2460
2460
|
base: string;
|
|
2461
2461
|
logger: AstroIntegrationLogger;
|
|
2462
|
+
headers?: OutgoingHttpHeaders;
|
|
2462
2463
|
}
|
|
2463
2464
|
export type CreatePreviewServer = (params: PreviewServerParams) => PreviewServer | Promise<PreviewServer>;
|
|
2464
2465
|
export interface PreviewModule {
|
package/dist/cli/index.js
CHANGED
|
@@ -12,6 +12,7 @@ async function printAstroHelp() {
|
|
|
12
12
|
["add", "Add an integration."],
|
|
13
13
|
["build", "Build your project and write it to disk."],
|
|
14
14
|
["check", "Check your project for errors."],
|
|
15
|
+
["db", "Manage your Astro database."],
|
|
15
16
|
["dev", "Start the development server."],
|
|
16
17
|
["docs", "Open documentation in your web browser."],
|
|
17
18
|
["info", "List info about your current Astro setup."],
|
|
@@ -52,7 +53,11 @@ function resolveCommand(flags) {
|
|
|
52
53
|
"check",
|
|
53
54
|
"docs",
|
|
54
55
|
"db",
|
|
55
|
-
"info"
|
|
56
|
+
"info",
|
|
57
|
+
"login",
|
|
58
|
+
"loutout",
|
|
59
|
+
"link",
|
|
60
|
+
"init"
|
|
56
61
|
]);
|
|
57
62
|
if (supportedCommands.has(cmd)) {
|
|
58
63
|
return cmd;
|
|
@@ -108,7 +113,11 @@ async function runCommand(cmd, flags) {
|
|
|
108
113
|
await add(packages, { flags });
|
|
109
114
|
return;
|
|
110
115
|
}
|
|
111
|
-
case "db":
|
|
116
|
+
case "db":
|
|
117
|
+
case "login":
|
|
118
|
+
case "logout":
|
|
119
|
+
case "link":
|
|
120
|
+
case "init": {
|
|
112
121
|
const { db } = await import("./db/index.js");
|
|
113
122
|
await db({ flags });
|
|
114
123
|
return;
|
|
@@ -6,11 +6,22 @@ import prompts from "prompts";
|
|
|
6
6
|
import resolvePackage from "resolve";
|
|
7
7
|
import whichPm from "which-pm";
|
|
8
8
|
import {} from "../core/logger/core.js";
|
|
9
|
+
import { createRequire } from "node:module";
|
|
10
|
+
import { sep } from "node:path";
|
|
11
|
+
const require2 = createRequire(import.meta.url);
|
|
9
12
|
async function getPackage(packageName, logger, options, otherDeps = []) {
|
|
10
|
-
let packageImport;
|
|
11
13
|
try {
|
|
14
|
+
if (packageName === "@astrojs/db") {
|
|
15
|
+
const packageJsonLoc = require2.resolve(packageName + "/package.json", {
|
|
16
|
+
paths: [options.cwd ?? process.cwd()]
|
|
17
|
+
});
|
|
18
|
+
const packageLoc = packageJsonLoc.replace(`package.json`, "dist/index.js");
|
|
19
|
+
const packageImport2 = await import(packageLoc);
|
|
20
|
+
return packageImport2;
|
|
21
|
+
}
|
|
12
22
|
await tryResolve(packageName, options.cwd ?? process.cwd());
|
|
13
|
-
packageImport = await import(packageName);
|
|
23
|
+
const packageImport = await import(packageName);
|
|
24
|
+
return packageImport;
|
|
14
25
|
} catch (e) {
|
|
15
26
|
logger.info(
|
|
16
27
|
null,
|
|
@@ -18,12 +29,12 @@ async function getPackage(packageName, logger, options, otherDeps = []) {
|
|
|
18
29
|
);
|
|
19
30
|
const result = await installPackage([packageName, ...otherDeps], options, logger);
|
|
20
31
|
if (result) {
|
|
21
|
-
packageImport = await import(packageName);
|
|
32
|
+
const packageImport = await import(packageName);
|
|
33
|
+
return packageImport;
|
|
22
34
|
} else {
|
|
23
35
|
return void 0;
|
|
24
36
|
}
|
|
25
37
|
}
|
|
26
|
-
return packageImport;
|
|
27
38
|
}
|
|
28
39
|
function tryResolve(packageName, cwd) {
|
|
29
40
|
return new Promise((resolve, reject) => {
|
|
@@ -38,14 +38,15 @@ function getPathFromVirtualModulePageName(virtualModulePrefix, id) {
|
|
|
38
38
|
return pageName.replace(ASTRO_PAGE_EXTENSION_POST_PATTERN, ".");
|
|
39
39
|
}
|
|
40
40
|
function shouldInlineAsset(assetContent, assetPath, assetsInlineLimit) {
|
|
41
|
-
if (typeof assetsInlineLimit === "
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
if (typeof assetsInlineLimit === "function") {
|
|
42
|
+
const result = assetsInlineLimit(assetPath, Buffer.from(assetContent));
|
|
43
|
+
if (result != null) {
|
|
44
|
+
return result;
|
|
45
|
+
} else {
|
|
46
|
+
return Buffer.byteLength(assetContent) < 4096;
|
|
47
|
+
}
|
|
47
48
|
}
|
|
48
|
-
return Buffer.byteLength(assetContent) <
|
|
49
|
+
return Buffer.byteLength(assetContent) < Number(assetsInlineLimit);
|
|
49
50
|
}
|
|
50
51
|
export {
|
|
51
52
|
ASTRO_PAGE_EXTENSION_POST_PATTERN,
|
|
@@ -7,7 +7,7 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
|
|
|
7
7
|
if (value == null) {
|
|
8
8
|
continue;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
let existing = merged[key];
|
|
11
11
|
if (existing == null) {
|
|
12
12
|
merged[key] = value;
|
|
13
13
|
continue;
|
|
@@ -26,6 +26,11 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
|
|
|
26
26
|
continue;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
+
if (key === "data" && rootPath === "db") {
|
|
30
|
+
if (!Array.isArray(existing) && !Array.isArray(value)) {
|
|
31
|
+
existing = [existing];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
29
34
|
if (Array.isArray(existing) || Array.isArray(value)) {
|
|
30
35
|
merged[key] = [...arraify(existing ?? []), ...arraify(value ?? [])];
|
|
31
36
|
continue;
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
|
|
|
23
23
|
base: restart.container.settings.config.base
|
|
24
24
|
})
|
|
25
25
|
);
|
|
26
|
-
const currentVersion = "4.4.
|
|
26
|
+
const currentVersion = "4.4.5";
|
|
27
27
|
if (currentVersion.includes("-")) {
|
|
28
28
|
logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
|
|
29
29
|
}
|
package/dist/core/messages.js
CHANGED
|
@@ -36,7 +36,7 @@ function serverStart({
|
|
|
36
36
|
host,
|
|
37
37
|
base
|
|
38
38
|
}) {
|
|
39
|
-
const version = "4.4.
|
|
39
|
+
const version = "4.4.5";
|
|
40
40
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
41
41
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
42
42
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -261,7 +261,7 @@ function printHelp({
|
|
|
261
261
|
message.push(
|
|
262
262
|
linebreak(),
|
|
263
263
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
264
|
-
`v${"4.4.
|
|
264
|
+
`v${"4.4.5"}`
|
|
265
265
|
)} ${headline}`
|
|
266
266
|
);
|
|
267
267
|
}
|
|
@@ -58,7 +58,8 @@ async function preview(inlineConfig) {
|
|
|
58
58
|
host: getResolvedHostForHttpServer(settings.config.server.host),
|
|
59
59
|
port: settings.config.server.port,
|
|
60
60
|
base: settings.config.base,
|
|
61
|
-
logger: new AstroIntegrationLogger(logger.options, settings.adapter.name)
|
|
61
|
+
logger: new AstroIntegrationLogger(logger.options, settings.adapter.name),
|
|
62
|
+
headers: settings.config.server.headers
|
|
62
63
|
});
|
|
63
64
|
return server;
|
|
64
65
|
}
|
|
@@ -62,7 +62,7 @@ class Slots {
|
|
|
62
62
|
if (expression) {
|
|
63
63
|
const slot = async () => typeof expression === "function" ? expression(...args) : expression;
|
|
64
64
|
return await renderSlotToString(result, slot).then((res) => {
|
|
65
|
-
return res
|
|
65
|
+
return res;
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
if (typeof component === "function") {
|
|
@@ -12,6 +12,7 @@ export declare class RenderContext {
|
|
|
12
12
|
status: number;
|
|
13
13
|
readonly cookies: AstroCookies;
|
|
14
14
|
readonly params: import("../@types/astro.js").Params;
|
|
15
|
+
readonly url: URL;
|
|
15
16
|
private constructor();
|
|
16
17
|
static create({ locals, middleware, pathname, pipeline, request, routeData, status, }: Pick<RenderContext, 'pathname' | 'pipeline' | 'request' | 'routeData'> & Partial<Pick<RenderContext, 'locals' | 'middleware' | 'status'>>): RenderContext;
|
|
17
18
|
/**
|
|
@@ -28,5 +29,7 @@ export declare class RenderContext {
|
|
|
28
29
|
render(componentInstance: ComponentInstance | undefined): Promise<Response>;
|
|
29
30
|
createAPIContext(props: APIContext['props']): APIContext;
|
|
30
31
|
createResult(mod: ComponentInstance): Promise<import("../@types/astro.js").SSRResult>;
|
|
31
|
-
|
|
32
|
+
computeCurrentLocale(): string | undefined;
|
|
33
|
+
computePreferredLocale(): string | undefined;
|
|
34
|
+
computePreferredLocaleList(): string[] | undefined;
|
|
32
35
|
}
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "../i18n/utils.js";
|
|
21
21
|
import { renderRedirect } from "./redirects/render.js";
|
|
22
22
|
class RenderContext {
|
|
23
|
-
constructor(pipeline, locals, middleware, pathname, request, routeData, status, cookies = new AstroCookies(request), params = getParams(routeData, pathname)) {
|
|
23
|
+
constructor(pipeline, locals, middleware, pathname, request, routeData, status, cookies = new AstroCookies(request), params = getParams(routeData, pathname), url = new URL(request.url)) {
|
|
24
24
|
this.pipeline = pipeline;
|
|
25
25
|
this.locals = locals;
|
|
26
26
|
this.middleware = middleware;
|
|
@@ -30,6 +30,7 @@ class RenderContext {
|
|
|
30
30
|
this.status = status;
|
|
31
31
|
this.cookies = cookies;
|
|
32
32
|
this.params = params;
|
|
33
|
+
this.url = url;
|
|
33
34
|
}
|
|
34
35
|
static create({
|
|
35
36
|
locals = {},
|
|
@@ -98,19 +99,23 @@ class RenderContext {
|
|
|
98
99
|
}
|
|
99
100
|
createAPIContext(props) {
|
|
100
101
|
const renderContext = this;
|
|
101
|
-
const { cookies,
|
|
102
|
-
const { currentLocale, preferredLocale, preferredLocaleList } = i18nData;
|
|
102
|
+
const { cookies, params, pipeline, request, url } = this;
|
|
103
103
|
const generator = `Astro v${ASTRO_VERSION}`;
|
|
104
104
|
const redirect = (path, status = 302) => new Response(null, { status, headers: { Location: path } });
|
|
105
105
|
const site = pipeline.site ? new URL(pipeline.site) : void 0;
|
|
106
|
-
const url = new URL(request.url);
|
|
107
106
|
return {
|
|
108
107
|
cookies,
|
|
109
|
-
currentLocale
|
|
108
|
+
get currentLocale() {
|
|
109
|
+
return renderContext.computeCurrentLocale();
|
|
110
|
+
},
|
|
110
111
|
generator,
|
|
111
112
|
params,
|
|
112
|
-
preferredLocale
|
|
113
|
-
|
|
113
|
+
get preferredLocale() {
|
|
114
|
+
return renderContext.computePreferredLocale();
|
|
115
|
+
},
|
|
116
|
+
get preferredLocaleList() {
|
|
117
|
+
return renderContext.computePreferredLocaleList();
|
|
118
|
+
},
|
|
114
119
|
props,
|
|
115
120
|
redirect,
|
|
116
121
|
request,
|
|
@@ -191,27 +196,42 @@ class RenderContext {
|
|
|
191
196
|
* API Context may be created multiple times per request, i18n data needs to be computed only once.
|
|
192
197
|
* So, it is computed and saved here on creation of the first APIContext and reused for later ones.
|
|
193
198
|
*/
|
|
194
|
-
#
|
|
195
|
-
|
|
196
|
-
if (this.#i18nData)
|
|
197
|
-
return this.#i18nData;
|
|
199
|
+
#currentLocale;
|
|
200
|
+
computeCurrentLocale() {
|
|
198
201
|
const {
|
|
202
|
+
url,
|
|
199
203
|
pipeline: { i18n },
|
|
200
|
-
request,
|
|
201
204
|
routeData
|
|
202
205
|
} = this;
|
|
203
206
|
if (!i18n)
|
|
204
|
-
return
|
|
205
|
-
currentLocale: void 0,
|
|
206
|
-
preferredLocale: void 0,
|
|
207
|
-
preferredLocaleList: void 0
|
|
208
|
-
};
|
|
207
|
+
return;
|
|
209
208
|
const { defaultLocale, locales, strategy } = i18n;
|
|
210
|
-
return this.#
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
209
|
+
return this.#currentLocale ??= computeCurrentLocale(
|
|
210
|
+
routeData.route,
|
|
211
|
+
locales,
|
|
212
|
+
strategy,
|
|
213
|
+
defaultLocale
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
#preferredLocale;
|
|
217
|
+
computePreferredLocale() {
|
|
218
|
+
const {
|
|
219
|
+
pipeline: { i18n },
|
|
220
|
+
request
|
|
221
|
+
} = this;
|
|
222
|
+
if (!i18n)
|
|
223
|
+
return;
|
|
224
|
+
return this.#preferredLocale ??= computePreferredLocale(request, i18n.locales);
|
|
225
|
+
}
|
|
226
|
+
#preferredLocaleList;
|
|
227
|
+
computePreferredLocaleList() {
|
|
228
|
+
const {
|
|
229
|
+
pipeline: { i18n },
|
|
230
|
+
request
|
|
231
|
+
} = this;
|
|
232
|
+
if (!i18n)
|
|
233
|
+
return;
|
|
234
|
+
return this.#preferredLocaleList ??= computePreferredLocaleList(request, i18n.locales);
|
|
215
235
|
}
|
|
216
236
|
}
|
|
217
237
|
export {
|
package/dist/core/request.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface CreateRequestOptions {
|
|
|
12
12
|
logger: Logger;
|
|
13
13
|
ssr: boolean;
|
|
14
14
|
locals?: object | undefined;
|
|
15
|
+
removeParams?: boolean;
|
|
15
16
|
}
|
|
16
|
-
export declare function createRequest({ url, headers, clientAddress, method, body, logger, ssr, locals, }: CreateRequestOptions): Request;
|
|
17
|
+
export declare function createRequest({ url, headers, clientAddress, method, body, logger, ssr, locals, removeParams, }: CreateRequestOptions): Request;
|
|
17
18
|
export {};
|
package/dist/core/request.js
CHANGED
|
@@ -8,10 +8,16 @@ function createRequest({
|
|
|
8
8
|
body = void 0,
|
|
9
9
|
logger,
|
|
10
10
|
ssr,
|
|
11
|
-
locals
|
|
11
|
+
locals,
|
|
12
|
+
removeParams = false
|
|
12
13
|
}) {
|
|
13
14
|
let headersObj = headers instanceof Headers ? headers : new Headers(Object.entries(headers));
|
|
14
|
-
|
|
15
|
+
if (typeof url === "string")
|
|
16
|
+
url = new URL(url);
|
|
17
|
+
if (removeParams && url.pathname !== "/_image") {
|
|
18
|
+
url.search = "";
|
|
19
|
+
}
|
|
20
|
+
const request = new Request(url, {
|
|
15
21
|
method,
|
|
16
22
|
headers: headersObj,
|
|
17
23
|
body
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isDefinedIcon } from "../ui-library/icons.js";
|
|
2
2
|
import { colorForIntegration, iconForIntegration } from "./utils/icons.js";
|
|
3
|
-
import { createWindowElement } from "./utils/window.js";
|
|
3
|
+
import { closeOnOutsideClick, createWindowElement } from "./utils/window.js";
|
|
4
4
|
const astroLogo = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 99 26" width="100"><path fill="#fff" d="M6.70402 22.1453c-1.17459-1.0737-1.51748-3.3297-1.02811-4.9641.84853 1.0304 2.02424 1.3569 3.24204 1.5411 1.88005.2844 3.72635.178 5.47285-.6813.1998-.0984.3844-.2292.6027-.3617.1639.4755.2065.9554.1493 1.4439-.1392 1.1898-.7313 2.1088-1.673 2.8054-.3765.2787-.775.5278-1.1639.7905-1.1948.8075-1.518 1.7544-1.0691 3.1318.0107.0336.0202.0671.0444.149-.6101-.273-1.0557-.6705-1.39518-1.1931-.3586-.5517-.52921-1.1619-.53819-1.8221-.00449-.3213-.00449-.6455-.0477-.9623-.10551-.7722-.46804-1.118-1.15102-1.1379-.70094-.0205-1.2554.4129-1.40244 1.0953-.01122.0523-.02749.1041-.04377.1649l.00112.0006Z"/><path fill="url(#paint0_linear_386_2739)" d="M6.70402 22.1453c-1.17459-1.0737-1.51748-3.3297-1.02811-4.9641.84853 1.0304 2.02424 1.3569 3.24204 1.5411 1.88005.2844 3.72635.178 5.47285-.6813.1998-.0984.3844-.2292.6027-.3617.1639.4755.2065.9554.1493 1.4439-.1392 1.1898-.7313 2.1088-1.673 2.8054-.3765.2787-.775.5278-1.1639.7905-1.1948.8075-1.518 1.7544-1.0691 3.1318.0107.0336.0202.0671.0444.149-.6101-.273-1.0557-.6705-1.39518-1.1931-.3586-.5517-.52921-1.1619-.53819-1.8221-.00449-.3213-.00449-.6455-.0477-.9623-.10551-.7722-.46804-1.118-1.15102-1.1379-.70094-.0205-1.2554.4129-1.40244 1.0953-.01122.0523-.02749.1041-.04377.1649l.00112.0006Z"/><path fill="#fff" d="M0 16.909s3.47815-1.6944 6.96603-1.6944l2.62973-8.13858c.09846-.39359.38592-.66106.71044-.66106.3246 0 .612.26747.7105.66106l2.6297 8.13858c4.1309 0 6.966 1.6944 6.966 1.6944S14.7045.814589 14.693.782298C14.5234.306461 14.2371 0 13.8512 0H6.76183c-.38593 0-.66063.306461-.84174.782298C5.90733.81398 0 16.909 0 16.909ZM36.671 11.7318c0 1.4262-1.7739 2.2779-4.2302 2.2779-1.5985 0-2.1638-.3962-2.1638-1.2281 0-.8715.7018-1.2875 2.3003-1.2875 1.4426 0 2.6707.0198 4.0937.1981v.0396Zm.0195-1.7629c-.8772-.19808-2.2028-.31693-3.7818-.31693-4.6006 0-6.7644 1.08943-6.7644 3.62483 0 2.6344 1.4815 3.6446 4.9125 3.6446 2.9046 0 4.8735-.7328 5.5947-2.5354h.117c-.0195.4358-.039.8716-.039 1.2083 0 .931.156 1.0102.9162 1.0102h3.5869c-.1949-.5546-.3119-2.1194-.3119-3.4663 0-1.446.0585-2.5355.0585-4.00123 0-2.99098-1.7934-4.89253-7.4077-4.89253-2.4173 0-5.1074.41596-7.1543 1.03.1949.81213.4679 2.45617.6043 3.5258 1.774-.83193 4.2887-1.18847 6.2381-1.18847 2.6902 0 3.4309.61404 3.4309 1.86193v.4952ZM46.5325 12.5637c-.4874.0594-1.1502.0594-1.8325.0594-.7213 0-1.3841-.0198-1.8324-.0792 0 .1585-.0195.3367-.0195.4952 0 2.476 1.618 3.922 7.3102 3.922 5.3609 0 7.0958-1.4262 7.0958-3.9418 0-2.3769-1.1501-3.5456-6.238-3.8031-3.9573-.17827-4.3082-.61404-4.3082-1.10924 0-.57442.5068-.87154 3.158-.87154 2.7487 0 3.4894.37635 3.4894 1.16866v.17827c.3899-.01981 1.0917-.03961 1.813-.03961.6823 0 1.423.0198 1.8519.05942 0-.17827.0195-.33674.0195-.47539 0-2.91175-2.4172-3.86252-7.0958-3.86252-5.2634 0-7.0373 1.2875-7.0373 3.8031 0 2.25805 1.423 3.66445 6.472 3.88235 3.7233.1188 4.1327.5348 4.1327 1.1092 0 .6141-.6043.8914-3.2165.8914-3.0021 0-3.7623-.416-3.7623-1.2677v-.1189ZM63.6883 2.125c-1.423 1.32712-3.9768 2.65425-5.3998 3.01079.0195.73289.0195 2.07982.0195 2.81271l1.3061.01981c-.0195 1.40635-.039 3.10979-.039 4.23889 0 2.6344 1.3841 4.6152 5.6922 4.6152 1.813 0 3.0216-.1981 4.5226-.515-.1559-.9706-.3314-2.4562-.3898-3.5852-.8968.2971-2.0274.4556-3.275.4556-1.735 0-2.4368-.4754-2.4368-1.8422 0-1.1884 0-2.29767.0195-3.32768 2.2223.01981 4.4446.05943 5.7507.09904-.0195-1.03.0195-2.51559.078-3.50598-1.8909.03961-4.0157.05942-5.7702.05942.0195-.87154.039-1.70347.0585-2.5354h-.1365ZM75.3313 7.35427c.0195-1.03001.039-1.90156.0585-2.75329h-3.9183c.0585 1.70347.0585 3.44656.0585 6.00172 0 2.5553-.0195 4.3182-.0585 6.0018h4.4836c-.078-1.1885-.0975-3.189-.0975-4.8925 0-2.69388 1.0917-3.46638 3.5674-3.46638 1.1502 0 1.9689.13865 2.6902.39615.0195-1.01019.2144-2.97117.3314-3.84271-.7408-.21789-1.5595-.35655-2.5537-.35655-2.1249-.0198-3.6844.85174-4.4056 2.93156l-.156-.0198ZM94.8501 10.5235c0 2.1591-1.5595 3.1693-4.0157 3.1693-2.4368 0-3.9963-.9508-3.9963-3.1693 0-2.21846 1.579-3.05039 3.9963-3.05039 2.4367 0 4.0157.89135 4.0157 3.05039Zm4.0743-.099c0-4.29832-3.353-6.21968-8.09-6.21968-4.7566 0-7.9926 1.92136-7.9926 6.21968 0 4.2785 3.0216 6.5762 7.9731 6.5762 4.9904 0 8.1095-2.2977 8.1095-6.5762Z"/><defs><linearGradient id="paint0_linear_386_2739" x1="5.46011" x2="16.8017" y1="25.9999" y2="20.6412" gradientUnits="userSpaceOnUse"><stop stop-color="#D83333"/><stop offset="1" stop-color="#F041FF"/></linearGradient></defs></svg>';
|
|
5
5
|
let integrationData;
|
|
6
6
|
var astro_default = {
|
|
@@ -10,7 +10,6 @@ var astro_default = {
|
|
|
10
10
|
async init(canvas, eventTarget) {
|
|
11
11
|
createCanvas();
|
|
12
12
|
document.addEventListener("astro:after-swap", createCanvas);
|
|
13
|
-
document.addEventListener("astro:after-swap", fetchIntegrationData);
|
|
14
13
|
eventTarget.addEventListener("app-toggled", async (event) => {
|
|
15
14
|
resetDebugButton();
|
|
16
15
|
if (!(event instanceof CustomEvent))
|
|
@@ -20,6 +19,7 @@ var astro_default = {
|
|
|
20
19
|
fetchIntegrationData();
|
|
21
20
|
}
|
|
22
21
|
});
|
|
22
|
+
closeOnOutsideClick(eventTarget);
|
|
23
23
|
function fetchIntegrationData() {
|
|
24
24
|
fetch("https://astro.build/api/v1/dev-overlay/", {
|
|
25
25
|
cache: "no-cache"
|
|
@@ -333,6 +333,8 @@ var astro_default = {
|
|
|
333
333
|
}, 3500);
|
|
334
334
|
});
|
|
335
335
|
canvas.append(windowComponent);
|
|
336
|
+
if (integrationData)
|
|
337
|
+
refreshIntegrationList();
|
|
336
338
|
}
|
|
337
339
|
function resetDebugButton() {
|
|
338
340
|
const copyDebugButton = canvas.querySelector("#copy-debug-button");
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { finder } from "@medv/finder";
|
|
1
2
|
import {
|
|
2
3
|
attachTooltipToHighlight,
|
|
3
4
|
createHighlight,
|
|
4
5
|
getElementsPositionInDocument,
|
|
5
6
|
positionHighlight
|
|
6
7
|
} from "../utils/highlight.js";
|
|
7
|
-
import { createWindowElement } from "../utils/window.js";
|
|
8
|
+
import { closeOnOutsideClick, createWindowElement } from "../utils/window.js";
|
|
8
9
|
import { a11y } from "./a11y.js";
|
|
9
|
-
import { finder } from "@medv/finder";
|
|
10
10
|
import { perf } from "./perf.js";
|
|
11
11
|
const icon = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 1 20 16"><path fill="#fff" d="M.6 2A1.1 1.1 0 0 1 1.7.9h16.6a1.1 1.1 0 1 1 0 2.2H1.6A1.1 1.1 0 0 1 .8 2Zm1.1 7.1h6a1.1 1.1 0 0 0 0-2.2h-6a1.1 1.1 0 0 0 0 2.2ZM9.3 13H1.8a1.1 1.1 0 1 0 0 2.2h7.5a1.1 1.1 0 1 0 0-2.2Zm11.3 1.9a1.1 1.1 0 0 1-1.5 0l-1.7-1.7a4.1 4.1 0 1 1 1.6-1.6l1.6 1.7a1.1 1.1 0 0 1 0 1.6Zm-5.3-3.4a1.9 1.9 0 1 0 0-3.8 1.9 1.9 0 0 0 0 3.8Z"/></svg>';
|
|
12
12
|
const rules = [...a11y, ...perf];
|
|
@@ -30,29 +30,7 @@ var audit_default = {
|
|
|
30
30
|
await lint();
|
|
31
31
|
document.addEventListener("astro:after-swap", async () => lint());
|
|
32
32
|
document.addEventListener("astro:page-load", async () => refreshLintPositions);
|
|
33
|
-
|
|
34
|
-
const target = event.target;
|
|
35
|
-
if (!target)
|
|
36
|
-
return;
|
|
37
|
-
if (!target.closest)
|
|
38
|
-
return;
|
|
39
|
-
if (target.closest("astro-dev-toolbar"))
|
|
40
|
-
return;
|
|
41
|
-
eventTarget.dispatchEvent(
|
|
42
|
-
new CustomEvent("toggle-app", {
|
|
43
|
-
detail: {
|
|
44
|
-
state: false
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
eventTarget.addEventListener("app-toggled", (event) => {
|
|
50
|
-
if (event.detail.state === true) {
|
|
51
|
-
document.addEventListener("click", onPageClick, true);
|
|
52
|
-
} else {
|
|
53
|
-
document.removeEventListener("click", onPageClick, true);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
33
|
+
closeOnOutsideClick(eventTarget);
|
|
56
34
|
async function lint() {
|
|
57
35
|
audits.forEach(({ highlightElement }) => {
|
|
58
36
|
highlightElement.remove();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { settings } from "../settings.js";
|
|
2
|
-
import { createWindowElement } from "./utils/window.js";
|
|
2
|
+
import { closeOnOutsideClick, createWindowElement } from "./utils/window.js";
|
|
3
3
|
const settingsRows = [
|
|
4
4
|
{
|
|
5
5
|
name: "Disable notifications",
|
|
@@ -36,9 +36,10 @@ var settings_default = {
|
|
|
36
36
|
id: "astro:settings",
|
|
37
37
|
name: "Settings",
|
|
38
38
|
icon: "gear",
|
|
39
|
-
init(canvas) {
|
|
39
|
+
init(canvas, eventTarget) {
|
|
40
40
|
createSettingsWindow();
|
|
41
41
|
document.addEventListener("astro:after-swap", createSettingsWindow);
|
|
42
|
+
closeOnOutsideClick(eventTarget);
|
|
42
43
|
function createSettingsWindow() {
|
|
43
44
|
const windowElement = createWindowElement(
|
|
44
45
|
`<style>
|
|
@@ -3,6 +3,32 @@ function createWindowElement(content) {
|
|
|
3
3
|
windowElement.innerHTML = content;
|
|
4
4
|
return windowElement;
|
|
5
5
|
}
|
|
6
|
+
function closeOnOutsideClick(eventTarget) {
|
|
7
|
+
function onPageClick(event) {
|
|
8
|
+
const target = event.target;
|
|
9
|
+
if (!target)
|
|
10
|
+
return;
|
|
11
|
+
if (!target.closest)
|
|
12
|
+
return;
|
|
13
|
+
if (target.closest("astro-dev-toolbar"))
|
|
14
|
+
return;
|
|
15
|
+
eventTarget.dispatchEvent(
|
|
16
|
+
new CustomEvent("toggle-app", {
|
|
17
|
+
detail: {
|
|
18
|
+
state: false
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
eventTarget.addEventListener("app-toggled", (event) => {
|
|
24
|
+
if (event.detail.state === true) {
|
|
25
|
+
document.addEventListener("click", onPageClick, true);
|
|
26
|
+
} else {
|
|
27
|
+
document.removeEventListener("click", onPageClick, true);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
6
31
|
export {
|
|
32
|
+
closeOnOutsideClick,
|
|
7
33
|
createWindowElement
|
|
8
34
|
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
getElementsPositionInDocument,
|
|
5
5
|
positionHighlight
|
|
6
6
|
} from "./utils/highlight.js";
|
|
7
|
-
import { createWindowElement } from "./utils/window.js";
|
|
7
|
+
import { closeOnOutsideClick, createWindowElement } from "./utils/window.js";
|
|
8
8
|
const icon = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#fff" d="M7.9 1.5v-.4a1.1 1.1 0 0 1 2.2 0v.4a1.1 1.1 0 1 1-2.2 0Zm-6.4 8.6a1.1 1.1 0 1 0 0-2.2h-.4a1.1 1.1 0 0 0 0 2.2h.4ZM12 3.7a1.1 1.1 0 0 0 1.4-.7l.4-1.1a1.1 1.1 0 0 0-2.1-.8l-.4 1.2a1.1 1.1 0 0 0 .7 1.4Zm-9.7 7.6-1.2.4a1.1 1.1 0 1 0 .8 2.1l1-.4a1.1 1.1 0 1 0-.6-2ZM20.8 17a1.9 1.9 0 0 1 0 2.6l-1.2 1.2a1.9 1.9 0 0 1-2.6 0l-4.3-4.2-1.6 3.6a1.9 1.9 0 0 1-1.7 1.2A1.9 1.9 0 0 1 7.5 20L2.7 5a1.9 1.9 0 0 1 2.4-2.4l15 5a1.9 1.9 0 0 1 .2 3.4l-3.7 1.6 4.2 4.3ZM19 18.3 14.6 14a1.9 1.9 0 0 1 .6-3l3.2-1.5L5.1 5.1l4.3 13.3 1.5-3.2a1.9 1.9 0 0 1 3-.6l4.4 4.4.7-.7Z"/></svg>';
|
|
9
9
|
var xray_default = {
|
|
10
10
|
id: "astro:xray",
|
|
@@ -15,31 +15,7 @@ var xray_default = {
|
|
|
15
15
|
addIslandsOverlay();
|
|
16
16
|
document.addEventListener("astro:after-swap", addIslandsOverlay);
|
|
17
17
|
document.addEventListener("astro:page-load", refreshIslandsOverlayPositions);
|
|
18
|
-
|
|
19
|
-
const target = event.target;
|
|
20
|
-
if (!target)
|
|
21
|
-
return;
|
|
22
|
-
if (!target.closest)
|
|
23
|
-
return;
|
|
24
|
-
if (target.closest("astro-dev-toolbar"))
|
|
25
|
-
return;
|
|
26
|
-
event.preventDefault();
|
|
27
|
-
event.stopPropagation();
|
|
28
|
-
eventTarget.dispatchEvent(
|
|
29
|
-
new CustomEvent("toggle-app", {
|
|
30
|
-
detail: {
|
|
31
|
-
state: false
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
eventTarget.addEventListener("app-toggled", (event) => {
|
|
37
|
-
if (event.detail.state === true) {
|
|
38
|
-
document.addEventListener("click", onPageClick, true);
|
|
39
|
-
} else {
|
|
40
|
-
document.removeEventListener("click", onPageClick, true);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
18
|
+
closeOnOutsideClick(eventTarget);
|
|
43
19
|
function addIslandsOverlay() {
|
|
44
20
|
islandsOverlays.forEach(({ highlightElement }) => {
|
|
45
21
|
highlightElement.remove();
|
|
@@ -61,6 +61,8 @@ function unescapeHTML(str) {
|
|
|
61
61
|
return Promise.resolve(str).then((value) => {
|
|
62
62
|
return unescapeHTML(value);
|
|
63
63
|
});
|
|
64
|
+
} else if (str[Symbol.for("astro:slot-string")]) {
|
|
65
|
+
return str;
|
|
64
66
|
} else if (Symbol.iterator in str) {
|
|
65
67
|
return unescapeChunks(str);
|
|
66
68
|
} else if (Symbol.asyncIterator in str || hasGetReader(str)) {
|
|
@@ -106,6 +106,8 @@ function renderToBufferDestination(bufferRenderFunction) {
|
|
|
106
106
|
write: (chunk) => bufferChunks.push(chunk)
|
|
107
107
|
};
|
|
108
108
|
const renderPromise = bufferRenderFunction(bufferDestination);
|
|
109
|
+
Promise.resolve(renderPromise).catch(() => {
|
|
110
|
+
});
|
|
109
111
|
return {
|
|
110
112
|
async renderToFinalDestination(destination) {
|
|
111
113
|
for (const chunk of bufferChunks) {
|
|
@@ -43,6 +43,9 @@ function reEncode(s) {
|
|
|
43
43
|
return reEncodeInValidStart[result.codePointAt(0) ?? 0] ? "_" + result : result;
|
|
44
44
|
}
|
|
45
45
|
function renderTransition(result, hash, animationName, transitionName) {
|
|
46
|
+
if (typeof (transitionName ?? "") !== "string") {
|
|
47
|
+
throw new Error(`Invalid transition name {${transitionName}}`);
|
|
48
|
+
}
|
|
46
49
|
if (!animationName)
|
|
47
50
|
animationName = "fade";
|
|
48
51
|
const scope = createTransitionScope(result, hash);
|
|
@@ -22,12 +22,6 @@ async function handleRequest({
|
|
|
22
22
|
pathname = url.pathname;
|
|
23
23
|
}
|
|
24
24
|
url.pathname = removeTrailingForwardSlash(config.base) + url.pathname;
|
|
25
|
-
if (!buildingToSSR && pathname !== "/_image") {
|
|
26
|
-
const allSearchParams = Array.from(url.searchParams);
|
|
27
|
-
for (const [key] of allSearchParams) {
|
|
28
|
-
url.searchParams.delete(key);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
25
|
let body = void 0;
|
|
32
26
|
if (!(incomingRequest.method === "GET" || incomingRequest.method === "HEAD")) {
|
|
33
27
|
let bytes = [];
|
|
@@ -169,7 +169,8 @@ async function handleRoute({
|
|
|
169
169
|
body,
|
|
170
170
|
logger,
|
|
171
171
|
ssr: buildingToSSR,
|
|
172
|
-
clientAddress: buildingToSSR ? incomingRequest.socket.remoteAddress : void 0
|
|
172
|
+
clientAddress: buildingToSSR ? incomingRequest.socket.remoteAddress : void 0,
|
|
173
|
+
removeParams: buildingToSSR === false || route.prerender
|
|
173
174
|
});
|
|
174
175
|
for (const [name, value] of Object.entries(config.server.headers ?? {})) {
|
|
175
176
|
if (value)
|