astro 5.12.1 → 5.12.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/client.d.ts +5 -0
- package/components/Code.astro +3 -9
- package/dist/assets/runtime.js +4 -0
- package/dist/cli/throw-and-exit.js +3 -1
- package/dist/content/content-layer.js +3 -3
- package/dist/content/loaders/file.js +7 -0
- package/dist/content/runtime.d.ts +1 -0
- package/dist/content/runtime.js +9 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/jsx-runtime/index.d.ts +1 -1
- package/dist/jsx-runtime/index.js +5 -2
- package/dist/types/public/common.d.ts +2 -0
- package/package.json +3 -3
- package/templates/content/module.mjs +5 -1
package/client.d.ts
CHANGED
package/components/Code.astro
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { ThemePresets } from '@astrojs/markdown-remark';
|
|
3
|
-
import type {
|
|
4
|
-
BuiltinLanguage,
|
|
5
|
-
LanguageRegistration,
|
|
6
|
-
ShikiTransformer,
|
|
7
|
-
SpecialLanguage,
|
|
8
|
-
ThemeRegistration,
|
|
9
|
-
ThemeRegistrationRaw,
|
|
10
|
-
} from 'shiki';
|
|
3
|
+
import type { ShikiTransformer, ThemeRegistration, ThemeRegistrationRaw } from 'shiki';
|
|
11
4
|
import { bundledLanguages } from 'shiki/langs';
|
|
12
5
|
import { getCachedHighlighter } from '../dist/core/shiki.js';
|
|
6
|
+
import type { CodeLanguage } from '../dist/types/public';
|
|
13
7
|
import type { HTMLAttributes } from '../types';
|
|
14
8
|
|
|
15
9
|
interface Props extends Omit<HTMLAttributes<'pre'>, 'lang'> {
|
|
@@ -22,7 +16,7 @@ interface Props extends Omit<HTMLAttributes<'pre'>, 'lang'> {
|
|
|
22
16
|
*
|
|
23
17
|
* @default "plaintext"
|
|
24
18
|
*/
|
|
25
|
-
lang?:
|
|
19
|
+
lang?: CodeLanguage;
|
|
26
20
|
/**
|
|
27
21
|
* A metastring to pass to the highlighter.
|
|
28
22
|
* Allows passing information to transformers: https://shiki.style/guide/transformers#meta
|
package/dist/assets/runtime.js
CHANGED
|
@@ -15,6 +15,10 @@ function createSvgComponent({ meta, attributes, children }) {
|
|
|
15
15
|
value: (_, opts, inspect) => inspect(meta, opts)
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
+
Object.defineProperty(Component, "toJSON", {
|
|
19
|
+
value: () => meta,
|
|
20
|
+
enumerable: false
|
|
21
|
+
});
|
|
18
22
|
return Object.assign(Component, meta);
|
|
19
23
|
}
|
|
20
24
|
const ATTRS_TO_DROP = ["xmlns", "xmlns:xlink", "version"];
|
|
@@ -5,7 +5,9 @@ import { debug } from "../core/logger/core.js";
|
|
|
5
5
|
import { formatErrorMessage } from "../core/messages.js";
|
|
6
6
|
import { eventError, telemetry } from "../events/index.js";
|
|
7
7
|
async function throwAndExit(cmd, err) {
|
|
8
|
-
if (isAstroConfigZodError(err))
|
|
8
|
+
if (isAstroConfigZodError(err)) {
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
9
11
|
let telemetryPromise;
|
|
10
12
|
let errorMessage;
|
|
11
13
|
function exitWithErrorMessage() {
|
|
@@ -164,7 +164,7 @@ ${contentConfig.error.message}`);
|
|
|
164
164
|
logger.info("Content config changed");
|
|
165
165
|
shouldClear = true;
|
|
166
166
|
}
|
|
167
|
-
if (previousAstroVersion && previousAstroVersion !== "5.12.
|
|
167
|
+
if (previousAstroVersion && previousAstroVersion !== "5.12.2") {
|
|
168
168
|
logger.info("Astro version changed");
|
|
169
169
|
shouldClear = true;
|
|
170
170
|
}
|
|
@@ -172,8 +172,8 @@ ${contentConfig.error.message}`);
|
|
|
172
172
|
logger.info("Clearing content store");
|
|
173
173
|
this.#store.clearAll();
|
|
174
174
|
}
|
|
175
|
-
if ("5.12.
|
|
176
|
-
await this.#store.metaStore().set("astro-version", "5.12.
|
|
175
|
+
if ("5.12.2") {
|
|
176
|
+
await this.#store.metaStore().set("astro-version", "5.12.2");
|
|
177
177
|
}
|
|
178
178
|
if (currentConfigDigest) {
|
|
179
179
|
await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
|
@@ -44,12 +44,19 @@ function file(fileName, options) {
|
|
|
44
44
|
}
|
|
45
45
|
logger.debug(`Found ${data.length} item array in ${fileName}`);
|
|
46
46
|
store.clear();
|
|
47
|
+
const idList = /* @__PURE__ */ new Set();
|
|
47
48
|
for (const rawItem of data) {
|
|
48
49
|
const id = (rawItem.id ?? rawItem.slug)?.toString();
|
|
49
50
|
if (!id) {
|
|
50
51
|
logger.error(`Item in ${fileName} is missing an id or slug field.`);
|
|
51
52
|
continue;
|
|
52
53
|
}
|
|
54
|
+
if (idList.has(id)) {
|
|
55
|
+
logger.warn(
|
|
56
|
+
`Duplicate id "${id}" found in ${fileName}. Later items with the same id will overwrite earlier ones.`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
idList.add(id);
|
|
53
60
|
const parsedData = await parseData({ id, data: rawItem, filePath });
|
|
54
61
|
store.set({ id, data: parsedData, filePath: normalizedFilePath });
|
|
55
62
|
}
|
|
@@ -139,3 +139,4 @@ export declare function createReference({ lookupMap }: {
|
|
|
139
139
|
collection: string;
|
|
140
140
|
}>;
|
|
141
141
|
export declare function defineCollection(config: any): import("./config.js").CollectionConfig<import("./config.js").BaseSchema>;
|
|
142
|
+
export declare function defineLiveCollection(): void;
|
package/dist/content/runtime.js
CHANGED
|
@@ -700,6 +700,14 @@ function defineCollection(config) {
|
|
|
700
700
|
}
|
|
701
701
|
return defineCollectionOrig(config);
|
|
702
702
|
}
|
|
703
|
+
function defineLiveCollection() {
|
|
704
|
+
throw new AstroError({
|
|
705
|
+
...AstroErrorData.LiveContentConfigError,
|
|
706
|
+
message: AstroErrorData.LiveContentConfigError.message(
|
|
707
|
+
"Live collections must be defined in a `src/live.config.ts` file."
|
|
708
|
+
)
|
|
709
|
+
});
|
|
710
|
+
}
|
|
703
711
|
export {
|
|
704
712
|
LiveCollectionCacheHintError,
|
|
705
713
|
LiveCollectionError,
|
|
@@ -715,5 +723,6 @@ export {
|
|
|
715
723
|
createGetLiveEntry,
|
|
716
724
|
createReference,
|
|
717
725
|
defineCollection,
|
|
726
|
+
defineLiveCollection,
|
|
718
727
|
renderEntry
|
|
719
728
|
};
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -22,7 +22,7 @@ async function dev(inlineConfig) {
|
|
|
22
22
|
await telemetry.record([]);
|
|
23
23
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
24
24
|
const logger = restart.container.logger;
|
|
25
|
-
const currentVersion = "5.12.
|
|
25
|
+
const currentVersion = "5.12.2";
|
|
26
26
|
const isPrerelease = currentVersion.includes("-");
|
|
27
27
|
if (!isPrerelease) {
|
|
28
28
|
try {
|
package/dist/core/messages.js
CHANGED
|
@@ -37,7 +37,7 @@ function serverStart({
|
|
|
37
37
|
host,
|
|
38
38
|
base
|
|
39
39
|
}) {
|
|
40
|
-
const version = "5.12.
|
|
40
|
+
const version = "5.12.2";
|
|
41
41
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
42
42
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
43
43
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -274,7 +274,7 @@ function printHelp({
|
|
|
274
274
|
message.push(
|
|
275
275
|
linebreak(),
|
|
276
276
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
277
|
-
`v${"5.12.
|
|
277
|
+
`v${"5.12.2"}`
|
|
278
278
|
)} ${headline}`
|
|
279
279
|
);
|
|
280
280
|
}
|
|
@@ -8,5 +8,5 @@ export interface AstroVNode {
|
|
|
8
8
|
}
|
|
9
9
|
export declare function isVNode(vnode: any): vnode is AstroVNode;
|
|
10
10
|
export declare function transformSlots(vnode: AstroVNode): AstroVNode | undefined;
|
|
11
|
-
declare function createVNode(type: any, props
|
|
11
|
+
declare function createVNode(type: any, props?: Record<string, any>, key?: string | number): AstroVNode;
|
|
12
12
|
export { AstroJSX, Fragment, createVNode as jsx, createVNode as jsxDEV, createVNode as jsxs };
|
|
@@ -54,12 +54,15 @@ function transformSetDirectives(vnode) {
|
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
function createVNode(type, props) {
|
|
57
|
+
function createVNode(type, props = {}, key) {
|
|
58
|
+
if (key) {
|
|
59
|
+
props.key = key;
|
|
60
|
+
}
|
|
58
61
|
const vnode = {
|
|
59
62
|
[Renderer]: "astro:jsx",
|
|
60
63
|
[AstroJSX]: true,
|
|
61
64
|
type,
|
|
62
|
-
props
|
|
65
|
+
props
|
|
63
66
|
};
|
|
64
67
|
transformSetDirectives(vnode);
|
|
65
68
|
transformSlots(vnode);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BundledLanguage, LanguageRegistration, SpecialLanguage } from 'shiki';
|
|
1
2
|
import type { OmitIndexSignature, Simplify } from '../../type-utils.js';
|
|
2
3
|
import type { APIContext } from './context.js';
|
|
3
4
|
/**
|
|
@@ -136,3 +137,4 @@ export type InferGetStaticPropsType<T> = T extends (opts: GetStaticPathsOptions)
|
|
|
136
137
|
} ? P : never : never : never;
|
|
137
138
|
export type Params = Record<string, string | undefined>;
|
|
138
139
|
export type Props = Record<string, unknown>;
|
|
140
|
+
export type CodeLanguage = BundledLanguage | LanguageRegistration | SpecialLanguage;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "5.12.
|
|
3
|
+
"version": "5.12.2",
|
|
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",
|
|
@@ -158,9 +158,9 @@
|
|
|
158
158
|
"zod": "^3.24.2",
|
|
159
159
|
"zod-to-json-schema": "^3.24.5",
|
|
160
160
|
"zod-to-ts": "^1.2.0",
|
|
161
|
-
"@astrojs/markdown-remark": "6.3.3",
|
|
162
161
|
"@astrojs/internal-helpers": "0.6.1",
|
|
163
|
-
"@astrojs/telemetry": "3.3.0"
|
|
162
|
+
"@astrojs/telemetry": "3.3.0",
|
|
163
|
+
"@astrojs/markdown-remark": "6.3.3"
|
|
164
164
|
},
|
|
165
165
|
"optionalDependencies": {
|
|
166
166
|
"sharp": "^0.33.3"
|
|
@@ -11,7 +11,11 @@ import {
|
|
|
11
11
|
createReference,
|
|
12
12
|
} from 'astro/content/runtime';
|
|
13
13
|
|
|
14
|
-
export {
|
|
14
|
+
export {
|
|
15
|
+
defineCollection,
|
|
16
|
+
defineLiveCollection,
|
|
17
|
+
renderEntry as render,
|
|
18
|
+
} from 'astro/content/runtime';
|
|
15
19
|
export { z } from 'astro/zod';
|
|
16
20
|
|
|
17
21
|
/* @@LIVE_CONTENT_CONFIG@@ */
|