astro 7.1.6 → 7.2.1
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/build/generate.d.ts +8 -1
- package/dist/assets/build/generate.js +21 -1
- package/dist/assets/fonts/providers/index.js +12 -2
- package/dist/assets/types.d.ts +13 -0
- package/dist/assets/utils/resolveImports.d.ts +0 -1
- package/dist/assets/utils/resolveImports.js +1 -4
- package/dist/assets/vite-plugin-assets.js +8 -0
- package/dist/cli/add/index.js +1 -1
- package/dist/cli/agent.d.ts +1 -0
- package/dist/cli/agent.js +11 -0
- package/dist/cli/dev/background.d.ts +3 -16
- package/dist/cli/dev/background.js +7 -93
- package/dist/cli/dev/index.d.ts +12 -0
- package/dist/cli/dev/index.js +30 -23
- package/dist/cli/dev/logs.js +2 -64
- package/dist/cli/dev/status.d.ts +2 -9
- package/dist/cli/dev/status.js +6 -24
- package/dist/cli/dev/stop.d.ts +2 -6
- package/dist/cli/dev/stop.js +6 -14
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/cli/install-package.js +1 -1
- package/dist/cli/preview/index.js +77 -3
- package/dist/cli/server.d.ts +60 -0
- package/dist/cli/server.js +274 -0
- package/dist/content/content-layer.js +63 -3
- package/dist/content/loaders/file.js +1 -1
- package/dist/content/loaders/glob.js +3 -2
- package/dist/content/mutable-data-store.js +3 -3
- package/dist/content/runtime.d.ts +3 -0
- package/dist/content/runtime.js +8 -2
- package/dist/content/types-generator.js +1 -0
- package/dist/content/vite-plugin-content-assets.js +6 -1
- package/dist/content/vite-plugin-content-imports.js +12 -3
- package/dist/content/vite-plugin-content-virtual-mod.js +28 -16
- package/dist/core/app/entrypoints/index.d.ts +2 -0
- package/dist/core/app/entrypoints/index.js +14 -0
- package/dist/core/app/types.d.ts +2 -0
- package/dist/core/build/config-hash/index.d.ts +8 -0
- package/dist/core/build/config-hash/index.js +23 -0
- package/dist/core/build/config-hash/input.d.ts +199 -0
- package/dist/core/build/config-hash/input.js +43 -0
- package/dist/core/build/generate.d.ts +3 -1
- package/dist/core/build/generate.js +149 -14
- package/dist/core/build/incremental-content-collector.d.ts +10 -0
- package/dist/core/build/incremental-content-collector.js +33 -0
- package/dist/core/build/incremental-image-collector.d.ts +11 -0
- package/dist/core/build/incremental-image-collector.js +32 -0
- package/dist/core/build/incremental-metadata.d.ts +9 -0
- package/dist/core/build/incremental-metadata.js +17 -0
- package/dist/core/build/incremental.d.ts +123 -0
- package/dist/core/build/incremental.js +178 -0
- package/dist/core/build/index.d.ts +3 -0
- package/dist/core/build/index.js +6 -2
- package/dist/core/build/internal.d.ts +19 -0
- package/dist/core/build/lockfile/finder.d.ts +22 -0
- package/dist/core/build/lockfile/finder.js +45 -0
- package/dist/core/build/lockfile/hasher.d.ts +16 -0
- package/dist/core/build/lockfile/hasher.js +46 -0
- package/dist/core/build/lockfile/index.d.ts +9 -0
- package/dist/core/build/lockfile/index.js +16 -0
- package/dist/core/build/plugins/index.js +3 -1
- package/dist/core/build/plugins/plugin-incremental.d.ts +14 -0
- package/dist/core/build/plugins/plugin-incremental.js +152 -0
- package/dist/core/build/plugins/plugin-manifest.js +11 -2
- package/dist/core/build/types.d.ts +2 -0
- package/dist/core/config/schemas/base.d.ts +3 -2
- package/dist/core/config/schemas/base.js +1 -0
- package/dist/core/config/schemas/defaults.d.ts +1 -0
- package/dist/core/config/schemas/defaults.js +1 -0
- package/dist/core/config/schemas/relative.d.ts +7 -4
- package/dist/core/config/settings.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.js +2 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/dev/lockfile.d.ts +8 -7
- package/dist/core/dev/lockfile.js +13 -13
- package/dist/core/encryption.d.ts +6 -0
- package/dist/core/encryption.js +14 -2
- package/dist/core/errors/default-handler.js +4 -5
- package/dist/core/fetch/fetch-state.js +1 -0
- package/dist/core/fetch/index.js +1 -1
- package/dist/core/logger/config.d.ts +1 -1
- package/dist/core/logger/load.d.ts +3 -1
- package/dist/core/logger/load.js +3 -3
- package/dist/core/logger/utils.d.ts +6 -4
- package/dist/core/logger/utils.js +13 -5
- package/dist/core/logger/vite-plugin.js +1 -1
- package/dist/core/messages/runtime.js +1 -1
- package/dist/core/middleware/vite-plugin.d.ts +1 -1
- package/dist/core/middleware/vite-plugin.js +11 -24
- package/dist/core/preview/static-preview-server.d.ts +2 -0
- package/dist/core/preview/static-preview-server.js +1 -0
- package/dist/core/routing/dev.d.ts +3 -1
- package/dist/core/routing/dev.js +10 -2
- package/dist/core/routing/handler.js +1 -1
- package/dist/core/session/config.d.ts +2 -2
- package/dist/core/session/config.js +2 -1
- package/dist/core/session/provider-disabled.d.ts +2 -0
- package/dist/core/session/provider-disabled.js +7 -0
- package/dist/core/session/provider.d.ts +1 -0
- package/dist/core/session/provider.js +4 -0
- package/dist/core/session/utils.js +3 -0
- package/dist/core/session/vite-plugin.d.ts +3 -0
- package/dist/core/session/vite-plugin.js +41 -6
- package/dist/integrations/hooks.js +3 -1
- package/dist/prefetch/index.js +18 -1
- package/dist/prefetch/speculation-rules.d.ts +6 -0
- package/dist/prefetch/speculation-rules.js +22 -0
- package/dist/runtime/prerender/static-paths.js +5 -1
- package/dist/runtime/server/render/head.js +10 -0
- package/dist/runtime/server/render/util.js +3 -0
- package/dist/transitions/swap-functions.js +49 -4
- package/dist/types/public/common.d.ts +1 -0
- package/dist/types/public/config.d.ts +81 -9
- package/dist/types/public/integrations.d.ts +29 -2
- package/dist/types/public/internal.d.ts +2 -0
- package/dist/types/public/preview.d.ts +2 -0
- package/dist/vite-plugin-app/app.d.ts +3 -1
- package/dist/vite-plugin-app/app.js +4 -3
- package/dist/vite-plugin-config-alias/index.js +1 -0
- package/dist/vite-plugin-environment/index.js +4 -1
- package/package.json +1 -2
|
@@ -2,6 +2,8 @@ import { extname } from "node:path";
|
|
|
2
2
|
import { pathToFileURL } from "node:url";
|
|
3
3
|
import * as devalue from "devalue";
|
|
4
4
|
import { getProxyCode } from "../assets/utils/proxy.js";
|
|
5
|
+
import { createContentDataIncrementalMetadata } from "../core/build/incremental-metadata.js";
|
|
6
|
+
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../core/constants.js";
|
|
5
7
|
import { AstroError } from "../core/errors/errors.js";
|
|
6
8
|
import { AstroErrorData } from "../core/errors/index.js";
|
|
7
9
|
import { CONTENT_FLAG, DATA_FLAG } from "./consts.js";
|
|
@@ -22,7 +24,6 @@ import {
|
|
|
22
24
|
reloadContentConfigObserver,
|
|
23
25
|
reverseSymlink
|
|
24
26
|
} from "./utils.js";
|
|
25
|
-
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../core/constants.js";
|
|
26
27
|
function getContentRendererByViteId(viteId, settings) {
|
|
27
28
|
let ext = viteId.split(".").pop();
|
|
28
29
|
if (!ext) return void 0;
|
|
@@ -91,7 +92,11 @@ export const _internal = {
|
|
|
91
92
|
rawData: ${JSON.stringify(_internal.rawData)},
|
|
92
93
|
};
|
|
93
94
|
`;
|
|
94
|
-
return
|
|
95
|
+
return {
|
|
96
|
+
code,
|
|
97
|
+
map: { mappings: "" },
|
|
98
|
+
meta: createContentDataIncrementalMetadata()
|
|
99
|
+
};
|
|
95
100
|
} else if (hasContentFlag(viteId, CONTENT_FLAG)) {
|
|
96
101
|
const fileId = reverseSymlink({ entry: viteId.split("?")[0], contentDir, symlinks });
|
|
97
102
|
const { id, slug, collection, body, data, _internal } = await getContentEntryModule({
|
|
@@ -114,7 +119,11 @@ export const _internal = {
|
|
|
114
119
|
filePath: ${JSON.stringify(_internal.filePath)},
|
|
115
120
|
rawData: ${JSON.stringify(_internal.rawData)},
|
|
116
121
|
};`;
|
|
117
|
-
return {
|
|
122
|
+
return {
|
|
123
|
+
code,
|
|
124
|
+
map: { mappings: "" },
|
|
125
|
+
meta: createContentDataIncrementalMetadata()
|
|
126
|
+
};
|
|
118
127
|
}
|
|
119
128
|
}
|
|
120
129
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import nodeFs from "node:fs";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { dataToEsm } from "@rollup/pluginutils";
|
|
4
3
|
import { isRunnableDevEnvironment, normalizePath } from "vite";
|
|
4
|
+
import { createContentDataIncrementalMetadata } from "../core/build/incremental-metadata.js";
|
|
5
5
|
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../core/constants.js";
|
|
6
6
|
import { AstroError, AstroErrorData } from "../core/errors/index.js";
|
|
7
7
|
import { rootRelativePath } from "../core/viteUtils.js";
|
|
@@ -28,7 +28,6 @@ import {
|
|
|
28
28
|
} from "./consts.js";
|
|
29
29
|
import { getDataStoreChunkSize, getDataStoreDir, getDataStoreFile } from "./paths.js";
|
|
30
30
|
import { getContentPaths, isDeferredModule } from "./utils.js";
|
|
31
|
-
const LARGE_DATA_STORE_THRESHOLD = 5 * 1024 * 1024;
|
|
32
31
|
function invalidateAssetImports(viteServer, filePath) {
|
|
33
32
|
const timestamp = Date.now();
|
|
34
33
|
for (const environment of Object.values(viteServer.environments)) {
|
|
@@ -149,14 +148,20 @@ function astroContentVirtualModPlugin({
|
|
|
149
148
|
if (id === MODULES_MJS_ID) {
|
|
150
149
|
const modules = new URL(MODULES_IMPORTS_FILE, settings.dotAstroDir);
|
|
151
150
|
if (fs.existsSync(modules)) {
|
|
152
|
-
return
|
|
151
|
+
return {
|
|
152
|
+
id: fileURLToPath(modules),
|
|
153
|
+
meta: createContentDataIncrementalMetadata()
|
|
154
|
+
};
|
|
153
155
|
}
|
|
154
156
|
return MODULES_MJS_VIRTUAL_ID;
|
|
155
157
|
}
|
|
156
158
|
if (id === ASSET_IMPORTS_VIRTUAL_ID) {
|
|
157
159
|
const assetImportsFile = new URL(ASSET_IMPORTS_FILE, settings.dotAstroDir);
|
|
158
160
|
if (fs.existsSync(assetImportsFile)) {
|
|
159
|
-
return
|
|
161
|
+
return {
|
|
162
|
+
id: fileURLToPath(assetImportsFile),
|
|
163
|
+
meta: createContentDataIncrementalMetadata()
|
|
164
|
+
};
|
|
160
165
|
}
|
|
161
166
|
return ASSET_IMPORTS_RESOLVED_STUB_ID;
|
|
162
167
|
}
|
|
@@ -208,7 +213,10 @@ function astroContentVirtualModPlugin({
|
|
|
208
213
|
}
|
|
209
214
|
if (id === RESOLVED_DATA_STORE_VIRTUAL_ID) {
|
|
210
215
|
if (!fs.existsSync(dataStoreFile)) {
|
|
211
|
-
return {
|
|
216
|
+
return {
|
|
217
|
+
code: "export default new Map()",
|
|
218
|
+
meta: createContentDataIncrementalMetadata()
|
|
219
|
+
};
|
|
212
220
|
}
|
|
213
221
|
const jsonData = await fs.promises.readFile(dataStoreFile, "utf-8");
|
|
214
222
|
if (getDataStoreChunkSize(settings) !== void 0) {
|
|
@@ -219,36 +227,40 @@ function astroContentVirtualModPlugin({
|
|
|
219
227
|
([collection, parts]) => `${JSON.stringify(collection)}:[${parts.map(chunkImport).join(",")}]`
|
|
220
228
|
);
|
|
221
229
|
const code = `export default{${entries.join(",")}}`;
|
|
222
|
-
return {
|
|
230
|
+
return {
|
|
231
|
+
code,
|
|
232
|
+
map: { mappings: "" },
|
|
233
|
+
meta: createContentDataIncrementalMetadata()
|
|
234
|
+
};
|
|
223
235
|
} catch (err) {
|
|
224
236
|
const message = "Could not parse data store manifest JSON file";
|
|
225
237
|
this.error({ message, id, cause: err });
|
|
226
238
|
}
|
|
227
239
|
}
|
|
228
240
|
try {
|
|
229
|
-
|
|
230
|
-
const useRuntimeJsonParse = isDev && Buffer.byteLength(jsonData) > LARGE_DATA_STORE_THRESHOLD;
|
|
231
|
-
return {
|
|
232
|
-
code: useRuntimeJsonParse ? `export default JSON.parse(${JSON.stringify(jsonData)})` : dataToEsm(parsed, {
|
|
233
|
-
compact: true
|
|
234
|
-
}),
|
|
235
|
-
map: { mappings: "" }
|
|
236
|
-
};
|
|
241
|
+
JSON.parse(jsonData);
|
|
237
242
|
} catch (err) {
|
|
238
243
|
const message = "Could not parse JSON file";
|
|
239
244
|
this.error({ message, id, cause: err });
|
|
240
245
|
}
|
|
246
|
+
return {
|
|
247
|
+
code: `export default JSON.parse(${JSON.stringify(jsonData)})`,
|
|
248
|
+
map: { mappings: "" },
|
|
249
|
+
meta: createContentDataIncrementalMetadata()
|
|
250
|
+
};
|
|
241
251
|
}
|
|
242
252
|
if (id === ASSET_IMPORTS_RESOLVED_STUB_ID) {
|
|
243
253
|
const assetImportsFile = new URL(ASSET_IMPORTS_FILE, settings.dotAstroDir);
|
|
244
254
|
return {
|
|
245
|
-
code: fs.existsSync(assetImportsFile) ? fs.readFileSync(assetImportsFile, "utf-8") : "export default new Map()"
|
|
255
|
+
code: fs.existsSync(assetImportsFile) ? fs.readFileSync(assetImportsFile, "utf-8") : "export default new Map()",
|
|
256
|
+
meta: createContentDataIncrementalMetadata()
|
|
246
257
|
};
|
|
247
258
|
}
|
|
248
259
|
if (id === MODULES_MJS_VIRTUAL_ID) {
|
|
249
260
|
const modules = new URL(MODULES_IMPORTS_FILE, settings.dotAstroDir);
|
|
250
261
|
return {
|
|
251
|
-
code: fs.existsSync(modules) ? fs.readFileSync(modules, "utf-8") : "export default new Map()"
|
|
262
|
+
code: fs.existsSync(modules) ? fs.readFileSync(modules, "utf-8") : "export default new Map()",
|
|
263
|
+
meta: createContentDataIncrementalMetadata()
|
|
252
264
|
};
|
|
253
265
|
}
|
|
254
266
|
}
|
|
@@ -5,3 +5,5 @@ export { fromRoutingStrategy, toRoutingStrategy } from '../common.js';
|
|
|
5
5
|
export { createConsoleLogger } from '../../logger/impls/console.js';
|
|
6
6
|
export { deserializeManifest, deserializeRouteData, deserializeRouteInfo, serializeRouteData, serializeRouteInfo, } from '../manifest.js';
|
|
7
7
|
export { AppPipeline } from '../pipeline.js';
|
|
8
|
+
export { beginContentEntryCollection, endContentEntryCollection, } from '../../build/incremental-content-collector.js';
|
|
9
|
+
export { beginImageCollection, endImageCollection, recordStaticImage, } from '../../build/incremental-image-collector.js';
|
|
@@ -12,15 +12,29 @@ import {
|
|
|
12
12
|
serializeRouteInfo
|
|
13
13
|
} from "../manifest.js";
|
|
14
14
|
import { AppPipeline } from "../pipeline.js";
|
|
15
|
+
import {
|
|
16
|
+
beginContentEntryCollection,
|
|
17
|
+
endContentEntryCollection
|
|
18
|
+
} from "../../build/incremental-content-collector.js";
|
|
19
|
+
import {
|
|
20
|
+
beginImageCollection,
|
|
21
|
+
endImageCollection,
|
|
22
|
+
recordStaticImage
|
|
23
|
+
} from "../../build/incremental-image-collector.js";
|
|
15
24
|
export {
|
|
16
25
|
App,
|
|
17
26
|
AppPipeline,
|
|
18
27
|
BaseApp,
|
|
28
|
+
beginContentEntryCollection,
|
|
29
|
+
beginImageCollection,
|
|
19
30
|
createConsoleLogger,
|
|
20
31
|
deserializeManifest,
|
|
21
32
|
deserializeRouteData,
|
|
22
33
|
deserializeRouteInfo,
|
|
34
|
+
endContentEntryCollection,
|
|
35
|
+
endImageCollection,
|
|
23
36
|
fromRoutingStrategy,
|
|
37
|
+
recordStaticImage,
|
|
24
38
|
serializeRouteData,
|
|
25
39
|
serializeRouteInfo,
|
|
26
40
|
toRoutingStrategy
|
package/dist/core/app/types.d.ts
CHANGED
|
@@ -193,6 +193,8 @@ export type SSRManifestCSP = {
|
|
|
193
193
|
resources: CspResourceEntry[];
|
|
194
194
|
hashes: CspHashEntry[];
|
|
195
195
|
};
|
|
196
|
+
/** Static speculation rules JSON to inject in the head when CSP + clientPrerender are both enabled. */
|
|
197
|
+
speculationRulesContent?: string;
|
|
196
198
|
};
|
|
197
199
|
export interface SSRManifestSession extends BaseSessionConfig {
|
|
198
200
|
driver: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AstroConfig } from '../../../types/public/config.js';
|
|
2
|
+
export { getConfigHashInput } from './input.js';
|
|
3
|
+
/**
|
|
4
|
+
* Produce a sha256 over the output-affecting subset of the resolved config (see
|
|
5
|
+
* {@link getConfigHashInput}). A mismatch invalidates the whole incremental
|
|
6
|
+
* build cache.
|
|
7
|
+
*/
|
|
8
|
+
export declare function computeConfigHash(config: AstroConfig): Promise<string>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { encodeHexLowerCase } from "@oslojs/encoding";
|
|
2
|
+
import { getConfigHashInput } from "./input.js";
|
|
3
|
+
import { getConfigHashInput as getConfigHashInput2 } from "./input.js";
|
|
4
|
+
function stableStringify(value) {
|
|
5
|
+
return JSON.stringify(value, (_key, val) => {
|
|
6
|
+
if (val && typeof val === "object" && !Array.isArray(val)) {
|
|
7
|
+
return Object.keys(val).sort().reduce((acc, key) => {
|
|
8
|
+
acc[key] = val[key];
|
|
9
|
+
return acc;
|
|
10
|
+
}, {});
|
|
11
|
+
}
|
|
12
|
+
return val;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
async function computeConfigHash(config) {
|
|
16
|
+
const input = stableStringify(getConfigHashInput(config));
|
|
17
|
+
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(input));
|
|
18
|
+
return encodeHexLowerCase(new Uint8Array(digest));
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
computeConfigHash,
|
|
22
|
+
getConfigHashInput2 as getConfigHashInput
|
|
23
|
+
};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import type { AstroConfig } from '../../../types/public/config.js';
|
|
2
|
+
/**
|
|
3
|
+
* Projection of {@link AstroConfig} limited to values that can change the bytes
|
|
4
|
+
* or paths of a prerendered page. A change to any of these must invalidate the
|
|
5
|
+
* incremental build cache: the per-route dependency hash only sees module
|
|
6
|
+
* *source*, so it misses config baked into compiled output by the compiler
|
|
7
|
+
* (`compressHTML`, `site`, `scopedStyleStrategy`), inlined via Vite `define`
|
|
8
|
+
* (`base`, `build.assetsPrefix`), or serialized into virtual modules (`image`,
|
|
9
|
+
* `env.schema`, `i18n`).
|
|
10
|
+
*
|
|
11
|
+
* Only serializable values are included. Function-valued config (integrations,
|
|
12
|
+
* vite/remark/rehype plugins, image services) is omitted because it cannot be
|
|
13
|
+
* serialized. `outDir`/`publicDir` are omitted too, since they move where files
|
|
14
|
+
* are written without changing a page's bytes.
|
|
15
|
+
*
|
|
16
|
+
* The whole `vite` config cannot be hashed: it carries plugins and other
|
|
17
|
+
* function-valued, per-run state that churns between builds and would sink the
|
|
18
|
+
* cache hit rate. Instead a curated allowlist of serializable Vite options that
|
|
19
|
+
* change emitted bytes or asset paths is included (e.g. `build.assetsInlineLimit`
|
|
20
|
+
* flips an asset between an inlined data URI and a separate hashed file). This
|
|
21
|
+
* allowlist is best-effort, so an obscure output-affecting Vite option outside
|
|
22
|
+
* it will not invalidate the cache; `--force` is the escape hatch.
|
|
23
|
+
*
|
|
24
|
+
* The set of fields is asserted against the full config schema in
|
|
25
|
+
* `test/units/build/config-hash.test.ts`, which fails when a new top-level
|
|
26
|
+
* config key appears so it gets classified here or explicitly excluded.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getConfigHashInput(config: AstroConfig): {
|
|
29
|
+
site: string | undefined;
|
|
30
|
+
base: string;
|
|
31
|
+
trailingSlash: "never" | "ignore" | "always";
|
|
32
|
+
output: "server" | "static";
|
|
33
|
+
compressHTML: boolean | "jsx";
|
|
34
|
+
scopedStyleStrategy: "where" | "class" | "attribute";
|
|
35
|
+
build: {
|
|
36
|
+
format: "file" | "directory" | "preserve";
|
|
37
|
+
assets: string;
|
|
38
|
+
assetsPrefix: string | ({
|
|
39
|
+
fallback: string;
|
|
40
|
+
} & Record<string, string>) | undefined;
|
|
41
|
+
inlineStylesheets: "never" | "always" | "auto";
|
|
42
|
+
redirects: boolean;
|
|
43
|
+
};
|
|
44
|
+
redirects: Record<string, string | {
|
|
45
|
+
status: 301 | 302 | 303 | 307 | 308 | 300 | 304;
|
|
46
|
+
destination: string;
|
|
47
|
+
}>;
|
|
48
|
+
i18n: {
|
|
49
|
+
defaultLocale: string;
|
|
50
|
+
locales: (string | {
|
|
51
|
+
path: string;
|
|
52
|
+
codes: [string, ...string[]];
|
|
53
|
+
})[];
|
|
54
|
+
routing: "manual" | {
|
|
55
|
+
prefixDefaultLocale: boolean;
|
|
56
|
+
redirectToDefaultLocale: boolean;
|
|
57
|
+
fallbackType: "redirect" | "rewrite";
|
|
58
|
+
};
|
|
59
|
+
domains?: Record<string, string> | undefined;
|
|
60
|
+
fallback?: Record<string, string> | undefined;
|
|
61
|
+
} | undefined;
|
|
62
|
+
image: {
|
|
63
|
+
endpoint: {
|
|
64
|
+
route: string;
|
|
65
|
+
entrypoint?: string | undefined;
|
|
66
|
+
};
|
|
67
|
+
service: {
|
|
68
|
+
entrypoint: string;
|
|
69
|
+
config: Record<string, any>;
|
|
70
|
+
};
|
|
71
|
+
dangerouslyProcessSVG: boolean;
|
|
72
|
+
domains: string[];
|
|
73
|
+
remotePatterns: {
|
|
74
|
+
protocol?: string | undefined;
|
|
75
|
+
hostname?: string | undefined;
|
|
76
|
+
port?: string | undefined;
|
|
77
|
+
pathname?: string | undefined;
|
|
78
|
+
}[];
|
|
79
|
+
responsiveStyles: boolean;
|
|
80
|
+
layout?: "fixed" | "constrained" | "full-width" | "none" | undefined;
|
|
81
|
+
objectFit?: string | undefined;
|
|
82
|
+
objectPosition?: string | undefined;
|
|
83
|
+
breakpoints?: number[] | undefined;
|
|
84
|
+
};
|
|
85
|
+
markdown: {
|
|
86
|
+
syntaxHighlight: false | "shiki" | "prism" | {
|
|
87
|
+
type: "shiki" | "prism";
|
|
88
|
+
excludeLangs?: string[] | undefined;
|
|
89
|
+
};
|
|
90
|
+
shikiConfig: {
|
|
91
|
+
langs: (import("shiki").LanguageRegistration & import("../../config/schemas/base.js").ComplexifyUnionObj)[];
|
|
92
|
+
langAlias: Record<string, string>;
|
|
93
|
+
theme: "andromeeda" | "aurora-x" | "ayu-dark" | "ayu-light" | "ayu-mirage" | "catppuccin-frappe" | "catppuccin-latte" | "catppuccin-macchiato" | "catppuccin-mocha" | "dark-plus" | "dracula" | "dracula-soft" | "everforest-dark" | "everforest-light" | "github-dark" | "github-dark-default" | "github-dark-dimmed" | "github-dark-high-contrast" | "github-light" | "github-light-default" | "github-light-high-contrast" | "gruvbox-dark-hard" | "gruvbox-dark-medium" | "gruvbox-dark-soft" | "gruvbox-light-hard" | "gruvbox-light-medium" | "gruvbox-light-soft" | "horizon" | "horizon-bright" | "houston" | "kanagawa-dragon" | "kanagawa-lotus" | "kanagawa-wave" | "laserwave" | "light-plus" | "material-theme" | "material-theme-darker" | "material-theme-lighter" | "material-theme-ocean" | "material-theme-palenight" | "min-dark" | "min-light" | "monokai" | "night-owl" | "night-owl-light" | "nord" | "one-dark-pro" | "one-light" | "plastic" | "poimandres" | "red" | "rose-pine" | "rose-pine-dawn" | "rose-pine-moon" | "slack-dark" | "slack-ochin" | "snazzy-light" | "solarized-dark" | "solarized-light" | "synthwave-84" | "tokyo-night" | "vesper" | "vitesse-black" | "vitesse-dark" | "vitesse-light" | (NonNullable<(import("shiki").BundledTheme | "css-variables") | import("shiki").ThemeRegistration | import("shiki").ThemeRegistrationRaw | undefined> & import("../../config/schemas/base.js").ComplexifyUnionObj);
|
|
94
|
+
themes: Record<string, "andromeeda" | "aurora-x" | "ayu-dark" | "ayu-light" | "ayu-mirage" | "catppuccin-frappe" | "catppuccin-latte" | "catppuccin-macchiato" | "catppuccin-mocha" | "dark-plus" | "dracula" | "dracula-soft" | "everforest-dark" | "everforest-light" | "github-dark" | "github-dark-default" | "github-dark-dimmed" | "github-dark-high-contrast" | "github-light" | "github-light-default" | "github-light-high-contrast" | "gruvbox-dark-hard" | "gruvbox-dark-medium" | "gruvbox-dark-soft" | "gruvbox-light-hard" | "gruvbox-light-medium" | "gruvbox-light-soft" | "horizon" | "horizon-bright" | "houston" | "kanagawa-dragon" | "kanagawa-lotus" | "kanagawa-wave" | "laserwave" | "light-plus" | "material-theme" | "material-theme-darker" | "material-theme-lighter" | "material-theme-ocean" | "material-theme-palenight" | "min-dark" | "min-light" | "monokai" | "night-owl" | "night-owl-light" | "nord" | "one-dark-pro" | "one-light" | "plastic" | "poimandres" | "red" | "rose-pine" | "rose-pine-dawn" | "rose-pine-moon" | "slack-dark" | "slack-ochin" | "snazzy-light" | "solarized-dark" | "solarized-light" | "synthwave-84" | "tokyo-night" | "vesper" | "vitesse-black" | "vitesse-dark" | "vitesse-light" | (NonNullable<(import("shiki").BundledTheme | "css-variables") | import("shiki").ThemeRegistration | import("shiki").ThemeRegistrationRaw | undefined> & import("../../config/schemas/base.js").ComplexifyUnionObj)>;
|
|
95
|
+
wrap: boolean | null;
|
|
96
|
+
transformers: (import("shiki").ShikiTransformer & import("../../config/schemas/base.js").ComplexifyUnionObj)[];
|
|
97
|
+
defaultColor?: string | false | undefined;
|
|
98
|
+
};
|
|
99
|
+
remarkPlugins: (string | [string, any] | (import("@astrojs/markdown-remark").RemarkPlugin & import("../../config/schemas/base.js").ComplexifyUnionObj) | [import("@astrojs/markdown-remark").RemarkPlugin & import("../../config/schemas/base.js").ComplexifyUnionObj, any])[];
|
|
100
|
+
rehypePlugins: (string | [string, any] | (import("@astrojs/markdown-remark").RehypePlugin & import("../../config/schemas/base.js").ComplexifyUnionObj) | [import("@astrojs/markdown-remark").RehypePlugin & import("../../config/schemas/base.js").ComplexifyUnionObj, any])[];
|
|
101
|
+
remarkRehype: import("../../config/schemas/base.js").RemarkRehype;
|
|
102
|
+
processor: {
|
|
103
|
+
name: string;
|
|
104
|
+
options: object;
|
|
105
|
+
createRenderer: (shared: import("@astrojs/markdown-remark").AstroMarkdownOptions) => Promise<import("@astrojs/markdown-remark").MarkdownRenderer>;
|
|
106
|
+
createMdxRenderer?: ((shared: import("@astrojs/markdown-remark").AstroMarkdownOptions, mdx: import("@astrojs/internal-helpers/markdown").MdxRendererOptions) => Promise<import("@astrojs/internal-helpers/markdown").MdxRenderer>) | undefined;
|
|
107
|
+
};
|
|
108
|
+
gfm?: boolean | undefined;
|
|
109
|
+
smartypants?: false | import("../../config/schemas/base.js").Smartypants | undefined;
|
|
110
|
+
};
|
|
111
|
+
env: {
|
|
112
|
+
schema: Record<string, ({
|
|
113
|
+
context: "client";
|
|
114
|
+
access: "public";
|
|
115
|
+
} | {
|
|
116
|
+
context: "server";
|
|
117
|
+
access: "public";
|
|
118
|
+
} | {
|
|
119
|
+
context: "server";
|
|
120
|
+
access: "secret";
|
|
121
|
+
}) & ({
|
|
122
|
+
type: "enum";
|
|
123
|
+
values: string[];
|
|
124
|
+
optional?: boolean | undefined;
|
|
125
|
+
default?: string | undefined;
|
|
126
|
+
} | {
|
|
127
|
+
type: "string";
|
|
128
|
+
optional?: boolean | undefined;
|
|
129
|
+
default?: string | undefined;
|
|
130
|
+
max?: number | undefined;
|
|
131
|
+
min?: number | undefined;
|
|
132
|
+
length?: number | undefined;
|
|
133
|
+
url?: boolean | undefined;
|
|
134
|
+
includes?: string | undefined;
|
|
135
|
+
startsWith?: string | undefined;
|
|
136
|
+
endsWith?: string | undefined;
|
|
137
|
+
} | {
|
|
138
|
+
type: "number";
|
|
139
|
+
optional?: boolean | undefined;
|
|
140
|
+
default?: number | undefined;
|
|
141
|
+
gt?: number | undefined;
|
|
142
|
+
min?: number | undefined;
|
|
143
|
+
lt?: number | undefined;
|
|
144
|
+
max?: number | undefined;
|
|
145
|
+
int?: boolean | undefined;
|
|
146
|
+
} | {
|
|
147
|
+
type: "boolean";
|
|
148
|
+
optional?: boolean | undefined;
|
|
149
|
+
default?: boolean | undefined;
|
|
150
|
+
})>;
|
|
151
|
+
};
|
|
152
|
+
security: {
|
|
153
|
+
csp: boolean | {
|
|
154
|
+
algorithm: "SHA-256" | "SHA-384" | "SHA-512";
|
|
155
|
+
directives?: (`base-uri${string}` | `child-src${string}` | `connect-src${string}` | `default-src${string}` | `fenced-frame-src${string}` | `font-src${string}` | `form-action${string}` | `frame-ancestors${string}` | `frame-src${string}` | `img-src${string}` | `manifest-src${string}` | `media-src${string}` | `object-src${string}` | `referrer${string}` | `report-to${string}` | `report-uri${string}` | `require-trusted-types-for${string}` | `sandbox${string}` | `trusted-types${string}` | `upgrade-insecure-requests${string}` | `worker-src${string}`)[] | undefined;
|
|
156
|
+
styleDirective?: {
|
|
157
|
+
resources?: (string | {
|
|
158
|
+
resource: string;
|
|
159
|
+
kind: "default" | "attribute" | "element";
|
|
160
|
+
})[] | undefined;
|
|
161
|
+
hashes?: (`sha256-${string}` | `sha384-${string}` | `sha512-${string}` | {
|
|
162
|
+
hash: `sha256-${string}` | `sha384-${string}` | `sha512-${string}`;
|
|
163
|
+
kind: "default" | "attribute" | "element";
|
|
164
|
+
})[] | undefined;
|
|
165
|
+
} | undefined;
|
|
166
|
+
scriptDirective?: {
|
|
167
|
+
resources?: (string | {
|
|
168
|
+
resource: string;
|
|
169
|
+
kind: "default" | "attribute" | "element";
|
|
170
|
+
})[] | undefined;
|
|
171
|
+
hashes?: (`sha256-${string}` | `sha384-${string}` | `sha512-${string}` | {
|
|
172
|
+
hash: `sha256-${string}` | `sha384-${string}` | `sha512-${string}`;
|
|
173
|
+
kind: "default" | "attribute" | "element";
|
|
174
|
+
})[] | undefined;
|
|
175
|
+
strictDynamic?: boolean | undefined;
|
|
176
|
+
} | undefined;
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
prefetch: boolean | {
|
|
180
|
+
prefetchAll?: boolean | undefined;
|
|
181
|
+
defaultStrategy?: "tap" | "hover" | "viewport" | "load" | undefined;
|
|
182
|
+
} | undefined;
|
|
183
|
+
vite: {
|
|
184
|
+
build: {
|
|
185
|
+
assetsInlineLimit: number | ((filePath: string, content: Buffer) => boolean | undefined) | undefined;
|
|
186
|
+
minify: boolean | "esbuild" | "oxc" | "terser" | undefined;
|
|
187
|
+
cssMinify: boolean | "esbuild" | "lightningcss" | undefined;
|
|
188
|
+
cssTarget: false | import("vite/types/internal/esbuildOptions.js").EsbuildTarget | undefined;
|
|
189
|
+
target: false | import("vite/types/internal/esbuildOptions.js").EsbuildTarget | undefined;
|
|
190
|
+
};
|
|
191
|
+
css: import("vite").CSSOptions | undefined;
|
|
192
|
+
json: import("vite").JsonOptions | undefined;
|
|
193
|
+
define: Record<string, any> | undefined;
|
|
194
|
+
oxc: false | import("vite").OxcOptions | undefined;
|
|
195
|
+
};
|
|
196
|
+
experimental: {
|
|
197
|
+
clientPrerender: boolean;
|
|
198
|
+
};
|
|
199
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
function getConfigHashInput(config) {
|
|
2
|
+
return {
|
|
3
|
+
site: config.site,
|
|
4
|
+
base: config.base,
|
|
5
|
+
trailingSlash: config.trailingSlash,
|
|
6
|
+
output: config.output,
|
|
7
|
+
compressHTML: config.compressHTML,
|
|
8
|
+
scopedStyleStrategy: config.scopedStyleStrategy,
|
|
9
|
+
build: {
|
|
10
|
+
format: config.build.format,
|
|
11
|
+
assets: config.build.assets,
|
|
12
|
+
assetsPrefix: config.build.assetsPrefix,
|
|
13
|
+
inlineStylesheets: config.build.inlineStylesheets,
|
|
14
|
+
redirects: config.build.redirects
|
|
15
|
+
},
|
|
16
|
+
redirects: config.redirects,
|
|
17
|
+
i18n: config.i18n,
|
|
18
|
+
image: config.image,
|
|
19
|
+
markdown: config.markdown,
|
|
20
|
+
env: { schema: config.env?.schema },
|
|
21
|
+
security: { csp: config.security?.csp },
|
|
22
|
+
prefetch: config.prefetch,
|
|
23
|
+
vite: {
|
|
24
|
+
build: {
|
|
25
|
+
assetsInlineLimit: config.vite.build?.assetsInlineLimit,
|
|
26
|
+
minify: config.vite.build?.minify,
|
|
27
|
+
cssMinify: config.vite.build?.cssMinify,
|
|
28
|
+
cssTarget: config.vite.build?.cssTarget,
|
|
29
|
+
target: config.vite.build?.target
|
|
30
|
+
},
|
|
31
|
+
css: config.vite.css,
|
|
32
|
+
json: config.vite.json,
|
|
33
|
+
define: config.vite.define,
|
|
34
|
+
oxc: config.vite.oxc
|
|
35
|
+
},
|
|
36
|
+
experimental: {
|
|
37
|
+
clientPrerender: config.experimental.clientPrerender
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
getConfigHashInput
|
|
43
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AstroLogger } from '../logger/core.js';
|
|
2
|
-
import type { AstroPrerenderer, RouteToHeaders } from '../../types/public/index.js';
|
|
2
|
+
import type { AstroPrerenderer, PrerenderResult, RouteToHeaders } from '../../types/public/index.js';
|
|
3
3
|
import type { RouteData } from '../../types/public/internal.js';
|
|
4
4
|
import { type BuildInternals } from './internal.js';
|
|
5
5
|
import type { StaticBuildOptions } from './types.js';
|
|
@@ -13,6 +13,8 @@ export interface RenderPathResult {
|
|
|
13
13
|
body: string | Uint8Array;
|
|
14
14
|
outFile: URL;
|
|
15
15
|
outFolder: URL;
|
|
16
|
+
/** Incremental-build metadata the prerenderer reported for this page, if any. */
|
|
17
|
+
metadata?: PrerenderResult['metadata'];
|
|
16
18
|
}
|
|
17
19
|
interface RenderToPathPayload {
|
|
18
20
|
prerenderer: AstroPrerenderer;
|