astro 4.16.4 → 4.16.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/assets/internal.js +2 -1
- package/dist/container/index.d.ts +7 -0
- package/dist/container/index.js +2 -1
- package/dist/content/content-layer.js +3 -3
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.js +3 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/render-context.d.ts +2 -1
- package/dist/core/render-context.js +7 -4
- package/dist/env/runtime-constants.d.ts +1 -0
- package/dist/env/runtime-constants.js +4 -0
- package/dist/env/runtime.js +5 -1
- package/dist/env/vite-plugin-env.js +2 -5
- package/package.json +3 -3
package/dist/assets/internal.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isRemotePath } from "@astrojs/internal-helpers/path";
|
|
1
2
|
import { AstroError, AstroErrorData } from "../core/errors/index.js";
|
|
2
3
|
import { DEFAULT_HASH_PROPS } from "./consts.js";
|
|
3
4
|
import { isLocalService } from "./services/service.js";
|
|
@@ -47,7 +48,7 @@ async function getImage(options, imageConfig) {
|
|
|
47
48
|
...options,
|
|
48
49
|
src: await resolveSrc(options.src)
|
|
49
50
|
};
|
|
50
|
-
if (options.inferSize && isRemoteImage(resolvedOptions.src)) {
|
|
51
|
+
if (options.inferSize && isRemoteImage(resolvedOptions.src) && isRemotePath(resolvedOptions.src)) {
|
|
51
52
|
const result = await inferRemoteSize(resolvedOptions.src);
|
|
52
53
|
resolvedOptions.width ??= result.width;
|
|
53
54
|
resolvedOptions.height ??= result.height;
|
|
@@ -59,6 +59,13 @@ export type ContainerRenderOptions = {
|
|
|
59
59
|
* ```
|
|
60
60
|
*/
|
|
61
61
|
props?: Props;
|
|
62
|
+
/**
|
|
63
|
+
* When `false`, it forces to render the component as it was a full-fledged page.
|
|
64
|
+
*
|
|
65
|
+
* By default, the container API render components as [partials](https://docs.astro.build/en/basics/astro-pages/#page-partials).
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
partial?: boolean;
|
|
62
69
|
};
|
|
63
70
|
export type AddServerRenderer = {
|
|
64
71
|
renderer: NamedSSRLoadedRendererValue;
|
package/dist/container/index.js
CHANGED
|
@@ -266,7 +266,8 @@ class experimental_AstroContainer {
|
|
|
266
266
|
status: 200,
|
|
267
267
|
request,
|
|
268
268
|
pathname: url.pathname,
|
|
269
|
-
locals: options?.locals ?? {}
|
|
269
|
+
locals: options?.locals ?? {},
|
|
270
|
+
partial: options?.partial ?? true
|
|
270
271
|
});
|
|
271
272
|
if (options.params) {
|
|
272
273
|
renderContext.params = options.params;
|
|
@@ -121,7 +121,7 @@ class ContentLayer {
|
|
|
121
121
|
logger.info("Content config changed");
|
|
122
122
|
shouldClear = true;
|
|
123
123
|
}
|
|
124
|
-
if (previousAstroVersion !== "4.16.
|
|
124
|
+
if (previousAstroVersion !== "4.16.6") {
|
|
125
125
|
logger.info("Astro version changed");
|
|
126
126
|
shouldClear = true;
|
|
127
127
|
}
|
|
@@ -129,8 +129,8 @@ class ContentLayer {
|
|
|
129
129
|
logger.info("Clearing content store");
|
|
130
130
|
this.#store.clearAll();
|
|
131
131
|
}
|
|
132
|
-
if ("4.16.
|
|
133
|
-
await this.#store.metaStore().set("astro-version", "4.16.
|
|
132
|
+
if ("4.16.6") {
|
|
133
|
+
await this.#store.metaStore().set("astro-version", "4.16.6");
|
|
134
134
|
}
|
|
135
135
|
if (currentConfigDigest) {
|
|
136
136
|
await this.#store.metaStore().set("config-digest", currentConfigDigest);
|
package/dist/core/constants.js
CHANGED
package/dist/core/create-vite.js
CHANGED
|
@@ -53,7 +53,9 @@ const ONLY_DEV_EXTERNAL = [
|
|
|
53
53
|
// Imported by `@astrojs/prism` which exposes `<Prism/>` that is processed by Vite
|
|
54
54
|
"prismjs/components/index.js",
|
|
55
55
|
// Imported by `astro/assets` -> `packages/astro/src/core/logger/core.ts`
|
|
56
|
-
"string-width"
|
|
56
|
+
"string-width",
|
|
57
|
+
// Imported by `astro:transitions` -> packages/astro/src/runtime/server/transition.ts
|
|
58
|
+
"cssesc"
|
|
57
59
|
];
|
|
58
60
|
async function createVite(commandConfig, { settings, logger, mode, command, fs = nodeFs, sync }) {
|
|
59
61
|
const astroPkgsConfig = await crawlFrameworkPkgs({
|
package/dist/core/dev/dev.js
CHANGED
|
@@ -22,7 +22,7 @@ async function dev(inlineConfig) {
|
|
|
22
22
|
await telemetry.record([]);
|
|
23
23
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
24
24
|
const logger = restart.container.logger;
|
|
25
|
-
const currentVersion = "4.16.
|
|
25
|
+
const currentVersion = "4.16.6";
|
|
26
26
|
const isPrerelease = currentVersion.includes("-");
|
|
27
27
|
if (!isPrerelease) {
|
|
28
28
|
try {
|
package/dist/core/messages.js
CHANGED
|
@@ -38,7 +38,7 @@ function serverStart({
|
|
|
38
38
|
host,
|
|
39
39
|
base
|
|
40
40
|
}) {
|
|
41
|
-
const version = "4.16.
|
|
41
|
+
const version = "4.16.6";
|
|
42
42
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
43
43
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
44
44
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -270,7 +270,7 @@ function printHelp({
|
|
|
270
270
|
message.push(
|
|
271
271
|
linebreak(),
|
|
272
272
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
273
|
-
`v${"4.16.
|
|
273
|
+
`v${"4.16.6"}`
|
|
274
274
|
)} ${headline}`
|
|
275
275
|
);
|
|
276
276
|
}
|
|
@@ -20,6 +20,7 @@ export declare class RenderContext {
|
|
|
20
20
|
params: import("../@types/astro.js").Params;
|
|
21
21
|
protected url: URL;
|
|
22
22
|
props: Props;
|
|
23
|
+
partial: undefined | boolean;
|
|
23
24
|
private constructor();
|
|
24
25
|
/**
|
|
25
26
|
* A flag that tells the render content if the rewriting was triggered
|
|
@@ -29,7 +30,7 @@ export declare class RenderContext {
|
|
|
29
30
|
* A safety net in case of loops
|
|
30
31
|
*/
|
|
31
32
|
counter: number;
|
|
32
|
-
static create({ locals, middleware, pathname, pipeline, request, routeData, status, props, }: Pick<RenderContext, 'pathname' | 'pipeline' | 'request' | 'routeData'> & Partial<Pick<RenderContext, 'locals' | 'middleware' | 'status' | 'props'>>): Promise<RenderContext>;
|
|
33
|
+
static create({ locals, middleware, pathname, pipeline, request, routeData, status, props, partial, }: Pick<RenderContext, 'pathname' | 'pipeline' | 'request' | 'routeData'> & Partial<Pick<RenderContext, 'locals' | 'middleware' | 'status' | 'props' | 'partial'>>): Promise<RenderContext>;
|
|
33
34
|
/**
|
|
34
35
|
* The main function of the RenderContext.
|
|
35
36
|
*
|
|
@@ -26,7 +26,7 @@ import { renderRedirect } from "./redirects/render.js";
|
|
|
26
26
|
import { Slots, getParams, getProps } from "./render/index.js";
|
|
27
27
|
const apiContextRoutesSymbol = Symbol.for("context.routes");
|
|
28
28
|
class RenderContext {
|
|
29
|
-
constructor(pipeline, locals, middleware, pathname, request, routeData, status, cookies = new AstroCookies(request), params = getParams(routeData, pathname), url = new URL(request.url), props = {}) {
|
|
29
|
+
constructor(pipeline, locals, middleware, pathname, request, routeData, status, cookies = new AstroCookies(request), params = getParams(routeData, pathname), url = new URL(request.url), props = {}, partial = void 0) {
|
|
30
30
|
this.pipeline = pipeline;
|
|
31
31
|
this.locals = locals;
|
|
32
32
|
this.middleware = middleware;
|
|
@@ -38,6 +38,7 @@ class RenderContext {
|
|
|
38
38
|
this.params = params;
|
|
39
39
|
this.url = url;
|
|
40
40
|
this.props = props;
|
|
41
|
+
this.partial = partial;
|
|
41
42
|
}
|
|
42
43
|
/**
|
|
43
44
|
* A flag that tells the render content if the rewriting was triggered
|
|
@@ -55,7 +56,8 @@ class RenderContext {
|
|
|
55
56
|
request,
|
|
56
57
|
routeData,
|
|
57
58
|
status = 200,
|
|
58
|
-
props
|
|
59
|
+
props,
|
|
60
|
+
partial = void 0
|
|
59
61
|
}) {
|
|
60
62
|
const pipelineMiddleware = await pipeline.getMiddleware();
|
|
61
63
|
return new RenderContext(
|
|
@@ -69,7 +71,8 @@ class RenderContext {
|
|
|
69
71
|
void 0,
|
|
70
72
|
void 0,
|
|
71
73
|
void 0,
|
|
72
|
-
props
|
|
74
|
+
props,
|
|
75
|
+
partial
|
|
73
76
|
);
|
|
74
77
|
}
|
|
75
78
|
/**
|
|
@@ -259,7 +262,7 @@ class RenderContext {
|
|
|
259
262
|
const { links, scripts, styles } = await pipeline.headElements(routeData);
|
|
260
263
|
const componentMetadata = await pipeline.componentMetadata(routeData) ?? manifest.componentMetadata;
|
|
261
264
|
const headers = new Headers({ "Content-Type": "text/html" });
|
|
262
|
-
const partial = Boolean(mod.partial);
|
|
265
|
+
const partial = typeof this.partial === "boolean" ? this.partial : Boolean(mod.partial);
|
|
263
266
|
const response = {
|
|
264
267
|
status,
|
|
265
268
|
statusText: "OK",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ENV_SYMBOL: unique symbol;
|
package/dist/env/runtime.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { AstroError, AstroErrorData } from "../core/errors/index.js";
|
|
2
2
|
import { invalidVariablesToError } from "./errors.js";
|
|
3
|
+
import { ENV_SYMBOL } from "./runtime-constants.js";
|
|
3
4
|
import { validateEnvVariable, getEnvFieldType } from "./validators.js";
|
|
4
|
-
let _getEnv = (key) =>
|
|
5
|
+
let _getEnv = (key) => {
|
|
6
|
+
const env = globalThis[ENV_SYMBOL] ?? {};
|
|
7
|
+
return env[key];
|
|
8
|
+
};
|
|
5
9
|
function setGetEnv(fn, reset = false) {
|
|
6
10
|
_getEnv = fn;
|
|
7
11
|
_onSetGetEnv(reset);
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
VIRTUAL_MODULES_IDS_VALUES
|
|
8
8
|
} from "./constants.js";
|
|
9
9
|
import { invalidVariablesToError } from "./errors.js";
|
|
10
|
+
import { ENV_SYMBOL } from "./runtime-constants.js";
|
|
10
11
|
import { getEnvFieldType, validateEnvVariable } from "./validators.js";
|
|
11
12
|
function astroEnv({
|
|
12
13
|
settings,
|
|
@@ -28,11 +29,7 @@ function astroEnv({
|
|
|
28
29
|
fileURLToPath(settings.config.root),
|
|
29
30
|
""
|
|
30
31
|
);
|
|
31
|
-
|
|
32
|
-
if (value !== void 0) {
|
|
33
|
-
process.env[key] = value;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
32
|
+
globalThis[ENV_SYMBOL] = loadedEnv;
|
|
36
33
|
const validatedVariables = validatePublicVariables({
|
|
37
34
|
schema,
|
|
38
35
|
loadedEnv,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "4.16.
|
|
3
|
+
"version": "4.16.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",
|
|
@@ -167,8 +167,8 @@
|
|
|
167
167
|
"zod": "^3.23.8",
|
|
168
168
|
"zod-to-json-schema": "^3.23.3",
|
|
169
169
|
"zod-to-ts": "^1.2.0",
|
|
170
|
-
"@astrojs/internal-helpers": "0.4.1",
|
|
171
170
|
"@astrojs/markdown-remark": "5.3.0",
|
|
171
|
+
"@astrojs/internal-helpers": "0.4.1",
|
|
172
172
|
"@astrojs/telemetry": "3.1.0"
|
|
173
173
|
},
|
|
174
174
|
"optionalDependencies": {
|
|
@@ -195,7 +195,7 @@
|
|
|
195
195
|
"eol": "^0.10.0",
|
|
196
196
|
"execa": "^8.0.1",
|
|
197
197
|
"expect-type": "^1.1.0",
|
|
198
|
-
"fs-fixture": "^2.
|
|
198
|
+
"fs-fixture": "^2.5.0",
|
|
199
199
|
"mdast-util-mdx": "^3.0.0",
|
|
200
200
|
"mdast-util-mdx-jsx": "^3.1.3",
|
|
201
201
|
"node-mocks-http": "^1.16.1",
|