astro 5.7.13 → 5.7.14

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.
@@ -8,7 +8,7 @@ export declare const ACTION_QUERY_PARAMS: {
8
8
  actionPayload: string;
9
9
  };
10
10
  export declare const appendForwardSlash: typeof _appendForwardSlash;
11
- export declare const ACTION_ERROR_CODES: readonly ["BAD_REQUEST", "UNAUTHORIZED", "FORBIDDEN", "NOT_FOUND", "TIMEOUT", "CONFLICT", "PRECONDITION_FAILED", "PAYLOAD_TOO_LARGE", "UNSUPPORTED_MEDIA_TYPE", "UNPROCESSABLE_CONTENT", "TOO_MANY_REQUESTS", "CLIENT_CLOSED_REQUEST", "INTERNAL_SERVER_ERROR"];
11
+ export declare const ACTION_ERROR_CODES: readonly ["BAD_REQUEST", "UNAUTHORIZED", "PAYMENT_REQUIRED", "FORBIDDEN", "NOT_FOUND", "METHOD_NOT_ALLOWED", "NOT_ACCEPTABLE", "PROXY_AUTHENTICATION_REQUIRED", "REQUEST_TIMEOUT", "CONFLICT", "GONE", "LENGTH_REQUIRED", "PRECONDITION_FAILED", "CONTENT_TOO_LARGE", "URI_TOO_LONG", "UNSUPPORTED_MEDIA_TYPE", "RANGE_NOT_SATISFIABLE", "EXPECTATION_FAILED", "MISDIRECTED_REQUEST", "UNPROCESSABLE_CONTENT", "LOCKED", "FAILED_DEPENDENCY", "TOO_EARLY", "UPGRADE_REQUIRED", "PRECONDITION_REQUIRED", "TOO_MANY_REQUESTS", "REQUEST_HEADER_FIELDS_TOO_LARGE", "UNAVAILABLE_FOR_LEGAL_REASONS", "INTERNAL_SERVER_ERROR", "NOT_IMPLEMENTED", "BAD_GATEWAY", "SERVICE_UNAVAILABLE", "GATEWAY_TIMEOUT", "HTTP_VERSION_NOT_SUPPORTED", "VARIANT_ALSO_NEGOTIATES", "INSUFFICIENT_STORAGE", "LOOP_DETECTED", "NETWORK_AUTHENTICATION_REQUIRED"];
12
12
  export type ActionErrorCode = (typeof ACTION_ERROR_CODES)[number];
13
13
  export declare class ActionError<_T extends ErrorInferenceObject = ErrorInferenceObject> extends Error {
14
14
  type: string;
@@ -12,34 +12,84 @@ const appendForwardSlash = _appendForwardSlash;
12
12
  const ACTION_ERROR_CODES = [
13
13
  "BAD_REQUEST",
14
14
  "UNAUTHORIZED",
15
+ "PAYMENT_REQUIRED",
15
16
  "FORBIDDEN",
16
17
  "NOT_FOUND",
17
- "TIMEOUT",
18
+ "METHOD_NOT_ALLOWED",
19
+ "NOT_ACCEPTABLE",
20
+ "PROXY_AUTHENTICATION_REQUIRED",
21
+ "REQUEST_TIMEOUT",
18
22
  "CONFLICT",
23
+ "GONE",
24
+ "LENGTH_REQUIRED",
19
25
  "PRECONDITION_FAILED",
20
- "PAYLOAD_TOO_LARGE",
26
+ "CONTENT_TOO_LARGE",
27
+ "URI_TOO_LONG",
21
28
  "UNSUPPORTED_MEDIA_TYPE",
29
+ "RANGE_NOT_SATISFIABLE",
30
+ "EXPECTATION_FAILED",
31
+ "MISDIRECTED_REQUEST",
22
32
  "UNPROCESSABLE_CONTENT",
33
+ "LOCKED",
34
+ "FAILED_DEPENDENCY",
35
+ "TOO_EARLY",
36
+ "UPGRADE_REQUIRED",
37
+ "PRECONDITION_REQUIRED",
23
38
  "TOO_MANY_REQUESTS",
24
- "CLIENT_CLOSED_REQUEST",
25
- "INTERNAL_SERVER_ERROR"
39
+ "REQUEST_HEADER_FIELDS_TOO_LARGE",
40
+ "UNAVAILABLE_FOR_LEGAL_REASONS",
41
+ "INTERNAL_SERVER_ERROR",
42
+ "NOT_IMPLEMENTED",
43
+ "BAD_GATEWAY",
44
+ "SERVICE_UNAVAILABLE",
45
+ "GATEWAY_TIMEOUT",
46
+ "HTTP_VERSION_NOT_SUPPORTED",
47
+ "VARIANT_ALSO_NEGOTIATES",
48
+ "INSUFFICIENT_STORAGE",
49
+ "LOOP_DETECTED",
50
+ "NETWORK_AUTHENTICATION_REQUIRED"
26
51
  ];
27
52
  const codeToStatusMap = {
28
- // Implemented from tRPC error code table
29
- // https://trpc.io/docs/server/error-handling#error-codes
53
+ // Implemented from IANA HTTP Status Code Registry
54
+ // https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
30
55
  BAD_REQUEST: 400,
31
56
  UNAUTHORIZED: 401,
57
+ PAYMENT_REQUIRED: 402,
32
58
  FORBIDDEN: 403,
33
59
  NOT_FOUND: 404,
34
- TIMEOUT: 405,
60
+ METHOD_NOT_ALLOWED: 405,
61
+ NOT_ACCEPTABLE: 406,
62
+ PROXY_AUTHENTICATION_REQUIRED: 407,
63
+ REQUEST_TIMEOUT: 408,
35
64
  CONFLICT: 409,
65
+ GONE: 410,
66
+ LENGTH_REQUIRED: 411,
36
67
  PRECONDITION_FAILED: 412,
37
- PAYLOAD_TOO_LARGE: 413,
68
+ CONTENT_TOO_LARGE: 413,
69
+ URI_TOO_LONG: 414,
38
70
  UNSUPPORTED_MEDIA_TYPE: 415,
71
+ RANGE_NOT_SATISFIABLE: 416,
72
+ EXPECTATION_FAILED: 417,
73
+ MISDIRECTED_REQUEST: 421,
39
74
  UNPROCESSABLE_CONTENT: 422,
75
+ LOCKED: 423,
76
+ FAILED_DEPENDENCY: 424,
77
+ TOO_EARLY: 425,
78
+ UPGRADE_REQUIRED: 426,
79
+ PRECONDITION_REQUIRED: 428,
40
80
  TOO_MANY_REQUESTS: 429,
41
- CLIENT_CLOSED_REQUEST: 499,
42
- INTERNAL_SERVER_ERROR: 500
81
+ REQUEST_HEADER_FIELDS_TOO_LARGE: 431,
82
+ UNAVAILABLE_FOR_LEGAL_REASONS: 451,
83
+ INTERNAL_SERVER_ERROR: 500,
84
+ NOT_IMPLEMENTED: 501,
85
+ BAD_GATEWAY: 502,
86
+ SERVICE_UNAVAILABLE: 503,
87
+ GATEWAY_TIMEOUT: 504,
88
+ HTTP_VERSION_NOT_SUPPORTED: 505,
89
+ VARIANT_ALSO_NEGOTIATES: 506,
90
+ INSUFFICIENT_STORAGE: 507,
91
+ LOOP_DETECTED: 508,
92
+ NETWORK_AUTHENTICATION_REQUIRED: 511
43
93
  };
44
94
  const statusToCodeMap = Object.entries(codeToStatusMap).reduce(
45
95
  // reverse the key-value pairs
@@ -153,7 +153,7 @@ ${contentConfig.error.message}`);
153
153
  logger.info("Content config changed");
154
154
  shouldClear = true;
155
155
  }
156
- if (previousAstroVersion && previousAstroVersion !== "5.7.13") {
156
+ if (previousAstroVersion && previousAstroVersion !== "5.7.14") {
157
157
  logger.info("Astro version changed");
158
158
  shouldClear = true;
159
159
  }
@@ -161,8 +161,8 @@ ${contentConfig.error.message}`);
161
161
  logger.info("Clearing content store");
162
162
  this.#store.clearAll();
163
163
  }
164
- if ("5.7.13") {
165
- await this.#store.metaStore().set("astro-version", "5.7.13");
164
+ if ("5.7.14") {
165
+ await this.#store.metaStore().set("astro-version", "5.7.14");
166
166
  }
167
167
  if (currentConfigDigest) {
168
168
  await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
@@ -101,22 +101,6 @@ function rollupPluginAstroBuildCSS(options) {
101
101
  }
102
102
  }
103
103
  };
104
- const cssScopeToPlugin = {
105
- name: "astro:rollup-plugin-css-scope-to",
106
- renderChunk(_, chunk, __, meta) {
107
- for (const id in chunk.modules) {
108
- const modMeta = this.getModuleInfo(id)?.meta;
109
- const cssScopeTo = modMeta?.astroCss?.cssScopeTo;
110
- if (cssScopeTo && !isCssScopeToRendered(cssScopeTo, Object.values(meta.chunks))) {
111
- delete chunk.modules[id];
112
- const moduleIdsIndex = chunk.moduleIds.indexOf(id);
113
- if (moduleIdsIndex > -1) {
114
- chunk.moduleIds.splice(moduleIdsIndex, 1);
115
- }
116
- }
117
- }
118
- }
119
- };
120
104
  const singleCssPlugin = {
121
105
  name: "astro:rollup-plugin-single-css",
122
106
  enforce: "post",
@@ -178,7 +162,7 @@ function rollupPluginAstroBuildCSS(options) {
178
162
  });
179
163
  }
180
164
  };
181
- return [cssBuildPlugin, cssScopeToPlugin, singleCssPlugin, inlineStylesheetsPlugin];
165
+ return [cssBuildPlugin, singleCssPlugin, inlineStylesheetsPlugin];
182
166
  }
183
167
  function* getParentClientOnlys(id, ctx, internals) {
184
168
  for (const info of getParentModuleInfos(id, ctx)) {
@@ -203,16 +187,6 @@ function appendCSSToPage(pageData, meta, pagesToCss, depth, order) {
203
187
  }
204
188
  }
205
189
  }
206
- function isCssScopeToRendered(cssScopeTo, chunks) {
207
- for (const moduleId in cssScopeTo) {
208
- const exports = cssScopeTo[moduleId];
209
- const renderedModule = chunks.find((c) => c.moduleIds.includes(moduleId))?.modules[moduleId];
210
- if (renderedModule?.renderedExports.some((e) => exports.includes(e))) {
211
- return true;
212
- }
213
- }
214
- return false;
215
- }
216
190
  export {
217
191
  pluginCSS
218
192
  };
@@ -1,5 +1,7 @@
1
1
  import { fileURLToPath } from "node:url";
2
+ import { resolve as importMetaResolve } from "import-meta-resolve";
2
3
  import { glob } from "tinyglobby";
4
+ import { builtinDrivers } from "unstorage";
3
5
  import { getAssetsPrefix } from "../../../assets/utils/getAssetsPrefix.js";
4
6
  import { normalizeTheLocale } from "../../../i18n/index.js";
5
7
  import { toFallbackType, toRoutingStrategy } from "../../../i18n/utils.js";
@@ -9,7 +11,6 @@ import { encodeKey } from "../../encryption.js";
9
11
  import { fileExtension, joinPaths, prependForwardSlash } from "../../path.js";
10
12
  import { DEFAULT_COMPONENTS } from "../../routing/default.js";
11
13
  import { serializeRouteData } from "../../routing/index.js";
12
- import { resolveSessionDriver } from "../../session.js";
13
14
  import { addRollupInput } from "../add-rollup-input.js";
14
15
  import { getOutFile, getOutFolder } from "../common.js";
15
16
  import { cssOrder, mergeInlineCss } from "../internal.js";
@@ -18,6 +19,22 @@ const manifestReplace = "@@ASTRO_MANIFEST_REPLACE@@";
18
19
  const replaceExp = new RegExp(`['"]${manifestReplace}['"]`, "g");
19
20
  const SSR_MANIFEST_VIRTUAL_MODULE_ID = "@astrojs-manifest";
20
21
  const RESOLVED_SSR_MANIFEST_VIRTUAL_MODULE_ID = "\0" + SSR_MANIFEST_VIRTUAL_MODULE_ID;
22
+ function resolveSessionDriver(driver) {
23
+ if (!driver) {
24
+ return null;
25
+ }
26
+ try {
27
+ if (driver === "fs") {
28
+ return importMetaResolve(builtinDrivers.fsLite, import.meta.url);
29
+ }
30
+ if (driver in builtinDrivers) {
31
+ return importMetaResolve(builtinDrivers[driver], import.meta.url);
32
+ }
33
+ } catch {
34
+ return null;
35
+ }
36
+ return driver;
37
+ }
21
38
  function vitePluginManifest(options, internals) {
22
39
  return {
23
40
  name: "@astro/plugin-build-manifest",
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "5.7.13";
1
+ const ASTRO_VERSION = "5.7.14";
2
2
  const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
3
3
  const REWRITE_DIRECTIVE_HEADER_KEY = "X-Astro-Rewrite";
4
4
  const REWRITE_DIRECTIVE_HEADER_VALUE = "yes";
@@ -22,7 +22,7 @@ async function dev(inlineConfig) {
22
22
  await telemetry.record([]);
23
23
  const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
24
24
  const logger = restart.container.logger;
25
- const currentVersion = "5.7.13";
25
+ const currentVersion = "5.7.14";
26
26
  const isPrerelease = currentVersion.includes("-");
27
27
  if (!isPrerelease) {
28
28
  try {
@@ -13,6 +13,7 @@ const viteHmrUpdateMsg = /hmr update (.*)/;
13
13
  const viteBuildMsg = /vite.*building.*for production/;
14
14
  const viteShortcutTitleMsg = /^\s*Shortcuts\s*$/;
15
15
  const viteShortcutHelpMsg = /press (.+?) to (.+)$/s;
16
+ const lightningcssUnsupportedPseudoMsg = /\[lightningcss\] 'global'.*not recognized.*pseudo-class/s;
16
17
  function createViteLogger(astroLogger, viteLogLevel = "info") {
17
18
  const warnedMessages = /* @__PURE__ */ new Set();
18
19
  const loggedErrors = /* @__PURE__ */ new WeakSet();
@@ -38,6 +39,7 @@ function createViteLogger(astroLogger, viteLogLevel = "info") {
38
39
  },
39
40
  warn(msg) {
40
41
  if (!isLogLevelEnabled(viteLogLevel, "warn")) return;
42
+ if (lightningcssUnsupportedPseudoMsg.test(msg)) return;
41
43
  logger.hasWarned = true;
42
44
  astroLogger.warn("vite", msg);
43
45
  },
@@ -37,7 +37,7 @@ function serverStart({
37
37
  host,
38
38
  base
39
39
  }) {
40
- const version = "5.7.13";
40
+ const version = "5.7.14";
41
41
  const localPrefix = `${dim("\u2503")} Local `;
42
42
  const networkPrefix = `${dim("\u2503")} Network `;
43
43
  const emptyPrefix = " ".repeat(11);
@@ -274,7 +274,7 @@ function printHelp({
274
274
  message.push(
275
275
  linebreak(),
276
276
  ` ${bgGreen(black(` ${commandName} `))} ${green(
277
- `v${"5.7.13"}`
277
+ `v${"5.7.14"}`
278
278
  )} ${headline}`
279
279
  );
280
280
  }
@@ -53,4 +53,3 @@ export declare class AstroSession<TDriver extends SessionDriverName = any> {
53
53
  */
54
54
  load(sessionID: string): Promise<void>;
55
55
  }
56
- export declare function resolveSessionDriver(driver: string | undefined): Promise<string | null>;
@@ -344,12 +344,14 @@ class AstroSession {
344
344
  });
345
345
  }
346
346
  let driver = null;
347
- const driverPackage = await resolveSessionDriver(this.#config.driver);
348
347
  try {
349
348
  if (this.#config.driverModule) {
350
349
  driver = (await this.#config.driverModule()).default;
351
- } else if (driverPackage) {
352
- driver = (await import(driverPackage)).default;
350
+ } else if (this.#config.driver) {
351
+ const driverName = resolveSessionDriverName(this.#config.driver);
352
+ if (driverName) {
353
+ driver = (await import(driverName)).default;
354
+ }
353
355
  }
354
356
  } catch (err) {
355
357
  if (err.code === "ERR_MODULE_NOT_FOUND") {
@@ -357,7 +359,7 @@ class AstroSession {
357
359
  {
358
360
  ...SessionStorageInitError,
359
361
  message: SessionStorageInitError.message(
360
- err.message.includes(`Cannot find package '${driverPackage}'`) ? "The driver module could not be found." : err.message,
362
+ err.message.includes(`Cannot find package`) ? "The driver module could not be found." : err.message,
361
363
  this.#config.driver
362
364
  )
363
365
  },
@@ -392,16 +394,16 @@ class AstroSession {
392
394
  }
393
395
  }
394
396
  }
395
- async function resolveSessionDriver(driver) {
397
+ function resolveSessionDriverName(driver) {
396
398
  if (!driver) {
397
399
  return null;
398
400
  }
399
401
  try {
400
402
  if (driver === "fs") {
401
- return await import.meta.resolve(builtinDrivers.fsLite);
403
+ return builtinDrivers.fsLite;
402
404
  }
403
405
  if (driver in builtinDrivers) {
404
- return await import.meta.resolve(builtinDrivers[driver]);
406
+ return builtinDrivers[driver];
405
407
  }
406
408
  } catch {
407
409
  return null;
@@ -410,6 +412,5 @@ async function resolveSessionDriver(driver) {
410
412
  }
411
413
  export {
412
414
  AstroSession,
413
- PERSIST_SYMBOL,
414
- resolveSessionDriver
415
+ PERSIST_SYMBOL
415
416
  };
@@ -423,6 +423,7 @@ const a11y = [
423
423
  match(element) {
424
424
  const isScrollable = element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;
425
425
  if (isScrollable) return false;
426
+ if (element.localName === "pre") return false;
426
427
  if (!isInteractive(element)) return false;
427
428
  if (!interactiveElements.includes(element.localName) && !roleless_elements.includes(element.localName))
428
429
  return true;
@@ -66,7 +66,7 @@ class DevToolbarAuditListWindow extends HTMLElement {
66
66
  "Noto Color Emoji";
67
67
  color: rgba(191, 193, 201, 1);
68
68
  position: fixed;
69
- z-index: 999999999;
69
+ z-index: 2000000009;
70
70
  bottom: 72px;
71
71
  left: 50%;
72
72
  transform: translateX(-50%);
@@ -67,6 +67,8 @@ var settings_default = {
67
67
  `<style>
68
68
  :host astro-dev-toolbar-window {
69
69
  height: 480px;
70
+ overflow-y: auto;
71
+ color-scheme: dark;
70
72
 
71
73
  --color-purple: rgba(224, 204, 250, 1);
72
74
  }
@@ -125,6 +127,9 @@ var settings_default = {
125
127
  label > section {
126
128
  max-width: 67%;
127
129
  }
130
+ label > section.full-width {
131
+ max-width: 100%;
132
+ }
128
133
  p {
129
134
  line-height: 1.5em;
130
135
  }
@@ -142,7 +147,7 @@ var settings_default = {
142
147
  <hr id="general"/>
143
148
 
144
149
  <label class="setting-row">
145
- <section>
150
+ <section class="full-width">
146
151
  <h3>Hide toolbar</h3>
147
152
  Run <code>astro preferences disable devToolbar</code> in your terminal to disable the toolbar. <a href="https://docs.astro.build/en/reference/cli-reference/#astro-preferences" target="_blank">Learn more</a>.
148
153
  </section>
@@ -1,9 +1,9 @@
1
1
  import type * as vite from 'vite';
2
2
  import type { Logger } from '../core/logger/core.js';
3
3
  import type { AstroSettings } from '../types/astro.js';
4
- import type { PluginCssMetadata as AstroPluginCssMetadata, PluginMetadata as AstroPluginMetadata } from './types.js';
4
+ import type { PluginMetadata as AstroPluginMetadata } from './types.js';
5
5
  export { getAstroMetadata } from './metadata.js';
6
- export type { AstroPluginMetadata, AstroPluginCssMetadata };
6
+ export type { AstroPluginMetadata };
7
7
  interface AstroPluginOptions {
8
8
  settings: AstroSettings;
9
9
  logger: Logger;
@@ -89,13 +89,11 @@ function astro({ settings, logger }) {
89
89
  result.dependencies?.forEach((dep) => this.addWatchFile(dep));
90
90
  return {
91
91
  code: result.code,
92
- // This metadata is used by `cssScopeToPlugin` to remove this module from the bundle
93
- // if the `filename` default export (the Astro component) is unused.
92
+ // `vite.cssScopeTo` is a Vite feature that allows this CSS to be treeshaken
93
+ // if the Astro component's default export is not used
94
94
  meta: result.isGlobal ? void 0 : {
95
- astroCss: {
96
- cssScopeTo: {
97
- [filename]: ["default"]
98
- }
95
+ vite: {
96
+ cssScopeTo: [filename, "default"]
99
97
  }
100
98
  }
101
99
  };
@@ -15,26 +15,6 @@ export interface PluginMetadata {
15
15
  pageOptions: PageOptions;
16
16
  };
17
17
  }
18
- export interface PluginCssMetadata {
19
- astroCss: {
20
- /**
21
- * For Astro CSS virtual modules, it can scope to the main Astro module's default export
22
- * so that if those exports are treeshaken away, the CSS module will also be treeshaken.
23
- *
24
- * Example config if the CSS id is `/src/Foo.astro?astro&type=style&lang.css`:
25
- * ```js
26
- * cssScopeTo: {
27
- * '/src/Foo.astro': ['default']
28
- * }
29
- * ```
30
- *
31
- * The above is the only config we use today, but we're exposing as a `Record` to follow the
32
- * upstream Vite implementation: https://github.com/vitejs/vite/pull/16058. When/If that lands,
33
- * we can also remove our custom implementation.
34
- */
35
- cssScopeTo: Record<string, string[]>;
36
- };
37
- }
38
18
  export interface CompileMetadata {
39
19
  /** Used for HMR to compare code changes */
40
20
  originalCode: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "5.7.13",
3
+ "version": "5.7.14",
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",
@@ -125,6 +125,7 @@
125
125
  "github-slugger": "^2.0.0",
126
126
  "html-escaper": "3.0.3",
127
127
  "http-cache-semantics": "^4.1.1",
128
+ "import-meta-resolve": "^4.1.0",
128
129
  "js-yaml": "^4.1.0",
129
130
  "kleur": "^4.1.5",
130
131
  "magic-string": "^0.30.17",
@@ -155,9 +156,9 @@
155
156
  "zod": "^3.24.2",
156
157
  "zod-to-json-schema": "^3.24.5",
157
158
  "zod-to-ts": "^1.2.0",
159
+ "@astrojs/internal-helpers": "0.6.1",
158
160
  "@astrojs/markdown-remark": "6.3.1",
159
- "@astrojs/telemetry": "3.2.1",
160
- "@astrojs/internal-helpers": "0.6.1"
161
+ "@astrojs/telemetry": "3.2.1"
161
162
  },
162
163
  "optionalDependencies": {
163
164
  "sharp": "^0.33.3"