astro 6.1.1 → 6.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/content/content-layer.js +3 -3
- package/dist/core/build/plugins/plugin-manifest.js +5 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/errors-data.js +3 -3
- package/dist/core/messages/runtime.js +1 -1
- package/dist/core/middleware/index.d.ts +7 -0
- package/dist/core/middleware/index.js +17 -12
- package/dist/core/preview/static-preview-server.js +12 -5
- package/package.json +9 -4
|
@@ -192,7 +192,7 @@ ${contentConfig.error.message}`
|
|
|
192
192
|
logger.info("Content config changed");
|
|
193
193
|
shouldClear = true;
|
|
194
194
|
}
|
|
195
|
-
if (previousAstroVersion && previousAstroVersion !== "6.1.
|
|
195
|
+
if (previousAstroVersion && previousAstroVersion !== "6.1.2") {
|
|
196
196
|
logger.info("Astro version changed");
|
|
197
197
|
shouldClear = true;
|
|
198
198
|
}
|
|
@@ -200,8 +200,8 @@ ${contentConfig.error.message}`
|
|
|
200
200
|
logger.info("Clearing content store");
|
|
201
201
|
this.#store.clearAll();
|
|
202
202
|
}
|
|
203
|
-
if ("6.1.
|
|
204
|
-
this.#store.metaStore().set("astro-version", "6.1.
|
|
203
|
+
if ("6.1.2") {
|
|
204
|
+
this.#store.metaStore().set("astro-version", "6.1.2");
|
|
205
205
|
}
|
|
206
206
|
if (currentConfigDigest) {
|
|
207
207
|
this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
|
@@ -67,6 +67,11 @@ async function createManifest(buildOpts, internals) {
|
|
|
67
67
|
for (const file of clientStatics) {
|
|
68
68
|
internals.staticFiles.add(file);
|
|
69
69
|
}
|
|
70
|
+
for (const [, ssrAssets] of internals.ssrAssetsPerEnvironment) {
|
|
71
|
+
for (const asset of ssrAssets) {
|
|
72
|
+
internals.staticFiles.add(asset);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
70
75
|
const staticFiles = internals.staticFiles;
|
|
71
76
|
const encodedKey = await encodeKey(await buildOpts.key);
|
|
72
77
|
const manifest = await buildManifest(buildOpts, internals, Array.from(staticFiles), encodedKey);
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -37,7 +37,7 @@ async function dev(inlineConfig) {
|
|
|
37
37
|
await telemetry.record([]);
|
|
38
38
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
39
39
|
const logger = restart.container.logger;
|
|
40
|
-
const currentVersion = "6.1.
|
|
40
|
+
const currentVersion = "6.1.2";
|
|
41
41
|
const isPrerelease = currentVersion.includes("-");
|
|
42
42
|
if (!isPrerelease) {
|
|
43
43
|
try {
|
|
@@ -577,7 +577,7 @@ const InvalidContentEntryFrontmatterError = {
|
|
|
577
577
|
`**${String(collection)} \u2192 ${String(
|
|
578
578
|
entryId
|
|
579
579
|
)}** frontmatter does not match collection schema.`,
|
|
580
|
-
error.message
|
|
580
|
+
...error.issues.map((issue) => ` **${issue.path.join(".")}**: ${issue.message}`)
|
|
581
581
|
].join("\n");
|
|
582
582
|
},
|
|
583
583
|
hint: "See https://docs.astro.build/en/guides/content-collections/ for more information on content schemas."
|
|
@@ -589,7 +589,7 @@ const InvalidContentEntryDataError = {
|
|
|
589
589
|
return [
|
|
590
590
|
`**${String(collection)} \u2192 ${String(entryId)}** data does not match collection schema.
|
|
591
591
|
`,
|
|
592
|
-
` **: ${
|
|
592
|
+
...error.issues.map((issue) => ` **${issue.path.join(".")}**: ${issue.message}`),
|
|
593
593
|
""
|
|
594
594
|
].join("\n");
|
|
595
595
|
},
|
|
@@ -631,7 +631,7 @@ const ContentEntryDataError = {
|
|
|
631
631
|
return [
|
|
632
632
|
`**${String(collection)} \u2192 ${String(entryId)}** data does not match collection schema.
|
|
633
633
|
`,
|
|
634
|
-
` **: ${
|
|
634
|
+
...error.issues.map((issue) => ` **${issue.path.join(".")}**: ${issue.message}`),
|
|
635
635
|
""
|
|
636
636
|
].join("\n");
|
|
637
637
|
},
|
|
@@ -37,6 +37,13 @@ export type CreateContext = {
|
|
|
37
37
|
* Creates a context to be passed to Astro middleware `onRequest` function.
|
|
38
38
|
*/
|
|
39
39
|
declare function createContext({ request, params, userDefinedLocales, defaultLocale, locals, clientAddress, }: CreateContext): APIContext;
|
|
40
|
+
/**
|
|
41
|
+
* Checks whether the passed `value` is serializable.
|
|
42
|
+
*
|
|
43
|
+
* A serializable value contains plain values. For example, `Proxy`, `Set`, `Map`, functions, etc.
|
|
44
|
+
* are not accepted because they can't be serialized.
|
|
45
|
+
*/
|
|
46
|
+
export declare function isLocalsSerializable(value: unknown): boolean;
|
|
40
47
|
/**
|
|
41
48
|
* It attempts to serialize `value` and return it as a string.
|
|
42
49
|
*
|
|
@@ -82,20 +82,24 @@ function createContext({
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
function isLocalsSerializable(value) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
85
|
+
const stack = [value];
|
|
86
|
+
while (stack.length > 0) {
|
|
87
|
+
const current = stack.pop();
|
|
88
|
+
const type = typeof current;
|
|
89
|
+
if (current === null || type === "string" || type === "number" || type === "boolean") {
|
|
90
|
+
continue;
|
|
93
91
|
}
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
if (Array.isArray(current)) {
|
|
93
|
+
stack.push(...current);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (type === "object" && isPlainObject(current)) {
|
|
97
|
+
stack.push(...Object.values(current));
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
96
101
|
}
|
|
97
|
-
|
|
98
|
-
return result;
|
|
102
|
+
return true;
|
|
99
103
|
}
|
|
100
104
|
function isPlainObject(value) {
|
|
101
105
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -118,6 +122,7 @@ import { defineMiddleware } from "./defineMiddleware.js";
|
|
|
118
122
|
export {
|
|
119
123
|
createContext,
|
|
120
124
|
defineMiddleware,
|
|
125
|
+
isLocalsSerializable,
|
|
121
126
|
sequence,
|
|
122
127
|
trySerializeLocals
|
|
123
128
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { performance } from "node:perf_hooks";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { preview } from "vite";
|
|
3
|
+
import { mergeConfig, preview } from "vite";
|
|
4
4
|
import * as msg from "../messages/runtime.js";
|
|
5
5
|
import { getResolvedHostForHttpServer } from "./util.js";
|
|
6
6
|
import { vitePluginAstroPreview } from "./vite-plugin-astro-preview.js";
|
|
@@ -10,7 +10,7 @@ async function createStaticPreviewServer(settings, logger) {
|
|
|
10
10
|
const startServerTime = performance.now();
|
|
11
11
|
let previewServer;
|
|
12
12
|
try {
|
|
13
|
-
|
|
13
|
+
const astroPreviewConfig = {
|
|
14
14
|
configFile: false,
|
|
15
15
|
base: settings.config.base,
|
|
16
16
|
appType: "mpa",
|
|
@@ -22,11 +22,18 @@ async function createStaticPreviewServer(settings, logger) {
|
|
|
22
22
|
host: settings.config.server.host,
|
|
23
23
|
port: settings.config.server.port,
|
|
24
24
|
headers: settings.config.server.headers,
|
|
25
|
-
open: settings.config.server.open
|
|
26
|
-
allowedHosts: settings.config.server.allowedHosts
|
|
25
|
+
open: settings.config.server.open
|
|
27
26
|
},
|
|
28
27
|
plugins: [vitePluginAstroPreview(settings)]
|
|
29
|
-
}
|
|
28
|
+
};
|
|
29
|
+
const { plugins: _plugins, ...userViteConfig } = settings.config.vite ?? {};
|
|
30
|
+
const mergedViteConfig = mergeConfig(userViteConfig, astroPreviewConfig);
|
|
31
|
+
const { allowedHosts } = settings.config.server;
|
|
32
|
+
if (typeof allowedHosts === "boolean" || Array.isArray(allowedHosts) && allowedHosts.length > 0) {
|
|
33
|
+
mergedViteConfig.preview ??= {};
|
|
34
|
+
mergedViteConfig.preview.allowedHosts = allowedHosts;
|
|
35
|
+
}
|
|
36
|
+
previewServer = await preview(mergedViteConfig);
|
|
30
37
|
} catch (err) {
|
|
31
38
|
if (err instanceof Error) {
|
|
32
39
|
logger.error(null, err.stack || err.message);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.2",
|
|
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",
|
|
@@ -153,8 +153,8 @@
|
|
|
153
153
|
"xxhash-wasm": "^1.1.0",
|
|
154
154
|
"yargs-parser": "^22.0.0",
|
|
155
155
|
"zod": "^4.3.6",
|
|
156
|
-
"@astrojs/markdown-remark": "7.1.0",
|
|
157
156
|
"@astrojs/internal-helpers": "0.8.0",
|
|
157
|
+
"@astrojs/markdown-remark": "7.1.0",
|
|
158
158
|
"@astrojs/telemetry": "3.3.0"
|
|
159
159
|
},
|
|
160
160
|
"optionalDependencies": {
|
|
@@ -218,7 +218,12 @@
|
|
|
218
218
|
"test:e2e:chrome": "playwright test",
|
|
219
219
|
"test:e2e:firefox": "playwright test --config playwright.firefox.config.js",
|
|
220
220
|
"test:types": "tsc --project test/types/tsconfig.json",
|
|
221
|
-
"
|
|
222
|
-
"test:
|
|
221
|
+
"typecheck:tests": "tsc --project tsconfig.test.json",
|
|
222
|
+
"test:unit": "pnpm run test:unit:js && pnpm run test:unit:ts",
|
|
223
|
+
"test:unit:js": "astro-scripts test \"test/units/**/*.test.js\" --teardown ./test/units/teardown.js",
|
|
224
|
+
"test:unit:ts": "astro-scripts test \"test/units/**/*.test.ts\" --strip-types --teardown ./test/units/teardown.js",
|
|
225
|
+
"test:integration": "pnpm run test:integration:js && pnpm run test:integration:ts",
|
|
226
|
+
"test:integration:js": "astro-scripts test \"test/*.test.js\"",
|
|
227
|
+
"test:integration:ts": "astro-scripts test \"test/*.test.ts\" --strip-types"
|
|
223
228
|
}
|
|
224
229
|
}
|