astro 1.0.0-beta.7 → 1.0.0-beta.8
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/cli/index.js +1 -2
- package/dist/core/app/index.js +1 -1
- package/dist/core/build/generate.js +1 -2
- package/dist/core/build/vite-plugin-ssr.js +1 -4
- package/dist/core/config.js +22 -7
- package/dist/core/dev/index.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/render/core.js +2 -2
- package/dist/core/render/dev/index.js +1 -2
- package/dist/core/render/result.js +8 -17
- package/dist/types/@types/astro.d.ts +18 -11
- package/dist/types/core/app/types.d.ts +3 -4
- package/dist/types/core/config.d.ts +55 -25
- package/dist/types/core/render/core.d.ts +3 -2
- package/dist/types/core/render/result.d.ts +3 -2
- package/dist/vite-plugin-astro-server/index.js +2 -1
- package/dist/vite-plugin-markdown/index.js +2 -3
- package/package.json +4 -2
package/dist/cli/index.js
CHANGED
|
@@ -30,7 +30,6 @@ function printAstroHelp() {
|
|
|
30
30
|
["--config <path>", "Specify the path to the Astro config file."],
|
|
31
31
|
["--root <path>", "Specify the path to the project root folder."],
|
|
32
32
|
["--legacy-build", "Use the build strategy prior to 0.24.0"],
|
|
33
|
-
["--experimental-ssr", "Enable SSR compilation fot 3rd-party adapters."],
|
|
34
33
|
["--drafts", "Include markdown draft pages in the build."],
|
|
35
34
|
["--verbose", "Enable verbose logging"],
|
|
36
35
|
["--silent", "Disable logging"]
|
|
@@ -38,7 +37,7 @@ function printAstroHelp() {
|
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
39
|
async function printVersion() {
|
|
41
|
-
const version = "1.0.0-beta.
|
|
40
|
+
const version = "1.0.0-beta.8";
|
|
42
41
|
console.log();
|
|
43
42
|
console.log(` ${colors.bgGreen(colors.black(` astro `))} ${colors.green(`v${version}`)}`);
|
|
44
43
|
}
|
package/dist/core/app/index.js
CHANGED
|
@@ -95,7 +95,7 @@ renderPage_fn = async function(request, routeData, mod) {
|
|
|
95
95
|
legacyBuild: false,
|
|
96
96
|
links,
|
|
97
97
|
logging: __privateGet(this, _logging),
|
|
98
|
-
|
|
98
|
+
markdown: manifest.markdown,
|
|
99
99
|
mod,
|
|
100
100
|
origin: url.origin,
|
|
101
101
|
pathname: url.pathname,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import astroRemark from "@astrojs/markdown-remark";
|
|
2
1
|
import fs from "fs";
|
|
3
2
|
import { bgGreen, black, cyan, dim, green, magenta } from "kleur/colors";
|
|
4
3
|
import npath from "path";
|
|
@@ -122,7 +121,7 @@ async function generatePath(pathname, opts, gopts) {
|
|
|
122
121
|
legacyBuild: false,
|
|
123
122
|
links,
|
|
124
123
|
logging,
|
|
125
|
-
|
|
124
|
+
markdown: astroConfig.markdown,
|
|
126
125
|
mod,
|
|
127
126
|
origin,
|
|
128
127
|
pathname,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import astroRemark from "@astrojs/markdown-remark";
|
|
2
1
|
import { serializeRouteData } from "../routing/index.js";
|
|
3
2
|
import { eachPageData } from "./internal.js";
|
|
4
3
|
import { addRollupInput } from "./add-rollup-input.js";
|
|
@@ -83,9 +82,7 @@ function buildManifest(opts, internals) {
|
|
|
83
82
|
const ssrManifest = {
|
|
84
83
|
routes,
|
|
85
84
|
site: astroConfig.site,
|
|
86
|
-
markdown:
|
|
87
|
-
render: [astroRemark, astroConfig.markdown]
|
|
88
|
-
},
|
|
85
|
+
markdown: astroConfig.markdown,
|
|
89
86
|
pageMap: null,
|
|
90
87
|
renderers: [],
|
|
91
88
|
entryModules
|
package/dist/core/config.js
CHANGED
|
@@ -21,6 +21,7 @@ import * as colors from "kleur/colors";
|
|
|
21
21
|
import path from "path";
|
|
22
22
|
import { pathToFileURL, fileURLToPath } from "url";
|
|
23
23
|
import { mergeConfig as mergeViteConfig } from "vite";
|
|
24
|
+
import { BUNDLED_THEMES } from "shiki";
|
|
24
25
|
import { z } from "zod";
|
|
25
26
|
import load, { ProloadError } from "@proload/core";
|
|
26
27
|
import loadTypeScript from "@proload/plugin-tsm";
|
|
@@ -88,13 +89,27 @@ const AstroConfigSchema = z.object({
|
|
|
88
89
|
}).optional().default({ options: {}, plugins: [] })
|
|
89
90
|
}).optional().default({}),
|
|
90
91
|
markdown: z.object({
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
syntaxHighlight: z.union([z.literal("shiki"), z.literal("prism"), z.literal(false)]).
|
|
94
|
-
shikiConfig: z.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
mode: z.enum(["md", "mdx"]).default("mdx"),
|
|
93
|
+
drafts: z.boolean().default(false),
|
|
94
|
+
syntaxHighlight: z.union([z.literal("shiki"), z.literal("prism"), z.literal(false)]).default("shiki"),
|
|
95
|
+
shikiConfig: z.object({
|
|
96
|
+
langs: z.custom().array().default([]),
|
|
97
|
+
theme: z.enum(BUNDLED_THEMES).or(z.custom()).default("github-dark"),
|
|
98
|
+
wrap: z.boolean().or(z.null()).default(false)
|
|
99
|
+
}).default({}),
|
|
100
|
+
remarkPlugins: z.union([
|
|
101
|
+
z.string(),
|
|
102
|
+
z.tuple([z.string(), z.any()]),
|
|
103
|
+
z.custom((data) => typeof data === "function"),
|
|
104
|
+
z.tuple([z.custom((data) => typeof data === "function"), z.any()])
|
|
105
|
+
]).array().default([]),
|
|
106
|
+
rehypePlugins: z.union([
|
|
107
|
+
z.string(),
|
|
108
|
+
z.tuple([z.string(), z.any()]),
|
|
109
|
+
z.custom((data) => typeof data === "function"),
|
|
110
|
+
z.tuple([z.custom((data) => typeof data === "function"), z.any()])
|
|
111
|
+
]).array().default([])
|
|
112
|
+
}).default({}),
|
|
98
113
|
vite: z.any().optional().default({}),
|
|
99
114
|
experimental: z.object({
|
|
100
115
|
ssr: z.boolean().optional().default(false),
|
package/dist/core/dev/index.js
CHANGED
|
@@ -36,7 +36,7 @@ async function dev(config, options = { logging: nodeLogOptions }) {
|
|
|
36
36
|
site,
|
|
37
37
|
https: !!((_a = viteConfig.server) == null ? void 0 : _a.https)
|
|
38
38
|
}));
|
|
39
|
-
const currentVersion = "1.0.0-beta.
|
|
39
|
+
const currentVersion = "1.0.0-beta.8";
|
|
40
40
|
if (currentVersion.includes("-")) {
|
|
41
41
|
warn(options.logging, null, msg.prerelease({ currentVersion }));
|
|
42
42
|
}
|
package/dist/core/messages.js
CHANGED
|
@@ -45,7 +45,7 @@ function devStart({
|
|
|
45
45
|
https,
|
|
46
46
|
site
|
|
47
47
|
}) {
|
|
48
|
-
const version = "1.0.0-beta.
|
|
48
|
+
const version = "1.0.0-beta.8";
|
|
49
49
|
const rootPath = site ? site.pathname : "/";
|
|
50
50
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
51
51
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
@@ -170,7 +170,7 @@ function printHelp({
|
|
|
170
170
|
};
|
|
171
171
|
let message = [];
|
|
172
172
|
if (headline) {
|
|
173
|
-
message.push(linebreak(), ` ${bgGreen(black(` ${commandName} `))} ${green(`v${"1.0.0-beta.
|
|
173
|
+
message.push(linebreak(), ` ${bgGreen(black(` ${commandName} `))} ${green(`v${"1.0.0-beta.8"}`)} ${headline}`);
|
|
174
174
|
}
|
|
175
175
|
if (usage) {
|
|
176
176
|
message.push(linebreak(), ` ${green(commandName)} ${bold(usage)}`);
|
package/dist/core/render/core.js
CHANGED
|
@@ -54,7 +54,7 @@ async function render(opts) {
|
|
|
54
54
|
links,
|
|
55
55
|
logging,
|
|
56
56
|
origin,
|
|
57
|
-
|
|
57
|
+
markdown,
|
|
58
58
|
mod,
|
|
59
59
|
pathname,
|
|
60
60
|
scripts,
|
|
@@ -87,7 +87,7 @@ async function render(opts) {
|
|
|
87
87
|
legacyBuild,
|
|
88
88
|
links,
|
|
89
89
|
logging,
|
|
90
|
-
|
|
90
|
+
markdown,
|
|
91
91
|
origin,
|
|
92
92
|
params,
|
|
93
93
|
pathname,
|
|
@@ -17,7 +17,6 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import astroRemark from "@astrojs/markdown-remark";
|
|
21
20
|
import { fileURLToPath } from "url";
|
|
22
21
|
import { render as coreRender } from "../core.js";
|
|
23
22
|
import { prependForwardSlash } from "../../../core/path.js";
|
|
@@ -105,7 +104,7 @@ async function render(renderers, mod, ssrOpts) {
|
|
|
105
104
|
legacyBuild: isLegacyBuild,
|
|
106
105
|
links,
|
|
107
106
|
logging,
|
|
108
|
-
|
|
107
|
+
markdown: astroConfig.markdown,
|
|
109
108
|
mod,
|
|
110
109
|
origin,
|
|
111
110
|
pathname,
|
|
@@ -105,8 +105,9 @@ Please update the name of this slot.`);
|
|
|
105
105
|
_cache = new WeakMap();
|
|
106
106
|
_result = new WeakMap();
|
|
107
107
|
_slots = new WeakMap();
|
|
108
|
+
let renderMarkdown = null;
|
|
108
109
|
function createResult(args) {
|
|
109
|
-
const { legacyBuild,
|
|
110
|
+
const { legacyBuild, markdown, params, pathname, renderers, request, resolve, site } = args;
|
|
110
111
|
const url = new URL(request.url);
|
|
111
112
|
const canonicalURL = createCanonicalURL("." + pathname, site ?? url.origin);
|
|
112
113
|
const result = {
|
|
@@ -162,24 +163,14 @@ ${extra}`);
|
|
|
162
163
|
enumerable: false,
|
|
163
164
|
writable: false,
|
|
164
165
|
value: async function(content, opts) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if (Array.isArray(mdRender)) {
|
|
168
|
-
renderOpts = mdRender[1];
|
|
169
|
-
mdRender = mdRender[0];
|
|
166
|
+
if (typeof Deno !== "undefined") {
|
|
167
|
+
throw new Error("Markdown is not supported in Deno SSR");
|
|
170
168
|
}
|
|
171
|
-
if (
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
} else if (mdRender instanceof Promise) {
|
|
175
|
-
const mod = await mdRender;
|
|
176
|
-
parser = mod.default;
|
|
177
|
-
} else if (typeof mdRender === "function") {
|
|
178
|
-
parser = mdRender;
|
|
179
|
-
} else {
|
|
180
|
-
throw new Error("No Markdown parser found.");
|
|
169
|
+
if (!renderMarkdown) {
|
|
170
|
+
let astroRemark = "@astrojs/markdown-remark";
|
|
171
|
+
renderMarkdown = (await import(astroRemark)).renderMarkdown;
|
|
181
172
|
}
|
|
182
|
-
const { code } = await
|
|
173
|
+
const { code } = await renderMarkdown(content, __spreadValues(__spreadValues({}, markdown), opts ?? {}));
|
|
183
174
|
return code;
|
|
184
175
|
}
|
|
185
176
|
});
|
|
@@ -3,7 +3,7 @@ import type { AddressInfo } from 'net';
|
|
|
3
3
|
import type * as babel from '@babel/core';
|
|
4
4
|
import type * as vite from 'vite';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import type { ShikiConfig,
|
|
6
|
+
import type { ShikiConfig, RemarkPlugins, RehypePlugins } from '@astrojs/markdown-remark';
|
|
7
7
|
import type { AstroConfigSchema } from '../core/config';
|
|
8
8
|
import type { AstroComponentFactory, Metadata } from '../runtime/server';
|
|
9
9
|
import type { ViteConfigWithSSR } from '../core/create-vite';
|
|
@@ -455,14 +455,23 @@ export interface AstroUserConfig {
|
|
|
455
455
|
* ```
|
|
456
456
|
*/
|
|
457
457
|
drafts?: boolean;
|
|
458
|
+
/**
|
|
459
|
+
* @docs
|
|
460
|
+
* @name markdown.mode
|
|
461
|
+
* @type {'md' | 'mdx'}
|
|
462
|
+
* @default `mdx`
|
|
463
|
+
* @description
|
|
464
|
+
* Control wheater to allow components inside markdown files ('mdx') or not ('md').
|
|
465
|
+
*/
|
|
466
|
+
mode?: 'md' | 'mdx';
|
|
458
467
|
/**
|
|
459
468
|
* @docs
|
|
460
469
|
* @name markdown.shikiConfig
|
|
461
|
-
* @
|
|
470
|
+
* @typeraw {Partial<ShikiConfig>}
|
|
462
471
|
* @description
|
|
463
472
|
* Shiki configuration options. See [the markdown configuration docs](https://docs.astro.build/en/guides/markdown-content/#shiki-configuration) for usage.
|
|
464
473
|
*/
|
|
465
|
-
shikiConfig?: ShikiConfig
|
|
474
|
+
shikiConfig?: Partial<ShikiConfig>;
|
|
466
475
|
/**
|
|
467
476
|
* @docs
|
|
468
477
|
* @name markdown.syntaxHighlight
|
|
@@ -487,7 +496,7 @@ export interface AstroUserConfig {
|
|
|
487
496
|
/**
|
|
488
497
|
* @docs
|
|
489
498
|
* @name markdown.remarkPlugins
|
|
490
|
-
* @type {
|
|
499
|
+
* @type {RemarkPlugins}
|
|
491
500
|
* @description
|
|
492
501
|
* Pass a custom [Remark](https://github.com/remarkjs/remark) plugin to customize how your Markdown is built.
|
|
493
502
|
*
|
|
@@ -502,11 +511,11 @@ export interface AstroUserConfig {
|
|
|
502
511
|
* };
|
|
503
512
|
* ```
|
|
504
513
|
*/
|
|
505
|
-
remarkPlugins?:
|
|
514
|
+
remarkPlugins?: RemarkPlugins;
|
|
506
515
|
/**
|
|
507
516
|
* @docs
|
|
508
517
|
* @name markdown.rehypePlugins
|
|
509
|
-
* @type {
|
|
518
|
+
* @type {RehypePlugins}
|
|
510
519
|
* @description
|
|
511
520
|
* Pass a custom [Rehype](https://github.com/remarkjs/remark-rehype) plugin to customize how your Markdown is built.
|
|
512
521
|
*
|
|
@@ -521,7 +530,7 @@ export interface AstroUserConfig {
|
|
|
521
530
|
* };
|
|
522
531
|
* ```
|
|
523
532
|
*/
|
|
524
|
-
rehypePlugins?:
|
|
533
|
+
rehypePlugins?: RehypePlugins;
|
|
525
534
|
};
|
|
526
535
|
/**
|
|
527
536
|
* @name adapter
|
|
@@ -588,12 +597,12 @@ export interface AstroUserConfig {
|
|
|
588
597
|
};
|
|
589
598
|
experimental?: {
|
|
590
599
|
/**
|
|
591
|
-
* Enable
|
|
600
|
+
* Enable support for 3rd-party integrations.
|
|
592
601
|
* Default: false
|
|
593
602
|
*/
|
|
594
603
|
integrations?: boolean;
|
|
595
604
|
/**
|
|
596
|
-
* Enable
|
|
605
|
+
* Enable support for 3rd-party SSR adapters.
|
|
597
606
|
* Default: false
|
|
598
607
|
*/
|
|
599
608
|
ssr?: boolean;
|
|
@@ -697,8 +706,6 @@ export declare type JSXTransformFn = (options: {
|
|
|
697
706
|
export interface ManifestData {
|
|
698
707
|
routes: RouteData[];
|
|
699
708
|
}
|
|
700
|
-
export declare type MarkdownRenderOptions = [string | MarkdownParser, Record<string, any>];
|
|
701
|
-
export declare type MarkdownParser = (contents: string, options?: Record<string, any>) => MarkdownParserResponse | PromiseLike<MarkdownParserResponse>;
|
|
702
709
|
export interface MarkdownParserResponse {
|
|
703
710
|
frontmatter: {
|
|
704
711
|
[key: string]: any;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { RouteData, SerializedRouteData,
|
|
1
|
+
import type { RouteData, SerializedRouteData, ComponentInstance, SSRLoadedRenderer } from '../../@types/astro';
|
|
2
|
+
import type { MarkdownRenderingOptions } from '@astrojs/markdown-remark';
|
|
2
3
|
export declare type ComponentPath = string;
|
|
3
4
|
export interface RouteInfo {
|
|
4
5
|
routeData: RouteData;
|
|
@@ -12,9 +13,7 @@ export declare type SerializedRouteInfo = Omit<RouteInfo, 'routeData'> & {
|
|
|
12
13
|
export interface SSRManifest {
|
|
13
14
|
routes: RouteInfo[];
|
|
14
15
|
site?: string;
|
|
15
|
-
markdown:
|
|
16
|
-
render: MarkdownRenderOptions;
|
|
17
|
-
};
|
|
16
|
+
markdown: MarkdownRenderingOptions;
|
|
18
17
|
pageMap: Map<ComponentPath, ComponentInstance>;
|
|
19
18
|
renderers: SSRLoadedRenderer[];
|
|
20
19
|
entryModules: Record<string, string>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { AstroConfig, AstroUserConfig, CLIFlags } from '../@types/astro';
|
|
2
2
|
import type { Arguments as Flags } from 'yargs-parser';
|
|
3
|
+
import type { ILanguageRegistration, IThemeRegistration, Theme } from 'shiki';
|
|
4
|
+
import type { RemarkPlugin, RehypePlugin } from '@astrojs/markdown-remark';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
export declare const LEGACY_ASTRO_CONFIG_KEYS: Set<string>;
|
|
5
7
|
export declare const AstroConfigSchema: z.ZodObject<{
|
|
@@ -81,28 +83,48 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
81
83
|
plugins: any[];
|
|
82
84
|
} | undefined;
|
|
83
85
|
}>>>;
|
|
84
|
-
markdown: z.ZodDefault<z.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
syntaxHighlight: z.ZodDefault<z.
|
|
88
|
-
shikiConfig: z.ZodDefault<z.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
markdown: z.ZodDefault<z.ZodObject<{
|
|
87
|
+
mode: z.ZodDefault<z.ZodEnum<["md", "mdx"]>>;
|
|
88
|
+
drafts: z.ZodDefault<z.ZodBoolean>;
|
|
89
|
+
syntaxHighlight: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"shiki">, z.ZodLiteral<"prism">, z.ZodLiteral<false>]>>;
|
|
90
|
+
shikiConfig: z.ZodDefault<z.ZodObject<{
|
|
91
|
+
langs: z.ZodDefault<z.ZodArray<z.ZodType<ILanguageRegistration, z.ZodTypeDef, ILanguageRegistration>, "many">>;
|
|
92
|
+
theme: z.ZodDefault<z.ZodUnion<[z.ZodEnum<[Theme, ...Theme[]]>, z.ZodType<IThemeRegistration, z.ZodTypeDef, IThemeRegistration>]>>;
|
|
93
|
+
wrap: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
|
|
94
|
+
}, "strip", z.ZodTypeAny, {
|
|
95
|
+
langs: ILanguageRegistration[];
|
|
96
|
+
theme: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {});
|
|
97
|
+
wrap: boolean | null;
|
|
98
|
+
}, {
|
|
99
|
+
langs?: ILanguageRegistration[] | undefined;
|
|
100
|
+
theme?: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {}) | undefined;
|
|
101
|
+
wrap?: boolean | null | undefined;
|
|
102
|
+
}>>;
|
|
103
|
+
remarkPlugins: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodAny], null>, z.ZodType<RemarkPlugin<any[]>, z.ZodTypeDef, RemarkPlugin<any[]>>, z.ZodTuple<[z.ZodType<RemarkPlugin<any[]>, z.ZodTypeDef, RemarkPlugin<any[]>>, z.ZodAny], null>]>, "many">>;
|
|
104
|
+
rehypePlugins: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodAny], null>, z.ZodType<RehypePlugin<any[]>, z.ZodTypeDef, RehypePlugin<any[]>>, z.ZodTuple<[z.ZodType<RehypePlugin<any[]>, z.ZodTypeDef, RehypePlugin<any[]>>, z.ZodAny], null>]>, "many">>;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
106
|
mode: "md" | "mdx";
|
|
107
|
+
drafts: boolean;
|
|
95
108
|
syntaxHighlight: false | "shiki" | "prism";
|
|
96
|
-
|
|
97
|
-
|
|
109
|
+
shikiConfig: {
|
|
110
|
+
langs: ILanguageRegistration[];
|
|
111
|
+
theme: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {});
|
|
112
|
+
wrap: boolean | null;
|
|
113
|
+
};
|
|
114
|
+
remarkPlugins: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[];
|
|
115
|
+
rehypePlugins: (string | [string, any] | RehypePlugin<any[]> | [RehypePlugin<any[]>, any])[];
|
|
98
116
|
}, {
|
|
99
|
-
drafts?: boolean | undefined;
|
|
100
117
|
mode?: "md" | "mdx" | undefined;
|
|
118
|
+
drafts?: boolean | undefined;
|
|
101
119
|
syntaxHighlight?: false | "shiki" | "prism" | undefined;
|
|
102
|
-
shikiConfig?:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
120
|
+
shikiConfig?: {
|
|
121
|
+
langs?: ILanguageRegistration[] | undefined;
|
|
122
|
+
theme?: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {}) | undefined;
|
|
123
|
+
wrap?: boolean | null | undefined;
|
|
124
|
+
} | undefined;
|
|
125
|
+
remarkPlugins?: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[] | undefined;
|
|
126
|
+
rehypePlugins?: (string | [string, any] | RehypePlugin<any[]> | [RehypePlugin<any[]>, any])[] | undefined;
|
|
127
|
+
}>>;
|
|
106
128
|
vite: z.ZodDefault<z.ZodOptional<z.ZodAny>>;
|
|
107
129
|
experimental: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
108
130
|
ssr: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -145,12 +167,16 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
145
167
|
};
|
|
146
168
|
};
|
|
147
169
|
markdown: {
|
|
148
|
-
shikiConfig?: any;
|
|
149
|
-
drafts: boolean;
|
|
150
170
|
mode: "md" | "mdx";
|
|
171
|
+
drafts: boolean;
|
|
151
172
|
syntaxHighlight: false | "shiki" | "prism";
|
|
152
|
-
|
|
153
|
-
|
|
173
|
+
shikiConfig: {
|
|
174
|
+
langs: ILanguageRegistration[];
|
|
175
|
+
theme: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {});
|
|
176
|
+
wrap: boolean | null;
|
|
177
|
+
};
|
|
178
|
+
remarkPlugins: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[];
|
|
179
|
+
rehypePlugins: (string | [string, any] | RehypePlugin<any[]> | [RehypePlugin<any[]>, any])[];
|
|
154
180
|
};
|
|
155
181
|
experimental: {
|
|
156
182
|
integrations: boolean;
|
|
@@ -186,12 +212,16 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
186
212
|
} | undefined;
|
|
187
213
|
} | undefined;
|
|
188
214
|
markdown?: {
|
|
189
|
-
drafts?: boolean | undefined;
|
|
190
215
|
mode?: "md" | "mdx" | undefined;
|
|
216
|
+
drafts?: boolean | undefined;
|
|
191
217
|
syntaxHighlight?: false | "shiki" | "prism" | undefined;
|
|
192
|
-
shikiConfig?:
|
|
193
|
-
|
|
194
|
-
|
|
218
|
+
shikiConfig?: {
|
|
219
|
+
langs?: ILanguageRegistration[] | undefined;
|
|
220
|
+
theme?: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "light-plus" | "material-darker" | "material-default" | "material-lighter" | "material-ocean" | "material-palenight" | "min-dark" | "min-light" | "monokai" | "nord" | "one-dark-pro" | "poimandres" | "rose-pine-dawn" | "rose-pine-moon" | "rose-pine" | "slack-dark" | "slack-ochin" | "solarized-dark" | "solarized-light" | "vitesse-dark" | "vitesse-light" | import("shiki").IShikiTheme | (string & {}) | undefined;
|
|
221
|
+
wrap?: boolean | null | undefined;
|
|
222
|
+
} | undefined;
|
|
223
|
+
remarkPlugins?: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[] | undefined;
|
|
224
|
+
rehypePlugins?: (string | [string, any] | RehypePlugin<any[]> | [RehypePlugin<any[]>, any])[] | undefined;
|
|
195
225
|
} | undefined;
|
|
196
226
|
vite?: any;
|
|
197
227
|
experimental?: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ComponentInstance,
|
|
1
|
+
import type { ComponentInstance, Params, Props, SSRLoadedRenderer, RouteData, SSRElement } from '../../@types/astro';
|
|
2
|
+
import type { MarkdownRenderingOptions } from '@astrojs/markdown-remark';
|
|
2
3
|
import type { LogOptions } from '../logger/core.js';
|
|
3
4
|
import { RouteCache } from './route-cache.js';
|
|
4
5
|
interface GetParamsAndPropsOptions {
|
|
@@ -17,7 +18,7 @@ export interface RenderOptions {
|
|
|
17
18
|
legacyBuild: boolean;
|
|
18
19
|
logging: LogOptions;
|
|
19
20
|
links: Set<SSRElement>;
|
|
20
|
-
|
|
21
|
+
markdown: MarkdownRenderingOptions;
|
|
21
22
|
mod: ComponentInstance;
|
|
22
23
|
origin: string;
|
|
23
24
|
pathname: string;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Params, SSRElement, SSRLoadedRenderer, SSRResult } from '../../@types/astro';
|
|
2
|
+
import type { MarkdownRenderingOptions } from '@astrojs/markdown-remark';
|
|
2
3
|
import { LogOptions } from '../logger/core.js';
|
|
3
4
|
export interface CreateResultArgs {
|
|
4
5
|
ssr: boolean;
|
|
5
6
|
legacyBuild: boolean;
|
|
6
7
|
logging: LogOptions;
|
|
7
8
|
origin: string;
|
|
8
|
-
|
|
9
|
+
markdown: MarkdownRenderingOptions;
|
|
9
10
|
params: Params;
|
|
10
11
|
pathname: string;
|
|
11
12
|
renderers: SSRLoadedRenderer[];
|
|
@@ -117,7 +117,8 @@ async function handleRequest(routeCache, viteServer, logging, manifest, config,
|
|
|
117
117
|
const pathname = decodeURI(url.pathname);
|
|
118
118
|
const rootRelativeUrl = pathname.substring(devRoot.length - 1);
|
|
119
119
|
if (!buildingToSSR) {
|
|
120
|
-
|
|
120
|
+
const allSearchParams = Array.from(url.searchParams);
|
|
121
|
+
for (const [key] of allSearchParams) {
|
|
121
122
|
url.searchParams.delete(key);
|
|
122
123
|
}
|
|
123
124
|
}
|
|
@@ -26,7 +26,7 @@ var __objRest = (source, exclude) => {
|
|
|
26
26
|
}
|
|
27
27
|
return target;
|
|
28
28
|
};
|
|
29
|
-
import
|
|
29
|
+
import { renderMarkdown } from "@astrojs/markdown-remark";
|
|
30
30
|
import { transform } from "@astrojs/compiler";
|
|
31
31
|
import ancestor from "common-ancestor-path";
|
|
32
32
|
import esbuild from "esbuild";
|
|
@@ -110,14 +110,13 @@ function markdown({ config }) {
|
|
|
110
110
|
}
|
|
111
111
|
if (id.endsWith(".md")) {
|
|
112
112
|
const source = await fs.promises.readFile(id, "utf8");
|
|
113
|
-
const render = astroRemark;
|
|
114
113
|
const renderOpts = config.markdown;
|
|
115
114
|
const filename = normalizeFilename(id);
|
|
116
115
|
const fileUrl = new URL(`file://${filename}`);
|
|
117
116
|
const isPage = fileUrl.pathname.startsWith(resolvePages(config).pathname);
|
|
118
117
|
const hasInjectedScript = isPage && config._ctx.scripts.some((s) => s.stage === "page-ssr");
|
|
119
118
|
const { data: frontmatter, content: markdownContent } = matter(source);
|
|
120
|
-
let renderResult = await
|
|
119
|
+
let renderResult = await renderMarkdown(markdownContent, renderOpts);
|
|
121
120
|
let { code: astroResult, metadata } = renderResult;
|
|
122
121
|
const _a = frontmatter, { layout = "", components = "", setup = "" } = _a, content = __objRest(_a, ["layout", "components", "setup"]);
|
|
123
122
|
content.astro = metadata;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.8",
|
|
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",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@astrojs/compiler": "^0.14.1",
|
|
79
79
|
"@astrojs/language-server": "^0.13.4",
|
|
80
|
-
"@astrojs/markdown-remark": "^0.8.
|
|
80
|
+
"@astrojs/markdown-remark": "^0.8.2",
|
|
81
81
|
"@astrojs/prism": "0.4.1",
|
|
82
82
|
"@astrojs/webapi": "^0.11.0",
|
|
83
83
|
"@babel/core": "^7.17.9",
|
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
"execa": "^6.1.0",
|
|
101
101
|
"fast-glob": "^3.2.11",
|
|
102
102
|
"fast-xml-parser": "^4.0.7",
|
|
103
|
+
"gray-matter": "^4.0.3",
|
|
103
104
|
"html-entities": "^2.3.3",
|
|
104
105
|
"html-escaper": "^3.0.3",
|
|
105
106
|
"htmlparser2": "^7.2.0",
|
|
@@ -156,6 +157,7 @@
|
|
|
156
157
|
"@types/resolve": "^1.20.1",
|
|
157
158
|
"@types/rimraf": "^3.0.2",
|
|
158
159
|
"@types/send": "^0.17.1",
|
|
160
|
+
"@types/unist": "^2.0.6",
|
|
159
161
|
"@types/yargs-parser": "^21.0.0",
|
|
160
162
|
"astro-scripts": "workspace:*",
|
|
161
163
|
"chai": "^4.3.6",
|