astro 4.4.14 → 4.5.0

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.
Files changed (98) hide show
  1. package/components/Code.astro +15 -12
  2. package/dist/@types/astro.d.ts +95 -18
  3. package/dist/assets/utils/getAssetsPrefix.d.ts +2 -0
  4. package/dist/assets/utils/getAssetsPrefix.js +14 -0
  5. package/dist/assets/vite-plugin-assets.js +10 -3
  6. package/dist/cli/add/index.js +76 -28
  7. package/dist/cli/install-package.js +2 -2
  8. package/dist/content/types-generator.js +56 -7
  9. package/dist/content/vite-plugin-content-assets.js +11 -3
  10. package/dist/core/app/common.js +2 -0
  11. package/dist/core/app/index.js +10 -2
  12. package/dist/core/app/types.d.ts +7 -2
  13. package/dist/core/base-pipeline.d.ts +2 -1
  14. package/dist/core/base-pipeline.js +2 -1
  15. package/dist/core/build/generate.js +1 -0
  16. package/dist/core/build/internal.d.ts +6 -0
  17. package/dist/core/build/internal.js +1 -0
  18. package/dist/core/build/plugins/index.js +6 -1
  19. package/dist/core/build/plugins/plugin-analyzer.js +10 -98
  20. package/dist/core/build/plugins/plugin-css.js +27 -1
  21. package/dist/core/build/plugins/plugin-manifest.js +5 -2
  22. package/dist/core/build/plugins/plugin-scripts.d.ts +8 -0
  23. package/dist/core/build/plugins/plugin-scripts.js +34 -0
  24. package/dist/core/compile/compile.d.ts +1 -7
  25. package/dist/core/compile/compile.js +5 -4
  26. package/dist/core/compile/style.d.ts +4 -3
  27. package/dist/core/compile/style.js +5 -4
  28. package/dist/core/compile/types.d.ts +11 -0
  29. package/dist/core/config/schema.d.ts +177 -113
  30. package/dist/core/config/schema.js +42 -9
  31. package/dist/core/config/vite-load.js +1 -0
  32. package/dist/core/constants.d.ts +1 -0
  33. package/dist/core/constants.js +3 -1
  34. package/dist/core/create-vite.js +5 -3
  35. package/dist/core/dev/dev.js +1 -1
  36. package/dist/core/errors/dev/vite.js +1 -1
  37. package/dist/core/messages.js +2 -2
  38. package/dist/core/render/params-and-props.js +2 -1
  39. package/dist/core/render/ssr-element.d.ts +8 -8
  40. package/dist/core/render/ssr-element.js +4 -2
  41. package/dist/core/render-context.js +3 -1
  42. package/dist/core/routing/astro-designed-error-pages.d.ts +2 -0
  43. package/dist/core/routing/astro-designed-error-pages.js +21 -0
  44. package/dist/runtime/client/dev-toolbar/apps/audit/index.d.ts +8 -15
  45. package/dist/runtime/client/dev-toolbar/apps/audit/index.js +130 -249
  46. package/dist/runtime/client/dev-toolbar/apps/audit/{a11y.js → rules/a11y.js} +4 -2
  47. package/dist/runtime/client/dev-toolbar/apps/audit/rules/index.d.ts +35 -0
  48. package/dist/runtime/client/dev-toolbar/apps/audit/rules/index.js +40 -0
  49. package/dist/runtime/client/dev-toolbar/apps/audit/{perf.js → rules/perf.js} +2 -2
  50. package/dist/runtime/client/dev-toolbar/apps/audit/ui/audit-list-item.d.ts +7 -0
  51. package/dist/runtime/client/dev-toolbar/apps/audit/ui/audit-list-item.js +137 -0
  52. package/dist/runtime/client/dev-toolbar/apps/audit/ui/audit-list-window.d.ts +23 -0
  53. package/dist/runtime/client/dev-toolbar/apps/audit/ui/audit-list-window.js +384 -0
  54. package/dist/runtime/client/dev-toolbar/apps/audit/ui/audit-ui.d.ts +6 -0
  55. package/dist/runtime/client/dev-toolbar/apps/audit/ui/audit-ui.js +126 -0
  56. package/dist/runtime/client/dev-toolbar/apps/utils/window.d.ts +1 -1
  57. package/dist/runtime/client/dev-toolbar/apps/utils/window.js +3 -1
  58. package/dist/runtime/client/dev-toolbar/entrypoint.js +43 -15
  59. package/dist/runtime/client/dev-toolbar/settings.d.ts +3 -1
  60. package/dist/runtime/client/dev-toolbar/settings.js +8 -2
  61. package/dist/runtime/client/dev-toolbar/toolbar.d.ts +1 -0
  62. package/dist/runtime/client/dev-toolbar/toolbar.js +10 -8
  63. package/dist/runtime/client/dev-toolbar/ui-library/badge.d.ts +14 -4
  64. package/dist/runtime/client/dev-toolbar/ui-library/badge.js +72 -33
  65. package/dist/runtime/client/dev-toolbar/ui-library/button.d.ts +14 -4
  66. package/dist/runtime/client/dev-toolbar/ui-library/button.js +100 -47
  67. package/dist/runtime/client/dev-toolbar/ui-library/card.d.ts +9 -0
  68. package/dist/runtime/client/dev-toolbar/ui-library/card.js +57 -2
  69. package/dist/runtime/client/dev-toolbar/ui-library/highlight.d.ts +9 -0
  70. package/dist/runtime/client/dev-toolbar/ui-library/highlight.js +54 -2
  71. package/dist/runtime/client/dev-toolbar/ui-library/icons.d.ts +4 -0
  72. package/dist/runtime/client/dev-toolbar/ui-library/icons.js +5 -1
  73. package/dist/runtime/client/dev-toolbar/ui-library/toggle.d.ts +9 -0
  74. package/dist/runtime/client/dev-toolbar/ui-library/toggle.js +64 -5
  75. package/dist/runtime/compiler/index.d.ts +1 -1
  76. package/dist/runtime/compiler/index.js +2 -0
  77. package/dist/runtime/server/hydration.js +3 -2
  78. package/dist/runtime/server/index.d.ts +1 -1
  79. package/dist/runtime/server/index.js +2 -0
  80. package/dist/runtime/server/render/astro/factory.d.ts +1 -1
  81. package/dist/runtime/server/render/component.js +4 -5
  82. package/dist/runtime/server/render/index.d.ts +1 -0
  83. package/dist/runtime/server/render/index.js +2 -0
  84. package/dist/runtime/server/render/script.d.ts +6 -0
  85. package/dist/runtime/server/render/script.js +15 -0
  86. package/dist/transitions/router.js +12 -3
  87. package/dist/vite-plugin-astro/index.d.ts +2 -2
  88. package/dist/vite-plugin-astro/index.js +12 -1
  89. package/dist/vite-plugin-astro/types.d.ts +21 -1
  90. package/dist/vite-plugin-astro-server/pipeline.js +6 -2
  91. package/dist/vite-plugin-astro-server/plugin.js +6 -2
  92. package/dist/vite-plugin-astro-server/response.d.ts +6 -0
  93. package/dist/vite-plugin-astro-server/response.js +13 -0
  94. package/dist/vite-plugin-astro-server/route.js +18 -2
  95. package/package.json +8 -9
  96. package/tsconfigs/base.json +3 -1
  97. /package/dist/runtime/client/dev-toolbar/apps/audit/{a11y.d.ts → rules/a11y.d.ts} +0 -0
  98. /package/dist/runtime/client/dev-toolbar/apps/audit/{perf.d.ts → rules/perf.d.ts} +0 -0
@@ -1,11 +1,11 @@
1
1
  import { markdownConfigDefaults } from "@astrojs/markdown-remark";
2
- import { bundledThemes } from "shikiji";
2
+ import { bundledThemes } from "shiki";
3
3
  import path from "node:path";
4
4
  import { pathToFileURL } from "node:url";
5
5
  import { z } from "zod";
6
6
  import { appendForwardSlash, prependForwardSlash, removeTrailingForwardSlash } from "../path.js";
7
+ import "@shikijs/core";
7
8
  import "mdast-util-to-hast";
8
- import "shikiji-core";
9
9
  const ASTRO_CONFIG_DEFAULTS = {
10
10
  root: ".",
11
11
  srcDir: "./src",
@@ -41,8 +41,9 @@ const ASTRO_CONFIG_DEFAULTS = {
41
41
  legacy: {},
42
42
  redirects: {},
43
43
  experimental: {
44
- optimizeHoistedScript: false,
44
+ directRenderScript: false,
45
45
  contentCollectionCache: false,
46
+ contentCollectionJsonSchema: false,
46
47
  clientPrerender: false,
47
48
  globalRoutePriority: false,
48
49
  i18nDomains: false
@@ -72,7 +73,19 @@ const AstroConfigSchema = z.object({
72
73
  client: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.build.client).transform((val) => new URL(val)),
73
74
  server: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.build.server).transform((val) => new URL(val)),
74
75
  assets: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.build.assets),
75
- assetsPrefix: z.string().optional(),
76
+ assetsPrefix: z.string().optional().or(z.object({ fallback: z.string() }).and(z.record(z.string())).optional()).refine(
77
+ (value) => {
78
+ if (value && typeof value !== "string") {
79
+ if (!value.fallback) {
80
+ return false;
81
+ }
82
+ }
83
+ return true;
84
+ },
85
+ {
86
+ message: "The `fallback` is mandatory when defining the option as an object."
87
+ }
88
+ ),
76
89
  serverEntry: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.build.serverEntry),
77
90
  redirects: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.build.redirects),
78
91
  inlineStylesheets: z.enum(["always", "auto", "never"]).optional().default(ASTRO_CONFIG_DEFAULTS.build.inlineStylesheets)
@@ -162,11 +175,18 @@ const AstroConfigSchema = z.object({
162
175
  return langs;
163
176
  }).default([]),
164
177
  theme: z.enum(Object.keys(bundledThemes)).or(z.custom()).default(ASTRO_CONFIG_DEFAULTS.markdown.shikiConfig.theme),
165
- experimentalThemes: z.record(
178
+ themes: z.record(
166
179
  z.enum(Object.keys(bundledThemes)).or(z.custom())
167
- ).default(ASTRO_CONFIG_DEFAULTS.markdown.shikiConfig.experimentalThemes),
180
+ ).default(ASTRO_CONFIG_DEFAULTS.markdown.shikiConfig.themes),
168
181
  wrap: z.boolean().or(z.null()).default(ASTRO_CONFIG_DEFAULTS.markdown.shikiConfig.wrap),
169
- transformers: z.custom().array().default(ASTRO_CONFIG_DEFAULTS.markdown.shikiConfig.transformers)
182
+ transformers: z.custom().array().transform((transformers) => {
183
+ for (const transformer of transformers) {
184
+ if (transformer.token && !("span" in transformer)) {
185
+ transformer.span = transformer.token;
186
+ }
187
+ }
188
+ return transformers;
189
+ }).default(ASTRO_CONFIG_DEFAULTS.markdown.shikiConfig.transformers)
170
190
  }).default({}),
171
191
  remarkPlugins: z.union([
172
192
  z.string(),
@@ -295,8 +315,9 @@ const AstroConfigSchema = z.object({
295
315
  })
296
316
  ),
297
317
  experimental: z.object({
298
- optimizeHoistedScript: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.optimizeHoistedScript),
318
+ directRenderScript: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.directRenderScript),
299
319
  contentCollectionCache: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.contentCollectionCache),
320
+ contentCollectionJsonSchema: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.contentCollectionJsonSchema),
300
321
  clientPrerender: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.clientPrerender),
301
322
  globalRoutePriority: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.globalRoutePriority),
302
323
  i18nDomains: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.i18nDomains)
@@ -320,7 +341,19 @@ function createRelativeSchema(cmd, fileProtocolRoot) {
320
341
  client: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.build.client).transform((val) => resolveDirAsUrl(val, fileProtocolRoot)),
321
342
  server: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.build.server).transform((val) => resolveDirAsUrl(val, fileProtocolRoot)),
322
343
  assets: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.build.assets),
323
- assetsPrefix: z.string().optional(),
344
+ assetsPrefix: z.string().optional().or(z.object({ fallback: z.string() }).and(z.record(z.string())).optional()).refine(
345
+ (value) => {
346
+ if (value && typeof value !== "string") {
347
+ if (!value.fallback) {
348
+ return false;
349
+ }
350
+ }
351
+ return true;
352
+ },
353
+ {
354
+ message: "The `fallback` is mandatory when defining the option as an object."
355
+ }
356
+ ),
324
357
  serverEntry: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.build.serverEntry),
325
358
  redirects: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.build.redirects),
326
359
  inlineStylesheets: z.enum(["always", "auto", "never"]).optional().default(ASTRO_CONFIG_DEFAULTS.build.inlineStylesheets)
@@ -4,6 +4,7 @@ import loadFallbackPlugin from "../../vite-plugin-load-fallback/index.js";
4
4
  import { debug } from "../logger/core.js";
5
5
  async function createViteServer(root, fs) {
6
6
  const viteServer = await createServer({
7
+ configFile: false,
7
8
  server: { middlewareMode: true, hmr: false, watch: null },
8
9
  optimizeDeps: { noDiscovery: true },
9
10
  clearScreen: false,
@@ -1,6 +1,7 @@
1
1
  export declare const ASTRO_VERSION: string;
2
2
  export declare const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
3
3
  export declare const ROUTE_TYPE_HEADER = "X-Astro-Route-Type";
4
+ export declare const DEFAULT_404_COMPONENT = "astro-default-404";
4
5
  /**
5
6
  * A response with one of these status codes will be rewritten
6
7
  * with the result of rendering the respective error page.
@@ -1,6 +1,7 @@
1
- const ASTRO_VERSION = "4.4.14";
1
+ const ASTRO_VERSION = "4.5.0";
2
2
  const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
3
3
  const ROUTE_TYPE_HEADER = "X-Astro-Route-Type";
4
+ const DEFAULT_404_COMPONENT = "astro-default-404";
4
5
  const REROUTABLE_STATUS_CODES = [404, 500];
5
6
  const clientAddressSymbol = Symbol.for("astro.clientAddress");
6
7
  const clientLocalsSymbol = Symbol.for("astro.locals");
@@ -16,6 +17,7 @@ const SUPPORTED_MARKDOWN_FILE_EXTENSIONS = [
16
17
  const MIDDLEWARE_PATH_SEGMENT_NAME = "middleware";
17
18
  export {
18
19
  ASTRO_VERSION,
20
+ DEFAULT_404_COMPONENT,
19
21
  MIDDLEWARE_PATH_SEGMENT_NAME,
20
22
  REROUTABLE_STATUS_CODES,
21
23
  REROUTE_DIRECTIVE_HEADER,
@@ -3,6 +3,7 @@ import { fileURLToPath } from "node:url";
3
3
  import glob from "fast-glob";
4
4
  import * as vite from "vite";
5
5
  import { crawlFrameworkPkgs } from "vitefu";
6
+ import { getAssetsPrefix } from "../assets/utils/getAssetsPrefix.js";
6
7
  import astroAssetsPlugin from "../assets/vite-plugin-assets.js";
7
8
  import {
8
9
  astroContentAssetPropagationPlugin,
@@ -33,6 +34,7 @@ import { vitePluginSSRManifest } from "../vite-plugin-ssr-manifest/index.js";
33
34
  import { createViteLogger } from "./logger/vite.js";
34
35
  import { vitePluginMiddleware } from "./middleware/vite-plugin.js";
35
36
  import { joinPaths } from "./path.js";
37
+ import { isObject } from "./util.js";
36
38
  const ALWAYS_NOEXTERNAL = [
37
39
  // This is only because Vite's native ESM doesn't resolve "exports" correctly.
38
40
  "astro",
@@ -183,9 +185,9 @@ async function createVite(commandConfig, { settings, logger, mode, command, fs =
183
185
  const assetsPrefix = settings.config.build.assetsPrefix;
184
186
  if (assetsPrefix) {
185
187
  commonConfig.experimental = {
186
- renderBuiltUrl(filename, { type }) {
188
+ renderBuiltUrl(filename, { type, hostType }) {
187
189
  if (type === "asset") {
188
- return joinPaths(assetsPrefix, filename);
190
+ return joinPaths(getAssetsPrefix(`.${hostType}`, assetsPrefix), filename);
189
191
  }
190
192
  }
191
193
  };
@@ -260,7 +262,7 @@ function isCommonNotAstro(dep) {
260
262
  );
261
263
  }
262
264
  function stringifyForDefine(value) {
263
- return typeof value === "string" ? JSON.stringify(value) : "undefined";
265
+ return typeof value === "string" || isObject(value) ? JSON.stringify(value) : "undefined";
264
266
  }
265
267
  export {
266
268
  createVite
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
23
23
  base: restart.container.settings.config.base
24
24
  })
25
25
  );
26
- const currentVersion = "4.4.14";
26
+ const currentVersion = "4.5.0";
27
27
  if (currentVersion.includes("-")) {
28
28
  logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
29
29
  }
@@ -1,6 +1,6 @@
1
1
  import * as fs from "node:fs";
2
2
  import { fileURLToPath } from "node:url";
3
- import { codeToHtml, createCssVariablesTheme } from "shikiji";
3
+ import { codeToHtml, createCssVariablesTheme } from "shiki";
4
4
  import { FailedToLoadModuleSSR, InvalidGlob, MdxIntegrationMissingError } from "../errors-data.js";
5
5
  import { AstroError } from "../errors.js";
6
6
  import { createSafeError } from "../utils.js";
@@ -36,7 +36,7 @@ function serverStart({
36
36
  host,
37
37
  base
38
38
  }) {
39
- const version = "4.4.14";
39
+ const version = "4.5.0";
40
40
  const localPrefix = `${dim("\u2503")} Local `;
41
41
  const networkPrefix = `${dim("\u2503")} Network `;
42
42
  const emptyPrefix = " ".repeat(11);
@@ -261,7 +261,7 @@ function printHelp({
261
261
  message.push(
262
262
  linebreak(),
263
263
  ` ${bgGreen(black(` ${commandName} `))} ${green(
264
- `v${"4.4.14"}`
264
+ `v${"4.5.0"}`
265
265
  )} ${headline}`
266
266
  );
267
267
  }
@@ -1,3 +1,4 @@
1
+ import { DEFAULT_404_COMPONENT } from "../constants.js";
1
2
  import { AstroError, AstroErrorData } from "../errors/index.js";
2
3
  import { routeIsFallback } from "../redirects/helpers.js";
3
4
  import { routeIsRedirect } from "../redirects/index.js";
@@ -7,7 +8,7 @@ async function getProps(opts) {
7
8
  if (!route || route.pathname) {
8
9
  return {};
9
10
  }
10
- if (routeIsRedirect(route) || routeIsFallback(route)) {
11
+ if (routeIsRedirect(route) || routeIsFallback(route) || route.component === DEFAULT_404_COMPONENT) {
11
12
  return {};
12
13
  }
13
14
  const params = getParams(route, pathname);
@@ -1,15 +1,15 @@
1
- import type { SSRElement } from '../../@types/astro.js';
1
+ import type { AssetsPrefix, SSRElement } from '../../@types/astro.js';
2
2
  import type { StylesheetAsset } from '../app/types.js';
3
- export declare function createAssetLink(href: string, base?: string, assetsPrefix?: string): string;
4
- export declare function createStylesheetElement(stylesheet: StylesheetAsset, base?: string, assetsPrefix?: string): SSRElement;
5
- export declare function createStylesheetElementSet(stylesheets: StylesheetAsset[], base?: string, assetsPrefix?: string): Set<SSRElement>;
3
+ export declare function createAssetLink(href: string, base?: string, assetsPrefix?: AssetsPrefix): string;
4
+ export declare function createStylesheetElement(stylesheet: StylesheetAsset, base?: string, assetsPrefix?: AssetsPrefix): SSRElement;
5
+ export declare function createStylesheetElementSet(stylesheets: StylesheetAsset[], base?: string, assetsPrefix?: AssetsPrefix): Set<SSRElement>;
6
6
  export declare function createModuleScriptElement(script: {
7
7
  type: 'inline' | 'external';
8
8
  value: string;
9
- }, base?: string, assetsPrefix?: string): SSRElement;
10
- export declare function createModuleScriptElementWithSrc(src: string, base?: string, assetsPrefix?: string): SSRElement;
11
- export declare function createModuleScriptElementWithSrcSet(srces: string[], site?: string, assetsPrefix?: string): Set<SSRElement>;
9
+ }, base?: string, assetsPrefix?: AssetsPrefix): SSRElement;
10
+ export declare function createModuleScriptElementWithSrc(src: string, base?: string, assetsPrefix?: AssetsPrefix): SSRElement;
11
+ export declare function createModuleScriptElementWithSrcSet(srces: string[], site?: string, assetsPrefix?: AssetsPrefix): Set<SSRElement>;
12
12
  export declare function createModuleScriptsSet(scripts: {
13
13
  type: 'inline' | 'external';
14
14
  value: string;
15
- }[], base?: string, assetsPrefix?: string): Set<SSRElement>;
15
+ }[], base?: string, assetsPrefix?: AssetsPrefix): Set<SSRElement>;
@@ -1,7 +1,9 @@
1
- import { joinPaths, prependForwardSlash, slash } from "../../core/path.js";
1
+ import { getAssetsPrefix } from "../../assets/utils/getAssetsPrefix.js";
2
+ import { fileExtension, joinPaths, prependForwardSlash, slash } from "../../core/path.js";
2
3
  function createAssetLink(href, base, assetsPrefix) {
3
4
  if (assetsPrefix) {
4
- return joinPaths(assetsPrefix, slash(href));
5
+ const pf = getAssetsPrefix(fileExtension(href), assetsPrefix);
6
+ return joinPaths(pf, slash(href));
5
7
  } else if (base) {
6
8
  return prependForwardSlash(joinPaths(base, slash(href)));
7
9
  } else {
@@ -142,7 +142,7 @@ class RenderContext {
142
142
  }
143
143
  async createResult(mod) {
144
144
  const { cookies, pathname, pipeline, routeData, status } = this;
145
- const { clientDirectives, compressHTML, manifest, renderers, resolve } = pipeline;
145
+ const { clientDirectives, inlinedScripts, compressHTML, manifest, renderers, resolve } = pipeline;
146
146
  const { links, scripts, styles } = await pipeline.headElements(routeData);
147
147
  const componentMetadata = await pipeline.componentMetadata(routeData) ?? manifest.componentMetadata;
148
148
  const headers = new Headers({ "Content-Type": "text/html" });
@@ -160,6 +160,7 @@ class RenderContext {
160
160
  };
161
161
  const result = {
162
162
  clientDirectives,
163
+ inlinedScripts,
163
164
  componentMetadata,
164
165
  compressHTML,
165
166
  cookies,
@@ -177,6 +178,7 @@ class RenderContext {
177
178
  hasHydrationScript: false,
178
179
  rendererSpecificHydrationScripts: /* @__PURE__ */ new Set(),
179
180
  hasRenderedHead: false,
181
+ renderedScripts: /* @__PURE__ */ new Set(),
180
182
  hasDirectives: /* @__PURE__ */ new Set(),
181
183
  headInTree: false,
182
184
  extraHead: [],
@@ -0,0 +1,2 @@
1
+ import type { ManifestData } from '../../@types/astro.js';
2
+ export declare function ensure404Route(manifest: ManifestData): ManifestData;
@@ -0,0 +1,21 @@
1
+ import { DEFAULT_404_COMPONENT } from "../constants.js";
2
+ function ensure404Route(manifest) {
3
+ if (!manifest.routes.some((route) => route.route === "/404")) {
4
+ manifest.routes.push({
5
+ component: DEFAULT_404_COMPONENT,
6
+ generate: () => "",
7
+ params: [],
8
+ pattern: /\/404/,
9
+ prerender: false,
10
+ segments: [],
11
+ type: "page",
12
+ route: "/404",
13
+ fallbackRoutes: [],
14
+ isIndex: false
15
+ });
16
+ }
17
+ return manifest;
18
+ }
19
+ export {
20
+ ensure404Route
21
+ };
@@ -1,18 +1,11 @@
1
- type DynamicString = string | ((element: Element) => string);
2
- export interface AuditRule {
3
- code: string;
4
- title: DynamicString;
5
- message: DynamicString;
6
- }
7
- export interface ResolvedAuditRule {
8
- code: string;
9
- title: string;
10
- message: string;
11
- }
12
- export interface AuditRuleWithSelector extends AuditRule {
13
- selector: string;
14
- match?: (element: Element) => boolean | null | undefined | void | Promise<boolean> | Promise<void> | Promise<null> | Promise<undefined>;
15
- }
1
+ import type { DevToolbarHighlight } from '../../ui-library/highlight.js';
2
+ import { type AuditRule } from './rules/index.js';
3
+ export type Audit = {
4
+ auditedElement: HTMLElement;
5
+ rule: AuditRule;
6
+ highlight: DevToolbarHighlight | null;
7
+ card: HTMLElement | null;
8
+ };
16
9
  declare const _default: {
17
10
  id: string;
18
11
  name: string;