astro 2.4.1 → 2.4.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/client-base.d.ts +1 -1
- package/dist/@types/astro.d.ts +5 -2
- package/dist/assets/internal.js +9 -6
- 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/middleware/callMiddleware.js +8 -3
- package/package.json +4 -1
package/client-base.d.ts
CHANGED
|
@@ -389,7 +389,7 @@ declare module '*?inline' {
|
|
|
389
389
|
}
|
|
390
390
|
|
|
391
391
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
392
|
-
|
|
392
|
+
declare namespace App {
|
|
393
393
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
394
394
|
export interface Locals {}
|
|
395
395
|
}
|
package/dist/@types/astro.d.ts
CHANGED
|
@@ -976,6 +976,7 @@ export interface AstroUserConfig {
|
|
|
976
976
|
* assets: true,
|
|
977
977
|
* },
|
|
978
978
|
* }
|
|
979
|
+
* ```
|
|
979
980
|
*/
|
|
980
981
|
assets?: boolean;
|
|
981
982
|
/**
|
|
@@ -984,8 +985,8 @@ export interface AstroUserConfig {
|
|
|
984
985
|
* @type {('always' | 'auto' | 'never')}
|
|
985
986
|
* @default `never`
|
|
986
987
|
* @description
|
|
987
|
-
* Control whether styles are sent to the browser in a separate css file or inlined into
|
|
988
|
-
* - `'always'` - all styles are inlined into
|
|
988
|
+
* Control whether styles are sent to the browser in a separate css file or inlined into `<style>` tags. Choose from the following options:
|
|
989
|
+
* - `'always'` - all styles are inlined into `<style>` tags
|
|
989
990
|
* - `'auto'` - only stylesheets smaller than `ViteConfig.build.assetsInlineLimit` (default: 4kb) are inlined. Otherwise, styles are sent in external stylesheets.
|
|
990
991
|
* - `'never'` - all styles are sent in external stylesheets
|
|
991
992
|
*
|
|
@@ -995,6 +996,7 @@ export interface AstroUserConfig {
|
|
|
995
996
|
* inlineStylesheets: `auto`,
|
|
996
997
|
* },
|
|
997
998
|
* }
|
|
999
|
+
* ```
|
|
998
1000
|
*/
|
|
999
1001
|
inlineStylesheets?: 'always' | 'auto' | 'never';
|
|
1000
1002
|
/**
|
|
@@ -1014,6 +1016,7 @@ export interface AstroUserConfig {
|
|
|
1014
1016
|
* middleware: true,
|
|
1015
1017
|
* },
|
|
1016
1018
|
* }
|
|
1019
|
+
* ```
|
|
1017
1020
|
*/
|
|
1018
1021
|
middleware?: boolean;
|
|
1019
1022
|
};
|
package/dist/assets/internal.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import { basename, join } from "node:path/posix";
|
|
3
3
|
import { AstroError, AstroErrorData } from "../core/errors/index.js";
|
|
4
|
+
import { warn } from "../core/logger/core.js";
|
|
4
5
|
import { prependForwardSlash } from "../core/path.js";
|
|
5
6
|
import { isLocalService } from "./services/service.js";
|
|
6
7
|
function isESMImportedImage(src) {
|
|
@@ -60,9 +61,10 @@ async function generateImage(buildOpts, options, filepath) {
|
|
|
60
61
|
try {
|
|
61
62
|
await fs.promises.mkdir(assetsCacheDir, { recursive: true });
|
|
62
63
|
} catch (err) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
warn(
|
|
65
|
+
buildOpts.logging,
|
|
66
|
+
"astro:assets",
|
|
67
|
+
`An error was encountered while creating the cache directory. Proceeding without caching. Error: ${err}`
|
|
66
68
|
);
|
|
67
69
|
useCache = false;
|
|
68
70
|
}
|
|
@@ -105,9 +107,10 @@ async function generateImage(buildOpts, options, filepath) {
|
|
|
105
107
|
await fs.promises.writeFile(cachedFileURL, resultData.data);
|
|
106
108
|
await fs.promises.copyFile(cachedFileURL, finalFileURL);
|
|
107
109
|
} catch (e) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
warn(
|
|
111
|
+
buildOpts.logging,
|
|
112
|
+
"astro:assets",
|
|
113
|
+
`An error was encountered while creating the cache directory. Proceeding without caching. Error: ${e}`
|
|
111
114
|
);
|
|
112
115
|
await fs.promises.writeFile(finalFileURL, resultData.data);
|
|
113
116
|
}
|
package/dist/core/constants.js
CHANGED
package/dist/core/create-vite.js
CHANGED
|
@@ -40,7 +40,9 @@ const ONLY_DEV_EXTERNAL = [
|
|
|
40
40
|
// Imported by `<Code/>` which is processed by Vite
|
|
41
41
|
"shiki",
|
|
42
42
|
// Imported by `@astrojs/prism` which exposes `<Prism/>` that is processed by Vite
|
|
43
|
-
"prismjs/components/index.js"
|
|
43
|
+
"prismjs/components/index.js",
|
|
44
|
+
// Imported by `astro/assets` -> `packages/astro/src/core/logger/core.ts`
|
|
45
|
+
"string-width"
|
|
44
46
|
];
|
|
45
47
|
async function createVite(commandConfig, { settings, logging, mode, command, fs = nodeFs }) {
|
|
46
48
|
var _a, _b;
|
package/dist/core/dev/dev.js
CHANGED
|
@@ -53,7 +53,7 @@ async function dev(settings, options) {
|
|
|
53
53
|
isRestart: options.isRestart
|
|
54
54
|
})
|
|
55
55
|
);
|
|
56
|
-
const currentVersion = "2.4.
|
|
56
|
+
const currentVersion = "2.4.3";
|
|
57
57
|
if (currentVersion.includes("-")) {
|
|
58
58
|
warn(options.logging, null, msg.prerelease({ currentVersion }));
|
|
59
59
|
}
|
package/dist/core/messages.js
CHANGED
|
@@ -47,7 +47,7 @@ function serverStart({
|
|
|
47
47
|
base,
|
|
48
48
|
isRestart = false
|
|
49
49
|
}) {
|
|
50
|
-
const version = "2.4.
|
|
50
|
+
const version = "2.4.3";
|
|
51
51
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
52
52
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
53
53
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -233,7 +233,7 @@ function printHelp({
|
|
|
233
233
|
message.push(
|
|
234
234
|
linebreak(),
|
|
235
235
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
236
|
-
`v${"2.4.
|
|
236
|
+
`v${"2.4.3"}`
|
|
237
237
|
)} ${headline}`
|
|
238
238
|
);
|
|
239
239
|
}
|
|
@@ -5,9 +5,11 @@ async function callMiddleware(onRequest, apiContext, responseFunction) {
|
|
|
5
5
|
resolveResolve = resolve;
|
|
6
6
|
});
|
|
7
7
|
let nextCalled = false;
|
|
8
|
+
let responseFunctionPromise = void 0;
|
|
8
9
|
const next = async () => {
|
|
9
10
|
nextCalled = true;
|
|
10
|
-
|
|
11
|
+
responseFunctionPromise = responseFunction();
|
|
12
|
+
return responseFunctionPromise;
|
|
11
13
|
};
|
|
12
14
|
let middlewarePromise = onRequest(apiContext, next);
|
|
13
15
|
return await Promise.resolve(middlewarePromise).then(async (value) => {
|
|
@@ -18,8 +20,11 @@ async function callMiddleware(onRequest, apiContext, responseFunction) {
|
|
|
18
20
|
}
|
|
19
21
|
return value;
|
|
20
22
|
} else {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
if (responseFunctionPromise) {
|
|
24
|
+
return responseFunctionPromise;
|
|
25
|
+
} else {
|
|
26
|
+
throw new AstroError(AstroErrorData.MiddlewareNotAResponse);
|
|
27
|
+
}
|
|
23
28
|
}
|
|
24
29
|
} else if (typeof value === "undefined") {
|
|
25
30
|
throw new AstroError(AstroErrorData.MiddlewareNoDataOrNextCalled);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.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",
|
|
@@ -20,6 +20,9 @@
|
|
|
20
20
|
],
|
|
21
21
|
"app/*": [
|
|
22
22
|
"./dist/core/app/*"
|
|
23
|
+
],
|
|
24
|
+
"middleware": [
|
|
25
|
+
"./dist/core/middleware/index.d.ts"
|
|
23
26
|
]
|
|
24
27
|
}
|
|
25
28
|
},
|