summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/tasty-snails-protect.md5
-rw-r--r--packages/internal-helpers/src/fs.ts4
2 files changed, 7 insertions, 2 deletions
diff --git a/.changeset/tasty-snails-protect.md b/.changeset/tasty-snails-protect.md
new file mode 100644
index 000000000..cbd945ca0
--- /dev/null
+++ b/.changeset/tasty-snails-protect.md
@@ -0,0 +1,5 @@
+---
+"@astrojs/internal-helpers": patch
+---
+
+Fixes usage of `fileURLToPath()` to anticipate the changed signature of this method in Node 22.1.0
diff --git a/packages/internal-helpers/src/fs.ts b/packages/internal-helpers/src/fs.ts
index c9f27810a..5630040bb 100644
--- a/packages/internal-helpers/src/fs.ts
+++ b/packages/internal-helpers/src/fs.ts
@@ -45,8 +45,8 @@ export async function copyFilesToFolder(
outDir: URL,
exclude: URL[] = [],
): Promise<string> {
- const excludeList = exclude.map(fileURLToPath);
- const fileList = files.map(fileURLToPath).filter((f) => !excludeList.includes(f));
+ const excludeList = exclude.map((url) => fileURLToPath(url));
+ const fileList = files.map((url) => fileURLToPath(url)).filter((f) => !excludeList.includes(f));
if (files.length === 0) throw new Error('No files found to copy');