astro 2.10.8 → 2.10.10
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/components/ViewTransitions.astro +30 -12
- package/dist/@types/astro.d.ts +68 -6
- package/dist/assets/{generate.d.ts → build/generate.d.ts} +2 -2
- package/dist/assets/build/generate.js +123 -0
- package/dist/assets/build/remote.d.ts +9 -0
- package/dist/assets/build/remote.js +42 -0
- package/dist/assets/image-endpoint.js +7 -8
- package/dist/assets/internal.d.ts +4 -2
- package/dist/assets/internal.js +23 -6
- package/dist/assets/services/service.d.ts +15 -8
- package/dist/assets/services/service.js +19 -10
- package/dist/assets/utils/remotePattern.d.ts +11 -0
- package/dist/assets/utils/remotePattern.js +46 -0
- package/dist/assets/utils/transformToPath.js +4 -5
- package/dist/assets/vite-plugin-assets.js +2 -6
- package/dist/core/app/index.js +21 -9
- package/dist/core/build/generate.js +4 -2
- package/dist/core/build/static-build.js +14 -4
- package/dist/core/config/schema.d.ts +104 -0
- package/dist/core/config/schema.js +20 -2
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/container.js +5 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/errors-data.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/runtime/server/render/common.d.ts +1 -1
- package/dist/runtime/server/render/common.js +13 -15
- package/dist/runtime/server/render/component.d.ts +1 -1
- package/dist/runtime/server/render/component.js +2 -1
- package/dist/runtime/server/render/head.d.ts +1 -1
- package/dist/runtime/server/render/head.js +3 -2
- package/dist/runtime/server/render/index.d.ts +1 -1
- package/dist/runtime/server/render/instruction.d.ts +16 -0
- package/dist/runtime/server/render/instruction.js +13 -0
- package/dist/runtime/server/render/slot.d.ts +1 -1
- package/dist/vite-plugin-integrations-container/index.js +2 -2
- package/package.json +3 -1
- package/dist/assets/generate.js +0 -90
- package/dist/runtime/server/render/types.d.ts +0 -12
- package/dist/runtime/server/render/types.js +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.10",
|
|
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",
|
|
@@ -134,6 +134,7 @@
|
|
|
134
134
|
"github-slugger": "^2.0.0",
|
|
135
135
|
"gray-matter": "^4.0.3",
|
|
136
136
|
"html-escaper": "^3.0.3",
|
|
137
|
+
"http-cache-semantics": "^4.1.1",
|
|
137
138
|
"js-yaml": "^4.1.0",
|
|
138
139
|
"kleur": "^4.1.4",
|
|
139
140
|
"magic-string": "^0.30.2",
|
|
@@ -173,6 +174,7 @@
|
|
|
173
174
|
"@types/estree": "^0.0.51",
|
|
174
175
|
"@types/hast": "^2.3.4",
|
|
175
176
|
"@types/html-escaper": "^3.0.0",
|
|
177
|
+
"@types/http-cache-semantics": "^4.0.1",
|
|
176
178
|
"@types/js-yaml": "^4.0.5",
|
|
177
179
|
"@types/mime": "^2.0.3",
|
|
178
180
|
"@types/mocha": "^9.1.1",
|
package/dist/assets/generate.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import { basename, join } from "node:path/posix";
|
|
3
|
-
import { warn } from "../core/logger/core.js";
|
|
4
|
-
import { prependForwardSlash } from "../core/path.js";
|
|
5
|
-
import { isServerLikeOutput } from "../prerender/utils.js";
|
|
6
|
-
import { getConfiguredImageService, isESMImportedImage } from "./internal.js";
|
|
7
|
-
async function generateImage(buildOpts, options, filepath) {
|
|
8
|
-
if (!isESMImportedImage(options.src)) {
|
|
9
|
-
return void 0;
|
|
10
|
-
}
|
|
11
|
-
let useCache = true;
|
|
12
|
-
const assetsCacheDir = new URL("assets/", buildOpts.settings.config.cacheDir);
|
|
13
|
-
try {
|
|
14
|
-
await fs.promises.mkdir(assetsCacheDir, { recursive: true });
|
|
15
|
-
} catch (err) {
|
|
16
|
-
warn(
|
|
17
|
-
buildOpts.logging,
|
|
18
|
-
"astro:assets",
|
|
19
|
-
`An error was encountered while creating the cache directory. Proceeding without caching. Error: ${err}`
|
|
20
|
-
);
|
|
21
|
-
useCache = false;
|
|
22
|
-
}
|
|
23
|
-
let serverRoot, clientRoot;
|
|
24
|
-
if (isServerLikeOutput(buildOpts.settings.config)) {
|
|
25
|
-
serverRoot = buildOpts.settings.config.build.server;
|
|
26
|
-
clientRoot = buildOpts.settings.config.build.client;
|
|
27
|
-
} else {
|
|
28
|
-
serverRoot = buildOpts.settings.config.outDir;
|
|
29
|
-
clientRoot = buildOpts.settings.config.outDir;
|
|
30
|
-
}
|
|
31
|
-
const finalFileURL = new URL("." + filepath, clientRoot);
|
|
32
|
-
const finalFolderURL = new URL("./", finalFileURL);
|
|
33
|
-
const cachedFileURL = new URL(basename(filepath), assetsCacheDir);
|
|
34
|
-
try {
|
|
35
|
-
await fs.promises.copyFile(cachedFileURL, finalFileURL);
|
|
36
|
-
return {
|
|
37
|
-
cached: true
|
|
38
|
-
};
|
|
39
|
-
} catch (e) {
|
|
40
|
-
}
|
|
41
|
-
const originalImagePath = options.src.src;
|
|
42
|
-
const fileData = await fs.promises.readFile(
|
|
43
|
-
new URL(
|
|
44
|
-
"." + prependForwardSlash(
|
|
45
|
-
join(buildOpts.settings.config.build.assets, basename(originalImagePath))
|
|
46
|
-
),
|
|
47
|
-
serverRoot
|
|
48
|
-
)
|
|
49
|
-
);
|
|
50
|
-
const imageService = await getConfiguredImageService();
|
|
51
|
-
const resultData = await imageService.transform(
|
|
52
|
-
fileData,
|
|
53
|
-
{ ...options, src: originalImagePath },
|
|
54
|
-
buildOpts.settings.config.image.service.config
|
|
55
|
-
);
|
|
56
|
-
await fs.promises.mkdir(finalFolderURL, { recursive: true });
|
|
57
|
-
if (useCache) {
|
|
58
|
-
try {
|
|
59
|
-
await fs.promises.writeFile(cachedFileURL, resultData.data);
|
|
60
|
-
await fs.promises.copyFile(cachedFileURL, finalFileURL);
|
|
61
|
-
} catch (e) {
|
|
62
|
-
warn(
|
|
63
|
-
buildOpts.logging,
|
|
64
|
-
"astro:assets",
|
|
65
|
-
`An error was encountered while creating the cache directory. Proceeding without caching. Error: ${e}`
|
|
66
|
-
);
|
|
67
|
-
await fs.promises.writeFile(finalFileURL, resultData.data);
|
|
68
|
-
}
|
|
69
|
-
} else {
|
|
70
|
-
await fs.promises.writeFile(finalFileURL, resultData.data);
|
|
71
|
-
}
|
|
72
|
-
return {
|
|
73
|
-
cached: false,
|
|
74
|
-
weight: {
|
|
75
|
-
before: Math.trunc(fileData.byteLength / 1024),
|
|
76
|
-
after: Math.trunc(resultData.data.byteLength / 1024)
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
function getStaticImageList() {
|
|
81
|
-
var _a, _b;
|
|
82
|
-
if (!((_a = globalThis == null ? void 0 : globalThis.astroAsset) == null ? void 0 : _a.staticImages)) {
|
|
83
|
-
return [];
|
|
84
|
-
}
|
|
85
|
-
return (_b = globalThis.astroAsset.staticImages) == null ? void 0 : _b.entries();
|
|
86
|
-
}
|
|
87
|
-
export {
|
|
88
|
-
generateImage,
|
|
89
|
-
getStaticImageList
|
|
90
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { HydrationMetadata } from '../hydration.js';
|
|
2
|
-
export type RenderDirectiveInstruction = {
|
|
3
|
-
type: 'directive';
|
|
4
|
-
hydration: HydrationMetadata;
|
|
5
|
-
};
|
|
6
|
-
export type RenderHeadInstruction = {
|
|
7
|
-
type: 'head';
|
|
8
|
-
};
|
|
9
|
-
export type MaybeRenderHeadInstruction = {
|
|
10
|
-
type: 'maybe-head';
|
|
11
|
-
};
|
|
12
|
-
export type RenderInstruction = RenderDirectiveInstruction | RenderHeadInstruction | MaybeRenderHeadInstruction;
|
|
File without changes
|