astro 4.4.8 → 4.4.10

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.
@@ -59,7 +59,13 @@ async function generateImagesForPath(originalFilePath, transformsAndPath, env, q
59
59
  }
60
60
  if (!env.isSSR && !isRemotePath(originalFilePath) && !globalThis.astroAsset.referencedImages?.has(transformsAndPath.originalSrcPath)) {
61
61
  try {
62
- await fs.promises.unlink(getFullImagePath(originalFilePath, env));
62
+ if (transformsAndPath.originalSrcPath) {
63
+ env.logger.debug(
64
+ "assets",
65
+ `Deleting ${originalFilePath} as it's not referenced outside of image processing.`
66
+ );
67
+ await fs.promises.unlink(getFullImagePath(originalFilePath, env));
68
+ }
63
69
  } catch (e) {
64
70
  }
65
71
  }
@@ -9,7 +9,7 @@ function getProxyCode(options, isSSR) {
9
9
  if (name === 'fsPath') {
10
10
  return ${stringifiedFSPath};
11
11
  }
12
- ${!isSSR ? `globalThis.astroAsset.referencedImages.add(${stringifiedFSPath});` : ""}
12
+ ${!isSSR ? `if (target[name] !== undefined) globalThis.astroAsset.referencedImages.add(${stringifiedFSPath});` : ""}
13
13
  return target[name];
14
14
  }
15
15
  })
@@ -31,7 +31,6 @@ export declare const AstroConfigSchema: z.ZodObject<{
31
31
  name: string;
32
32
  hooks?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
33
33
  }>>;
34
- db: z.ZodOptional<z.ZodDefault<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>>;
35
34
  integrations: z.ZodEffects<z.ZodDefault<z.ZodArray<z.ZodObject<{
36
35
  name: z.ZodString;
37
36
  hooks: z.ZodDefault<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
@@ -430,7 +429,6 @@ export declare const AstroConfigSchema: z.ZodObject<{
430
429
  [k: string]: unknown;
431
430
  };
432
431
  } | undefined;
433
- db?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
434
432
  prefetch?: boolean | {
435
433
  prefetchAll?: boolean | undefined;
436
434
  defaultStrategy?: "tap" | "hover" | "viewport" | "load" | undefined;
@@ -465,7 +463,6 @@ export declare const AstroConfigSchema: z.ZodObject<{
465
463
  name: string;
466
464
  hooks?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
467
465
  } | undefined;
468
- db?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
469
466
  integrations?: unknown;
470
467
  build?: {
471
468
  format?: "file" | "directory" | "preserve" | undefined;
@@ -627,7 +624,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
627
624
  name: string;
628
625
  hooks?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
629
626
  }>>;
630
- db: z.ZodOptional<z.ZodDefault<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>>;
631
627
  integrations: z.ZodEffects<z.ZodDefault<z.ZodArray<z.ZodObject<{
632
628
  name: z.ZodString;
633
629
  hooks: z.ZodDefault<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
@@ -971,7 +967,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
971
967
  [k: string]: unknown;
972
968
  };
973
969
  } | undefined;
974
- db?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
975
970
  prefetch?: boolean | {
976
971
  prefetchAll?: boolean | undefined;
977
972
  defaultStrategy?: "tap" | "hover" | "viewport" | "load" | undefined;
@@ -1018,7 +1013,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1018
1013
  name: string;
1019
1014
  hooks?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1020
1015
  } | undefined;
1021
- db?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1022
1016
  integrations?: unknown;
1023
1017
  prefetch?: boolean | {
1024
1018
  prefetchAll?: boolean | undefined;
@@ -1168,7 +1162,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1168
1162
  [k: string]: unknown;
1169
1163
  };
1170
1164
  } | undefined;
1171
- db?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1172
1165
  prefetch?: boolean | {
1173
1166
  prefetchAll?: boolean | undefined;
1174
1167
  defaultStrategy?: "tap" | "hover" | "viewport" | "load" | undefined;
@@ -1215,7 +1208,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1215
1208
  name: string;
1216
1209
  hooks?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1217
1210
  } | undefined;
1218
- db?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1219
1211
  integrations?: unknown;
1220
1212
  prefetch?: boolean | {
1221
1213
  prefetchAll?: boolean | undefined;
@@ -1365,7 +1357,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1365
1357
  [k: string]: unknown;
1366
1358
  };
1367
1359
  } | undefined;
1368
- db?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1369
1360
  prefetch?: boolean | {
1370
1361
  prefetchAll?: boolean | undefined;
1371
1362
  defaultStrategy?: "tap" | "hover" | "viewport" | "load" | undefined;
@@ -1412,7 +1403,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1412
1403
  name: string;
1413
1404
  hooks?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1414
1405
  } | undefined;
1415
- db?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1416
1406
  integrations?: unknown;
1417
1407
  prefetch?: boolean | {
1418
1408
  prefetchAll?: boolean | undefined;
@@ -1562,7 +1552,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1562
1552
  [k: string]: unknown;
1563
1553
  };
1564
1554
  } | undefined;
1565
- db?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1566
1555
  prefetch?: boolean | {
1567
1556
  prefetchAll?: boolean | undefined;
1568
1557
  defaultStrategy?: "tap" | "hover" | "viewport" | "load" | undefined;
@@ -1609,7 +1598,6 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
1609
1598
  name: string;
1610
1599
  hooks?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1611
1600
  } | undefined;
1612
- db?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1613
1601
  integrations?: unknown;
1614
1602
  prefetch?: boolean | {
1615
1603
  prefetchAll?: boolean | undefined;
@@ -61,7 +61,6 @@ const AstroConfigSchema = z.object({
61
61
  output: z.union([z.literal("static"), z.literal("server"), z.literal("hybrid")]).optional().default("static"),
62
62
  scopedStyleStrategy: z.union([z.literal("where"), z.literal("class"), z.literal("attribute")]).optional().default("attribute"),
63
63
  adapter: z.object({ name: z.string(), hooks: z.object({}).passthrough().default({}) }).optional(),
64
- db: z.object({}).passthrough().default({}).optional(),
65
64
  integrations: z.preprocess(
66
65
  // preprocess
67
66
  (val) => Array.isArray(val) ? val.flat(Infinity).filter(Boolean) : val,
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "4.4.8";
1
+ const ASTRO_VERSION = "4.4.10";
2
2
  const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
3
3
  const ROUTE_TYPE_HEADER = "X-Astro-Route-Type";
4
4
  const REROUTABLE_STATUS_CODES = [404, 500];
@@ -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.8";
26
+ const currentVersion = "4.4.10";
27
27
  if (currentVersion.includes("-")) {
28
28
  logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
29
29
  }
@@ -7,7 +7,7 @@ export type LoggerLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
7
7
  * rather than specific to a single command, function, use, etc. The label will be
8
8
  * shown in the log message to the user, so it should be relevant.
9
9
  */
10
- export type LoggerLabel = 'add' | 'build' | 'check' | 'config' | 'content' | 'deprecated' | 'markdown' | 'router' | 'types' | 'vite' | 'watch' | 'middleware' | 'preferences' | 'redirects' | 'toolbar' | 'SKIP_FORMAT';
10
+ export type LoggerLabel = 'add' | 'build' | 'check' | 'config' | 'content' | 'deprecated' | 'markdown' | 'router' | 'types' | 'vite' | 'watch' | 'middleware' | 'preferences' | 'redirects' | 'toolbar' | 'assets' | 'SKIP_FORMAT';
11
11
  export interface LogOptions {
12
12
  dest: LogWritable<LogMessage>;
13
13
  level: LoggerLevel;
@@ -36,7 +36,7 @@ function serverStart({
36
36
  host,
37
37
  base
38
38
  }) {
39
- const version = "4.4.8";
39
+ const version = "4.4.10";
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.8"}`
264
+ `v${"4.4.10"}`
265
265
  )} ${headline}`
266
266
  );
267
267
  }
@@ -49,25 +49,6 @@ if (inBrowser) {
49
49
  history.scrollRestoration = "manual";
50
50
  }
51
51
  }
52
- const throttle = (cb, delay) => {
53
- let wait = false;
54
- let onceMore = false;
55
- return (...args) => {
56
- if (wait) {
57
- onceMore = true;
58
- return;
59
- }
60
- cb(...args);
61
- wait = true;
62
- setTimeout(() => {
63
- if (onceMore) {
64
- onceMore = false;
65
- cb(...args);
66
- }
67
- wait = false;
68
- }, delay);
69
- };
70
- };
71
52
  async function fetchHTML(href, init) {
72
53
  try {
73
54
  const res = await fetch(href, init);
@@ -414,8 +395,10 @@ function onPopState(ev) {
414
395
  currentHistoryIndex = nextIndex;
415
396
  transition(direction, originalLocation, new URL(location.href), {}, state);
416
397
  }
417
- const onScroll = () => {
418
- updateScrollPosition({ scrollX, scrollY });
398
+ const onScrollEnd = () => {
399
+ if (scrollX !== history.state.scrollX || scrollY !== history.state.scrollY) {
400
+ updateScrollPosition({ scrollX, scrollY });
401
+ }
419
402
  };
420
403
  if (inBrowser) {
421
404
  if (supportsViewTransitions || getFallback() !== "none") {
@@ -423,9 +406,35 @@ if (inBrowser) {
423
406
  addEventListener("popstate", onPopState);
424
407
  addEventListener("load", onPageLoad);
425
408
  if ("onscrollend" in window)
426
- addEventListener("scrollend", onScroll);
427
- else
428
- addEventListener("scroll", throttle(onScroll, 350), { passive: true });
409
+ addEventListener("scrollend", onScrollEnd);
410
+ else {
411
+ let intervalId, lastY, lastX, lastIndex;
412
+ const scrollInterval = () => {
413
+ if (lastIndex !== history.state?.index) {
414
+ clearInterval(intervalId);
415
+ intervalId = void 0;
416
+ return;
417
+ }
418
+ if (lastY === scrollY && lastX === scrollX) {
419
+ clearInterval(intervalId);
420
+ intervalId = void 0;
421
+ onScrollEnd();
422
+ return;
423
+ } else {
424
+ lastY = scrollY, lastX = scrollX;
425
+ }
426
+ };
427
+ addEventListener(
428
+ "scroll",
429
+ () => {
430
+ if (intervalId !== void 0)
431
+ return;
432
+ lastIndex = history.state.index, lastY = scrollY, lastX = scrollX;
433
+ intervalId = window.setInterval(scrollInterval, 50);
434
+ },
435
+ { passive: true }
436
+ );
437
+ }
429
438
  }
430
439
  for (const script of document.scripts) {
431
440
  script.dataset.astroExec = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "4.4.8",
3
+ "version": "4.4.10",
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",
@@ -163,8 +163,8 @@
163
163
  "which-pm": "^2.1.1",
164
164
  "yargs-parser": "^21.1.1",
165
165
  "zod": "^3.22.4",
166
- "@astrojs/internal-helpers": "0.2.1",
167
166
  "@astrojs/markdown-remark": "4.2.1",
167
+ "@astrojs/internal-helpers": "0.2.1",
168
168
  "@astrojs/telemetry": "3.0.4"
169
169
  },
170
170
  "optionalDependencies": {
@@ -228,6 +228,7 @@
228
228
  "dev": "astro-scripts dev --copy-wasm --prebuild \"src/runtime/server/astro-island.ts\" --prebuild \"src/runtime/client/{idle,load,media,only,visible}.ts\" \"src/**/*.{ts,js}\"",
229
229
  "postbuild": "astro-scripts copy \"src/**/*.astro\" && astro-scripts copy \"src/**/*.wasm\"",
230
230
  "test": "pnpm run test:node",
231
+ "test:match": "pnpm run test:node --match",
231
232
  "test:e2e": "playwright test",
232
233
  "test:e2e:match": "playwright test -g",
233
234
  "test:node": "astro-scripts test \"test/**/*.test.js\""