astro 2.10.4 → 2.10.6
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/components/ViewTransitions.astro +29 -1
- package/content-types.template.d.ts +3 -1
- package/dist/@types/astro.d.ts +21 -0
- package/dist/content/runtime.js +1 -1
- package/dist/core/build/plugins/index.js +1 -1
- package/dist/core/build/plugins/plugin-analyzer.d.ts +3 -2
- package/dist/core/build/plugins/plugin-analyzer.js +24 -25
- package/dist/core/build/plugins/plugin-middleware.js +1 -1
- package/dist/core/config/schema.d.ts +16 -0
- package/dist/core/config/schema.js +4 -2
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/template/4xx.js +34 -4
- package/dist/vite-plugin-astro-server/plugin.js +4 -6
- package/package.json +1 -1
- package/dist/template/css.d.ts +0 -6
- package/dist/template/css.js +0 -46
|
@@ -63,9 +63,16 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
63
63
|
return 'animate';
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
function markScriptsExec() {
|
|
67
|
+
for (const script of document.scripts) {
|
|
68
|
+
script.dataset.astroExec = '';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
66
72
|
function runScripts() {
|
|
67
73
|
let wait = Promise.resolve();
|
|
68
74
|
for (const script of Array.from(document.scripts)) {
|
|
75
|
+
if (script.dataset.astroExec === '') continue;
|
|
69
76
|
const s = document.createElement('script');
|
|
70
77
|
s.innerHTML = script.innerHTML;
|
|
71
78
|
for (const attr of script.attributes) {
|
|
@@ -77,6 +84,7 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
77
84
|
}
|
|
78
85
|
s.setAttribute(attr.name, attr.value);
|
|
79
86
|
}
|
|
87
|
+
s.dataset.astroExec = '';
|
|
80
88
|
script.replaceWith(s);
|
|
81
89
|
}
|
|
82
90
|
return wait;
|
|
@@ -100,6 +108,19 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
100
108
|
const href = el.getAttribute('href');
|
|
101
109
|
return doc.head.querySelector(`link[rel=stylesheet][href="${href}"]`);
|
|
102
110
|
}
|
|
111
|
+
if (el.tagName === 'SCRIPT') {
|
|
112
|
+
let s1 = el as HTMLScriptElement;
|
|
113
|
+
for (const s2 of doc.scripts) {
|
|
114
|
+
if (
|
|
115
|
+
// Inline
|
|
116
|
+
(s1.textContent && s1.textContent === s2.textContent) ||
|
|
117
|
+
// External
|
|
118
|
+
(s1.type === s2.type && s1.src === s2.src)
|
|
119
|
+
) {
|
|
120
|
+
return s2;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
103
124
|
return null;
|
|
104
125
|
};
|
|
105
126
|
|
|
@@ -132,6 +153,10 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
132
153
|
}
|
|
133
154
|
}
|
|
134
155
|
|
|
156
|
+
if (state?.scrollY === 0 && location.hash) {
|
|
157
|
+
const id = decodeURIComponent(location.hash.slice(1));
|
|
158
|
+
state.scrollY = document.getElementById(id)?.offsetTop || 0;
|
|
159
|
+
}
|
|
135
160
|
if (state?.scrollY != null) {
|
|
136
161
|
scrollTo(0, state.scrollY);
|
|
137
162
|
}
|
|
@@ -203,6 +228,7 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
203
228
|
} finally {
|
|
204
229
|
document.documentElement.removeAttribute('data-astro-transition');
|
|
205
230
|
await runScripts();
|
|
231
|
+
markScriptsExec();
|
|
206
232
|
onload();
|
|
207
233
|
}
|
|
208
234
|
}
|
|
@@ -221,6 +247,8 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
221
247
|
}
|
|
222
248
|
|
|
223
249
|
if (supportsViewTransitions || getFallback() !== 'none') {
|
|
250
|
+
markScriptsExec();
|
|
251
|
+
|
|
224
252
|
document.addEventListener('click', (ev) => {
|
|
225
253
|
let link = ev.target;
|
|
226
254
|
if (link instanceof Element && link.tagName !== 'A') {
|
|
@@ -235,7 +263,7 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
235
263
|
link.href &&
|
|
236
264
|
(!link.target || link.target === '_self') &&
|
|
237
265
|
link.origin === location.origin &&
|
|
238
|
-
|
|
266
|
+
location.pathname !== link.pathname &&
|
|
239
267
|
ev.button === 0 && // left clicks only
|
|
240
268
|
!ev.metaKey && // new tab (mac)
|
|
241
269
|
!ev.ctrlKey && // new tab (windows)
|
|
@@ -10,7 +10,9 @@ declare module 'astro:content' {
|
|
|
10
10
|
|
|
11
11
|
declare module 'astro:content' {
|
|
12
12
|
export { z } from 'astro/zod';
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
type Flatten<T> = T extends { [K: string]: infer U } ? U : never;
|
|
15
|
+
export type CollectionEntry<C extends keyof AnyEntryMap> = Flatten<AnyEntryMap[C]>;
|
|
14
16
|
|
|
15
17
|
// TODO: Remove this when having this fallback is no longer relevant. 2.3? 3.0? - erika, 2023-04-04
|
|
16
18
|
/**
|
package/dist/@types/astro.d.ts
CHANGED
|
@@ -1186,6 +1186,27 @@ export interface AstroUserConfig {
|
|
|
1186
1186
|
* ```
|
|
1187
1187
|
*/
|
|
1188
1188
|
viewTransitions?: boolean;
|
|
1189
|
+
/**
|
|
1190
|
+
* @docs
|
|
1191
|
+
* @name experimental.optimizeHoistedScript
|
|
1192
|
+
* @type {boolean}
|
|
1193
|
+
* @default `false`
|
|
1194
|
+
* @version 2.10.4
|
|
1195
|
+
* @description
|
|
1196
|
+
* Prevents unused components' scripts from being included in a page unexpectedly.
|
|
1197
|
+
* The optimization is best-effort and may inversely miss including the used scripts. Make sure to double-check your built pages
|
|
1198
|
+
* before publishing.
|
|
1199
|
+
* Enable hoisted script analysis optimization by adding the experimental flag:
|
|
1200
|
+
*
|
|
1201
|
+
* ```js
|
|
1202
|
+
* {
|
|
1203
|
+
* experimental: {
|
|
1204
|
+
* optimizeHoistedScript: true,
|
|
1205
|
+
* },
|
|
1206
|
+
* }
|
|
1207
|
+
* ```
|
|
1208
|
+
*/
|
|
1209
|
+
optimizeHoistedScript?: boolean;
|
|
1189
1210
|
};
|
|
1190
1211
|
/** @deprecated - Use "integrations" instead. Run Astro to learn more about migrating. */
|
|
1191
1212
|
renderers?: never;
|
package/dist/content/runtime.js
CHANGED
|
@@ -49,7 +49,7 @@ function createGetCollection({
|
|
|
49
49
|
);
|
|
50
50
|
let entries = [];
|
|
51
51
|
if (import.meta.env.PROD && cacheEntriesByCollection.has(collection)) {
|
|
52
|
-
entries = cacheEntriesByCollection.get(collection);
|
|
52
|
+
entries = [...cacheEntriesByCollection.get(collection)];
|
|
53
53
|
} else {
|
|
54
54
|
entries = await Promise.all(
|
|
55
55
|
lazyImports.map(async (lazyImport) => {
|
|
@@ -14,7 +14,7 @@ import { pluginSSR, pluginSSRSplit } from "./plugin-ssr.js";
|
|
|
14
14
|
function registerAllPlugins({ internals, options, register }) {
|
|
15
15
|
register(pluginComponentEntry(internals));
|
|
16
16
|
register(pluginAliasResolve(internals));
|
|
17
|
-
register(pluginAnalyzer(internals));
|
|
17
|
+
register(pluginAnalyzer(options, internals));
|
|
18
18
|
register(pluginInternals(internals));
|
|
19
19
|
register(pluginRenderers(options));
|
|
20
20
|
register(pluginMiddleware(options, internals));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Plugin as VitePlugin } from 'vite';
|
|
2
2
|
import type { BuildInternals } from '../internal.js';
|
|
3
3
|
import type { AstroBuildPlugin } from '../plugin.js';
|
|
4
|
-
|
|
5
|
-
export declare function
|
|
4
|
+
import type { StaticBuildOptions } from '../types.js';
|
|
5
|
+
export declare function vitePluginAnalyzer(options: StaticBuildOptions, internals: BuildInternals): VitePlugin;
|
|
6
|
+
export declare function pluginAnalyzer(options: StaticBuildOptions, internals: BuildInternals): AstroBuildPlugin;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { walk } from "estree-walker";
|
|
2
1
|
import { PROPAGATED_ASSET_FLAG } from "../../../content/consts.js";
|
|
3
2
|
import { prependForwardSlash } from "../../../core/path.js";
|
|
4
3
|
import { getTopLevelPages, moduleIsTopLevelPage, walkParentInfos } from "../graph.js";
|
|
@@ -19,15 +18,13 @@ async function doesParentImportChild(parentInfo, childInfo, childExportNames) {
|
|
|
19
18
|
}
|
|
20
19
|
const imports = [];
|
|
21
20
|
const exports = [];
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
exports.push(node);
|
|
28
|
-
}
|
|
21
|
+
for (const node of parentInfo.ast.body) {
|
|
22
|
+
if (node.type === "ImportDeclaration") {
|
|
23
|
+
imports.push(node);
|
|
24
|
+
} else if (node.type === "ExportDefaultDeclaration" || node.type === "ExportNamedDeclaration") {
|
|
25
|
+
exports.push(node);
|
|
29
26
|
}
|
|
30
|
-
}
|
|
27
|
+
}
|
|
31
28
|
const importNames = [];
|
|
32
29
|
const exportNames = [];
|
|
33
30
|
for (const node of imports) {
|
|
@@ -89,7 +86,7 @@ async function doesParentImportChild(parentInfo, childInfo, childExportNames) {
|
|
|
89
86
|
}
|
|
90
87
|
return exportNames;
|
|
91
88
|
}
|
|
92
|
-
function vitePluginAnalyzer(internals) {
|
|
89
|
+
function vitePluginAnalyzer(options, internals) {
|
|
93
90
|
function hoistedScriptScanner() {
|
|
94
91
|
const uniqueHoistedIds = /* @__PURE__ */ new Map();
|
|
95
92
|
const pageScripts = /* @__PURE__ */ new Map();
|
|
@@ -108,20 +105,22 @@ function vitePluginAnalyzer(internals) {
|
|
|
108
105
|
for (const [parentInfo, depth] of walkParentInfos(from, this, function until(importer) {
|
|
109
106
|
return isPropagatedAsset(importer);
|
|
110
107
|
})) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
108
|
+
if (options.settings.config.experimental.optimizeHoistedScript) {
|
|
109
|
+
depthsToChildren.set(depth, parentInfo);
|
|
110
|
+
if (depth > 0) {
|
|
111
|
+
const childInfo = depthsToChildren.get(depth - 1);
|
|
112
|
+
const childExportNames = depthsToExportNames.get(depth - 1);
|
|
113
|
+
const doesImport = await doesParentImportChild.call(
|
|
114
|
+
this,
|
|
115
|
+
parentInfo,
|
|
116
|
+
childInfo,
|
|
117
|
+
childExportNames
|
|
118
|
+
);
|
|
119
|
+
if (doesImport === "no") {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
depthsToExportNames.set(depth, doesImport);
|
|
123
123
|
}
|
|
124
|
-
depthsToExportNames.set(depth, doesImport);
|
|
125
124
|
}
|
|
126
125
|
if (isPropagatedAsset(parentInfo.id)) {
|
|
127
126
|
for (const [nestedParentInfo] of walkParentInfos(from, this)) {
|
|
@@ -241,13 +240,13 @@ function vitePluginAnalyzer(internals) {
|
|
|
241
240
|
}
|
|
242
241
|
};
|
|
243
242
|
}
|
|
244
|
-
function pluginAnalyzer(internals) {
|
|
243
|
+
function pluginAnalyzer(options, internals) {
|
|
245
244
|
return {
|
|
246
245
|
build: "ssr",
|
|
247
246
|
hooks: {
|
|
248
247
|
"build:before": () => {
|
|
249
248
|
return {
|
|
250
|
-
vitePlugin: vitePluginAnalyzer(internals)
|
|
249
|
+
vitePlugin: vitePluginAnalyzer(options, internals)
|
|
251
250
|
};
|
|
252
251
|
}
|
|
253
252
|
}
|
|
@@ -42,7 +42,7 @@ function vitePluginMiddleware(opts, internals) {
|
|
|
42
42
|
if (chunk.type === "asset") {
|
|
43
43
|
continue;
|
|
44
44
|
}
|
|
45
|
-
if (chunk.fileName === "middleware.mjs") {
|
|
45
|
+
if (chunk.fileName === "middleware.mjs" && opts.settings.config.build.excludeMiddleware) {
|
|
46
46
|
internals.middlewareEntryPoint = new URL(chunkName, opts.settings.config.build.server);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -179,18 +179,23 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
179
179
|
experimental: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
180
180
|
assets: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
181
181
|
viewTransitions: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
182
|
+
optimizeHoistedScript: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
182
183
|
}, "passthrough", z.ZodTypeAny, {
|
|
183
184
|
assets: boolean;
|
|
184
185
|
viewTransitions: boolean;
|
|
186
|
+
optimizeHoistedScript: boolean;
|
|
185
187
|
}, {
|
|
186
188
|
assets?: boolean | undefined;
|
|
187
189
|
viewTransitions?: boolean | undefined;
|
|
190
|
+
optimizeHoistedScript?: boolean | undefined;
|
|
188
191
|
}>, {
|
|
189
192
|
assets: boolean;
|
|
190
193
|
viewTransitions: boolean;
|
|
194
|
+
optimizeHoistedScript: boolean;
|
|
191
195
|
}, {
|
|
192
196
|
assets?: boolean | undefined;
|
|
193
197
|
viewTransitions?: boolean | undefined;
|
|
198
|
+
optimizeHoistedScript?: boolean | undefined;
|
|
194
199
|
}>>>;
|
|
195
200
|
legacy: z.ZodDefault<z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>>;
|
|
196
201
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -259,6 +264,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
259
264
|
experimental: {
|
|
260
265
|
assets: boolean;
|
|
261
266
|
viewTransitions: boolean;
|
|
267
|
+
optimizeHoistedScript: boolean;
|
|
262
268
|
};
|
|
263
269
|
legacy: {};
|
|
264
270
|
}, {
|
|
@@ -319,6 +325,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
319
325
|
experimental?: {
|
|
320
326
|
assets?: boolean | undefined;
|
|
321
327
|
viewTransitions?: boolean | undefined;
|
|
328
|
+
optimizeHoistedScript?: boolean | undefined;
|
|
322
329
|
} | undefined;
|
|
323
330
|
legacy?: {} | undefined;
|
|
324
331
|
}>;
|
|
@@ -435,18 +442,23 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
435
442
|
experimental: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
436
443
|
assets: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
437
444
|
viewTransitions: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
445
|
+
optimizeHoistedScript: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
438
446
|
}, "passthrough", z.ZodTypeAny, {
|
|
439
447
|
assets: boolean;
|
|
440
448
|
viewTransitions: boolean;
|
|
449
|
+
optimizeHoistedScript: boolean;
|
|
441
450
|
}, {
|
|
442
451
|
assets?: boolean | undefined;
|
|
443
452
|
viewTransitions?: boolean | undefined;
|
|
453
|
+
optimizeHoistedScript?: boolean | undefined;
|
|
444
454
|
}>, {
|
|
445
455
|
assets: boolean;
|
|
446
456
|
viewTransitions: boolean;
|
|
457
|
+
optimizeHoistedScript: boolean;
|
|
447
458
|
}, {
|
|
448
459
|
assets?: boolean | undefined;
|
|
449
460
|
viewTransitions?: boolean | undefined;
|
|
461
|
+
optimizeHoistedScript?: boolean | undefined;
|
|
450
462
|
}>>>;
|
|
451
463
|
legacy: z.ZodDefault<z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>>;
|
|
452
464
|
root: z.ZodEffects<z.ZodDefault<z.ZodString>, import("url").URL, string | undefined>;
|
|
@@ -581,6 +593,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
581
593
|
experimental: {
|
|
582
594
|
assets: boolean;
|
|
583
595
|
viewTransitions: boolean;
|
|
596
|
+
optimizeHoistedScript: boolean;
|
|
584
597
|
};
|
|
585
598
|
legacy: {};
|
|
586
599
|
}, {
|
|
@@ -641,6 +654,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
641
654
|
experimental?: {
|
|
642
655
|
assets?: boolean | undefined;
|
|
643
656
|
viewTransitions?: boolean | undefined;
|
|
657
|
+
optimizeHoistedScript?: boolean | undefined;
|
|
644
658
|
} | undefined;
|
|
645
659
|
legacy?: {} | undefined;
|
|
646
660
|
}>, {
|
|
@@ -710,6 +724,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
710
724
|
experimental: {
|
|
711
725
|
assets: boolean;
|
|
712
726
|
viewTransitions: boolean;
|
|
727
|
+
optimizeHoistedScript: boolean;
|
|
713
728
|
};
|
|
714
729
|
legacy: {};
|
|
715
730
|
}, {
|
|
@@ -770,6 +785,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
770
785
|
experimental?: {
|
|
771
786
|
assets?: boolean | undefined;
|
|
772
787
|
viewTransitions?: boolean | undefined;
|
|
788
|
+
optimizeHoistedScript?: boolean | undefined;
|
|
773
789
|
} | undefined;
|
|
774
790
|
legacy?: {} | undefined;
|
|
775
791
|
}>;
|
|
@@ -39,7 +39,8 @@ const ASTRO_CONFIG_DEFAULTS = {
|
|
|
39
39
|
redirects: {},
|
|
40
40
|
experimental: {
|
|
41
41
|
assets: false,
|
|
42
|
-
viewTransitions: false
|
|
42
|
+
viewTransitions: false,
|
|
43
|
+
optimizeHoistedScript: false
|
|
43
44
|
}
|
|
44
45
|
};
|
|
45
46
|
const AstroConfigSchema = z.object({
|
|
@@ -143,7 +144,8 @@ const AstroConfigSchema = z.object({
|
|
|
143
144
|
vite: z.custom((data) => data instanceof Object && !Array.isArray(data)).default(ASTRO_CONFIG_DEFAULTS.vite),
|
|
144
145
|
experimental: z.object({
|
|
145
146
|
assets: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.assets),
|
|
146
|
-
viewTransitions: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.viewTransitions)
|
|
147
|
+
viewTransitions: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.viewTransitions),
|
|
148
|
+
optimizeHoistedScript: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.optimizeHoistedScript)
|
|
147
149
|
}).passthrough().refine(
|
|
148
150
|
(d) => {
|
|
149
151
|
const validKeys = Object.keys(ASTRO_CONFIG_DEFAULTS.experimental);
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
|
|
|
23
23
|
base: restart.container.settings.config.base
|
|
24
24
|
})
|
|
25
25
|
);
|
|
26
|
-
const currentVersion = "2.10.
|
|
26
|
+
const currentVersion = "2.10.6";
|
|
27
27
|
if (currentVersion.includes("-")) {
|
|
28
28
|
warn(logging, null, msg.prerelease({ currentVersion }));
|
|
29
29
|
}
|
package/dist/core/messages.js
CHANGED
|
@@ -47,7 +47,7 @@ function serverStart({
|
|
|
47
47
|
base,
|
|
48
48
|
isRestart = false
|
|
49
49
|
}) {
|
|
50
|
-
const version = "2.10.
|
|
50
|
+
const version = "2.10.6";
|
|
51
51
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
52
52
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
53
53
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -233,7 +233,7 @@ function printHelp({
|
|
|
233
233
|
message.push(
|
|
234
234
|
linebreak(),
|
|
235
235
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
236
|
-
`v${"2.10.
|
|
236
|
+
`v${"2.10.6"}`
|
|
237
237
|
)} ${headline}`
|
|
238
238
|
);
|
|
239
239
|
}
|
package/dist/template/4xx.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { escape } from "html-escaper";
|
|
2
|
-
import { baseCSS } from "./css.js";
|
|
3
2
|
function template({
|
|
4
3
|
title,
|
|
5
4
|
pathname,
|
|
@@ -13,14 +12,40 @@ function template({
|
|
|
13
12
|
<meta charset="UTF-8">
|
|
14
13
|
<title>${tabTitle}</title>
|
|
15
14
|
<style>
|
|
16
|
-
${baseCSS}
|
|
17
15
|
:root {
|
|
16
|
+
--gray-10: hsl(258, 7%, 10%);
|
|
17
|
+
--gray-20: hsl(258, 7%, 20%);
|
|
18
|
+
--gray-30: hsl(258, 7%, 30%);
|
|
19
|
+
--gray-40: hsl(258, 7%, 40%);
|
|
20
|
+
--gray-50: hsl(258, 7%, 50%);
|
|
21
|
+
--gray-60: hsl(258, 7%, 60%);
|
|
22
|
+
--gray-70: hsl(258, 7%, 70%);
|
|
23
|
+
--gray-80: hsl(258, 7%, 80%);
|
|
24
|
+
--gray-90: hsl(258, 7%, 90%);
|
|
18
25
|
--black: #13151A;
|
|
19
26
|
--accent-light: #E0CCFA;
|
|
20
27
|
}
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
* {
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
html {
|
|
23
34
|
background: var(--black);
|
|
35
|
+
color-scheme: dark;
|
|
36
|
+
accent-color: var(--accent-light);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
body {
|
|
40
|
+
background-color: var(--gray-10);
|
|
41
|
+
color: var(--gray-80);
|
|
42
|
+
font-family: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", monospace;
|
|
43
|
+
line-height: 1.5;
|
|
44
|
+
margin: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
a {
|
|
48
|
+
color: var(--accent-light);
|
|
24
49
|
}
|
|
25
50
|
|
|
26
51
|
.center {
|
|
@@ -37,6 +62,8 @@ function template({
|
|
|
37
62
|
color: white;
|
|
38
63
|
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
|
39
64
|
font-weight: 700;
|
|
65
|
+
margin-top: 1rem;
|
|
66
|
+
margin-bottom: 0;
|
|
40
67
|
}
|
|
41
68
|
|
|
42
69
|
.statusCode {
|
|
@@ -48,11 +75,14 @@ function template({
|
|
|
48
75
|
width: 124px;
|
|
49
76
|
}
|
|
50
77
|
|
|
51
|
-
pre {
|
|
78
|
+
pre, code {
|
|
52
79
|
padding: 2px 8px;
|
|
53
80
|
background: rgba(0,0,0, 0.25);
|
|
54
81
|
border: 1px solid rgba(255,255,255, 0.25);
|
|
55
82
|
border-radius: 4px;
|
|
83
|
+
font-size: 1.2em;
|
|
84
|
+
margin-top: 0;
|
|
85
|
+
max-width: 60em;
|
|
56
86
|
}
|
|
57
87
|
</style>
|
|
58
88
|
</head>
|
|
@@ -28,12 +28,10 @@ function createVitePluginAstroServer({
|
|
|
28
28
|
viteServer.watcher.on("unlink", rebuildManifest.bind(null, true));
|
|
29
29
|
viteServer.watcher.on("change", rebuildManifest.bind(null, false));
|
|
30
30
|
return () => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
}
|
|
31
|
+
viteServer.middlewares.stack.unshift({
|
|
32
|
+
route: "",
|
|
33
|
+
handle: baseMiddleware(settings, logging)
|
|
34
|
+
});
|
|
37
35
|
viteServer.middlewares.use(async function astroDevHandler(request, response) {
|
|
38
36
|
if (request.url === void 0 || !request.method) {
|
|
39
37
|
response.writeHead(500, "Incomplete request");
|
package/package.json
CHANGED
package/dist/template/css.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CSS is exported as a string so the error pages:
|
|
3
|
-
* 1. don’t need to resolve a deep internal CSS import
|
|
4
|
-
* 2. don’t need external dependencies to render (they may be shown because of a dep!)
|
|
5
|
-
*/
|
|
6
|
-
export declare const baseCSS = "\n:root {\n --gray-10: hsl(258, 7%, 10%);\n --gray-20: hsl(258, 7%, 20%);\n --gray-30: hsl(258, 7%, 30%);\n --gray-40: hsl(258, 7%, 40%);\n --gray-50: hsl(258, 7%, 50%);\n --gray-60: hsl(258, 7%, 60%);\n --gray-70: hsl(258, 7%, 70%);\n --gray-80: hsl(258, 7%, 80%);\n --gray-90: hsl(258, 7%, 90%);\n --orange: #ff5d01;\n}\n\n* {\n box-sizing: border-box;\n}\n\nbody {\n background-color: var(--gray-10);\n color: var(--gray-80);\n font-family: monospace;\n line-height: 1.5;\n margin: 0;\n}\n\na {\n color: var(--orange);\n}\n\nh1 {\n font-weight: 800;\n margin-top: 1rem;\n margin-bottom: 0;\n}\n\npre {\n color:;\n font-size: 1.2em;\n margin-top: 0;\n max-width: 60em;\n}\n";
|
package/dist/template/css.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const baseCSS = `
|
|
2
|
-
:root {
|
|
3
|
-
--gray-10: hsl(258, 7%, 10%);
|
|
4
|
-
--gray-20: hsl(258, 7%, 20%);
|
|
5
|
-
--gray-30: hsl(258, 7%, 30%);
|
|
6
|
-
--gray-40: hsl(258, 7%, 40%);
|
|
7
|
-
--gray-50: hsl(258, 7%, 50%);
|
|
8
|
-
--gray-60: hsl(258, 7%, 60%);
|
|
9
|
-
--gray-70: hsl(258, 7%, 70%);
|
|
10
|
-
--gray-80: hsl(258, 7%, 80%);
|
|
11
|
-
--gray-90: hsl(258, 7%, 90%);
|
|
12
|
-
--orange: #ff5d01;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
* {
|
|
16
|
-
box-sizing: border-box;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
body {
|
|
20
|
-
background-color: var(--gray-10);
|
|
21
|
-
color: var(--gray-80);
|
|
22
|
-
font-family: monospace;
|
|
23
|
-
line-height: 1.5;
|
|
24
|
-
margin: 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
a {
|
|
28
|
-
color: var(--orange);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
h1 {
|
|
32
|
-
font-weight: 800;
|
|
33
|
-
margin-top: 1rem;
|
|
34
|
-
margin-bottom: 0;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
pre {
|
|
38
|
-
color:;
|
|
39
|
-
font-size: 1.2em;
|
|
40
|
-
margin-top: 0;
|
|
41
|
-
max-width: 60em;
|
|
42
|
-
}
|
|
43
|
-
`;
|
|
44
|
-
export {
|
|
45
|
-
baseCSS
|
|
46
|
-
};
|