astro 4.14.2 → 4.14.3
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/config.d.ts +3 -0
- package/dist/@types/astro.d.ts +12 -8
- package/dist/assets/services/squoosh.js +6 -0
- package/dist/core/config/vite-load.js +1 -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/sync/index.js +1 -1
- package/dist/core/sync/write-files.js +4 -6
- package/dist/env/vite-plugin-env.js +6 -4
- package/dist/integrations/features-validation.js +6 -3
- package/dist/integrations/hooks.js +1 -1
- package/dist/vite-plugin-env/index.js +1 -1
- package/package.json +10 -11
package/config.d.ts
CHANGED
|
@@ -26,6 +26,9 @@ export function getViteConfig(
|
|
|
26
26
|
export function sharpImageService(config?: SharpImageServiceConfig): ImageServiceConfig;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
+
* @deprecated The Squoosh image service is deprecated and will be removed in Astro 5.x.
|
|
30
|
+
* We suggest migrating to the default Sharp image service instead, as it is faster, more powerful and better maintained.
|
|
31
|
+
*
|
|
29
32
|
* Return the configuration needed to use the Squoosh-based image service
|
|
30
33
|
* See: https://docs.astro.build/en/guides/images/#configure-squoosh
|
|
31
34
|
*/
|
package/dist/@types/astro.d.ts
CHANGED
|
@@ -1913,7 +1913,7 @@ export interface AstroUserConfig {
|
|
|
1913
1913
|
*
|
|
1914
1914
|
* **Note:** Secret client variables are not supported because there is no safe way to send this data to the client. Therefore, it is not possible to configure both `context: "client"` and `access: "secret"` in your schema.
|
|
1915
1915
|
*
|
|
1916
|
-
* For a complete overview, and to give feedback on this experimental API, see the [Astro Env RFC](https://github.com/withastro/roadmap/blob/
|
|
1916
|
+
* For a complete overview, and to give feedback on this experimental API, see the [Astro Env RFC](https://github.com/withastro/roadmap/blob/main/proposals/0049-astro-env.md).
|
|
1917
1917
|
*/
|
|
1918
1918
|
env?: {
|
|
1919
1919
|
/**
|
|
@@ -2127,6 +2127,10 @@ export interface AstroUserConfig {
|
|
|
2127
2127
|
* export const collections = { blog, dogs };
|
|
2128
2128
|
* ```
|
|
2129
2129
|
*
|
|
2130
|
+
* :::note
|
|
2131
|
+
* Loaders will not automatically [exclude files prefaced with an `_`](/en/guides/routing/#excluding-pages). Use a regular expression such as `pattern: '**\/[^_]*.md` in your loader to ignore these files.
|
|
2132
|
+
* :::
|
|
2133
|
+
*
|
|
2130
2134
|
* #### Querying and rendering with the Content Layer API
|
|
2131
2135
|
*
|
|
2132
2136
|
* The collection can be [queried in the same way as content collections](/en/guides/content-collections/#querying-collections):
|
|
@@ -2207,8 +2211,8 @@ export interface AstroUserConfig {
|
|
|
2207
2211
|
*
|
|
2208
2212
|
* const blog = defineCollection({
|
|
2209
2213
|
* // For content layer you no longer define a `type`
|
|
2210
|
-
*
|
|
2211
|
-
*
|
|
2214
|
+
* type: 'content',
|
|
2215
|
+
* loader: glob({ pattern: '**\/[^_]*.md', base: "./src/data/blog" }),
|
|
2212
2216
|
* schema: z.object({
|
|
2213
2217
|
* title: z.string(),
|
|
2214
2218
|
* description: z.string(),
|
|
@@ -2239,13 +2243,13 @@ export interface AstroUserConfig {
|
|
|
2239
2243
|
* ```astro ins={4,9} del={3,8}
|
|
2240
2244
|
* // src/pages/index.astro
|
|
2241
2245
|
* ---
|
|
2242
|
-
*
|
|
2243
|
-
*
|
|
2246
|
+
* import { getEntry } from 'astro:content';
|
|
2247
|
+
* import { getEntry, render } from 'astro:content';
|
|
2244
2248
|
*
|
|
2245
|
-
*
|
|
2249
|
+
* const post = await getEntry('blog', params.slug);
|
|
2246
2250
|
*
|
|
2247
|
-
*
|
|
2248
|
-
*
|
|
2251
|
+
* const { Content, headings } = await post.render();
|
|
2252
|
+
* const { Content, headings } = await render(post);
|
|
2249
2253
|
* ---
|
|
2250
2254
|
*
|
|
2251
2255
|
* <Content />
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { yellow } from "kleur/colors";
|
|
1
2
|
import { imageMetadata } from "../utils/metadata.js";
|
|
2
3
|
import {
|
|
3
4
|
baseService,
|
|
4
5
|
parseQuality
|
|
5
6
|
} from "./service.js";
|
|
6
7
|
import { processBuffer } from "./vendor/squoosh/image-pool.js";
|
|
8
|
+
console.warn(
|
|
9
|
+
yellow(
|
|
10
|
+
"The Squoosh image service is deprecated and will be removed in Astro 5.x. We suggest migrating to the default Sharp image service instead, as it is faster, more powerful and better maintained."
|
|
11
|
+
)
|
|
12
|
+
);
|
|
7
13
|
const baseQuality = { low: 25, mid: 50, high: 80, max: 100 };
|
|
8
14
|
const qualityTable = {
|
|
9
15
|
avif: {
|
|
@@ -5,7 +5,7 @@ import { debug } from "../logger/core.js";
|
|
|
5
5
|
async function createViteServer(root, fs) {
|
|
6
6
|
const viteServer = await createServer({
|
|
7
7
|
configFile: false,
|
|
8
|
-
server: { middlewareMode: true, hmr: false, watch: null },
|
|
8
|
+
server: { middlewareMode: true, hmr: false, watch: null, ws: false },
|
|
9
9
|
optimizeDeps: { noDiscovery: true },
|
|
10
10
|
clearScreen: false,
|
|
11
11
|
appType: "custom",
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
|
|
|
23
23
|
await telemetry.record([]);
|
|
24
24
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
25
25
|
const logger = restart.container.logger;
|
|
26
|
-
const currentVersion = "4.14.
|
|
26
|
+
const currentVersion = "4.14.3";
|
|
27
27
|
const isPrerelease = currentVersion.includes("-");
|
|
28
28
|
if (!isPrerelease) {
|
|
29
29
|
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.14.
|
|
41
|
+
const version = "4.14.3";
|
|
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.14.
|
|
273
|
+
`v${"4.14.3"}`
|
|
274
274
|
)} ${headline}`
|
|
275
275
|
);
|
|
276
276
|
}
|
package/dist/core/sync/index.js
CHANGED
|
@@ -112,7 +112,7 @@ async function syncContentCollections(settings, { logger, fs }) {
|
|
|
112
112
|
const tempViteServer = await createServer(
|
|
113
113
|
await createVite(
|
|
114
114
|
{
|
|
115
|
-
server: { middlewareMode: true, hmr: false, watch: null },
|
|
115
|
+
server: { middlewareMode: true, hmr: false, watch: null, ws: false },
|
|
116
116
|
optimizeDeps: { noDiscovery: true },
|
|
117
117
|
ssr: { external: [] },
|
|
118
118
|
logLevel: "silent"
|
|
@@ -19,7 +19,7 @@ const CLIENT_TYPES_REFERENCE = getTsReference("types", "astro/client");
|
|
|
19
19
|
function writeInjectedTypes(settings, fs) {
|
|
20
20
|
const references = [];
|
|
21
21
|
for (const { filename, content } of settings.injectedTypes) {
|
|
22
|
-
const filepath =
|
|
22
|
+
const filepath = fileURLToPath(new URL(filename, settings.dotAstroDir));
|
|
23
23
|
fs.mkdirSync(dirname(filepath), { recursive: true });
|
|
24
24
|
fs.writeFileSync(filepath, content, "utf-8");
|
|
25
25
|
references.push(normalizePath(relative(fileURLToPath(settings.dotAstroDir), filepath)));
|
|
@@ -30,16 +30,14 @@ ${references.map((reference) => getTsReference("path", reference)).join("\n")}`;
|
|
|
30
30
|
fs.mkdirSync(settings.dotAstroDir, { recursive: true });
|
|
31
31
|
}
|
|
32
32
|
fs.writeFileSync(
|
|
33
|
-
|
|
33
|
+
fileURLToPath(new URL(REFERENCE_FILE, settings.dotAstroDir)),
|
|
34
34
|
astroDtsContent,
|
|
35
35
|
"utf-8"
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
38
|
async function setUpEnvTs(settings, fs, logger) {
|
|
39
|
-
const envTsPath =
|
|
40
|
-
const envTsPathRelativetoRoot =
|
|
41
|
-
relative(fileURLToPath(settings.config.root), envTsPath)
|
|
42
|
-
);
|
|
39
|
+
const envTsPath = fileURLToPath(new URL("env.d.ts", settings.config.srcDir));
|
|
40
|
+
const envTsPathRelativetoRoot = relative(fileURLToPath(settings.config.root), envTsPath);
|
|
43
41
|
const relativePath = normalizePath(
|
|
44
42
|
relative(
|
|
45
43
|
fileURLToPath(settings.config.srcDir),
|
|
@@ -14,7 +14,7 @@ function astroEnv({
|
|
|
14
14
|
fs,
|
|
15
15
|
sync
|
|
16
16
|
}) {
|
|
17
|
-
if (!settings.config.experimental.env
|
|
17
|
+
if (!settings.config.experimental.env) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
const schema = settings.config.experimental.env.schema ?? {};
|
|
@@ -36,7 +36,8 @@ function astroEnv({
|
|
|
36
36
|
const validatedVariables = validatePublicVariables({
|
|
37
37
|
schema,
|
|
38
38
|
loadedEnv,
|
|
39
|
-
validateSecrets: settings.config.experimental.env?.validateSecrets ?? false
|
|
39
|
+
validateSecrets: settings.config.experimental.env?.validateSecrets ?? false,
|
|
40
|
+
sync
|
|
40
41
|
});
|
|
41
42
|
templates = {
|
|
42
43
|
...getTemplates(schema, fs, validatedVariables),
|
|
@@ -76,7 +77,8 @@ function resolveVirtualModuleId(id) {
|
|
|
76
77
|
function validatePublicVariables({
|
|
77
78
|
schema,
|
|
78
79
|
loadedEnv,
|
|
79
|
-
validateSecrets
|
|
80
|
+
validateSecrets,
|
|
81
|
+
sync
|
|
80
82
|
}) {
|
|
81
83
|
const valid = [];
|
|
82
84
|
const invalid = [];
|
|
@@ -93,7 +95,7 @@ function validatePublicVariables({
|
|
|
93
95
|
valid.push({ key, value: result.value, type, context: options.context });
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
|
-
if (invalid.length > 0) {
|
|
98
|
+
if (invalid.length > 0 && !sync) {
|
|
97
99
|
throw new AstroError({
|
|
98
100
|
...AstroErrorData.EnvInvalidVariables,
|
|
99
101
|
message: AstroErrorData.EnvInvalidVariables.message(invalidVariablesToError(invalid))
|
|
@@ -81,18 +81,21 @@ function validateSupportKind(supportKind, adapterName, logger, featureName, hasC
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
function featureIsUnsupported(adapterName, logger, featureName) {
|
|
84
|
-
logger.error(
|
|
84
|
+
logger.error(
|
|
85
|
+
"config",
|
|
86
|
+
`The adapter ${adapterName} doesn't currently support the feature "${featureName}".`
|
|
87
|
+
);
|
|
85
88
|
}
|
|
86
89
|
function featureIsExperimental(adapterName, logger, featureName) {
|
|
87
90
|
logger.warn(
|
|
88
91
|
"config",
|
|
89
|
-
`The
|
|
92
|
+
`The adapter ${adapterName} provides experimental support for "${featureName}". You may experience issues or breaking changes until this feature is fully supported by the adapter.`
|
|
90
93
|
);
|
|
91
94
|
}
|
|
92
95
|
function featureIsDeprecated(adapterName, logger, featureName) {
|
|
93
96
|
logger.warn(
|
|
94
97
|
"config",
|
|
95
|
-
`The
|
|
98
|
+
`The adapter ${adapterName} has deprecated its support for "${featureName}", and future compatibility is not guaranteed. The adapter may completely remove support for this feature without warning.`
|
|
96
99
|
);
|
|
97
100
|
}
|
|
98
101
|
const SHARP_SERVICE = "astro/assets/services/sharp";
|
|
@@ -260,7 +260,7 @@ async function runHookConfigDone({
|
|
|
260
260
|
filename: normalizedFilename,
|
|
261
261
|
content: injectedType.content
|
|
262
262
|
});
|
|
263
|
-
return new URL(normalizedFilename, settings.
|
|
263
|
+
return new URL(normalizedFilename, settings.dotAstroDir);
|
|
264
264
|
},
|
|
265
265
|
logger: getLogger(integration, logger)
|
|
266
266
|
}),
|
|
@@ -117,8 +117,8 @@ function envVitePlugin({ settings, logger }) {
|
|
|
117
117
|
s.prepend(devImportMetaEnvPrepend);
|
|
118
118
|
let exportConstPrerenderStr;
|
|
119
119
|
s.replace(exportConstPrerenderRe, (m, key) => {
|
|
120
|
-
exportConstPrerenderStr = m;
|
|
121
120
|
if (privateEnv[key] != null) {
|
|
121
|
+
exportConstPrerenderStr = m;
|
|
122
122
|
return `export const prerender = ${privateEnv[key]}`;
|
|
123
123
|
} else {
|
|
124
124
|
return m;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "4.14.
|
|
3
|
+
"version": "4.14.3",
|
|
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",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"vendor"
|
|
109
109
|
],
|
|
110
110
|
"dependencies": {
|
|
111
|
-
"@astrojs/compiler": "^2.10.
|
|
111
|
+
"@astrojs/compiler": "^2.10.3",
|
|
112
112
|
"@babel/core": "^7.25.2",
|
|
113
113
|
"@babel/generator": "^7.25.0",
|
|
114
114
|
"@babel/parser": "^7.25.3",
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
"magic-string": "^0.30.11",
|
|
150
150
|
"micromatch": "^4.0.7",
|
|
151
151
|
"mrmime": "^2.0.0",
|
|
152
|
-
"neotraverse": "^0.6.
|
|
152
|
+
"neotraverse": "^0.6.18",
|
|
153
153
|
"ora": "^8.0.1",
|
|
154
154
|
"p-limit": "^6.1.0",
|
|
155
155
|
"p-queue": "^8.0.1",
|
|
@@ -158,13 +158,13 @@
|
|
|
158
158
|
"prompts": "^2.4.2",
|
|
159
159
|
"rehype": "^13.0.1",
|
|
160
160
|
"semver": "^7.6.3",
|
|
161
|
-
"shiki": "^1.
|
|
161
|
+
"shiki": "^1.14.1",
|
|
162
162
|
"string-width": "^7.2.0",
|
|
163
163
|
"strip-ansi": "^7.1.0",
|
|
164
164
|
"tsconfck": "^3.1.1",
|
|
165
165
|
"unist-util-visit": "^5.0.0",
|
|
166
166
|
"vfile": "^6.0.2",
|
|
167
|
-
"vite": "^5.4.
|
|
167
|
+
"vite": "^5.4.1",
|
|
168
168
|
"vitefu": "^0.2.5",
|
|
169
169
|
"which-pm": "^3.0.0",
|
|
170
170
|
"xxhash-wasm": "^1.0.2",
|
|
@@ -180,8 +180,8 @@
|
|
|
180
180
|
"sharp": "^0.33.3"
|
|
181
181
|
},
|
|
182
182
|
"devDependencies": {
|
|
183
|
-
"@astrojs/check": "^0.9.
|
|
184
|
-
"@playwright/test": "^1.46.
|
|
183
|
+
"@astrojs/check": "^0.9.3",
|
|
184
|
+
"@playwright/test": "^1.46.1",
|
|
185
185
|
"@types/aria-query": "^5.0.4",
|
|
186
186
|
"@types/babel__generator": "^7.6.8",
|
|
187
187
|
"@types/babel__traverse": "^7.20.6",
|
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
"rehype-slug": "^6.0.0",
|
|
212
212
|
"rehype-toc": "^3.0.2",
|
|
213
213
|
"remark-code-titles": "^0.1.2",
|
|
214
|
-
"rollup": "^4.
|
|
214
|
+
"rollup": "^4.21.0",
|
|
215
215
|
"sass": "^1.77.8",
|
|
216
216
|
"undici": "^6.19.7",
|
|
217
217
|
"unified": "^11.0.5",
|
|
@@ -227,10 +227,9 @@
|
|
|
227
227
|
},
|
|
228
228
|
"scripts": {
|
|
229
229
|
"prebuild": "astro-scripts prebuild --to-string \"src/runtime/server/astro-island.ts\" \"src/runtime/client/{idle,load,media,only,visible}.ts\"",
|
|
230
|
-
"build": "pnpm run prebuild && astro-scripts build \"src/**/*.{ts,js}\" && tsc
|
|
231
|
-
"build:ci": "pnpm run prebuild && astro-scripts build \"src/**/*.{ts,js}\"
|
|
230
|
+
"build": "pnpm run prebuild && astro-scripts build \"src/**/*.{ts,js}\" --copy-wasm && tsc",
|
|
231
|
+
"build:ci": "pnpm run prebuild && astro-scripts build \"src/**/*.{ts,js}\" --copy-wasm",
|
|
232
232
|
"dev": "astro-scripts dev --copy-wasm --prebuild \"src/runtime/server/astro-island.ts\" --prebuild \"src/runtime/client/{idle,load,media,only,visible}.ts\" \"src/**/*.{ts,js}\"",
|
|
233
|
-
"postbuild": "astro-scripts copy \"src/**/*.astro\" && astro-scripts copy \"src/**/*.wasm\"",
|
|
234
233
|
"test": "pnpm run test:node && pnpm run test:types",
|
|
235
234
|
"test:match": "pnpm run test:node --match",
|
|
236
235
|
"test:e2e": "pnpm test:e2e:chrome && pnpm test:e2e:firefox",
|