astro 4.16.0 → 4.16.2

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.
@@ -1,5 +1,5 @@
1
1
  import { promises as fs, existsSync } from "node:fs";
2
- import * as fastq from "fastq";
2
+ import PQueue from "p-queue";
3
3
  import xxhash from "xxhash-wasm";
4
4
  import { AstroUserError } from "../core/errors/errors.js";
5
5
  import {
@@ -28,13 +28,13 @@ class ContentLayer {
28
28
  this.#store = store;
29
29
  this.#settings = settings;
30
30
  this.#watcher = watcher;
31
- this.#queue = fastq.promise(this.#doSync.bind(this), 1);
31
+ this.#queue = new PQueue({ concurrency: 1 });
32
32
  }
33
33
  /**
34
34
  * Whether the content layer is currently loading content
35
35
  */
36
36
  get loading() {
37
- return !this.#queue.idle();
37
+ return this.#queue.size > 0 || this.#queue.pending > 0;
38
38
  }
39
39
  /**
40
40
  * Watch for changes to the content config and trigger a sync when it changes.
@@ -90,7 +90,7 @@ class ContentLayer {
90
90
  * so that only one sync can run at a time. The function returns a promise that resolves when this sync job is complete.
91
91
  */
92
92
  sync(options = {}) {
93
- return this.#queue.push(options);
93
+ return this.#queue.add(() => this.#doSync(options));
94
94
  }
95
95
  async #doSync(options) {
96
96
  const contentConfig = globalContentConfigObserver.get();
@@ -121,7 +121,7 @@ class ContentLayer {
121
121
  logger.info("Content config changed");
122
122
  shouldClear = true;
123
123
  }
124
- if (previousAstroVersion !== "4.16.0") {
124
+ if (previousAstroVersion !== "4.16.2") {
125
125
  logger.info("Astro version changed");
126
126
  shouldClear = true;
127
127
  }
@@ -129,8 +129,8 @@ class ContentLayer {
129
129
  logger.info("Clearing content store");
130
130
  this.#store.clearAll();
131
131
  }
132
- if ("4.16.0") {
133
- await this.#store.metaStore().set("astro-version", "4.16.0");
132
+ if ("4.16.2") {
133
+ await this.#store.metaStore().set("astro-version", "4.16.2");
134
134
  }
135
135
  if (currentConfigDigest) {
136
136
  await this.#store.metaStore().set("config-digest", currentConfigDigest);
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "4.16.0";
1
+ const ASTRO_VERSION = "4.16.2";
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 = "4.16.0";
25
+ const currentVersion = "4.16.2";
26
26
  const isPrerelease = currentVersion.includes("-");
27
27
  if (!isPrerelease) {
28
28
  try {
@@ -29,8 +29,6 @@ export declare function info(opts: LogOptions, label: string | null, message: st
29
29
  export declare function warn(opts: LogOptions, label: string | null, message: string, newLine?: boolean): void;
30
30
  /** Emit a error message, Useful when Astro can't recover from some error. */
31
31
  export declare function error(opts: LogOptions, label: string | null, message: string, newLine?: boolean): void;
32
- type LogFn = typeof info | typeof warn | typeof error;
33
- export declare function table(opts: LogOptions, columns: number[]): (logFn: LogFn, ...input: Array<any>) => void;
34
32
  export declare function debug(...args: any[]): void;
35
33
  /**
36
34
  * Get the prefix for a log message.
@@ -63,4 +61,3 @@ export declare class AstroIntegrationLogger {
63
61
  error(message: string): void;
64
62
  debug(message: string): void;
65
63
  }
66
- export {};
@@ -1,5 +1,4 @@
1
1
  import { blue, bold, dim, red, yellow } from "kleur/colors";
2
- import stringWidth from "string-width";
3
2
  const dateTimeFormat = new Intl.DateTimeFormat([], {
4
3
  hour: "2-digit",
5
4
  minute: "2-digit",
@@ -39,25 +38,11 @@ function warn(opts, label, message, newLine = true) {
39
38
  function error(opts, label, message, newLine = true) {
40
39
  return log(opts, "error", label, message, newLine);
41
40
  }
42
- function table(opts, columns) {
43
- return function logTable(logFn, ...input) {
44
- const message = columns.map((len, i) => padStr(input[i].toString(), len)).join(" ");
45
- logFn(opts, null, message);
46
- };
47
- }
48
41
  function debug(...args) {
49
42
  if ("_astroGlobalDebug" in globalThis) {
50
43
  globalThis._astroGlobalDebug(...args);
51
44
  }
52
45
  }
53
- function padStr(str, len) {
54
- const strLen = stringWidth(str);
55
- if (strLen > len) {
56
- return str.substring(0, len - 3) + "...";
57
- }
58
- const spaces = Array.from({ length: len - strLen }, () => " ").join("");
59
- return str + spaces;
60
- }
61
46
  function getEventPrefix({ level, label }) {
62
47
  const timestamp = `${dateTimeFormat.format(/* @__PURE__ */ new Date())}`;
63
48
  const prefix = [];
@@ -147,7 +132,6 @@ export {
147
132
  isLogLevelEnabled,
148
133
  levels,
149
134
  log,
150
- table,
151
135
  timerMessage,
152
136
  warn
153
137
  };
@@ -38,7 +38,7 @@ function serverStart({
38
38
  host,
39
39
  base
40
40
  }) {
41
- const version = "4.16.0";
41
+ const version = "4.16.2";
42
42
  const localPrefix = `${dim("\u2503")} Local `;
43
43
  const networkPrefix = `${dim("\u2503")} Network `;
44
44
  const emptyPrefix = " ".repeat(11);
@@ -270,7 +270,7 @@ function printHelp({
270
270
  message.push(
271
271
  linebreak(),
272
272
  ` ${bgGreen(black(` ${commandName} `))} ${green(
273
- `v${"4.16.0"}`
273
+ `v${"4.16.2"}`
274
274
  )} ${headline}`
275
275
  );
276
276
  }
@@ -75,7 +75,7 @@ function getFallback() {
75
75
  }
76
76
  function runScripts() {
77
77
  let wait = Promise.resolve();
78
- for (const script of Array.from(document.scripts)) {
78
+ for (const script of document.getElementsByTagName("script")) {
79
79
  if (script.dataset.astroExec === "") continue;
80
80
  const type = script.getAttribute("type");
81
81
  if (type && type !== "module" && type !== "text/javascript") continue;
@@ -416,7 +416,7 @@ if (inBrowser) {
416
416
  );
417
417
  }
418
418
  }
419
- for (const script of document.scripts) {
419
+ for (const script of document.getElementsByTagName("script")) {
420
420
  script.dataset.astroExec = "";
421
421
  }
422
422
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "4.16.0",
3
+ "version": "4.16.2",
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",
@@ -135,7 +135,6 @@
135
135
  "esbuild": "^0.21.5",
136
136
  "estree-walker": "^3.0.3",
137
137
  "fast-glob": "^3.3.2",
138
- "fastq": "^1.17.1",
139
138
  "flattie": "^1.1.1",
140
139
  "github-slugger": "^2.0.0",
141
140
  "gray-matter": "^4.0.3",
@@ -156,7 +155,6 @@
156
155
  "rehype": "^13.0.2",
157
156
  "semver": "^7.6.3",
158
157
  "shiki": "^1.22.0",
159
- "string-width": "^7.2.0",
160
158
  "tinyexec": "^0.3.0",
161
159
  "tsconfck": "^3.1.3",
162
160
  "unist-util-visit": "^5.0.0",
@@ -98,6 +98,7 @@ declare module 'astro:content' {
98
98
  /** Run `astro sync` to generate high fidelity types */
99
99
  export type CollectionKey = any;
100
100
  /** Run `astro sync` to generate high fidelity types */
101
+ // biome-ignore lint/correctness/noUnusedVariables: stub generic type to match generated type
101
102
  export type CollectionEntry<C> = any;
102
103
  /** Run `astro sync` to generate high fidelity types */
103
104
  export type ContentCollectionKey = any;