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
@@ -12,6 +12,18 @@ async function handle404Response(origin, req, res) {
12
12
  });
13
13
  writeHtmlResponse(res, 404, html);
14
14
  }
15
+ async function default404Page({ pathname }) {
16
+ return new Response(
17
+ notFoundTemplate({
18
+ statusCode: 404,
19
+ title: "Not found",
20
+ tabTitle: "404: Not Found",
21
+ pathname
22
+ }),
23
+ { status: 404, headers: { "Content-Type": "text/html; charset=utf-8" } }
24
+ );
25
+ }
26
+ default404Page.isAstroComponentFactory = true;
15
27
  async function handle500Response(loader, res, err) {
16
28
  res.on(
17
29
  "close",
@@ -81,6 +93,7 @@ async function writeSSRResult(webRequest, webResponse, res) {
81
93
  return writeWebResponse(res, webResponse);
82
94
  }
83
95
  export {
96
+ default404Page,
84
97
  handle404Response,
85
98
  handle500Response,
86
99
  writeHtmlResponse,
@@ -1,4 +1,8 @@
1
- import { REROUTE_DIRECTIVE_HEADER, clientLocalsSymbol } from "../core/constants.js";
1
+ import {
2
+ DEFAULT_404_COMPONENT,
3
+ REROUTE_DIRECTIVE_HEADER,
4
+ clientLocalsSymbol
5
+ } from "../core/constants.js";
2
6
  import { AstroErrorData, isAstroError } from "../core/errors/index.js";
3
7
  import { req } from "../core/messages.js";
4
8
  import { loadMiddleware } from "../core/middleware/loadMiddleware.js";
@@ -8,7 +12,7 @@ import { createRequest } from "../core/request.js";
8
12
  import { matchAllRoutes } from "../core/routing/index.js";
9
13
  import { normalizeTheLocale } from "../i18n/index.js";
10
14
  import { getSortedPreloadedMatches } from "../prerender/routing.js";
11
- import { handle404Response, writeSSRResult, writeWebResponse } from "./response.js";
15
+ import { default404Page, handle404Response, writeSSRResult, writeWebResponse } from "./response.js";
12
16
  function isLoggedRequest(url) {
13
17
  return url !== "/favicon.ico";
14
18
  }
@@ -60,6 +64,18 @@ ${AstroErrorData.NoMatchingStaticPathFound.hint(possibleRoutes)}`
60
64
  );
61
65
  }
62
66
  const custom404 = getCustom404Route(manifestData);
67
+ if (custom404 && custom404.component === DEFAULT_404_COMPONENT) {
68
+ const component = {
69
+ default: default404Page
70
+ };
71
+ return {
72
+ route: custom404,
73
+ filePath: new URL(`file://${custom404.component}`),
74
+ resolvedPathname: pathname,
75
+ preloadedComponent: component,
76
+ mod: component
77
+ };
78
+ }
63
79
  if (custom404) {
64
80
  const filePath = new URL(`./${custom404.component}`, config.root);
65
81
  const preloadedComponent = await pipeline.preload(filePath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "4.4.14",
3
+ "version": "4.5.0",
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",
@@ -102,14 +102,14 @@
102
102
  "vendor"
103
103
  ],
104
104
  "dependencies": {
105
- "@astrojs/compiler": "^2.5.3",
105
+ "@astrojs/compiler": "^2.7.0",
106
106
  "@babel/core": "^7.23.3",
107
107
  "@babel/generator": "^7.23.3",
108
108
  "@babel/parser": "^7.23.3",
109
109
  "@babel/plugin-transform-react-jsx": "^7.22.5",
110
110
  "@babel/traverse": "^7.23.3",
111
111
  "@babel/types": "^7.23.3",
112
- "@medv/finder": "^3.1.0",
112
+ "@shikijs/core": "^1.1.2",
113
113
  "@types/babel__core": "^7.20.4",
114
114
  "acorn": "^8.11.2",
115
115
  "aria-query": "^5.3.0",
@@ -151,8 +151,7 @@
151
151
  "rehype": "^13.0.1",
152
152
  "resolve": "^1.22.4",
153
153
  "semver": "^7.5.4",
154
- "shikiji": "^0.9.19",
155
- "shikiji-core": "^0.9.19",
154
+ "shiki": "^1.1.2",
156
155
  "string-width": "^7.0.0",
157
156
  "strip-ansi": "^7.1.0",
158
157
  "tsconfck": "^3.0.0",
@@ -163,9 +162,10 @@
163
162
  "which-pm": "^2.1.1",
164
163
  "yargs-parser": "^21.1.1",
165
164
  "zod": "^3.22.4",
166
- "@astrojs/telemetry": "3.0.4",
167
- "@astrojs/internal-helpers": "0.2.1",
168
- "@astrojs/markdown-remark": "4.2.1"
165
+ "zod-to-json-schema": "^3.22.4",
166
+ "@astrojs/internal-helpers": "0.3.0",
167
+ "@astrojs/markdown-remark": "4.3.0",
168
+ "@astrojs/telemetry": "3.0.4"
169
169
  },
170
170
  "optionalDependencies": {
171
171
  "sharp": "^0.32.6"
@@ -185,7 +185,6 @@
185
185
  "@types/diff": "^5.0.8",
186
186
  "@types/dlv": "^1.1.4",
187
187
  "@types/dom-view-transitions": "^1.0.4",
188
- "@types/estree": "^1.0.5",
189
188
  "@types/hast": "^3.0.3",
190
189
  "@types/html-escaper": "^3.0.2",
191
190
  "@types/http-cache-semantics": "^4.0.4",
@@ -24,6 +24,8 @@
24
24
  // Skip typechecking libraries and .d.ts files
25
25
  "skipLibCheck": true,
26
26
  // Allow JavaScript files to be imported
27
- "allowJs": true
27
+ "allowJs": true,
28
+ // Allow JSX files (or files that are internally considered JSX, like Astro files) to be imported inside `.js` and `.ts` files.
29
+ "jsx": "preserve"
28
30
  }
29
31
  }