astro 1.7.0 → 1.7.2
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/README.md +1 -1
- package/components/Shiki.js +1 -1
- package/dist/@types/astro.d.ts +20 -5
- package/dist/content/internal.js +1 -3
- package/dist/core/build/static-build.js +3 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/errors-data.d.ts +8 -5
- package/dist/core/errors/errors-data.js +1 -1
- package/dist/core/errors/utils.d.ts +2 -2
- package/dist/core/messages.js +2 -2
- package/dist/core/render/route-cache.d.ts +1 -1
- package/dist/runtime/server/index.d.ts +1 -1
- package/dist/vite-plugin-astro/compile.js +6 -1
- package/dist/vite-plugin-config-alias/index.d.ts +1 -1
- package/dist/vite-plugin-head-propagation/index.d.ts +1 -1
- package/dist/vite-plugin-head-propagation/index.js +2 -0
- package/dist/vite-plugin-jsx/index.js +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/components/Shiki.js
CHANGED
|
@@ -2,7 +2,7 @@ import { getHighlighter as getShikiHighlighter } from 'shiki';
|
|
|
2
2
|
import { themes } from './shiki-themes.js';
|
|
3
3
|
import { languages } from './shiki-languages.js';
|
|
4
4
|
|
|
5
|
-
// Caches Promise<
|
|
5
|
+
// Caches Promise<Highlighter> for reuse when the same theme and langs are provided
|
|
6
6
|
const _resolvedHighlighters = new Map();
|
|
7
7
|
|
|
8
8
|
/** @type {Promise<any>} */
|
package/dist/@types/astro.d.ts
CHANGED
|
@@ -763,7 +763,7 @@ export interface AstroUserConfig {
|
|
|
763
763
|
*
|
|
764
764
|
* Extend Astro with custom integrations. Integrations are your one-stop-shop for adding framework support (like Solid.js), new features (like sitemaps), and new libraries (like Partytown and Turbolinks).
|
|
765
765
|
*
|
|
766
|
-
* Read our [Integrations Guide](/en/guides/integrations-guide/) for help getting started with Astro Integrations.
|
|
766
|
+
* Read our [Integrations Guide](https://docs.astro.build/en/guides/integrations-guide/) for help getting started with Astro Integrations.
|
|
767
767
|
*
|
|
768
768
|
* ```js
|
|
769
769
|
* import react from '@astrojs/react';
|
|
@@ -826,9 +826,9 @@ export interface AstroUserConfig {
|
|
|
826
826
|
* @version 1.0.0-rc.1
|
|
827
827
|
* @description
|
|
828
828
|
* Enable Astro's pre-v1.0 support for components and JSX expressions in `.md` (and alternative extensions for markdown files like ".markdown") Markdown files.
|
|
829
|
-
* In Astro `1.0.0-rc`, this original behavior was removed as the default, in favor of our new [MDX integration](/en/guides/integrations-guide/mdx/).
|
|
829
|
+
* In Astro `1.0.0-rc`, this original behavior was removed as the default, in favor of our new [MDX integration](https://docs.astro.build/en/guides/integrations-guide/mdx/).
|
|
830
830
|
*
|
|
831
|
-
* To enable this behavior, set `legacy.astroFlavoredMarkdown` to `true` in your [`astro.config.mjs` configuration file](/en/guides/configuring-astro/#the-astro-config-file).
|
|
831
|
+
* To enable this behavior, set `legacy.astroFlavoredMarkdown` to `true` in your [`astro.config.mjs` configuration file](https://docs.astro.build/en/guides/configuring-astro/#the-astro-config-file).
|
|
832
832
|
*
|
|
833
833
|
* ```js
|
|
834
834
|
* {
|
|
@@ -851,8 +851,23 @@ export interface AstroUserConfig {
|
|
|
851
851
|
*/
|
|
852
852
|
experimental?: {
|
|
853
853
|
/**
|
|
854
|
-
* @
|
|
854
|
+
* @docs
|
|
855
|
+
* @name experimental.errorOverlay
|
|
856
|
+
* @type {boolean}
|
|
857
|
+
* @default `false`
|
|
858
|
+
* @version 1.7.0
|
|
859
|
+
* @description
|
|
855
860
|
* Turn on experimental support for the new error overlay component.
|
|
861
|
+
*
|
|
862
|
+
* To enable this feature, set `experimental.errorOverlay` to `true` in your Astro config:
|
|
863
|
+
*
|
|
864
|
+
* ```js
|
|
865
|
+
* {
|
|
866
|
+
* experimental: {
|
|
867
|
+
* errorOverlay: true,
|
|
868
|
+
* },
|
|
869
|
+
* }
|
|
870
|
+
* ```
|
|
856
871
|
*/
|
|
857
872
|
errorOverlay?: boolean;
|
|
858
873
|
/**
|
|
@@ -882,7 +897,7 @@ export interface AstroUserConfig {
|
|
|
882
897
|
* @default `false`
|
|
883
898
|
* @version 1.7.0
|
|
884
899
|
* @description
|
|
885
|
-
* Enable experimental support for [Content Collections](/en/guides/content-collections). This makes the `src/content/` directory a reserved directory for Astro to manage, and introduces the `astro:content` module for querying this content.
|
|
900
|
+
* Enable experimental support for [Content Collections](https://docs.astro.build/en/guides/content-collections/). This makes the `src/content/` directory a reserved directory for Astro to manage, and introduces the `astro:content` module for querying this content.
|
|
886
901
|
*
|
|
887
902
|
* To enable this feature, set `experimental.contentCollections` to `true` in your Astro config:
|
|
888
903
|
*
|
package/dist/content/internal.js
CHANGED
|
@@ -114,9 +114,7 @@ async function render({
|
|
|
114
114
|
propagation: "self"
|
|
115
115
|
});
|
|
116
116
|
if (!mod._internal && id.endsWith(".mdx")) {
|
|
117
|
-
throw new Error(
|
|
118
|
-
`[Content] Failed to render MDX entry. Try installing @astrojs/mdx@next--content-schemas`
|
|
119
|
-
);
|
|
117
|
+
throw new Error(`[Content] Failed to render MDX entry. Try installing @astrojs/mdx@latest`);
|
|
120
118
|
}
|
|
121
119
|
return {
|
|
122
120
|
Content,
|
|
@@ -293,7 +293,9 @@ async function cleanServerOutput(opts) {
|
|
|
293
293
|
await Promise.all(
|
|
294
294
|
Array.from(directories).map(async (filename) => {
|
|
295
295
|
const url = new URL(filename, out);
|
|
296
|
-
const dir = await glob(fileURLToPath(url)
|
|
296
|
+
const dir = await glob(fileURLToPath(url));
|
|
297
|
+
if (filename === "chunks")
|
|
298
|
+
return;
|
|
297
299
|
if (!dir.length) {
|
|
298
300
|
await fs.promises.rm(url, { recursive: true, force: true });
|
|
299
301
|
}
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -30,7 +30,7 @@ async function dev(settings, options) {
|
|
|
30
30
|
isRestart: options.isRestart
|
|
31
31
|
})
|
|
32
32
|
);
|
|
33
|
-
const currentVersion = "1.7.
|
|
33
|
+
const currentVersion = "1.7.2";
|
|
34
34
|
if (currentVersion.includes("-")) {
|
|
35
35
|
warn(options.logging, null, msg.prerelease({ currentVersion }));
|
|
36
36
|
}
|
|
@@ -147,7 +147,7 @@ export declare const AstroErrorData: {
|
|
|
147
147
|
* - [`client:only`](https://docs.astro.build/en/reference/directives-reference/#clientonly)
|
|
148
148
|
* @description
|
|
149
149
|
*
|
|
150
|
-
* `client:only` components are not
|
|
150
|
+
* `client:only` components are not run on the server, as such Astro does not know (and cannot guess) which renderer to use and require a hint. Like such:
|
|
151
151
|
*
|
|
152
152
|
* ```astro
|
|
153
153
|
* <SomeReactComponent client:only="react" />
|
|
@@ -319,7 +319,7 @@ export declare const AstroErrorData: {
|
|
|
319
319
|
* - [Server-side Rendering](https://docs.astro.build/en/guides/server-side-rendering/)
|
|
320
320
|
* - [Adding an Adapter](https://docs.astro.build/en/guides/server-side-rendering/#adding-an-adapter)
|
|
321
321
|
* @description
|
|
322
|
-
* To use server-side rendering, an adapter needs to be installed so Astro knows how to generate the proper output for your
|
|
322
|
+
* To use server-side rendering, an adapter needs to be installed so Astro knows how to generate the proper output for your targeted deployment platform.
|
|
323
323
|
*/
|
|
324
324
|
readonly NoAdapterInstalled: {
|
|
325
325
|
readonly title: "Cannot use Server-side Rendering without an adapter.";
|
|
@@ -340,8 +340,11 @@ export declare const AstroErrorData: {
|
|
|
340
340
|
};
|
|
341
341
|
/**
|
|
342
342
|
* @docs
|
|
343
|
+
* @message
|
|
344
|
+
* **Example error messages:**<br/>
|
|
345
|
+
* InvalidPrerenderExport: A `prerender` export has been detected, but its value cannot be statically analyzed.
|
|
343
346
|
* @description
|
|
344
|
-
*
|
|
347
|
+
* The `prerender` feature only supports a subset of valid JavaScript — be sure to use exactly `export const prerender = true` so that our compiler can detect this directive at build time. Variables, `let`, and `var` declarations are not supported.
|
|
345
348
|
*/
|
|
346
349
|
readonly InvalidPrerenderExport: {
|
|
347
350
|
readonly title: "Invalid prerender export.";
|
|
@@ -438,13 +441,13 @@ export declare const AstroErrorData: {
|
|
|
438
441
|
* A Markdown document's frontmatter in `src/content/` does not match its collection schema.
|
|
439
442
|
* Make sure that all required fields are present, and that all fields are of the correct type.
|
|
440
443
|
* You can check against the collection schema in your `src/content/config.*` file.
|
|
441
|
-
* See the [Content collections documentation](https://docs.astro.build/en/guides/content-collections) for more information.
|
|
444
|
+
* See the [Content collections documentation](https://docs.astro.build/en/guides/content-collections/) for more information.
|
|
442
445
|
*/
|
|
443
446
|
readonly MarkdownContentSchemaValidationError: {
|
|
444
447
|
readonly title: "Content collection frontmatter invalid.";
|
|
445
448
|
readonly code: 6002;
|
|
446
449
|
readonly message: (collection: string, entryId: string, error: ZodError) => string;
|
|
447
|
-
readonly hint: "See https://docs.astro.build/en/guides/content-collections for more information on content schemas.";
|
|
450
|
+
readonly hint: "See https://docs.astro.build/en/guides/content-collections/ for more information on content schemas.";
|
|
448
451
|
};
|
|
449
452
|
readonly UnknownConfigError: {
|
|
450
453
|
readonly title: "Unknown configuration error.";
|
|
@@ -173,7 +173,7 @@ Expected \`true\` value but got \`${suffix}\`.`;
|
|
|
173
173
|
...error.errors.map((zodError) => zodError.message)
|
|
174
174
|
].join("\n");
|
|
175
175
|
},
|
|
176
|
-
hint: "See https://docs.astro.build/en/guides/content-collections for more information on content schemas."
|
|
176
|
+
hint: "See https://docs.astro.build/en/guides/content-collections/ for more information on content schemas."
|
|
177
177
|
},
|
|
178
178
|
UnknownConfigError: {
|
|
179
179
|
title: "Unknown configuration error.",
|
|
@@ -3,7 +3,7 @@ import { AstroErrorCodes } from './errors-data.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* Get the line and character based on the offset
|
|
5
5
|
* @param offset The index of the position
|
|
6
|
-
* @param text The text for which the position should be
|
|
6
|
+
* @param text The text for which the position should be retrieved
|
|
7
7
|
*/
|
|
8
8
|
export declare function positionAt(offset: number, text: string): {
|
|
9
9
|
line: number;
|
|
@@ -138,7 +138,7 @@ export declare function getErrorDataByCode(code: AstroErrorCodes | DiagnosticCod
|
|
|
138
138
|
readonly title: "Content collection frontmatter invalid.";
|
|
139
139
|
readonly code: 6002;
|
|
140
140
|
readonly message: (collection: string, entryId: string, error: import("zod").ZodError<any>) => string;
|
|
141
|
-
readonly hint: "See https://docs.astro.build/en/guides/content-collections for more information on content schemas.";
|
|
141
|
+
readonly hint: "See https://docs.astro.build/en/guides/content-collections/ for more information on content schemas.";
|
|
142
142
|
} | {
|
|
143
143
|
readonly title: "Unknown configuration error.";
|
|
144
144
|
readonly code: 7000;
|
package/dist/core/messages.js
CHANGED
|
@@ -49,7 +49,7 @@ function serverStart({
|
|
|
49
49
|
site,
|
|
50
50
|
isRestart = false
|
|
51
51
|
}) {
|
|
52
|
-
const version = "1.7.
|
|
52
|
+
const version = "1.7.2";
|
|
53
53
|
const rootPath = site ? site.pathname : "/";
|
|
54
54
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
55
55
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
@@ -272,7 +272,7 @@ function printHelp({
|
|
|
272
272
|
message.push(
|
|
273
273
|
linebreak(),
|
|
274
274
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
275
|
-
`v${"1.7.
|
|
275
|
+
`v${"1.7.2"}`
|
|
276
276
|
)} ${headline}`
|
|
277
277
|
);
|
|
278
278
|
}
|
|
@@ -12,7 +12,7 @@ export interface RouteCacheEntry {
|
|
|
12
12
|
staticPaths: GetStaticPathsResultKeyed;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Manage the route cache, responsible for caching data related to each route,
|
|
16
16
|
* including the result of calling getStaticPath() so that it can be reused across
|
|
17
17
|
* responses during dev and only ever called once during build.
|
|
18
18
|
*/
|
|
@@ -6,7 +6,7 @@ export { renderJSX } from './jsx.js';
|
|
|
6
6
|
export { addAttribute, createHeadAndContent, defineScriptVars, Fragment, maybeRenderHead, renderAstroTemplateResult as renderAstroComponent, renderComponent, renderComponentToIterable, Renderer as Renderer, renderHead, renderHTMLElement, renderPage, renderSlot, renderStyleElement, renderTemplate as render, renderTemplate, renderToString, renderUniqueStylesheet, stringifyChunk, voidElementNames, } from './render/index.js';
|
|
7
7
|
export type { AstroComponentFactory, AstroComponentInstance, AstroComponentSlots, AstroComponentSlotsWithValues, RenderInstruction, } from './render/index.js';
|
|
8
8
|
export declare function mergeSlots(...slotted: unknown[]): Record<string, () => any>;
|
|
9
|
-
/** @internal
|
|
9
|
+
/** @internal Associate JSX components with a specific renderer (see /src/vite-plugin-jsx/tag.ts) */
|
|
10
10
|
export declare function __astro_tag_component__(Component: unknown, rendererName: string): void;
|
|
11
11
|
export declare function spreadAttributes(values: Record<any, any>, _name?: string, { class: scopedClassName }?: {
|
|
12
12
|
class?: string;
|
|
@@ -15,7 +15,12 @@ async function cachedFullCompilation({
|
|
|
15
15
|
esbuildResult = await transformWithEsbuild(transformResult.code, rawId, {
|
|
16
16
|
loader: "ts",
|
|
17
17
|
target: "esnext",
|
|
18
|
-
sourcemap: "external"
|
|
18
|
+
sourcemap: "external",
|
|
19
|
+
tsconfigRaw: {
|
|
20
|
+
compilerOptions: {
|
|
21
|
+
importsNotUsedAsValues: "remove"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
19
24
|
});
|
|
20
25
|
} catch (err) {
|
|
21
26
|
await enhanceCompileError({
|
|
@@ -5,7 +5,7 @@ export declare interface Alias {
|
|
|
5
5
|
find: RegExp;
|
|
6
6
|
replacement: string;
|
|
7
7
|
}
|
|
8
|
-
/** Returns a Vite plugin used to alias
|
|
8
|
+
/** Returns a Vite plugin used to alias paths from tsconfig.json and jsconfig.json. */
|
|
9
9
|
export default function configAliasVitePlugin({ settings, }: {
|
|
10
10
|
settings: AstroSettings;
|
|
11
11
|
}): vite.PluginOption;
|
|
@@ -4,7 +4,7 @@ import * as vite from 'vite';
|
|
|
4
4
|
* If any component is marked as doing head injection, walk up the tree
|
|
5
5
|
* and mark parent Astro components as having head injection in the tree.
|
|
6
6
|
* This is used at runtime to determine if we should wait for head content
|
|
7
|
-
* to be
|
|
7
|
+
* to be populated before rendering the entire tree.
|
|
8
8
|
*/
|
|
9
9
|
export default function configHeadPropagationVitePlugin({ settings, }: {
|
|
10
10
|
settings: AstroSettings;
|
|
@@ -104,7 +104,12 @@ function jsx({ settings, logging }) {
|
|
|
104
104
|
const { code: jsxCode2 } = await transformWithEsbuild(code, id, {
|
|
105
105
|
loader: getEsbuildLoader(id),
|
|
106
106
|
jsx: "preserve",
|
|
107
|
-
sourcemap: "inline"
|
|
107
|
+
sourcemap: "inline",
|
|
108
|
+
tsconfigRaw: {
|
|
109
|
+
compilerOptions: {
|
|
110
|
+
importsNotUsedAsValues: "remove"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
108
113
|
});
|
|
109
114
|
return transformJSX({
|
|
110
115
|
code: jsxCode2,
|