Skip to content

Commit c3ed9ee

Browse files
authored
fix: docs and types (#13087)
1 parent 18a2699 commit c3ed9ee

File tree

6 files changed

+28
-27
lines changed

6 files changed

+28
-27
lines changed

packages/astro/client.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,14 @@ declare module 'astro:middleware' {
189189
export * from 'astro/virtual-modules/middleware.js';
190190
}
191191

192-
declare module 'astro:manifest/server' {
192+
declare module 'astro:config/server' {
193193
// biome-ignore format: bug
194194
type ServerConfigSerialized = import('./dist/types/public/manifest.js').ServerDeserializedManifest;
195195
const manifest: ServerConfigSerialized;
196196
export default manifest;
197197
}
198198

199-
declare module 'astro:manifest/client' {
199+
declare module 'astro:config/client' {
200200
// biome-ignore format: bug
201201
type ClientConfigSerialized = import('./dist/types/public/manifest.js').ClientDeserializedManifest;
202202
const manifest: ClientConfigSerialized;

packages/astro/src/core/errors/errors-data.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@ export interface ErrorData {
1717
* @name Astro Errors
1818
*/
1919
// Astro Errors, most errors will go here!
20+
21+
/**
22+
* @docs
23+
* @description
24+
* Cannot use the module `astro:config` without enabling the experimental feature.
25+
*/
26+
export const CantUseAstroConfigModuleError = {
27+
name: 'CantUseAstroConfigModuleError',
28+
title: 'Cannot use the `astro:config` module without enabling the experimental feature.',
29+
message: (moduleName) =>
30+
`Cannot import the module "${moduleName}" because the experimental feature is disabled. Enable \`experimental.serializeManifest\` in your \`astro.config.mjs\` `,
31+
} satisfies ErrorData;
32+
2033
/**
2134
* @docs
2235
* @message
@@ -1758,6 +1771,7 @@ export const UnsupportedConfigTransformError = {
17581771
hint: 'See the devalue library for all supported types: https://github.com/rich-harris/devalue',
17591772
} satisfies ErrorData;
17601773

1774+
17611775
/**
17621776
* @docs
17631777
* @kind heading
@@ -1822,18 +1836,6 @@ export const ActionCalledFromServerError = {
18221836
hint: 'See the `Astro.callAction()` reference for usage examples: https://docs.astro.build/en/reference/api-reference/#callaction',
18231837
} satisfies ErrorData;
18241838

1825-
/**
1826-
* @docs
1827-
* @description
1828-
* Cannot use the module `astro:config` without enabling the experimental feature.
1829-
*/
1830-
export const CantUseManifestModule = {
1831-
name: 'CantUseManifestModule',
1832-
title: 'Cannot use the `astro:config` module without enabling the experimental feature.',
1833-
message: (moduleName) =>
1834-
`Cannot import the module "${moduleName}" because the experimental feature is disabled. Enable \`experimental.serializeManifest\` in your \`astro.config.mjs\` `,
1835-
} satisfies ErrorData;
1836-
18371839
// Generic catch-all - Only use this in extreme cases, like if there was a cosmic ray bit flip.
18381840
export const UnknownError = { name: 'UnknownError', title: 'Unknown Error.' } satisfies ErrorData;
18391841

packages/astro/src/manifest/virtual-module.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Plugin } from 'vite';
2-
import { CantUseManifestModule } from '../core/errors/errors-data.js';
2+
import { CantUseAstroConfigModuleError } from '../core/errors/errors-data.js';
33
import { AstroError, AstroErrorData } from '../core/errors/index.js';
44
import type { Logger } from '../core/logger/core.js';
55
import { fromRoutingStrategy } from '../i18n/utils.js';
@@ -37,8 +37,8 @@ export default function virtualModulePlugin({
3737
if (id === RESOLVED_VIRTUAL_CLIENT_ID) {
3838
if (!settings.config.experimental.serializeConfig) {
3939
throw new AstroError({
40-
...CantUseManifestModule,
41-
message: CantUseManifestModule.message(VIRTUAL_CLIENT_ID),
40+
...CantUseAstroConfigModuleError,
41+
message: CantUseAstroConfigModuleError.message(VIRTUAL_CLIENT_ID),
4242
});
4343
}
4444
// There's nothing wrong about using `/client` on the server
@@ -48,8 +48,8 @@ export default function virtualModulePlugin({
4848
else if (id == RESOLVED_VIRTUAL_SERVER_ID) {
4949
if (!settings.config.experimental.serializeConfig) {
5050
throw new AstroError({
51-
...CantUseManifestModule,
52-
message: CantUseManifestModule.message(VIRTUAL_SERVER_ID),
51+
...CantUseAstroConfigModuleError,
52+
message: CantUseAstroConfigModuleError.message(VIRTUAL_SERVER_ID),
5353
});
5454
}
5555
if (!opts?.ssr) {

packages/astro/src/types/public/config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,12 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
271271
* ```js
272272
* export default defineConfig({
273273
* redirects: {
274-
* '/old': '/new',
274+
* '/old': '/new',
275275
* '/blog/[...slug]': '/articles/[...slug]',
276276
* '/about': 'https://example.com/about',
277277
* '/news': {
278-
* status: 302,
279-
* destination: 'https://example.com/news'
278+
* status: 302,
279+
* destination: 'https://example.com/news'
280280
* }
281281
* }
282282
* })

packages/astro/test/serializeManifest.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { AstroError } from '../dist/core/errors/index.js';
66
import testAdapter from './test-adapter.js';
77
import { loadFixture } from './test-utils.js';
88

9-
describe('astro:manifest/client', () => {
9+
describe('astro:config/client', () => {
1010
/** @type {import('./test-utils').Fixture} */
1111
let fixture;
1212
let devServer;
@@ -29,7 +29,7 @@ describe('astro:manifest/client', () => {
2929
it('should throw an error when importing the module', async () => {
3030
const response = await fixture.fetch('/');
3131
const html = await response.text();
32-
assert.match(html, /CantUseManifestModule/);
32+
assert.match(html, /CantUseAstroConfigModuleError/);
3333
});
3434
});
3535

@@ -112,7 +112,7 @@ describe('astro:manifest/client', () => {
112112
});
113113
});
114114

115-
describe('astro:manifest/server', () => {
115+
describe('astro:config/server', () => {
116116
/** @type {import('./test-utils').Fixture} */
117117
let fixture;
118118
let devServer;
@@ -150,7 +150,7 @@ describe('astro:manifest/server', () => {
150150
it('should throw an error when importing the module', async () => {
151151
const response = await fixture.fetch('/server');
152152
const html = await response.text();
153-
assert.match(html, /CantUseManifestModule/);
153+
assert.match(html, /CantUseAstroConfigModuleError/);
154154
});
155155
});
156156

pnpm-lock.yaml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)