astro 5.7.4 → 5.7.5
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/fonts/config.d.ts +0 -16
- package/dist/assets/fonts/config.js +1 -2
- package/dist/assets/fonts/providers/index.d.ts +1 -1
- package/dist/assets/fonts/providers/index.js +3 -2
- package/dist/assets/fonts/utils.d.ts +0 -1
- package/dist/assets/fonts/utils.js +0 -1
- package/dist/assets/fonts/vite-plugin-fonts.js +11 -8
- package/dist/assets/services/service.d.ts +1 -1
- package/dist/assets/utils/etag.d.ts +0 -11
- package/dist/assets/utils/etag.js +1 -2
- package/dist/assets/utils/vendor/image-size/lookup.d.ts +0 -2
- package/dist/assets/utils/vendor/image-size/lookup.js +0 -10
- package/dist/cli/add/index.d.ts +0 -9
- package/dist/cli/add/index.js +1 -2
- package/dist/cli/info/index.d.ts +0 -1
- package/dist/cli/info/index.js +0 -1
- package/dist/cli/preferences/index.d.ts +0 -2
- package/dist/container/index.js +1 -6
- package/dist/content/content-layer.d.ts +2 -7
- package/dist/content/content-layer.js +4 -6
- package/dist/content/index.d.ts +1 -2
- package/dist/content/index.js +1 -5
- package/dist/content/loaders/file.d.ts +2 -1
- package/dist/content/loaders/glob.d.ts +3 -2
- package/dist/content/utils.d.ts +1 -12
- package/dist/content/utils.js +0 -13
- package/dist/content/vite-plugin-content-virtual-mod.d.ts +0 -16
- package/dist/content/vite-plugin-content-virtual-mod.js +1 -3
- package/dist/core/app/index.js +3 -4
- package/dist/core/app/pipeline.d.ts +2 -3
- package/dist/core/app/pipeline.js +1 -3
- package/dist/core/app/types.d.ts +3 -2
- package/dist/core/build/consts.d.ts +0 -1
- package/dist/core/build/consts.js +1 -3
- package/dist/core/build/index.d.ts +2 -1
- package/dist/core/build/page-data.d.ts +3 -2
- package/dist/core/build/plugin.d.ts +1 -1
- package/dist/core/build/plugins/plugin-analyzer.d.ts +0 -2
- package/dist/core/build/plugins/plugin-analyzer.js +1 -2
- package/dist/core/build/plugins/plugin-chunks.d.ts +0 -2
- package/dist/core/build/plugins/plugin-chunks.js +1 -2
- package/dist/core/build/plugins/plugin-component-entry.d.ts +0 -8
- package/dist/core/build/plugins/plugin-component-entry.js +1 -3
- package/dist/core/build/plugins/plugin-internals.d.ts +0 -2
- package/dist/core/build/plugins/plugin-internals.js +1 -2
- package/dist/core/build/plugins/plugin-renderers.d.ts +0 -2
- package/dist/core/build/plugins/plugin-renderers.js +1 -2
- package/dist/core/build/plugins/plugin-scripts.d.ts +0 -5
- package/dist/core/build/plugins/plugin-scripts.js +1 -2
- package/dist/core/build/plugins/plugin-ssr.d.ts +0 -1
- package/dist/core/build/plugins/plugin-ssr.js +0 -1
- package/dist/core/build/plugins/util.d.ts +0 -9
- package/dist/core/build/plugins/util.js +0 -2
- package/dist/core/build/types.d.ts +1 -1
- package/dist/core/config/config.d.ts +0 -1
- package/dist/core/config/config.js +0 -1
- package/dist/core/config/index.d.ts +1 -2
- package/dist/core/config/index.js +0 -2
- package/dist/core/config/schemas/base.d.ts +6 -4
- package/dist/core/config/schemas/relative.d.ts +6 -6
- package/dist/core/config/timer.d.ts +0 -5
- package/dist/core/config/tsconfig.d.ts +1 -1
- package/dist/core/constants.d.ts +0 -4
- package/dist/core/constants.js +1 -3
- package/dist/core/cookies/index.d.ts +1 -1
- package/dist/core/cookies/index.js +2 -4
- package/dist/core/cookies/response.d.ts +0 -1
- package/dist/core/cookies/response.js +1 -5
- package/dist/core/dev/container.d.ts +2 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/dev/index.d.ts +1 -1
- package/dist/core/dev/index.js +1 -2
- package/dist/core/dev/restart.d.ts +1 -1
- package/dist/core/encryption.d.ts +0 -8
- package/dist/core/encryption.js +1 -7
- package/dist/core/errors/index.d.ts +1 -2
- package/dist/core/errors/index.js +0 -2
- package/dist/core/logger/core.d.ts +3 -9
- package/dist/core/logger/core.js +1 -5
- package/dist/core/messages.d.ts +0 -1
- package/dist/core/messages.js +2 -11
- package/dist/core/middleware/sequence.js +3 -0
- package/dist/core/preview/static-preview-server.d.ts +2 -1
- package/dist/core/redirects/index.d.ts +0 -1
- package/dist/core/redirects/index.js +0 -2
- package/dist/core/render/index.d.ts +0 -17
- package/dist/core/render/ssr-element.d.ts +0 -2
- package/dist/core/render/ssr-element.js +0 -2
- package/dist/core/render-context.js +4 -0
- package/dist/core/request.d.ts +1 -1
- package/dist/core/routing/3xx.d.ts +2 -1
- package/dist/core/routing/astro-designed-error-pages.d.ts +0 -1
- package/dist/core/routing/astro-designed-error-pages.js +1 -16
- package/dist/core/routing/index.d.ts +2 -3
- package/dist/core/routing/index.js +3 -8
- package/dist/core/routing/manifest/create.d.ts +2 -3
- package/dist/core/routing/manifest/create.js +0 -1
- package/dist/core/routing/request.d.ts +0 -1
- package/dist/core/routing/request.js +1 -2
- package/dist/core/routing/rewrite.d.ts +3 -2
- package/dist/core/server-islands/vite-plugin-server-islands.d.ts +0 -1
- package/dist/core/server-islands/vite-plugin-server-islands.js +0 -1
- package/dist/core/sync/index.d.ts +2 -1
- package/dist/core/util.d.ts +0 -1
- package/dist/core/util.js +0 -1
- package/dist/events/session.d.ts +1 -1
- package/dist/integrations/features-validation.d.ts +1 -3
- package/dist/integrations/features-validation.js +0 -2
- package/dist/preferences/index.d.ts +4 -4
- package/dist/type-utils.d.ts +0 -4
- package/dist/types/public/config.d.ts +19 -0
- package/dist/types/typed-emitter.d.ts +2 -1
- package/dist/vite-plugin-astro/hmr.d.ts +2 -1
- package/dist/vite-plugin-astro/query.d.ts +3 -2
- package/dist/vite-plugin-astro/types.d.ts +2 -1
- package/dist/vite-plugin-astro-server/controller.d.ts +2 -2
- package/dist/vite-plugin-astro-server/plugin.d.ts +2 -1
- package/dist/vite-plugin-astro-server/response.d.ts +0 -1
- package/dist/vite-plugin-astro-server/response.js +0 -12
- package/dist/vite-plugin-astro-server/route.d.ts +1 -1
- package/dist/vite-plugin-astro-server/server-state.d.ts +3 -3
- package/dist/vite-plugin-astro-server/server-state.js +0 -4
- package/dist/vite-plugin-load-fallback/index.d.ts +1 -1
- package/dist/vite-plugin-scanner/index.d.ts +2 -1
- package/package.json +5 -11
- package/templates/env.mjs +1 -0
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const requiredFamilyAttributesSchema: z.ZodObject<{
|
|
3
|
-
/**
|
|
4
|
-
* The font family name, as identified by your font provider.
|
|
5
|
-
*/
|
|
6
|
-
name: z.ZodString;
|
|
7
|
-
/**
|
|
8
|
-
* A valid [ident](https://developer.mozilla.org/en-US/docs/Web/CSS/ident) in the form of a CSS variable (i.e. starting with `--`).
|
|
9
|
-
*/
|
|
10
|
-
cssVariable: z.ZodString;
|
|
11
|
-
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
name: string;
|
|
13
|
-
cssVariable: string;
|
|
14
|
-
}, {
|
|
15
|
-
name: string;
|
|
16
|
-
cssVariable: string;
|
|
17
|
-
}>;
|
|
18
2
|
export declare const fontProviderSchema: z.ZodObject<{
|
|
19
3
|
/**
|
|
20
4
|
* URL, path relative to the root or package import.
|
|
@@ -21,7 +21,7 @@ declare function fontsource(): {
|
|
|
21
21
|
config?: Record<string, any> | undefined;
|
|
22
22
|
};
|
|
23
23
|
/** [Google](https://fonts.google.com/) */
|
|
24
|
-
declare function google(): {
|
|
24
|
+
declare function google(config?: Parameters<typeof providers.google>[0]): {
|
|
25
25
|
entrypoint: string | URL;
|
|
26
26
|
config?: Record<string, any> | undefined;
|
|
27
27
|
};
|
|
@@ -19,9 +19,10 @@ function fontsource() {
|
|
|
19
19
|
entrypoint: "astro/assets/fonts/providers/fontsource"
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
function google() {
|
|
22
|
+
function google(config) {
|
|
23
23
|
return defineAstroFontProvider({
|
|
24
|
-
entrypoint: "astro/assets/fonts/providers/google"
|
|
24
|
+
entrypoint: "astro/assets/fonts/providers/google",
|
|
25
|
+
config
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
const fontProviders = {
|
|
@@ -6,7 +6,6 @@ import { type ResolveProviderOptions } from './providers/utils.js';
|
|
|
6
6
|
import type { FontFamily, FontType, ResolvedFontFamily } from './types.js';
|
|
7
7
|
export declare function toCSS(properties: Record<string, string | undefined>, indent?: number): string;
|
|
8
8
|
export declare function renderFontFace(properties: Record<string, string | undefined>): string;
|
|
9
|
-
export declare function unifontFontFaceDataToProperties(font: Partial<unifont.FontFaceData>): Record<string, string | undefined>;
|
|
10
9
|
export declare function generateFontFace(family: string, font: unifont.FontFaceData): string;
|
|
11
10
|
export declare function renderFontSrc(sources: Exclude<unifont.FontFaceData['src'][number], string>[]): string;
|
|
12
11
|
export declare function withoutQuotes(str: string): string;
|
|
@@ -49,14 +49,17 @@ function fontsPlugin({ settings, sync, logger }) {
|
|
|
49
49
|
if (!settings.config.experimental.fonts) {
|
|
50
50
|
return {
|
|
51
51
|
name: "astro:fonts:fallback",
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
resolveId(id) {
|
|
53
|
+
if (id === VIRTUAL_MODULE_ID) {
|
|
54
|
+
return RESOLVED_VIRTUAL_MODULE_ID;
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
load(id) {
|
|
58
|
+
if (id === RESOLVED_VIRTUAL_MODULE_ID) {
|
|
59
|
+
return {
|
|
60
|
+
code: ""
|
|
61
|
+
};
|
|
62
|
+
}
|
|
60
63
|
}
|
|
61
64
|
};
|
|
62
65
|
}
|
|
@@ -44,7 +44,7 @@ interface SharedServiceProps<T extends Record<string, any> = Record<string, any>
|
|
|
44
44
|
validateOptions?: (options: ImageTransform, imageConfig: ImageConfig<T>) => ImageTransform | Promise<ImageTransform>;
|
|
45
45
|
}
|
|
46
46
|
export type ExternalImageService<T extends Record<string, any> = Record<string, any>> = SharedServiceProps<T>;
|
|
47
|
-
|
|
47
|
+
type LocalImageTransform = {
|
|
48
48
|
src: string;
|
|
49
49
|
[key: string]: any;
|
|
50
50
|
};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FNV-1a Hash implementation
|
|
3
|
-
* @author Travis Webb (tjwebb) <me@traviswebb.com>
|
|
4
|
-
*
|
|
5
|
-
* Ported from https://github.com/tjwebb/fnv-plus/blob/master/index.js
|
|
6
|
-
* License https://github.com/tjwebb/fnv-plus#license
|
|
7
|
-
*
|
|
8
|
-
* Simplified, optimized and add modified for 52 bit, which provides a larger hash space
|
|
9
|
-
* and still making use of Javascript's 53-bit integer space.
|
|
10
|
-
*/
|
|
11
|
-
export declare const fnv1a52: (str: string) => number;
|
|
12
1
|
export declare const etag: (payload: string, weak?: boolean) => string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { imageType } from './types/index.js';
|
|
2
1
|
import type { ISizeCalculationResult } from './types/interface.ts';
|
|
3
2
|
/**
|
|
4
3
|
* Return size information based on an Uint8Array
|
|
@@ -7,4 +6,3 @@ import type { ISizeCalculationResult } from './types/interface.ts';
|
|
|
7
6
|
* @returns {ISizeCalculationResult}
|
|
8
7
|
*/
|
|
9
8
|
export declare function lookup(input: Uint8Array): ISizeCalculationResult;
|
|
10
|
-
export declare const disableTypes: (types: imageType[]) => void;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { typeHandlers } from "./types/index.js";
|
|
2
2
|
import { detector } from "./detector.js";
|
|
3
|
-
const globalOptions = {
|
|
4
|
-
disabledTypes: []
|
|
5
|
-
};
|
|
6
3
|
function lookup(input) {
|
|
7
4
|
const type = detector(input);
|
|
8
5
|
if (typeof type !== "undefined") {
|
|
9
|
-
if (globalOptions.disabledTypes.includes(type)) {
|
|
10
|
-
throw new TypeError("disabled file type: " + type);
|
|
11
|
-
}
|
|
12
6
|
const size = typeHandlers.get(type).calculate(input);
|
|
13
7
|
if (size !== void 0) {
|
|
14
8
|
size.type = size.type ?? type;
|
|
@@ -17,10 +11,6 @@ function lookup(input) {
|
|
|
17
11
|
}
|
|
18
12
|
throw new TypeError("unsupported file type: " + type);
|
|
19
13
|
}
|
|
20
|
-
const disableTypes = (types) => {
|
|
21
|
-
globalOptions.disabledTypes = types;
|
|
22
|
-
};
|
|
23
14
|
export {
|
|
24
|
-
disableTypes,
|
|
25
15
|
lookup
|
|
26
16
|
};
|
package/dist/cli/add/index.d.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import { type ProxifiedModule } from 'magicast';
|
|
2
1
|
import { type Flags } from '../flags.js';
|
|
3
2
|
interface AddOptions {
|
|
4
3
|
flags: Flags;
|
|
5
4
|
}
|
|
6
|
-
interface IntegrationInfo {
|
|
7
|
-
id: string;
|
|
8
|
-
packageName: string;
|
|
9
|
-
integrationName: string;
|
|
10
|
-
dependencies: [name: string, version: string][];
|
|
11
|
-
type: 'integration' | 'adapter';
|
|
12
|
-
}
|
|
13
5
|
export declare function add(names: string[], { flags }: AddOptions): Promise<void>;
|
|
14
|
-
export declare function setAdapter(mod: ProxifiedModule<any>, adapter: IntegrationInfo, exportName: string): void;
|
|
15
6
|
export {};
|
package/dist/cli/add/index.js
CHANGED
package/dist/cli/info/index.d.ts
CHANGED
|
@@ -8,6 +8,5 @@ export declare function getInfoOutput({ userConfig, print, }: {
|
|
|
8
8
|
print: boolean;
|
|
9
9
|
}): Promise<string>;
|
|
10
10
|
export declare function printInfo({ flags }: InfoOptions): Promise<void>;
|
|
11
|
-
export declare function copyToClipboard(text: string, force?: boolean): Promise<void>;
|
|
12
11
|
export declare function readFromClipboard(): string;
|
|
13
12
|
export {};
|
package/dist/cli/info/index.js
CHANGED
|
@@ -2,7 +2,5 @@ import { type Flags } from '../flags.js';
|
|
|
2
2
|
interface PreferencesOptions {
|
|
3
3
|
flags: Flags;
|
|
4
4
|
}
|
|
5
|
-
declare const PREFERENCES_SUBCOMMANDS: readonly ["get", "set", "enable", "disable", "delete", "reset", "list"];
|
|
6
|
-
export type Subcommand = (typeof PREFERENCES_SUBCOMMANDS)[number];
|
|
7
5
|
export declare function preferences(subcommand: string, key: string, value: string | undefined, { flags }: PreferencesOptions): Promise<number>;
|
|
8
6
|
export {};
|
package/dist/container/index.js
CHANGED
|
@@ -55,11 +55,6 @@ class experimental_AstroContainer {
|
|
|
55
55
|
* @private
|
|
56
56
|
*/
|
|
57
57
|
#withManifest = false;
|
|
58
|
-
/**
|
|
59
|
-
* Internal function responsible for importing a renderer
|
|
60
|
-
* @private
|
|
61
|
-
*/
|
|
62
|
-
#getRenderer;
|
|
63
58
|
constructor({
|
|
64
59
|
streaming = false,
|
|
65
60
|
manifest,
|
|
@@ -187,7 +182,7 @@ class experimental_AstroContainer {
|
|
|
187
182
|
this.#pipeline.manifest.renderers[rendererIndex] = renderer;
|
|
188
183
|
}
|
|
189
184
|
// NOTE: we keep this private via TS instead via `#` so it's still available on the surface, so we can play with it.
|
|
190
|
-
// @ematipico: I plan to use it for a possible integration that could help people
|
|
185
|
+
// @ts-expect-error @ematipico: I plan to use it for a possible integration that could help people
|
|
191
186
|
static async createFromManifest(manifest) {
|
|
192
187
|
const astroConfig = await validateConfig(ASTRO_CONFIG_DEFAULTS, process.cwd(), "container");
|
|
193
188
|
const container = new experimental_AstroContainer({
|
|
@@ -2,16 +2,14 @@ import type { FSWatcher } from 'vite';
|
|
|
2
2
|
import type { Logger } from '../core/logger/core.js';
|
|
3
3
|
import type { AstroSettings } from '../types/astro.js';
|
|
4
4
|
import type { RefreshContentOptions } from '../types/public/content.js';
|
|
5
|
-
import type { LoaderContext } from './loaders/types.js';
|
|
6
5
|
import type { MutableDataStore } from './mutable-data-store.js';
|
|
7
|
-
|
|
6
|
+
interface ContentLayerOptions {
|
|
8
7
|
store: MutableDataStore;
|
|
9
8
|
settings: AstroSettings;
|
|
10
9
|
logger: Logger;
|
|
11
10
|
watcher?: FSWatcher;
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
export declare class ContentLayer {
|
|
12
|
+
declare class ContentLayer {
|
|
15
13
|
#private;
|
|
16
14
|
constructor({ settings, logger, store, watcher }: ContentLayerOptions);
|
|
17
15
|
/**
|
|
@@ -33,9 +31,6 @@ export declare class ContentLayer {
|
|
|
33
31
|
sync(options?: RefreshContentOptions): Promise<void>;
|
|
34
32
|
regenerateCollectionFileManifest(): Promise<void>;
|
|
35
33
|
}
|
|
36
|
-
export declare function simpleLoader<TData extends {
|
|
37
|
-
id: string;
|
|
38
|
-
}>(handler: CollectionLoader<TData>, context: LoaderContext): Promise<void>;
|
|
39
34
|
/**
|
|
40
35
|
* Get the path to the data store file.
|
|
41
36
|
* During development, this is in the `.astro` directory so that the Vite watcher can see it.
|
|
@@ -153,7 +153,7 @@ ${contentConfig.error.message}`);
|
|
|
153
153
|
logger.info("Content config changed");
|
|
154
154
|
shouldClear = true;
|
|
155
155
|
}
|
|
156
|
-
if (previousAstroVersion && previousAstroVersion !== "5.7.
|
|
156
|
+
if (previousAstroVersion && previousAstroVersion !== "5.7.5") {
|
|
157
157
|
logger.info("Astro version changed");
|
|
158
158
|
shouldClear = true;
|
|
159
159
|
}
|
|
@@ -161,8 +161,8 @@ ${contentConfig.error.message}`);
|
|
|
161
161
|
logger.info("Clearing content store");
|
|
162
162
|
this.#store.clearAll();
|
|
163
163
|
}
|
|
164
|
-
if ("5.7.
|
|
165
|
-
await this.#store.metaStore().set("astro-version", "5.7.
|
|
164
|
+
if ("5.7.5") {
|
|
165
|
+
await this.#store.metaStore().set("astro-version", "5.7.5");
|
|
166
166
|
}
|
|
167
167
|
if (currentConfigDigest) {
|
|
168
168
|
await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
|
@@ -343,8 +343,6 @@ function contentLayerSingleton() {
|
|
|
343
343
|
}
|
|
344
344
|
const globalContentLayer = contentLayerSingleton();
|
|
345
345
|
export {
|
|
346
|
-
ContentLayer,
|
|
347
346
|
getDataStoreFile,
|
|
348
|
-
globalContentLayer
|
|
349
|
-
simpleLoader
|
|
347
|
+
globalContentLayer
|
|
350
348
|
};
|
package/dist/content/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { CONTENT_FLAG, PROPAGATED_ASSET_FLAG } from './consts.js';
|
|
2
1
|
export { attachContentServerListeners } from './server-listeners.js';
|
|
3
2
|
export { createContentTypesGenerator } from './types-generator.js';
|
|
4
|
-
export {
|
|
3
|
+
export { getContentPaths, hasAssetPropagationFlag } from './utils.js';
|
|
5
4
|
export { astroContentAssetPropagationPlugin } from './vite-plugin-content-assets.js';
|
|
6
5
|
export { astroContentImportPlugin } from './vite-plugin-content-imports.js';
|
|
7
6
|
export { astroContentVirtualModPlugin } from './vite-plugin-content-virtual-mod.js';
|
package/dist/content/index.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import { CONTENT_FLAG, PROPAGATED_ASSET_FLAG } from "./consts.js";
|
|
2
1
|
import { attachContentServerListeners } from "./server-listeners.js";
|
|
3
2
|
import { createContentTypesGenerator } from "./types-generator.js";
|
|
4
|
-
import {
|
|
3
|
+
import { getContentPaths, hasAssetPropagationFlag } from "./utils.js";
|
|
5
4
|
import { astroContentAssetPropagationPlugin } from "./vite-plugin-content-assets.js";
|
|
6
5
|
import { astroContentImportPlugin } from "./vite-plugin-content-imports.js";
|
|
7
6
|
import { astroContentVirtualModPlugin } from "./vite-plugin-content-virtual-mod.js";
|
|
8
7
|
export {
|
|
9
|
-
CONTENT_FLAG,
|
|
10
|
-
PROPAGATED_ASSET_FLAG,
|
|
11
8
|
astroContentAssetPropagationPlugin,
|
|
12
9
|
astroContentImportPlugin,
|
|
13
10
|
astroContentVirtualModPlugin,
|
|
14
11
|
attachContentServerListeners,
|
|
15
|
-
contentObservable,
|
|
16
12
|
createContentTypesGenerator,
|
|
17
13
|
getContentPaths,
|
|
18
14
|
hasAssetPropagationFlag
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Loader } from './types.js';
|
|
2
|
-
|
|
2
|
+
interface FileOptions {
|
|
3
3
|
/**
|
|
4
4
|
* the parsing function to use for this data
|
|
5
5
|
* @default JSON.parse or yaml.load, depending on the extension of the file
|
|
@@ -12,3 +12,4 @@ export interface FileOptions {
|
|
|
12
12
|
* @param options Additional options for the file loader
|
|
13
13
|
*/
|
|
14
14
|
export declare function file(fileName: string, options?: FileOptions): Loader;
|
|
15
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Loader } from './types.js';
|
|
2
|
-
|
|
2
|
+
interface GenerateIdOptions {
|
|
3
3
|
/** The path to the entry file, relative to the base directory. */
|
|
4
4
|
entry: string;
|
|
5
5
|
/** The base directory URL. */
|
|
@@ -7,7 +7,7 @@ export interface GenerateIdOptions {
|
|
|
7
7
|
/** The parsed, unvalidated data of the entry. */
|
|
8
8
|
data: Record<string, unknown>;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
interface GlobOptions {
|
|
11
11
|
/** The glob pattern to match files, relative to the base directory */
|
|
12
12
|
pattern: string | Array<string>;
|
|
13
13
|
/** The base directory to resolve the glob pattern from. Relative to the root directory, or an absolute file URL. Defaults to `.` */
|
|
@@ -28,3 +28,4 @@ export declare function glob(globOptions: GlobOptions & {
|
|
|
28
28
|
/** @deprecated */
|
|
29
29
|
_legacy?: true;
|
|
30
30
|
}): Loader;
|
|
31
|
+
export {};
|
package/dist/content/utils.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { Logger } from '../core/logger/core.js';
|
|
|
6
6
|
import type { AstroSettings } from '../types/astro.js';
|
|
7
7
|
import type { AstroConfig } from '../types/public/config.js';
|
|
8
8
|
import type { ContentEntryType, DataEntryType } from '../types/public/content.js';
|
|
9
|
-
import { CONTENT_FLAGS } from './consts.js';
|
|
9
|
+
import { type CONTENT_FLAGS } from './consts.js';
|
|
10
10
|
/**
|
|
11
11
|
* A map from a collection + slug to the local file path.
|
|
12
12
|
* This is used internally to resolve entry imports when using `getEntry()`.
|
|
@@ -431,14 +431,8 @@ export declare function safeParseFrontmatter(source: string, id?: string): impor
|
|
|
431
431
|
* subscribe to changes during dev server updates.
|
|
432
432
|
*/
|
|
433
433
|
export declare const globalContentConfigObserver: ContentObservable;
|
|
434
|
-
export declare function hasAnyContentFlag(viteId: string): boolean;
|
|
435
434
|
export declare function hasContentFlag(viteId: string, flag: (typeof CONTENT_FLAGS)[number]): boolean;
|
|
436
435
|
export declare function isDeferredModule(viteId: string): boolean;
|
|
437
|
-
export declare function autogenerateCollections({ config, settings, fs, }: {
|
|
438
|
-
config?: ContentConfig;
|
|
439
|
-
settings: AstroSettings;
|
|
440
|
-
fs: typeof fsMod;
|
|
441
|
-
}): Promise<ContentConfig | undefined>;
|
|
442
436
|
export declare function reloadContentConfigObserver({ observer, ...loadContentConfigOpts }: {
|
|
443
437
|
fs: typeof fsMod;
|
|
444
438
|
settings: AstroSettings;
|
|
@@ -464,7 +458,6 @@ type Observable<C> = {
|
|
|
464
458
|
subscribe: (fn: (ctx: C) => void) => () => void;
|
|
465
459
|
};
|
|
466
460
|
export type ContentObservable = Observable<ContentCtx>;
|
|
467
|
-
export declare function contentObservable(initialCtx: ContentCtx): ContentObservable;
|
|
468
461
|
export type ContentPaths = {
|
|
469
462
|
root: URL;
|
|
470
463
|
contentDir: URL;
|
|
@@ -492,10 +485,6 @@ export declare function getEntrySlug({ id, collection, generatedSlug, contentEnt
|
|
|
492
485
|
export declare function getExtGlob(exts: string[]): string;
|
|
493
486
|
export declare function hasAssetPropagationFlag(id: string): boolean;
|
|
494
487
|
export declare function globWithUnderscoresIgnored(relContentDir: string, exts: string[]): string[];
|
|
495
|
-
/**
|
|
496
|
-
* Convert a platform path to a posix path.
|
|
497
|
-
*/
|
|
498
|
-
export declare function posixifyPath(filePath: string): string;
|
|
499
488
|
/**
|
|
500
489
|
* Unlike `path.posix.relative`, this function will accept a platform path and return a posix path.
|
|
501
490
|
*/
|
package/dist/content/utils.js
CHANGED
|
@@ -11,7 +11,6 @@ import { isYAMLException } from "../core/errors/utils.js";
|
|
|
11
11
|
import { appendForwardSlash } from "../core/path.js";
|
|
12
12
|
import { normalizePath } from "../core/viteUtils.js";
|
|
13
13
|
import {
|
|
14
|
-
CONTENT_FLAGS,
|
|
15
14
|
CONTENT_LAYER_TYPE,
|
|
16
15
|
CONTENT_MODULE_FLAG,
|
|
17
16
|
DEFERRED_MODULE,
|
|
@@ -349,14 +348,6 @@ function safeParseFrontmatter(source, id) {
|
|
|
349
348
|
}
|
|
350
349
|
}
|
|
351
350
|
const globalContentConfigObserver = contentObservable({ status: "init" });
|
|
352
|
-
function hasAnyContentFlag(viteId) {
|
|
353
|
-
const flags = new URLSearchParams(viteId.split("?")[1] ?? "");
|
|
354
|
-
const flag = Array.from(flags.keys()).at(0);
|
|
355
|
-
if (typeof flag !== "string") {
|
|
356
|
-
return false;
|
|
357
|
-
}
|
|
358
|
-
return CONTENT_FLAGS.includes(flag);
|
|
359
|
-
}
|
|
360
351
|
function hasContentFlag(viteId, flag) {
|
|
361
352
|
const flags = new URLSearchParams(viteId.split("?")[1] ?? "");
|
|
362
353
|
return flags.has(flag);
|
|
@@ -607,9 +598,7 @@ function safeStringify(value) {
|
|
|
607
598
|
return JSON.stringify(value, safeStringifyReplacer(seen));
|
|
608
599
|
}
|
|
609
600
|
export {
|
|
610
|
-
autogenerateCollections,
|
|
611
601
|
contentModuleToId,
|
|
612
|
-
contentObservable,
|
|
613
602
|
getContentEntryExts,
|
|
614
603
|
getContentEntryIdAndSlug,
|
|
615
604
|
getContentPaths,
|
|
@@ -625,14 +614,12 @@ export {
|
|
|
625
614
|
getSymlinkedContentCollections,
|
|
626
615
|
globWithUnderscoresIgnored,
|
|
627
616
|
globalContentConfigObserver,
|
|
628
|
-
hasAnyContentFlag,
|
|
629
617
|
hasAssetPropagationFlag,
|
|
630
618
|
hasContentFlag,
|
|
631
619
|
isDeferredModule,
|
|
632
620
|
loaderReturnSchema,
|
|
633
621
|
parseEntrySlug,
|
|
634
622
|
posixRelative,
|
|
635
|
-
posixifyPath,
|
|
636
623
|
reloadContentConfigObserver,
|
|
637
624
|
reverseSymlink,
|
|
638
625
|
safeParseFrontmatter,
|
|
@@ -1,25 +1,9 @@
|
|
|
1
1
|
import nodeFs from 'node:fs';
|
|
2
2
|
import type { Plugin } from 'vite';
|
|
3
3
|
import type { AstroSettings } from '../types/astro.js';
|
|
4
|
-
import { type ContentLookupMap } from './utils.js';
|
|
5
4
|
interface AstroContentVirtualModPluginParams {
|
|
6
5
|
settings: AstroSettings;
|
|
7
6
|
fs: typeof nodeFs;
|
|
8
7
|
}
|
|
9
8
|
export declare function astroContentVirtualModPlugin({ settings, fs, }: AstroContentVirtualModPluginParams): Plugin;
|
|
10
|
-
export declare function generateContentEntryFile({ settings, lookupMap, isClient, }: {
|
|
11
|
-
settings: AstroSettings;
|
|
12
|
-
fs: typeof nodeFs;
|
|
13
|
-
lookupMap: ContentLookupMap;
|
|
14
|
-
isClient: boolean;
|
|
15
|
-
}): Promise<string>;
|
|
16
|
-
/**
|
|
17
|
-
* Generate a map from a collection + slug to the local file path.
|
|
18
|
-
* This is used internally to resolve entry imports when using `getEntry()`.
|
|
19
|
-
* @see `templates/content/module.mjs`
|
|
20
|
-
*/
|
|
21
|
-
export declare function generateLookupMap({ settings, fs, }: {
|
|
22
|
-
settings: AstroSettings;
|
|
23
|
-
fs: typeof nodeFs;
|
|
24
|
-
}): Promise<ContentLookupMap>;
|
|
25
9
|
export {};
|
|
@@ -297,7 +297,5 @@ const UnexpectedLookupMapError = new AstroError({
|
|
|
297
297
|
message: `Unexpected error while parsing content entry IDs and slugs.`
|
|
298
298
|
});
|
|
299
299
|
export {
|
|
300
|
-
astroContentVirtualModPlugin
|
|
301
|
-
generateContentEntryFile,
|
|
302
|
-
generateLookupMap
|
|
300
|
+
astroContentVirtualModPlugin
|
|
303
301
|
};
|
package/dist/core/app/index.js
CHANGED
|
@@ -44,7 +44,7 @@ class App {
|
|
|
44
44
|
};
|
|
45
45
|
ensure404Route(this.#manifestData);
|
|
46
46
|
this.#baseWithoutTrailingSlash = removeTrailingForwardSlash(this.#manifest.base);
|
|
47
|
-
this.#pipeline = this.#createPipeline(
|
|
47
|
+
this.#pipeline = this.#createPipeline(streaming);
|
|
48
48
|
this.#adapterLogger = new AstroIntegrationLogger(
|
|
49
49
|
this.#logger.options,
|
|
50
50
|
this.#manifest.adapterName
|
|
@@ -56,12 +56,11 @@ class App {
|
|
|
56
56
|
/**
|
|
57
57
|
* Creates a pipeline by reading the stored manifest
|
|
58
58
|
*
|
|
59
|
-
* @param manifestData
|
|
60
59
|
* @param streaming
|
|
61
60
|
* @private
|
|
62
61
|
*/
|
|
63
|
-
#createPipeline(
|
|
64
|
-
return AppPipeline.create(
|
|
62
|
+
#createPipeline(streaming = false) {
|
|
63
|
+
return AppPipeline.create({
|
|
65
64
|
logger: this.#logger,
|
|
66
65
|
manifest: this.#manifest,
|
|
67
66
|
runtimeMode: "production",
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { ComponentInstance
|
|
1
|
+
import type { ComponentInstance } from '../../types/astro.js';
|
|
2
2
|
import type { RewritePayload } from '../../types/public/common.js';
|
|
3
3
|
import type { RouteData, SSRResult } from '../../types/public/internal.js';
|
|
4
4
|
import { Pipeline, type TryRewriteResult } from '../base-pipeline.js';
|
|
5
5
|
import type { SinglePageBuiltModule } from '../build/types.js';
|
|
6
6
|
export declare class AppPipeline extends Pipeline {
|
|
7
|
-
|
|
8
|
-
static create(manifestData: RoutesList, { logger, manifest, runtimeMode, renderers, resolve, serverLike, streaming, defaultRoutes, }: Pick<AppPipeline, 'logger' | 'manifest' | 'runtimeMode' | 'renderers' | 'resolve' | 'serverLike' | 'streaming' | 'defaultRoutes'>): AppPipeline;
|
|
7
|
+
static create({ logger, manifest, runtimeMode, renderers, resolve, serverLike, streaming, defaultRoutes, }: Pick<AppPipeline, 'logger' | 'manifest' | 'runtimeMode' | 'renderers' | 'resolve' | 'serverLike' | 'streaming' | 'defaultRoutes'>): AppPipeline;
|
|
9
8
|
headElements(routeData: RouteData): Pick<SSRResult, 'scripts' | 'styles' | 'links'>;
|
|
10
9
|
componentMetadata(): void;
|
|
11
10
|
getComponentByRoute(routeData: RouteData): Promise<ComponentInstance>;
|
|
@@ -3,8 +3,7 @@ import { RedirectSinglePageBuiltModule } from "../redirects/component.js";
|
|
|
3
3
|
import { createModuleScriptElement, createStylesheetElementSet } from "../render/ssr-element.js";
|
|
4
4
|
import { findRouteToRewrite } from "../routing/rewrite.js";
|
|
5
5
|
class AppPipeline extends Pipeline {
|
|
6
|
-
|
|
7
|
-
static create(manifestData, {
|
|
6
|
+
static create({
|
|
8
7
|
logger,
|
|
9
8
|
manifest,
|
|
10
9
|
runtimeMode,
|
|
@@ -32,7 +31,6 @@ class AppPipeline extends Pipeline {
|
|
|
32
31
|
void 0,
|
|
33
32
|
defaultRoutes
|
|
34
33
|
);
|
|
35
|
-
pipeline.#manifestData = manifestData;
|
|
36
34
|
return pipeline;
|
|
37
35
|
}
|
|
38
36
|
headElements(routeData) {
|
package/dist/core/app/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { AstroMiddlewareInstance } from '../../types/public/common.js';
|
|
|
6
6
|
import type { AstroConfig, Locales, ResolvedSessionConfig } from '../../types/public/config.js';
|
|
7
7
|
import type { RouteData, SSRComponentMetadata, SSRLoadedRenderer, SSRResult } from '../../types/public/internal.js';
|
|
8
8
|
import type { SinglePageBuiltModule } from '../build/types.js';
|
|
9
|
-
|
|
9
|
+
type ComponentPath = string;
|
|
10
10
|
export type StylesheetAsset = {
|
|
11
11
|
type: 'inline';
|
|
12
12
|
content: string;
|
|
@@ -30,7 +30,7 @@ export interface RouteInfo {
|
|
|
30
30
|
export type SerializedRouteInfo = Omit<RouteInfo, 'routeData'> & {
|
|
31
31
|
routeData: SerializedRouteData;
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
type ImportComponentInstance = () => Promise<SinglePageBuiltModule>;
|
|
34
34
|
export type AssetsPrefix = string | ({
|
|
35
35
|
fallback: string;
|
|
36
36
|
} & Record<string, string>) | undefined;
|
|
@@ -98,3 +98,4 @@ export type SerializedSSRManifest = Omit<SSRManifest, 'middleware' | 'routes' |
|
|
|
98
98
|
serverIslandNameMap: [string, string][];
|
|
99
99
|
key: string;
|
|
100
100
|
};
|
|
101
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AstroInlineConfig } from '../../types/public/config.js';
|
|
2
|
-
|
|
2
|
+
interface BuildOptions {
|
|
3
3
|
/**
|
|
4
4
|
* Output a development-based build similar to code transformed in `astro dev`. This
|
|
5
5
|
* can be useful to test build-only issues with additional debugging information included.
|
|
@@ -25,3 +25,4 @@ export interface BuildOptions {
|
|
|
25
25
|
* @experimental The JavaScript API is experimental
|
|
26
26
|
*/
|
|
27
27
|
export default function build(inlineConfig: AstroInlineConfig, options?: BuildOptions): Promise<void>;
|
|
28
|
+
export {};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { AstroSettings, RoutesList } from '../../types/astro.js';
|
|
2
2
|
import type { Logger } from '../logger/core.js';
|
|
3
3
|
import type { AllPagesData } from './types.js';
|
|
4
|
-
|
|
4
|
+
interface CollectPagesDataOptions {
|
|
5
5
|
settings: AstroSettings;
|
|
6
6
|
logger: Logger;
|
|
7
7
|
manifest: RoutesList;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
interface CollectPagesDataResult {
|
|
10
10
|
assets: Record<string, string>;
|
|
11
11
|
allPages: AllPagesData;
|
|
12
12
|
}
|
|
13
13
|
export declare function collectPagesData(opts: CollectPagesDataOptions): CollectPagesDataResult;
|
|
14
|
+
export {};
|
|
@@ -8,7 +8,7 @@ type OutputChunk = Extract<OutputChunkorAsset, {
|
|
|
8
8
|
}>;
|
|
9
9
|
export type BuildTarget = 'server' | 'client';
|
|
10
10
|
type MutateChunk = (chunk: OutputChunk, targets: BuildTarget[], newCode: string) => void;
|
|
11
|
-
|
|
11
|
+
interface BuildBeforeHookResult {
|
|
12
12
|
enforce?: 'after-user-plugins';
|
|
13
13
|
vitePlugin: VitePlugin | VitePlugin[] | undefined;
|
|
14
14
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { Plugin as VitePlugin } from 'vite';
|
|
2
1
|
import type { BuildInternals } from '../internal.js';
|
|
3
2
|
import type { AstroBuildPlugin } from '../plugin.js';
|
|
4
|
-
export declare function vitePluginAnalyzer(internals: BuildInternals): VitePlugin;
|
|
5
3
|
export declare function pluginAnalyzer(internals: BuildInternals): AstroBuildPlugin;
|