diff --git a/package.json b/package.json index 5aa1e3ed..1ce49b9f 100644 --- a/package.json +++ b/package.json @@ -74,12 +74,10 @@ "@rollup/plugin-json": "6.1.0", "@swc/core": "1.7.26", "@types/debug": "4.1.12", - "@types/fs-extra": "11.0.4", "@types/node": "22.5.5", "@types/resolve": "1.20.6", "bumpp": "^9.5.2", "flat": "6.0.1", - "fs-extra": "11.2.0", "postcss": "8.4.47", "postcss-simple-vars": "7.0.1", "prettier": "3.3.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3ace6c62..66a7fff7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -69,9 +69,6 @@ importers: '@types/debug': specifier: 4.1.12 version: 4.1.12 - '@types/fs-extra': - specifier: 11.0.4 - version: 11.0.4 '@types/node': specifier: 22.5.5 version: 22.5.5 @@ -84,9 +81,6 @@ importers: flat: specifier: 6.0.1 version: 6.0.1 - fs-extra: - specifier: 11.2.0 - version: 11.2.0 postcss: specifier: 8.4.47 version: 8.4.47 @@ -691,12 +685,6 @@ packages: '@types/estree@1.0.5': resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} - '@types/fs-extra@11.0.4': - resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} - - '@types/jsonfile@6.1.4': - resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==} - '@types/ms@0.7.34': resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==} @@ -1012,10 +1000,6 @@ packages: resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} engines: {node: '>=14'} - fs-extra@11.2.0: - resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==} - engines: {node: '>=14.14'} - fs-extra@7.0.1: resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==} engines: {node: '>=6 <7 || >=8'} @@ -1164,9 +1148,6 @@ packages: jsonfile@4.0.0: resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==} - jsonfile@6.1.0: - resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} - kleur@3.0.3: resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} engines: {node: '>=6'} @@ -1723,10 +1704,6 @@ packages: resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} engines: {node: '>= 4.0.0'} - universalify@2.0.1: - resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} - engines: {node: '>= 10.0.0'} - uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} @@ -2233,15 +2210,6 @@ snapshots: '@types/estree@1.0.5': {} - '@types/fs-extra@11.0.4': - dependencies: - '@types/jsonfile': 6.1.4 - '@types/node': 22.5.5 - - '@types/jsonfile@6.1.4': - dependencies: - '@types/node': 22.5.5 - '@types/ms@0.7.34': {} '@types/node@22.5.5': @@ -2609,12 +2577,6 @@ snapshots: cross-spawn: 7.0.3 signal-exit: 4.1.0 - fs-extra@11.2.0: - dependencies: - graceful-fs: 4.2.11 - jsonfile: 6.1.0 - universalify: 2.0.1 - fs-extra@7.0.1: dependencies: graceful-fs: 4.2.11 @@ -2748,12 +2710,6 @@ snapshots: optionalDependencies: graceful-fs: 4.2.11 - jsonfile@6.1.0: - dependencies: - universalify: 2.0.1 - optionalDependencies: - graceful-fs: 4.2.11 - kleur@3.0.3: {} lilconfig@3.1.2: {} @@ -3235,8 +3191,6 @@ snapshots: universalify@0.1.2: {} - universalify@2.0.1: {} - uri-js@4.4.1: dependencies: punycode: 2.3.1 diff --git a/test/utils.ts b/test/utils.ts index dd353718..ca9e702c 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -1,8 +1,9 @@ +import fs from 'node:fs' +import fsp from 'node:fs/promises' import path from 'node:path' import { fileURLToPath } from 'node:url' import { expect } from 'vitest' import execa from 'execa' -import fs from 'fs-extra' import { glob } from 'tinyglobby' const __dirname = path.dirname(fileURLToPath(import.meta.url)) @@ -35,8 +36,12 @@ export async function run( // Write entry files on disk await Promise.all( - Object.keys(files).map((name) => { - return fs.outputFile(path.resolve(testDir, name), files[name], 'utf8') + Object.keys(files).map(async (name) => { + const filePath = path.resolve(testDir, name) + const parentDir = path.dirname(filePath) + // Thanks to `recursive: true`, this doesn't fail even if the directory already exists. + await fsp.mkdir(parentDir, { recursive: true }) + return fsp.writeFile(filePath, files[name], 'utf8') }), ) @@ -69,7 +74,7 @@ export async function run( logs, outDir: path.resolve(testDir, 'dist'), getFileContent(filename: string) { - return fs.readFile(path.resolve(testDir, filename), 'utf8') + return fsp.readFile(path.resolve(testDir, filename), 'utf8') }, } }