astro 1.1.1 → 1.1.4
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/astro-jsx.d.ts +2 -1
- package/components/Code.astro +0 -5
- package/components/Shiki.js +20 -1
- package/config.d.ts +1 -1
- package/dist/core/add/index.js +11 -11
- package/dist/core/build/generate.js +20 -1
- package/dist/core/build/index.js +1 -2
- package/dist/core/build/internal.d.ts +5 -1
- package/dist/core/build/internal.js +8 -5
- package/dist/core/build/static-build.js +4 -7
- package/dist/core/build/vite-plugin-css.js +15 -2
- package/dist/core/config.d.ts +6 -6
- package/dist/core/create-vite.js +1 -0
- package/dist/core/dev/index.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/path.d.ts +1 -0
- package/dist/core/path.js +5 -0
- package/dist/core/render/dev/vite.d.ts +1 -1
- package/dist/core/render/dev/vite.js +6 -3
- package/dist/core/util.js +1 -1
- package/dist/runtime/server/astro-global.js +1 -1
- package/dist/vite-plugin-astro-server/index.js +0 -13
- package/package.json +4 -4
package/astro-jsx.d.ts
CHANGED
|
@@ -1007,7 +1007,7 @@ declare namespace astroHTML.JSX {
|
|
|
1007
1007
|
// - "string"
|
|
1008
1008
|
// - union of string literals
|
|
1009
1009
|
interface SVGAttributes extends AriaAttributes, DOMAttributes, AstroBuiltinAttributes {
|
|
1010
|
-
// Attributes which also defined in HTMLAttributes
|
|
1010
|
+
// Attributes which are also defined in HTMLAttributes
|
|
1011
1011
|
class?: string | undefined | null;
|
|
1012
1012
|
color?: string | undefined | null;
|
|
1013
1013
|
height?: number | string | undefined | null;
|
|
@@ -1018,6 +1018,7 @@ declare namespace astroHTML.JSX {
|
|
|
1018
1018
|
method?: string | undefined | null;
|
|
1019
1019
|
min?: number | string | undefined | null;
|
|
1020
1020
|
name?: string | undefined | null;
|
|
1021
|
+
slot?: string | undefined | null;
|
|
1021
1022
|
style?: string | Record<string, any> | undefined | null;
|
|
1022
1023
|
target?: string | undefined | null;
|
|
1023
1024
|
type?: string | undefined | null;
|
package/components/Code.astro
CHANGED
|
@@ -38,11 +38,6 @@ const { code, lang = 'plaintext', theme = 'github-dark', wrap = false } = Astro.
|
|
|
38
38
|
function repairShikiTheme(html: string): string {
|
|
39
39
|
// Replace "shiki" class naming with "astro"
|
|
40
40
|
html = html.replace('<pre class="shiki"', '<pre class="astro-code"');
|
|
41
|
-
// Replace "shiki" css variable naming with "astro".
|
|
42
|
-
html = html.replace(
|
|
43
|
-
/style="(background-)?color: var\(--shiki-/g,
|
|
44
|
-
'style="$1color: var(--astro-code-'
|
|
45
|
-
);
|
|
46
41
|
// Handle code wrapping
|
|
47
42
|
// if wrap=null, do nothing.
|
|
48
43
|
if (wrap === false) {
|
package/components/Shiki.js
CHANGED
|
@@ -8,6 +8,10 @@ function stringify(opts) {
|
|
|
8
8
|
return JSON.stringify(opts, Object.keys(opts).sort());
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @param {import('shiki').HighlighterOptions} opts
|
|
13
|
+
* @returns {Promise<import('shiki').Highlighter>}
|
|
14
|
+
*/
|
|
11
15
|
export function getHighlighter(opts) {
|
|
12
16
|
const key = stringify(opts);
|
|
13
17
|
|
|
@@ -17,7 +21,22 @@ export function getHighlighter(opts) {
|
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
// Start the async getHighlighter call and cache the Promise
|
|
20
|
-
const highlighter = getShikiHighlighter(opts)
|
|
24
|
+
const highlighter = getShikiHighlighter(opts).then((hl) => {
|
|
25
|
+
hl.setColorReplacements({
|
|
26
|
+
'#000001': 'var(--astro-code-color-text)',
|
|
27
|
+
'#000002': 'var(--astro-code-color-background)',
|
|
28
|
+
'#000004': 'var(--astro-code-token-constant)',
|
|
29
|
+
'#000005': 'var(--astro-code-token-string)',
|
|
30
|
+
'#000006': 'var(--astro-code-token-comment)',
|
|
31
|
+
'#000007': 'var(--astro-code-token-keyword)',
|
|
32
|
+
'#000008': 'var(--astro-code-token-parameter)',
|
|
33
|
+
'#000009': 'var(--astro-code-token-function)',
|
|
34
|
+
'#000010': 'var(--astro-code-token-string-expression)',
|
|
35
|
+
'#000011': 'var(--astro-code-token-punctuation)',
|
|
36
|
+
'#000012': 'var(--astro-code-token-link)',
|
|
37
|
+
});
|
|
38
|
+
return hl;
|
|
39
|
+
});
|
|
21
40
|
_resolvedHighlighters.set(key, highlighter);
|
|
22
41
|
|
|
23
42
|
return highlighter;
|
package/config.d.ts
CHANGED
package/dist/core/add/index.js
CHANGED
|
@@ -51,29 +51,29 @@ async function add(names, { cwd, flags, logging, telemetry }) {
|
|
|
51
51
|
["--yes", "Accept all prompts."],
|
|
52
52
|
["--help", "Show this help message."]
|
|
53
53
|
],
|
|
54
|
-
"
|
|
54
|
+
"UI Frameworks": [
|
|
55
55
|
["react", "astro add react"],
|
|
56
56
|
["preact", "astro add preact"],
|
|
57
57
|
["vue", "astro add vue"],
|
|
58
58
|
["svelte", "astro add svelte"],
|
|
59
59
|
["solid-js", "astro add solid-js"],
|
|
60
|
-
["lit", "astro add lit"]
|
|
60
|
+
["lit", "astro add lit"],
|
|
61
|
+
["alpine", "astro add alpine"]
|
|
61
62
|
],
|
|
62
|
-
"
|
|
63
|
+
"SSR Adapters": [
|
|
63
64
|
["netlify", "astro add netlify"],
|
|
64
65
|
["vercel", "astro add vercel"],
|
|
66
|
+
["deno", "astro add deno"],
|
|
65
67
|
["cloudflare", "astro add cloudflare"],
|
|
66
|
-
["
|
|
68
|
+
["node", "astro add node"]
|
|
67
69
|
],
|
|
68
|
-
|
|
70
|
+
Others: [
|
|
69
71
|
["tailwind", "astro add tailwind"],
|
|
72
|
+
["image", "astro add image"],
|
|
73
|
+
["mdx", "astro add mdx"],
|
|
70
74
|
["partytown", "astro add partytown"],
|
|
71
|
-
["sitemap", "astro add sitemap"]
|
|
72
|
-
|
|
73
|
-
"Example: Add an Adapter": [
|
|
74
|
-
["netlify", "astro add netlify"],
|
|
75
|
-
["vercel", "astro add vercel"],
|
|
76
|
-
["deno", "astro add deno"]
|
|
75
|
+
["sitemap", "astro add sitemap"],
|
|
76
|
+
["prefetch", "astro add prefetch"]
|
|
77
77
|
]
|
|
78
78
|
},
|
|
79
79
|
description: `For more integrations, check out: ${cyan("https://astro.build/integrations")}`
|
|
@@ -153,8 +153,27 @@ async function getPathsForRoute(pageData, mod, opts, builtPaths) {
|
|
|
153
153
|
}
|
|
154
154
|
return paths;
|
|
155
155
|
}
|
|
156
|
+
function shouldAppendForwardSlash(trailingSlash, buildFormat) {
|
|
157
|
+
switch (trailingSlash) {
|
|
158
|
+
case "always":
|
|
159
|
+
return true;
|
|
160
|
+
case "never":
|
|
161
|
+
return false;
|
|
162
|
+
case "ignore": {
|
|
163
|
+
switch (buildFormat) {
|
|
164
|
+
case "directory":
|
|
165
|
+
return true;
|
|
166
|
+
case "file":
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
156
172
|
function addPageName(pathname, opts) {
|
|
157
|
-
opts.
|
|
173
|
+
const trailingSlash = opts.astroConfig.trailingSlash;
|
|
174
|
+
const buildFormat = opts.astroConfig.build.format;
|
|
175
|
+
const pageName = shouldAppendForwardSlash(trailingSlash, buildFormat) ? pathname.replace(/\/?$/, "/").replace(/^\//, "") : pathname.replace(/^\//, "");
|
|
176
|
+
opts.pageNames.push(pageName);
|
|
158
177
|
}
|
|
159
178
|
function getUrlForPath(pathname, base, origin, format, routeType) {
|
|
160
179
|
const ending = format === "directory" ? "/" : ".html";
|
package/dist/core/build/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { OutputChunk, RenderedChunk } from 'rollup';
|
|
2
2
|
import type { PageBuildData, ViteID } from './types';
|
|
3
3
|
export interface BuildInternals {
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The module ids of all CSS chunks, used to deduplicate CSS assets between
|
|
6
|
+
* SSR build and client build in vite-plugin-css.
|
|
7
|
+
*/
|
|
8
|
+
cssChunkModuleIds: Set<string>;
|
|
5
9
|
hoistedScriptIdToHoistedMap: Map<string, Set<string>>;
|
|
6
10
|
hoistedScriptIdToPagesMap: Map<string, Set<string>>;
|
|
7
11
|
entrySpecifierToBundleMap: Map<string, string>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { prependForwardSlash } from "../path.js";
|
|
1
|
+
import { prependForwardSlash, removeFileExtension } from "../path.js";
|
|
2
2
|
import { viteID } from "../util.js";
|
|
3
3
|
function createBuildInternals() {
|
|
4
|
-
const pureCSSChunks = /* @__PURE__ */ new Set();
|
|
5
4
|
const hoistedScriptIdToHoistedMap = /* @__PURE__ */ new Map();
|
|
6
5
|
const hoistedScriptIdToPagesMap = /* @__PURE__ */ new Map();
|
|
7
6
|
return {
|
|
8
|
-
|
|
7
|
+
cssChunkModuleIds: /* @__PURE__ */ new Set(),
|
|
9
8
|
hoistedScriptIdToHoistedMap,
|
|
10
9
|
hoistedScriptIdToPagesMap,
|
|
11
10
|
entrySpecifierToBundleMap: /* @__PURE__ */ new Map(),
|
|
@@ -46,8 +45,12 @@ function* getPageDatasByChunk(internals, chunk) {
|
|
|
46
45
|
function* getPageDatasByClientOnlyID(internals, viteid) {
|
|
47
46
|
const pagesByClientOnly = internals.pagesByClientOnly;
|
|
48
47
|
if (pagesByClientOnly.size) {
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
let pathname = `/@fs${prependForwardSlash(viteid)}`;
|
|
49
|
+
let pageBuildDatas = pagesByClientOnly.get(viteid);
|
|
50
|
+
if (!pageBuildDatas) {
|
|
51
|
+
pathname = `/@fs${prependForwardSlash(removeFileExtension(viteid))}`;
|
|
52
|
+
pageBuildDatas = pagesByClientOnly.get(pathname);
|
|
53
|
+
}
|
|
51
54
|
if (pageBuildDatas) {
|
|
52
55
|
for (const pageData of pageBuildDatas) {
|
|
53
56
|
yield pageData;
|
|
@@ -23,9 +23,9 @@ async function staticBuild(opts) {
|
|
|
23
23
|
if (isModeServerWithNoAdapter(opts.astroConfig)) {
|
|
24
24
|
throw new Error(`Cannot use \`output: 'server'\` without an adapter.
|
|
25
25
|
Install and configure the appropriate server adapter for your final deployment.
|
|
26
|
-
|
|
26
|
+
Learn more: https://docs.astro.build/en/guides/server-side-rendering/
|
|
27
27
|
|
|
28
|
-
// astro.config.js
|
|
28
|
+
// Example: astro.config.js
|
|
29
29
|
import netlify from '@astrojs/netlify';
|
|
30
30
|
export default {
|
|
31
31
|
output: 'server',
|
|
@@ -64,11 +64,8 @@ Example:
|
|
|
64
64
|
await clientBuild(opts, internals, clientInput);
|
|
65
65
|
timer.generate = performance.now();
|
|
66
66
|
if (astroConfig.output === "static") {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
} finally {
|
|
70
|
-
await cleanSsrOutput(opts);
|
|
71
|
-
}
|
|
67
|
+
await generatePages(opts, internals);
|
|
68
|
+
await cleanSsrOutput(opts);
|
|
72
69
|
} else {
|
|
73
70
|
await injectManifest(opts, internals);
|
|
74
71
|
info(opts.logging, null, `
|
|
@@ -83,8 +83,21 @@ function rollupPluginAstroBuildCSS(options) {
|
|
|
83
83
|
if ("viteMetadata" in chunk) {
|
|
84
84
|
const meta = chunk["viteMetadata"];
|
|
85
85
|
if (meta.importedCss.size) {
|
|
86
|
+
if (options.target === "server") {
|
|
87
|
+
for (const id of Object.keys(c.modules)) {
|
|
88
|
+
internals.cssChunkModuleIds.add(id);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (options.target === "client") {
|
|
92
|
+
if (Object.keys(c.modules).every((id) => internals.cssChunkModuleIds.has(id))) {
|
|
93
|
+
for (const importedCssImport of meta.importedCss) {
|
|
94
|
+
delete bundle[importedCssImport];
|
|
95
|
+
}
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
86
99
|
if (options.target === "client") {
|
|
87
|
-
for (const
|
|
100
|
+
for (const id of Object.keys(c.modules)) {
|
|
88
101
|
for (const pageData of getParentClientOnlys(id, this)) {
|
|
89
102
|
for (const importedCssImport of meta.importedCss) {
|
|
90
103
|
pageData.css.set(importedCssImport, { depth: -1 });
|
|
@@ -92,7 +105,7 @@ function rollupPluginAstroBuildCSS(options) {
|
|
|
92
105
|
}
|
|
93
106
|
}
|
|
94
107
|
}
|
|
95
|
-
for (const
|
|
108
|
+
for (const id of Object.keys(c.modules)) {
|
|
96
109
|
for (const [pageInfo, depth] of walkParentInfos(id, this)) {
|
|
97
110
|
if (moduleIsTopLevelPage(pageInfo)) {
|
|
98
111
|
const pageViteID = pageInfo.id;
|
package/dist/core/config.d.ts
CHANGED
|
@@ -94,11 +94,11 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
94
94
|
wrap: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
|
|
95
95
|
}, "strip", z.ZodTypeAny, {
|
|
96
96
|
langs: ILanguageRegistration[];
|
|
97
|
-
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
|
+
theme: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_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 & {});
|
|
98
98
|
wrap: boolean | null;
|
|
99
99
|
}, {
|
|
100
100
|
langs?: ILanguageRegistration[] | undefined;
|
|
101
|
-
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
|
+
theme?: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_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;
|
|
102
102
|
wrap?: boolean | null | undefined;
|
|
103
103
|
}>>;
|
|
104
104
|
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">>;
|
|
@@ -110,7 +110,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
110
110
|
syntaxHighlight: false | "shiki" | "prism";
|
|
111
111
|
shikiConfig: {
|
|
112
112
|
langs: ILanguageRegistration[];
|
|
113
|
-
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 & {});
|
|
113
|
+
theme: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_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 & {});
|
|
114
114
|
wrap: boolean | null;
|
|
115
115
|
};
|
|
116
116
|
remarkPlugins: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[];
|
|
@@ -122,7 +122,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
122
122
|
syntaxHighlight?: false | "shiki" | "prism" | undefined;
|
|
123
123
|
shikiConfig?: {
|
|
124
124
|
langs?: ILanguageRegistration[] | undefined;
|
|
125
|
-
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;
|
|
125
|
+
theme?: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_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;
|
|
126
126
|
wrap?: boolean | null | undefined;
|
|
127
127
|
} | undefined;
|
|
128
128
|
remarkPlugins?: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[] | undefined;
|
|
@@ -150,7 +150,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
150
150
|
syntaxHighlight: false | "shiki" | "prism";
|
|
151
151
|
shikiConfig: {
|
|
152
152
|
langs: ILanguageRegistration[];
|
|
153
|
-
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 & {});
|
|
153
|
+
theme: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_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 & {});
|
|
154
154
|
wrap: boolean | null;
|
|
155
155
|
};
|
|
156
156
|
remarkPlugins: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[];
|
|
@@ -193,7 +193,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
193
193
|
syntaxHighlight?: false | "shiki" | "prism" | undefined;
|
|
194
194
|
shikiConfig?: {
|
|
195
195
|
langs?: ILanguageRegistration[] | undefined;
|
|
196
|
-
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;
|
|
196
|
+
theme?: "css-variables" | "dark-plus" | "dracula-soft" | "dracula" | "github-dark-dimmed" | "github-dark" | "github-light" | "hc_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;
|
|
197
197
|
wrap?: boolean | null | undefined;
|
|
198
198
|
} | undefined;
|
|
199
199
|
remarkPlugins?: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[] | undefined;
|
package/dist/core/create-vite.js
CHANGED
|
@@ -38,6 +38,7 @@ async function createVite(commandConfig, { astroConfig, logging, mode }) {
|
|
|
38
38
|
cacheDir: fileURLToPath(new URL("./node_modules/.vite/", astroConfig.root)),
|
|
39
39
|
clearScreen: false,
|
|
40
40
|
logLevel: "warn",
|
|
41
|
+
appType: "custom",
|
|
41
42
|
optimizeDeps: {
|
|
42
43
|
entries: ["src/**/*"],
|
|
43
44
|
exclude: ["node-fetch"]
|
package/dist/core/dev/index.js
CHANGED
|
@@ -46,7 +46,7 @@ async function dev(config, options) {
|
|
|
46
46
|
https: !!((_a = viteConfig.server) == null ? void 0 : _a.https)
|
|
47
47
|
})
|
|
48
48
|
);
|
|
49
|
-
const currentVersion = "1.1.
|
|
49
|
+
const currentVersion = "1.1.4";
|
|
50
50
|
if (currentVersion.includes("-")) {
|
|
51
51
|
warn(options.logging, null, msg.prerelease({ currentVersion }));
|
|
52
52
|
}
|
package/dist/core/messages.js
CHANGED
|
@@ -46,7 +46,7 @@ function devStart({
|
|
|
46
46
|
https,
|
|
47
47
|
site
|
|
48
48
|
}) {
|
|
49
|
-
const version = "1.1.
|
|
49
|
+
const version = "1.1.4";
|
|
50
50
|
const rootPath = site ? site.pathname : "/";
|
|
51
51
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
52
52
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
@@ -225,7 +225,7 @@ function printHelp({
|
|
|
225
225
|
message.push(
|
|
226
226
|
linebreak(),
|
|
227
227
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
228
|
-
`v${"1.1.
|
|
228
|
+
`v${"1.1.4"}`
|
|
229
229
|
)} ${headline}`
|
|
230
230
|
);
|
|
231
231
|
}
|
package/dist/core/path.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export declare function startsWithDotDotSlash(path: string): boolean;
|
|
|
8
8
|
export declare function startsWithDotSlash(path: string): boolean;
|
|
9
9
|
export declare function isRelativePath(path: string): boolean;
|
|
10
10
|
export declare function joinPaths(...paths: (string | undefined)[]): string;
|
|
11
|
+
export declare function removeFileExtension(path: string): string;
|
package/dist/core/path.js
CHANGED
|
@@ -36,11 +36,16 @@ function isString(path) {
|
|
|
36
36
|
function joinPaths(...paths) {
|
|
37
37
|
return paths.filter(isString).map(trimSlashes).join("/");
|
|
38
38
|
}
|
|
39
|
+
function removeFileExtension(path) {
|
|
40
|
+
let idx = path.lastIndexOf(".");
|
|
41
|
+
return idx === -1 ? path : path.slice(0, idx);
|
|
42
|
+
}
|
|
39
43
|
export {
|
|
40
44
|
appendForwardSlash,
|
|
41
45
|
isRelativePath,
|
|
42
46
|
joinPaths,
|
|
43
47
|
prependForwardSlash,
|
|
48
|
+
removeFileExtension,
|
|
44
49
|
removeLeadingForwardSlash,
|
|
45
50
|
removeTrailingForwardSlash,
|
|
46
51
|
startsWithDotDotSlash,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import vite from 'vite';
|
|
2
2
|
/** recursively crawl the module graph to get all style files imported by parent id */
|
|
3
|
-
export declare function crawlGraph(viteServer: vite.ViteDevServer, _id: string,
|
|
3
|
+
export declare function crawlGraph(viteServer: vite.ViteDevServer, _id: string, isRootFile: boolean, scanned?: Set<string>): AsyncGenerator<vite.ModuleNode, void, unknown>;
|
|
@@ -3,10 +3,10 @@ import { unwrapId } from "../../util.js";
|
|
|
3
3
|
import { STYLE_EXTENSIONS } from "../util.js";
|
|
4
4
|
const fileExtensionsToSSR = /* @__PURE__ */ new Set([".astro", ".md"]);
|
|
5
5
|
const STRIP_QUERY_PARAMS_REGEX = /\?.*$/;
|
|
6
|
-
async function* crawlGraph(viteServer, _id,
|
|
6
|
+
async function* crawlGraph(viteServer, _id, isRootFile, scanned = /* @__PURE__ */ new Set()) {
|
|
7
7
|
const id = unwrapId(_id);
|
|
8
8
|
const importedModules = /* @__PURE__ */ new Set();
|
|
9
|
-
const moduleEntriesForId =
|
|
9
|
+
const moduleEntriesForId = isRootFile ? viteServer.moduleGraph.getModulesByFile(id) ?? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([viteServer.moduleGraph.getModuleById(id)]);
|
|
10
10
|
for (const entry of moduleEntriesForId) {
|
|
11
11
|
if (!entry) {
|
|
12
12
|
continue;
|
|
@@ -23,7 +23,10 @@ async function* crawlGraph(viteServer, _id, isFile, scanned = /* @__PURE__ */ ne
|
|
|
23
23
|
if (fileExtensionsToSSR.has(npath.extname(importedModulePathname))) {
|
|
24
24
|
const mod = viteServer.moduleGraph.getModuleById(importedModule.id);
|
|
25
25
|
if (!(mod == null ? void 0 : mod.ssrModule)) {
|
|
26
|
-
|
|
26
|
+
try {
|
|
27
|
+
await viteServer.ssrLoadModule(importedModule.id);
|
|
28
|
+
} catch {
|
|
29
|
+
}
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
32
|
}
|
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.1.
|
|
8
|
+
const ASTRO_VERSION = "1.1.4";
|
|
9
9
|
function isObject(value) {
|
|
10
10
|
return typeof value === "object" && value != null;
|
|
11
11
|
}
|
|
@@ -16,18 +16,6 @@ import { createRequest } from "../core/request.js";
|
|
|
16
16
|
import { createRouteManifest, matchAllRoutes } from "../core/routing/index.js";
|
|
17
17
|
import { createSafeError, resolvePages } from "../core/util.js";
|
|
18
18
|
import notFoundTemplate, { subpathNotUsedTemplate } from "../template/4xx.js";
|
|
19
|
-
const BAD_VITE_MIDDLEWARE = [
|
|
20
|
-
"viteIndexHtmlMiddleware",
|
|
21
|
-
"vite404Middleware",
|
|
22
|
-
"viteSpaFallbackMiddleware"
|
|
23
|
-
];
|
|
24
|
-
function removeViteHttpMiddleware(server) {
|
|
25
|
-
for (let i = server.stack.length - 1; i > 0; i--) {
|
|
26
|
-
if (BAD_VITE_MIDDLEWARE.includes(server.stack[i].handle.name)) {
|
|
27
|
-
server.stack.splice(i, 1);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
19
|
function truncateString(str, n) {
|
|
32
20
|
if (str.length > n) {
|
|
33
21
|
return str.substring(0, n) + "…";
|
|
@@ -288,7 +276,6 @@ function createPlugin({ config, logging }) {
|
|
|
288
276
|
viteServer.watcher.on("unlink", rebuildManifest.bind(null, true));
|
|
289
277
|
viteServer.watcher.on("change", rebuildManifest.bind(null, false));
|
|
290
278
|
return () => {
|
|
291
|
-
removeViteHttpMiddleware(viteServer.middlewares);
|
|
292
279
|
if (config.base !== "/") {
|
|
293
280
|
viteServer.middlewares.stack.unshift({
|
|
294
281
|
route: "",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
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",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@astrojs/compiler": "^0.23.4",
|
|
86
86
|
"@astrojs/language-server": "^0.23.0",
|
|
87
|
-
"@astrojs/markdown-remark": "^1.1.
|
|
87
|
+
"@astrojs/markdown-remark": "^1.1.1",
|
|
88
88
|
"@astrojs/telemetry": "^1.0.0",
|
|
89
89
|
"@astrojs/webapi": "^1.0.0",
|
|
90
90
|
"@babel/core": "^7.18.2",
|
|
@@ -95,7 +95,6 @@
|
|
|
95
95
|
"@babel/types": "^7.18.4",
|
|
96
96
|
"@proload/core": "^0.3.2",
|
|
97
97
|
"@proload/plugin-tsm": "^0.2.1",
|
|
98
|
-
"ast-types": "^0.14.2",
|
|
99
98
|
"boxen": "^6.2.1",
|
|
100
99
|
"ci-info": "^3.3.1",
|
|
101
100
|
"common-ancestor-path": "^1.0.1",
|
|
@@ -125,7 +124,7 @@
|
|
|
125
124
|
"resolve": "^1.22.0",
|
|
126
125
|
"rollup": "~2.77.0",
|
|
127
126
|
"semver": "^7.3.7",
|
|
128
|
-
"shiki": "^0.
|
|
127
|
+
"shiki": "^0.11.1",
|
|
129
128
|
"sirv": "^2.0.2",
|
|
130
129
|
"slash": "^4.0.0",
|
|
131
130
|
"string-width": "^5.1.2",
|
|
@@ -160,6 +159,7 @@
|
|
|
160
159
|
"@types/send": "^0.17.1",
|
|
161
160
|
"@types/unist": "^2.0.6",
|
|
162
161
|
"@types/yargs-parser": "^21.0.0",
|
|
162
|
+
"ast-types": "^0.14.2",
|
|
163
163
|
"astro-scripts": "0.0.7",
|
|
164
164
|
"chai": "^4.3.6",
|
|
165
165
|
"cheerio": "^1.0.0-rc.11",
|