astro 1.4.0 → 1.4.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-base.d.ts +34 -0
- package/dist/core/dev/index.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/util.js +1 -1
- package/dist/jsx-runtime/index.d.ts +2 -1
- package/dist/jsx-runtime/index.js +2 -1
- package/dist/runtime/server/astro-global.js +1 -1
- package/dist/runtime/server/jsx.js +4 -0
- package/dist/runtime/server/render/common.js +1 -1
- package/env.d.ts +6 -33
- package/package.json +1 -1
package/client-base.d.ts
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
/// <reference path="./import-meta.d.ts" />
|
|
2
2
|
|
|
3
|
+
declare module '*.md' {
|
|
4
|
+
type MD = import('./dist/@types/astro').MarkdownInstance<Record<string, any>>;
|
|
5
|
+
|
|
6
|
+
export const frontmatter: MD['frontmatter'];
|
|
7
|
+
export const file: MD['file'];
|
|
8
|
+
export const url: MD['url'];
|
|
9
|
+
export const getHeadings: MD['getHeadings'];
|
|
10
|
+
/** @deprecated Renamed to `getHeadings()` */
|
|
11
|
+
export const getHeaders: () => void;
|
|
12
|
+
export const Content: MD['Content'];
|
|
13
|
+
export const rawContent: MD['rawContent'];
|
|
14
|
+
export const compiledContent: MD['compiledContent'];
|
|
15
|
+
|
|
16
|
+
const load: MD['default'];
|
|
17
|
+
export default load;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare module '*.mdx' {
|
|
21
|
+
type MDX = import('./dist/@types/astro').MDXInstance<Record<string, any>>;
|
|
22
|
+
|
|
23
|
+
export const frontmatter: MDX['frontmatter'];
|
|
24
|
+
export const file: MDX['file'];
|
|
25
|
+
export const url: MDX['url'];
|
|
26
|
+
export const getHeadings: MDX['getHeadings'];
|
|
27
|
+
export const Content: MDX['Content'];
|
|
28
|
+
export const rawContent: MDX['rawContent'];
|
|
29
|
+
export const compiledContent: MDX['compiledContent'];
|
|
30
|
+
|
|
31
|
+
const load: MDX['default'];
|
|
32
|
+
export default load;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Everything below are Vite's types (apart from image types, which are in `client.d.ts`)
|
|
36
|
+
|
|
3
37
|
// CSS modules
|
|
4
38
|
type CSSModuleClasses = { readonly [key: string]: string };
|
|
5
39
|
|
package/dist/core/dev/index.js
CHANGED
package/dist/core/messages.js
CHANGED
|
@@ -47,7 +47,7 @@ function serverStart({
|
|
|
47
47
|
site,
|
|
48
48
|
isRestart = false
|
|
49
49
|
}) {
|
|
50
|
-
const version = "1.4.
|
|
50
|
+
const version = "1.4.2";
|
|
51
51
|
const rootPath = site ? site.pathname : "/";
|
|
52
52
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
53
53
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
@@ -250,7 +250,7 @@ function printHelp({
|
|
|
250
250
|
message.push(
|
|
251
251
|
linebreak(),
|
|
252
252
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
253
|
-
`v${"1.4.
|
|
253
|
+
`v${"1.4.2"}`
|
|
254
254
|
)} ${headline}`
|
|
255
255
|
);
|
|
256
256
|
}
|
package/dist/core/util.js
CHANGED
|
@@ -5,7 +5,7 @@ import resolve from "resolve";
|
|
|
5
5
|
import slash from "slash";
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
7
7
|
import { prependForwardSlash, removeTrailingForwardSlash } from "./path.js";
|
|
8
|
-
const ASTRO_VERSION = "1.4.
|
|
8
|
+
const ASTRO_VERSION = "1.4.2";
|
|
9
9
|
function isObject(value) {
|
|
10
10
|
return typeof value === "object" && value != null;
|
|
11
11
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Fragment } from '../runtime/server/index.js';
|
|
1
|
+
import { Fragment, Renderer } from '../runtime/server/index.js';
|
|
2
2
|
declare const AstroJSX = "astro:jsx";
|
|
3
3
|
export interface AstroVNode {
|
|
4
|
+
[Renderer]: string;
|
|
4
5
|
[AstroJSX]: boolean;
|
|
5
6
|
type: string | ((...args: any) => any);
|
|
6
7
|
props: Record<string, any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment, markHTMLString } from "../runtime/server/index.js";
|
|
1
|
+
import { Fragment, markHTMLString, Renderer } from "../runtime/server/index.js";
|
|
2
2
|
const AstroJSX = "astro:jsx";
|
|
3
3
|
const Empty = Symbol("empty");
|
|
4
4
|
const toSlotName = (str) => str.trim().replace(/[-_]([a-z])/g, (_, w) => w.toUpperCase());
|
|
@@ -65,6 +65,7 @@ function transformSetDirectives(vnode) {
|
|
|
65
65
|
}
|
|
66
66
|
function createVNode(type, props) {
|
|
67
67
|
const vnode = {
|
|
68
|
+
[Renderer]: "astro:jsx",
|
|
68
69
|
[AstroJSX]: true,
|
|
69
70
|
type,
|
|
70
71
|
props: props ?? {}
|
|
@@ -31,6 +31,10 @@ async function renderJSX(result, vnode) {
|
|
|
31
31
|
}
|
|
32
32
|
if (isVNode(vnode)) {
|
|
33
33
|
switch (true) {
|
|
34
|
+
case !vnode.type: {
|
|
35
|
+
throw new Error(`Unable to render ${result._metadata.pathname} because it contains an undefined Component!
|
|
36
|
+
Did you forget to import the component or is it possible there is a typo?`);
|
|
37
|
+
}
|
|
34
38
|
case vnode.type === Symbol.for("astro:fragment"):
|
|
35
39
|
return renderJSX(result, vnode.props.children);
|
|
36
40
|
case vnode.type.isAstroComponentFactory: {
|
package/env.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
/// <reference path="./client.d.ts" />
|
|
2
2
|
|
|
3
|
+
// Caution! The types here are only available inside Astro files (injected automatically by our language server)
|
|
4
|
+
// As such, if the typings you're trying to add should be available inside ex: React components, they should instead
|
|
5
|
+
// be inside `client-base.d.ts`
|
|
6
|
+
|
|
3
7
|
type Astro = import('./dist/@types/astro').AstroGlobal;
|
|
4
8
|
|
|
5
|
-
// We duplicate the description here because editors won't show the JSDoc comment from the imported type
|
|
9
|
+
// We have to duplicate the description here because editors won't show the JSDoc comment from the imported type
|
|
10
|
+
// However, they will for its properties, ex: Astro.request will show the AstroGlobal.request description
|
|
6
11
|
/**
|
|
7
12
|
* Astro global available in all contexts in .astro files
|
|
8
13
|
*
|
|
@@ -12,38 +17,6 @@ declare const Astro: Readonly<Astro>;
|
|
|
12
17
|
|
|
13
18
|
declare const Fragment: any;
|
|
14
19
|
|
|
15
|
-
declare module '*.md' {
|
|
16
|
-
type MD = import('./dist/@types/astro').MarkdownInstance<Record<string, any>>;
|
|
17
|
-
|
|
18
|
-
export const frontmatter: MD['frontmatter'];
|
|
19
|
-
export const file: MD['file'];
|
|
20
|
-
export const url: MD['url'];
|
|
21
|
-
export const getHeadings: MD['getHeadings'];
|
|
22
|
-
/** @deprecated Renamed to `getHeadings()` */
|
|
23
|
-
export const getHeaders: () => void;
|
|
24
|
-
export const Content: MD['Content'];
|
|
25
|
-
export const rawContent: MD['rawContent'];
|
|
26
|
-
export const compiledContent: MD['compiledContent'];
|
|
27
|
-
|
|
28
|
-
const load: MD['default'];
|
|
29
|
-
export default load;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
declare module '*.mdx' {
|
|
33
|
-
type MDX = import('./dist/@types/astro').MDXInstance<Record<string, any>>;
|
|
34
|
-
|
|
35
|
-
export const frontmatter: MDX['frontmatter'];
|
|
36
|
-
export const file: MDX['file'];
|
|
37
|
-
export const url: MDX['url'];
|
|
38
|
-
export const getHeadings: MDX['getHeadings'];
|
|
39
|
-
export const Content: MDX['Content'];
|
|
40
|
-
export const rawContent: MDX['rawContent'];
|
|
41
|
-
export const compiledContent: MDX['compiledContent'];
|
|
42
|
-
|
|
43
|
-
const load: MDX['default'];
|
|
44
|
-
export default load;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
20
|
declare module '*.html' {
|
|
48
21
|
const Component: { render(opts: { slots: Record<string, string> }): string };
|
|
49
22
|
export default Component;
|