astro 6.1.4 → 6.1.6
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/actions/integration.js +1 -1
- package/dist/assets/build/generate.d.ts +2 -2
- package/dist/assets/consts.d.ts +2 -0
- package/dist/assets/consts.js +4 -0
- package/dist/assets/fonts/core/compute-font-families-assets.d.ts +2 -2
- package/dist/assets/fonts/core/get-or-create-font-family-assets.d.ts +2 -2
- package/dist/assets/fonts/vite-plugin-fonts.d.ts +2 -2
- package/dist/assets/vite-plugin-assets.d.ts +2 -2
- package/dist/assets/vite-plugin-assets.js +33 -3
- package/dist/cli/add/index.js +1 -11
- package/dist/cli/create-key/core/create-key.d.ts +2 -2
- package/dist/cli/docs/core/open-docs.d.ts +2 -2
- package/dist/cli/flags.d.ts +2 -2
- package/dist/cli/flags.js +1 -1
- package/dist/cli/info/core/info.d.ts +2 -2
- package/dist/cli/info/infra/tinyclip-clipboard.d.ts +2 -2
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/cli/infra/logger-help-display.d.ts +2 -2
- package/dist/cli/install-package.d.ts +2 -2
- package/dist/cli/preferences/index.js +1 -1
- package/dist/container/index.js +3 -3
- package/dist/content/content-layer.d.ts +2 -2
- package/dist/content/content-layer.js +3 -3
- package/dist/content/instance.d.ts +2 -2
- package/dist/content/runtime.js +1 -1
- package/dist/content/server-listeners.d.ts +2 -2
- package/dist/content/types-generator.d.ts +2 -2
- package/dist/content/utils.d.ts +2 -2
- package/dist/content/vite-plugin-content-imports.d.ts +2 -2
- package/dist/core/app/base.d.ts +2 -2
- package/dist/core/app/base.js +3 -3
- package/dist/core/app/dev/app.d.ts +4 -4
- package/dist/core/app/logging.d.ts +2 -2
- package/dist/core/app/logging.js +3 -3
- package/dist/core/app/types.d.ts +2 -2
- package/dist/core/base-pipeline.d.ts +3 -3
- package/dist/core/build/generate.d.ts +2 -2
- package/dist/core/build/index.d.ts +2 -2
- package/dist/core/build/page-data.d.ts +2 -2
- package/dist/core/build/types.d.ts +2 -2
- package/dist/core/cache/runtime/noop.d.ts +2 -2
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.d.ts +2 -2
- package/dist/core/dev/adapter-validation.d.ts +3 -3
- package/dist/core/dev/container.d.ts +3 -3
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/logger/console.d.ts +2 -2
- package/dist/core/logger/console.js +4 -1
- package/dist/core/logger/core.d.ts +48 -21
- package/dist/core/logger/core.js +8 -4
- package/dist/core/logger/node.d.ts +4 -4
- package/dist/core/logger/node.js +21 -9
- package/dist/core/logger/vite.d.ts +1 -1
- package/dist/core/messages/runtime.d.ts +2 -2
- package/dist/core/messages/runtime.js +1 -1
- package/dist/core/preview/static-preview-server.d.ts +2 -2
- package/dist/core/render/params-and-props.d.ts +2 -2
- package/dist/core/render/route-cache.d.ts +3 -3
- package/dist/core/render/slots.d.ts +2 -2
- package/dist/core/request.d.ts +2 -2
- package/dist/core/routing/create-manifest.d.ts +3 -3
- package/dist/core/routing/prerender.d.ts +2 -2
- package/dist/core/routing/rewrite.d.ts +2 -2
- package/dist/core/sync/index.d.ts +3 -3
- package/dist/env/validators.d.ts +1 -1
- package/dist/integrations/features-validation.d.ts +2 -2
- package/dist/integrations/hooks.d.ts +13 -13
- package/dist/preferences/dlv.d.ts +1 -0
- package/dist/preferences/dlv.js +9 -0
- package/dist/preferences/index.js +1 -1
- package/dist/preferences/store.js +1 -1
- package/dist/runtime/server/endpoint.d.ts +2 -2
- package/dist/runtime/server/escape.d.ts +8 -0
- package/dist/runtime/server/escape.js +4 -0
- package/dist/runtime/server/render/component.js +6 -6
- package/dist/runtime/server/render/server-islands.js +5 -12
- package/dist/runtime/server/render/util.js +2 -5
- package/dist/transitions/swap-functions.js +1 -1
- package/dist/types/astro.d.ts +3 -3
- package/dist/types/public/config.d.ts +2 -2
- package/dist/vite-plugin-app/app.d.ts +5 -5
- package/dist/vite-plugin-app/createAstroServerApp.d.ts +2 -2
- package/dist/vite-plugin-app/createAstroServerApp.js +3 -3
- package/dist/vite-plugin-astro/compile.d.ts +2 -2
- package/dist/vite-plugin-astro/hmr.d.ts +2 -2
- package/dist/vite-plugin-astro/index.d.ts +2 -2
- package/dist/vite-plugin-astro-server/base.d.ts +2 -2
- package/dist/vite-plugin-astro-server/error.d.ts +2 -2
- package/dist/vite-plugin-astro-server/plugin.d.ts +2 -2
- package/dist/vite-plugin-astro-server/sec-fetch.d.ts +2 -2
- package/dist/vite-plugin-hmr-reload/index.js +17 -0
- package/dist/vite-plugin-integrations-container/index.d.ts +2 -2
- package/dist/vite-plugin-markdown/index.d.ts +2 -2
- package/dist/vite-plugin-routes/index.d.ts +2 -2
- package/package.json +3 -5
|
@@ -3,7 +3,7 @@ import type { AddressInfo } from 'node:net';
|
|
|
3
3
|
import type { InlineConfig, ViteDevServer } from 'vite';
|
|
4
4
|
import type { SerializedSSRManifest } from '../core/app/types.js';
|
|
5
5
|
import type { PageBuildData } from '../core/build/types.js';
|
|
6
|
-
import type {
|
|
6
|
+
import type { AstroLogger } from '../core/logger/core.js';
|
|
7
7
|
import type { AstroSettings } from '../types/astro.js';
|
|
8
8
|
import type { AstroConfig } from '../types/public/config.js';
|
|
9
9
|
import type { IntegrationResolvedRoute, RouteOptions, RouteToHeaders } from '../types/public/integrations.js';
|
|
@@ -41,69 +41,69 @@ export declare function normalizeInjectedTypeFilename(filename: string, integrat
|
|
|
41
41
|
interface RunHookConfigSetup {
|
|
42
42
|
settings: AstroSettings;
|
|
43
43
|
command: 'dev' | 'build' | 'preview' | 'sync';
|
|
44
|
-
logger:
|
|
44
|
+
logger: AstroLogger;
|
|
45
45
|
isRestart?: boolean;
|
|
46
46
|
fs?: typeof fsMod;
|
|
47
47
|
}
|
|
48
48
|
export declare function runHookConfigSetup({ settings, command, logger, isRestart, fs, }: RunHookConfigSetup): Promise<AstroSettings>;
|
|
49
49
|
export declare function runHookConfigDone({ settings, logger, command, }: {
|
|
50
50
|
settings: AstroSettings;
|
|
51
|
-
logger:
|
|
51
|
+
logger: AstroLogger;
|
|
52
52
|
command?: 'dev' | 'build' | 'preview' | 'sync';
|
|
53
53
|
}): Promise<void>;
|
|
54
54
|
export declare function runHookServerSetup({ config, server, logger, }: {
|
|
55
55
|
config: AstroConfig;
|
|
56
56
|
server: ViteDevServer;
|
|
57
|
-
logger:
|
|
57
|
+
logger: AstroLogger;
|
|
58
58
|
}): Promise<void>;
|
|
59
59
|
export declare function runHookServerStart({ config, address, logger, }: {
|
|
60
60
|
config: AstroConfig;
|
|
61
61
|
address: AddressInfo;
|
|
62
|
-
logger:
|
|
62
|
+
logger: AstroLogger;
|
|
63
63
|
}): Promise<void>;
|
|
64
64
|
export declare function runHookServerDone({ config, logger, }: {
|
|
65
65
|
config: AstroConfig;
|
|
66
|
-
logger:
|
|
66
|
+
logger: AstroLogger;
|
|
67
67
|
}): Promise<void>;
|
|
68
68
|
export declare function runHookBuildStart({ settings, logger, }: {
|
|
69
69
|
settings: AstroSettings;
|
|
70
|
-
logger:
|
|
70
|
+
logger: AstroLogger;
|
|
71
71
|
}): Promise<void>;
|
|
72
72
|
export declare function runHookBuildSetup({ config, vite, pages, target, logger, }: {
|
|
73
73
|
config: AstroConfig;
|
|
74
74
|
vite: InlineConfig;
|
|
75
75
|
pages: Map<string, PageBuildData>;
|
|
76
76
|
target: 'server' | 'client';
|
|
77
|
-
logger:
|
|
77
|
+
logger: AstroLogger;
|
|
78
78
|
}): Promise<InlineConfig>;
|
|
79
79
|
type RunHookBuildSsr = {
|
|
80
80
|
config: AstroConfig;
|
|
81
81
|
manifest: SerializedSSRManifest;
|
|
82
|
-
logger:
|
|
82
|
+
logger: AstroLogger;
|
|
83
83
|
middlewareEntryPoint: URL | undefined;
|
|
84
84
|
};
|
|
85
85
|
export declare function runHookBuildSsr({ config, manifest, logger, middlewareEntryPoint, }: RunHookBuildSsr): Promise<void>;
|
|
86
86
|
export declare function runHookBuildGenerated({ settings, logger, routeToHeaders, }: {
|
|
87
87
|
settings: AstroSettings;
|
|
88
|
-
logger:
|
|
88
|
+
logger: AstroLogger;
|
|
89
89
|
routeToHeaders: RouteToHeaders;
|
|
90
90
|
}): Promise<void>;
|
|
91
91
|
type RunHookBuildDone = {
|
|
92
92
|
settings: AstroSettings;
|
|
93
93
|
pages: string[];
|
|
94
94
|
routes: RouteData[];
|
|
95
|
-
logger:
|
|
95
|
+
logger: AstroLogger;
|
|
96
96
|
};
|
|
97
97
|
export declare function runHookBuildDone({ settings, pages, routes, logger }: RunHookBuildDone): Promise<void>;
|
|
98
98
|
export declare function runHookRouteSetup({ route, settings, logger, }: {
|
|
99
99
|
route: RouteOptions;
|
|
100
100
|
settings: AstroSettings;
|
|
101
|
-
logger:
|
|
101
|
+
logger: AstroLogger;
|
|
102
102
|
}): Promise<void>;
|
|
103
103
|
export declare function runHookRoutesResolved({ routes, settings, logger, }: {
|
|
104
104
|
routes: Array<RouteData>;
|
|
105
105
|
settings: AstroSettings;
|
|
106
|
-
logger:
|
|
106
|
+
logger: AstroLogger;
|
|
107
107
|
}): Promise<void>;
|
|
108
108
|
export declare function toIntegrationResolvedRoute(route: RouteData, trailingSlash: AstroConfig['trailingSlash']): IntegrationResolvedRoute;
|
|
109
109
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function dlv(obj: Record<string, unknown>, key: string): any;
|
|
@@ -2,8 +2,8 @@ import os from "node:os";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import dget from "dlv";
|
|
6
5
|
import { DEFAULT_PREFERENCES } from "./defaults.js";
|
|
6
|
+
import dget from "./dlv.js";
|
|
7
7
|
import { PreferenceStore } from "./store.js";
|
|
8
8
|
function isValidKey(key) {
|
|
9
9
|
return dget(DEFAULT_PREFERENCES, key) !== void 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AstroLogger } from '../../core/logger/core.js';
|
|
2
2
|
import type { APIRoute } from '../../types/public/common.js';
|
|
3
3
|
import type { APIContext } from '../../types/public/context.js';
|
|
4
4
|
/** Renders an endpoint request to completion, returning the body. */
|
|
5
5
|
export declare function renderEndpoint(mod: {
|
|
6
6
|
[method: string]: APIRoute;
|
|
7
|
-
}, context: APIContext, isPrerendered: boolean, logger:
|
|
7
|
+
}, context: APIContext, isPrerendered: boolean, logger: AstroLogger): Promise<Response>;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
export declare const escapeHTML: (str: string) => string;
|
|
2
|
+
/**
|
|
3
|
+
* Serializes a value to a JSON string that is safe to embed inside a `<script>` tag.
|
|
4
|
+
* All `<` characters are escaped to `\u003c` so the browser's HTML parser cannot be
|
|
5
|
+
* tricked into closing the script block early via `</script>` variants (case-insensitive,
|
|
6
|
+
* whitespace, or self-closing forms) or `<!--` comment injection.
|
|
7
|
+
* @see https://mathiasbynens.be/notes/etago
|
|
8
|
+
*/
|
|
9
|
+
export declare function stringifyForScript(value: any): string;
|
|
2
10
|
export declare class HTMLBytes extends Uint8Array {
|
|
3
11
|
}
|
|
4
12
|
declare const htmlStringSymbol: unique symbol;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { escape } from "html-escaper";
|
|
2
2
|
import { streamAsyncIterator } from "./util.js";
|
|
3
3
|
const escapeHTML = escape;
|
|
4
|
+
function stringifyForScript(value) {
|
|
5
|
+
return JSON.stringify(value)?.replace(/</g, "\\u003c");
|
|
6
|
+
}
|
|
4
7
|
class HTMLBytes extends Uint8Array {
|
|
5
8
|
}
|
|
6
9
|
Object.defineProperty(HTMLBytes.prototype, Symbol.toStringTag, {
|
|
@@ -77,5 +80,6 @@ export {
|
|
|
77
80
|
isHTMLBytes,
|
|
78
81
|
isHTMLString,
|
|
79
82
|
markHTMLString,
|
|
83
|
+
stringifyForScript,
|
|
80
84
|
unescapeHTML
|
|
81
85
|
};
|
|
@@ -18,7 +18,7 @@ import { componentIsHTMLElement, renderHTMLElement } from "./dom.js";
|
|
|
18
18
|
import { maybeRenderHead } from "./head.js";
|
|
19
19
|
import { createRenderInstruction } from "./instruction.js";
|
|
20
20
|
import { containsServerDirective, ServerIslandComponent } from "./server-islands.js";
|
|
21
|
-
import { renderSlots, renderSlotToString } from "./slot.js";
|
|
21
|
+
import { renderSlot, renderSlots, renderSlotToString } from "./slot.js";
|
|
22
22
|
import { formatList, internalSpreadAttributes, renderElement, voidElementNames } from "./util.js";
|
|
23
23
|
const needsHeadRenderingSymbol = /* @__PURE__ */ Symbol.for("astro.needsHeadRendering");
|
|
24
24
|
const rendererAliases = /* @__PURE__ */ new Map([["solid", "solid-js"]]);
|
|
@@ -331,12 +331,12 @@ function sanitizeElementName(tag) {
|
|
|
331
331
|
if (!unsafe.test(tag)) return tag;
|
|
332
332
|
return tag.trim().split(unsafe)[0].trim();
|
|
333
333
|
}
|
|
334
|
-
|
|
335
|
-
const
|
|
334
|
+
function renderFragmentComponent(result, slots = {}) {
|
|
335
|
+
const slot = slots?.default;
|
|
336
336
|
return {
|
|
337
337
|
render(destination) {
|
|
338
|
-
if (
|
|
339
|
-
|
|
338
|
+
if (slot == null) return;
|
|
339
|
+
return renderSlot(result, slot).render(destination);
|
|
340
340
|
}
|
|
341
341
|
};
|
|
342
342
|
}
|
|
@@ -370,7 +370,7 @@ function renderComponent(result, displayName, Component, props, slots = {}) {
|
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
if (isFragmentComponent(Component)) {
|
|
373
|
-
return renderFragmentComponent(result, slots)
|
|
373
|
+
return renderFragmentComponent(result, slots);
|
|
374
374
|
}
|
|
375
375
|
props = normalizeProps(props);
|
|
376
376
|
if (isHTMLComponent(Component)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { encryptString, generateCspDigest } from "../../../core/encryption.js";
|
|
2
|
-
import { markHTMLString } from "../escape.js";
|
|
2
|
+
import { markHTMLString, stringifyForScript } from "../escape.js";
|
|
3
3
|
import { renderChild } from "./any.js";
|
|
4
4
|
import { createThinHead } from "./astro/head-and-content.js";
|
|
5
5
|
import { createRenderInstruction } from "./instruction.js";
|
|
@@ -13,13 +13,6 @@ const internalProps = /* @__PURE__ */ new Set([
|
|
|
13
13
|
function containsServerDirective(props) {
|
|
14
14
|
return "server:component-directive" in props;
|
|
15
15
|
}
|
|
16
|
-
const SCRIPT_RE = /<\/script/giu;
|
|
17
|
-
const COMMENT_RE = /<!--/gu;
|
|
18
|
-
const SCRIPT_REPLACER = "<\\/script";
|
|
19
|
-
const COMMENT_REPLACER = "\\u003C!--";
|
|
20
|
-
function safeJsonStringify(obj) {
|
|
21
|
-
return JSON.stringify(obj).replace(SCRIPT_RE, SCRIPT_REPLACER).replace(COMMENT_RE, COMMENT_REPLACER);
|
|
22
|
-
}
|
|
23
16
|
function createSearchParams(encryptedComponentExport, encryptedProps, slots) {
|
|
24
17
|
const params = new URLSearchParams();
|
|
25
18
|
params.set("e", encryptedComponentExport);
|
|
@@ -154,7 +147,7 @@ class ServerIslandComponent {
|
|
|
154
147
|
);
|
|
155
148
|
}
|
|
156
149
|
const adapterHeaders = this.result.internalFetchHeaders || {};
|
|
157
|
-
const headersJson =
|
|
150
|
+
const headersJson = stringifyForScript(adapterHeaders);
|
|
158
151
|
const method = useGETRequest ? (
|
|
159
152
|
// GET request
|
|
160
153
|
`const headers = new Headers(${headersJson});
|
|
@@ -162,9 +155,9 @@ let response = await fetch('${serverIslandUrl}', { headers });`
|
|
|
162
155
|
) : (
|
|
163
156
|
// POST request
|
|
164
157
|
`let data = {
|
|
165
|
-
encryptedComponentExport: ${
|
|
166
|
-
encryptedProps: ${
|
|
167
|
-
encryptedSlots: ${
|
|
158
|
+
encryptedComponentExport: ${stringifyForScript(componentExportEncrypted)},
|
|
159
|
+
encryptedProps: ${stringifyForScript(propsEncrypted)},
|
|
160
|
+
encryptedSlots: ${stringifyForScript(slotsEncrypted)},
|
|
168
161
|
};
|
|
169
162
|
const headers = new Headers({ 'Content-Type': 'application/json', ...${headersJson} });
|
|
170
163
|
let response = await fetch('${serverIslandUrl}', {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clsx } from "clsx";
|
|
2
|
-
import { HTMLString, markHTMLString } from "../escape.js";
|
|
2
|
+
import { HTMLString, markHTMLString, stringifyForScript } from "../escape.js";
|
|
3
3
|
import { isPromise } from "../util.js";
|
|
4
4
|
const voidElementNames = /^(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/i;
|
|
5
5
|
const htmlBooleanAttributes = /^(?:allowfullscreen|async|autofocus|autoplay|checked|controls|default|defer|disabled|disablepictureinpicture|disableremoteplayback|formnovalidate|inert|loop|muted|nomodule|novalidate|open|playsinline|readonly|required|reversed|scoped|seamless|selected|itemscope)$/i;
|
|
@@ -19,10 +19,7 @@ const toStyleString = (obj) => Object.entries(obj).filter(([_, v]) => typeof v =
|
|
|
19
19
|
function defineScriptVars(vars) {
|
|
20
20
|
let output = "";
|
|
21
21
|
for (const [key, value] of Object.entries(vars)) {
|
|
22
|
-
output += `const ${toIdent(key)} = ${
|
|
23
|
-
/<\/script>/g,
|
|
24
|
-
"\\x3C/script>"
|
|
25
|
-
)};
|
|
22
|
+
output += `const ${toIdent(key)} = ${stringifyForScript(value)};
|
|
26
23
|
`;
|
|
27
24
|
}
|
|
28
25
|
return markHTMLString(output);
|
|
@@ -118,7 +118,7 @@ const persistedHeadElement = (el, newDoc) => {
|
|
|
118
118
|
}
|
|
119
119
|
if (import.meta.env.DEV && el.tagName === "STYLE") {
|
|
120
120
|
const viteDevId = el.getAttribute("data-vite-dev-id");
|
|
121
|
-
if (viteDevId) {
|
|
121
|
+
if (/\?vue&type=style&.*lang.css$/.test(viteDevId || "")) {
|
|
122
122
|
return newDoc.head.querySelector(`style[data-vite-dev-id="${viteDevId}"]`);
|
|
123
123
|
}
|
|
124
124
|
}
|
package/dist/types/astro.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AstroTimer } from '../core/config/timer.js';
|
|
2
2
|
import type { TSConfig } from '../core/config/tsconfig.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AstroLogger, AstroLoggerLevel } from '../core/logger/core.js';
|
|
4
4
|
import type { AstroPreferences } from '../preferences/index.js';
|
|
5
5
|
import type { AstroComponentFactory } from '../runtime/server/index.js';
|
|
6
6
|
import type { GetStaticPaths } from './public/common.js';
|
|
@@ -65,7 +65,7 @@ export interface AstroSettings {
|
|
|
65
65
|
fontResources: Set<string>;
|
|
66
66
|
styleHashes: Required<CspObject['styleDirective']>['hashes'];
|
|
67
67
|
};
|
|
68
|
-
logLevel:
|
|
68
|
+
logLevel: AstroLoggerLevel;
|
|
69
69
|
}
|
|
70
70
|
/** Generic interface for a component (Astro, Svelte, React, etc.) */
|
|
71
71
|
export interface ComponentInstance {
|
|
@@ -80,7 +80,7 @@ export interface RoutesList {
|
|
|
80
80
|
}
|
|
81
81
|
export interface AstroPluginOptions {
|
|
82
82
|
settings: AstroSettings;
|
|
83
|
-
logger:
|
|
83
|
+
logger: AstroLogger;
|
|
84
84
|
}
|
|
85
85
|
export interface ImportedDevStyle {
|
|
86
86
|
id: string;
|
|
@@ -10,7 +10,7 @@ import type { CacheProviderConfig, RouteRules } from '../../core/cache/types.js'
|
|
|
10
10
|
import type { AstroConfigType } from '../../core/config/schemas/index.js';
|
|
11
11
|
import type { REDIRECT_STATUS_CODES } from '../../core/constants.js';
|
|
12
12
|
import type { CspAlgorithm, CspDirective, CspHash } from '../../core/csp/config.js';
|
|
13
|
-
import type {
|
|
13
|
+
import type { AstroLoggerLevel } from '../../core/logger/core.js';
|
|
14
14
|
import type { SessionConfig, SessionDriverConfig, SessionDriverName } from '../../core/session/types.js';
|
|
15
15
|
import type { EnvSchema } from '../../env/schema.js';
|
|
16
16
|
import type { AstroIntegration } from './integrations.js';
|
|
@@ -2934,7 +2934,7 @@ export interface AstroInlineOnlyConfig {
|
|
|
2934
2934
|
*
|
|
2935
2935
|
* @default "info"
|
|
2936
2936
|
*/
|
|
2937
|
-
logLevel?:
|
|
2937
|
+
logLevel?: AstroLoggerLevel;
|
|
2938
2938
|
/**
|
|
2939
2939
|
* Clear the content layer cache, forcing a rebuild of all content entries.
|
|
2940
2940
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type http from 'node:http';
|
|
2
2
|
import { BaseApp, type RenderErrorOptions } from '../core/app/entrypoints/index.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AstroLogger } from '../core/logger/core.js';
|
|
4
4
|
import type { ModuleLoader } from '../core/module-loader/index.js';
|
|
5
5
|
import type { CreateRenderContext, RenderContext } from '../core/render-context.js';
|
|
6
6
|
import type { AstroSettings, RoutesList } from '../types/astro.js';
|
|
@@ -10,11 +10,11 @@ import { RunnablePipeline } from './pipeline.js';
|
|
|
10
10
|
import type { DevMatch, LogRequestPayload } from '../core/app/base.js';
|
|
11
11
|
export declare class AstroServerApp extends BaseApp<RunnablePipeline> {
|
|
12
12
|
settings: AstroSettings;
|
|
13
|
-
logger:
|
|
13
|
+
logger: AstroLogger;
|
|
14
14
|
loader: ModuleLoader;
|
|
15
15
|
manifestData: RoutesList;
|
|
16
16
|
currentRenderContext: RenderContext | undefined;
|
|
17
|
-
constructor(manifest: SSRManifest, streaming: boolean | undefined, logger:
|
|
17
|
+
constructor(manifest: SSRManifest, streaming: boolean | undefined, logger: AstroLogger, manifestData: RoutesList, loader: ModuleLoader, settings: AstroSettings, getDebugInfo: () => Promise<string>);
|
|
18
18
|
isDev(): boolean;
|
|
19
19
|
/**
|
|
20
20
|
* Updates the routes list when files change during development.
|
|
@@ -32,8 +32,8 @@ export declare class AstroServerApp extends BaseApp<RunnablePipeline> {
|
|
|
32
32
|
*/
|
|
33
33
|
clearMiddleware(): void;
|
|
34
34
|
devMatch(pathname: string): Promise<DevMatch | undefined>;
|
|
35
|
-
static create(manifest: SSRManifest, routesList: RoutesList, logger:
|
|
36
|
-
createPipeline(_streaming: boolean, manifest: SSRManifest, settings: AstroSettings, logger:
|
|
35
|
+
static create(manifest: SSRManifest, routesList: RoutesList, logger: AstroLogger, loader: ModuleLoader, settings: AstroSettings, getDebugInfo: () => Promise<string>): Promise<AstroServerApp>;
|
|
36
|
+
createPipeline(_streaming: boolean, manifest: SSRManifest, settings: AstroSettings, logger: AstroLogger, loader: ModuleLoader, manifestData: RoutesList, getDebugInfo: () => Promise<string>): RunnablePipeline;
|
|
37
37
|
createRenderContext(payload: CreateRenderContext): Promise<RenderContext>;
|
|
38
38
|
handleRequest({ controller, incomingRequest, incomingResponse, isHttps, }: HandleRequest): Promise<void>;
|
|
39
39
|
match(request: Request, _allowPrerenderedRoutes: boolean): RouteData | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type http from 'node:http';
|
|
2
|
-
import {
|
|
2
|
+
import { AstroLogger } from '../core/logger/core.js';
|
|
3
3
|
import type { ModuleLoader } from '../core/module-loader/index.js';
|
|
4
4
|
import type { AstroSettings } from '../types/astro.js';
|
|
5
5
|
import type { DevServerController } from '../vite-plugin-astro-server/controller.js';
|
|
6
|
-
export default function createAstroServerApp(controller: DevServerController, settings: AstroSettings, loader: ModuleLoader, logger?:
|
|
6
|
+
export default function createAstroServerApp(controller: DevServerController, settings: AstroSettings, loader: ModuleLoader, logger?: AstroLogger): Promise<{
|
|
7
7
|
handler(incomingRequest: http.IncomingMessage, incomingResponse: http.ServerResponse): void;
|
|
8
8
|
}>;
|
|
@@ -9,12 +9,12 @@ import { BuildTimeAstroVersionProvider } from "../cli/infra/build-time-astro-ver
|
|
|
9
9
|
import { PassthroughTextStyler } from "../cli/infra/passthrough-text-styler.js";
|
|
10
10
|
import { ProcessOperatingSystemProvider } from "../cli/infra/process-operating-system-provider.js";
|
|
11
11
|
import { TinyexecCommandExecutor } from "../cli/infra/tinyexec-command-executor.js";
|
|
12
|
-
import {
|
|
12
|
+
import { AstroLogger } from "../core/logger/core.js";
|
|
13
13
|
import { nodeLogDestination } from "../core/logger/node.js";
|
|
14
14
|
import { AstroServerApp } from "./app.js";
|
|
15
15
|
async function createAstroServerApp(controller, settings, loader, logger) {
|
|
16
|
-
const actualLogger = logger ?? new
|
|
17
|
-
|
|
16
|
+
const actualLogger = logger ?? new AstroLogger({
|
|
17
|
+
destination: nodeLogDestination,
|
|
18
18
|
level: settings.logLevel
|
|
19
19
|
});
|
|
20
20
|
const routesList = { routes: routes.map((r) => r.routeData) };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type CompileProps, type CompileResult } from '../core/compile/index.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AstroLogger } from '../core/logger/core.js';
|
|
3
3
|
import type { CompileMetadata } from './types.js';
|
|
4
4
|
import type { SourceMapInput } from 'rollup';
|
|
5
5
|
interface CompileAstroOption {
|
|
6
6
|
compileProps: CompileProps;
|
|
7
7
|
astroFileToCompileMetadata: Map<string, CompileMetadata>;
|
|
8
|
-
logger:
|
|
8
|
+
logger: AstroLogger;
|
|
9
9
|
}
|
|
10
10
|
export interface CompileAstroResult extends Omit<CompileResult, 'map'> {
|
|
11
11
|
map: SourceMapInput;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { HmrContext } from 'vite';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AstroLogger } from '../core/logger/core.js';
|
|
3
3
|
import type { CompileAstroResult } from './compile.js';
|
|
4
4
|
import type { CompileMetadata } from './types.js';
|
|
5
5
|
interface HandleHotUpdateOptions {
|
|
6
|
-
logger:
|
|
6
|
+
logger: AstroLogger;
|
|
7
7
|
compile: (code: string, filename: string) => Promise<CompileAstroResult>;
|
|
8
8
|
astroFileToCompileMetadata: Map<string, CompileMetadata>;
|
|
9
9
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type * as vite from 'vite';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AstroLogger } from '../core/logger/core.js';
|
|
3
3
|
import type { AstroSettings } from '../types/astro.js';
|
|
4
4
|
import type { PluginMetadata as AstroPluginMetadata } from './types.js';
|
|
5
5
|
export { getAstroMetadata } from './metadata.js';
|
|
6
6
|
export type { AstroPluginMetadata };
|
|
7
7
|
interface AstroPluginOptions {
|
|
8
8
|
settings: AstroSettings;
|
|
9
|
-
logger:
|
|
9
|
+
logger: AstroLogger;
|
|
10
10
|
}
|
|
11
11
|
/** Transform .astro files for Vite */
|
|
12
12
|
export default function astro({ settings, logger }: AstroPluginOptions): vite.Plugin[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as vite from 'vite';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AstroLogger } from '../core/logger/core.js';
|
|
3
3
|
import type { AstroSettings } from '../types/astro.js';
|
|
4
4
|
/**
|
|
5
5
|
* Outcome of the base-URL evaluation for a dev-server request.
|
|
@@ -53,4 +53,4 @@ export declare function resolveDevRoot(base: string, site?: string): {
|
|
|
53
53
|
* by the caller.
|
|
54
54
|
*/
|
|
55
55
|
export declare function evaluateBaseRewrite(url: string, pathname: string, acceptHeader: string | undefined, devRoot: string, devRootReplacement: string): BaseRewriteDecision;
|
|
56
|
-
export declare function baseMiddleware(settings: AstroSettings, logger:
|
|
56
|
+
export declare function baseMiddleware(settings: AstroSettings, logger: AstroLogger): vite.Connect.NextHandleFunction;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SSRManifest } from '../core/app/types.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AstroLogger } from '../core/logger/core.js';
|
|
3
3
|
import type { ModuleLoader } from '../core/module-loader/index.js';
|
|
4
|
-
export declare function recordServerError(loader: ModuleLoader, manifest: SSRManifest, logger:
|
|
4
|
+
export declare function recordServerError(loader: ModuleLoader, manifest: SSRManifest, logger: AstroLogger, err: Error): {
|
|
5
5
|
errorWithMetadata: import("../core/errors/errors.js").ErrorWithMetadata;
|
|
6
6
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type * as vite from 'vite';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AstroLogger } from '../core/logger/core.js';
|
|
3
3
|
import type { AstroSettings } from '../types/astro.js';
|
|
4
4
|
interface AstroPluginOptions {
|
|
5
5
|
settings: AstroSettings;
|
|
6
|
-
logger:
|
|
6
|
+
logger: AstroLogger;
|
|
7
7
|
}
|
|
8
8
|
export default function createVitePluginAstroServer({ settings, logger, }: AstroPluginOptions): vite.Plugin;
|
|
9
9
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RemotePattern } from '@astrojs/internal-helpers/remote';
|
|
2
2
|
import type * as vite from 'vite';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AstroLogger } from '../core/logger/core.js';
|
|
4
4
|
/**
|
|
5
5
|
* Middleware that validates Sec-Fetch metadata headers on incoming requests
|
|
6
6
|
* to block cross-origin subresource requests (e.g. `<script>` tags from
|
|
@@ -18,4 +18,4 @@ import type { Logger } from '../core/logger/core.js';
|
|
|
18
18
|
* dev server setups (e.g. ngrok, Cloudflare Tunnel) where the browser sees a
|
|
19
19
|
* different origin than the dev server itself.
|
|
20
20
|
*/
|
|
21
|
-
export declare function secFetchMiddleware(logger:
|
|
21
|
+
export declare function secFetchMiddleware(logger: AstroLogger, allowedDomains?: Partial<RemotePattern>[]): vite.Connect.NextHandleFunction;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { VIRTUAL_PAGE_RESOLVED_MODULE_ID } from "../vite-plugin-pages/const.js";
|
|
2
2
|
import { getDevCssModuleNameFromPageVirtualModuleName } from "../vite-plugin-css/util.js";
|
|
3
3
|
import { isAstroServerEnvironment } from "../environments.js";
|
|
4
|
+
const STYLE_EXT_REGEX = /\.(?:css|scss|sass|less|styl|pcss)$/i;
|
|
5
|
+
function isStyleModule(mod) {
|
|
6
|
+
if (mod.file && STYLE_EXT_REGEX.test(mod.file)) return true;
|
|
7
|
+
if (mod.id) {
|
|
8
|
+
const idPath = mod.id.split("?")[0];
|
|
9
|
+
if (STYLE_EXT_REGEX.test(idPath)) return true;
|
|
10
|
+
}
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
4
13
|
function hmrReload() {
|
|
5
14
|
return {
|
|
6
15
|
name: "astro:hmr-reload",
|
|
@@ -10,9 +19,14 @@ function hmrReload() {
|
|
|
10
19
|
handler({ modules, server, timestamp }) {
|
|
11
20
|
if (!isAstroServerEnvironment(this.environment)) return;
|
|
12
21
|
let hasSsrOnlyModules = false;
|
|
22
|
+
let hasSkippedStyleModules = false;
|
|
13
23
|
const invalidatedModules = /* @__PURE__ */ new Set();
|
|
14
24
|
for (const mod of modules) {
|
|
15
25
|
if (mod.id == null) continue;
|
|
26
|
+
if (isStyleModule(mod)) {
|
|
27
|
+
hasSkippedStyleModules = true;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
16
30
|
const clientModule = server.environments.client.moduleGraph.getModuleById(mod.id);
|
|
17
31
|
if (clientModule != null) continue;
|
|
18
32
|
this.environment.moduleGraph.invalidateModule(mod, invalidatedModules, timestamp, true);
|
|
@@ -31,6 +45,9 @@ function hmrReload() {
|
|
|
31
45
|
server.ws.send({ type: "full-reload" });
|
|
32
46
|
return [];
|
|
33
47
|
}
|
|
48
|
+
if (hasSkippedStyleModules) {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
34
51
|
}
|
|
35
52
|
}
|
|
36
53
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Plugin as VitePlugin } from 'vite';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AstroLogger } from '../core/logger/core.js';
|
|
3
3
|
import type { AstroSettings } from '../types/astro.js';
|
|
4
4
|
/** Connect Astro integrations into Vite, as needed. */
|
|
5
5
|
export default function astroIntegrationsContainerPlugin({ settings, logger, }: {
|
|
6
6
|
settings: AstroSettings;
|
|
7
|
-
logger:
|
|
7
|
+
logger: AstroLogger;
|
|
8
8
|
}): VitePlugin;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AstroLogger } from '../core/logger/core.js';
|
|
3
3
|
import type { AstroSettings } from '../types/astro.js';
|
|
4
4
|
interface AstroPluginOptions {
|
|
5
5
|
settings: AstroSettings;
|
|
6
|
-
logger:
|
|
6
|
+
logger: AstroLogger;
|
|
7
7
|
}
|
|
8
8
|
export default function markdown({ settings, logger }: AstroPluginOptions): Plugin;
|
|
9
9
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type fsMod from 'node:fs';
|
|
2
2
|
import { type Plugin } from 'vite';
|
|
3
3
|
import type { SerializedRouteInfo } from '../core/app/types.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { AstroLogger } from '../core/logger/core.js';
|
|
5
5
|
import type { AstroSettings, RoutesList } from '../types/astro.js';
|
|
6
6
|
type Payload = {
|
|
7
7
|
settings: AstroSettings;
|
|
8
|
-
logger:
|
|
8
|
+
logger: AstroLogger;
|
|
9
9
|
fsMod?: typeof fsMod;
|
|
10
10
|
routesList: RoutesList;
|
|
11
11
|
command: 'dev' | 'build';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.6",
|
|
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",
|
|
@@ -114,7 +114,6 @@
|
|
|
114
114
|
"cookie": "^1.1.1",
|
|
115
115
|
"devalue": "^5.6.3",
|
|
116
116
|
"diff": "^8.0.3",
|
|
117
|
-
"dlv": "^1.1.3",
|
|
118
117
|
"dset": "^3.1.4",
|
|
119
118
|
"es-module-lexer": "^2.0.0",
|
|
120
119
|
"esbuild": "^0.27.3",
|
|
@@ -154,8 +153,8 @@
|
|
|
154
153
|
"yargs-parser": "^22.0.0",
|
|
155
154
|
"zod": "^4.3.6",
|
|
156
155
|
"@astrojs/internal-helpers": "0.8.0",
|
|
157
|
-
"@astrojs/
|
|
158
|
-
"@astrojs/
|
|
156
|
+
"@astrojs/telemetry": "3.3.0",
|
|
157
|
+
"@astrojs/markdown-remark": "7.1.0"
|
|
159
158
|
},
|
|
160
159
|
"optionalDependencies": {
|
|
161
160
|
"sharp": "^0.34.0"
|
|
@@ -164,7 +163,6 @@
|
|
|
164
163
|
"@astrojs/compiler-rs": "^0.1.6",
|
|
165
164
|
"@playwright/test": "1.58.2",
|
|
166
165
|
"@types/aria-query": "^5.0.4",
|
|
167
|
-
"@types/dlv": "^1.1.5",
|
|
168
166
|
"@types/hast": "^3.0.4",
|
|
169
167
|
"@types/html-escaper": "3.0.4",
|
|
170
168
|
"@types/http-cache-semantics": "^4.2.0",
|