diff --git a/docs/package.json b/docs/package.json index 7f4c0303c102..f14d7e59086a 100644 --- a/docs/package.json +++ b/docs/package.json @@ -25,8 +25,8 @@ "@vite-pwa/assets-generator": "^0.2.4", "@vite-pwa/vitepress": "^0.5.0", "@vitejs/plugin-vue": "^5.1.2", - "fast-glob": "^3.3.2", "https-localhost": "^4.7.1", + "tinyglobby": "^0.2.5", "unocss": "^0.62.0", "unplugin-vue-components": "^0.27.4", "vite": "^5.2.8", diff --git a/package.json b/package.json index c787b2da3907..5e5d12828eef 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,6 @@ "changelogithub": "^0.13.9", "esbuild": "^0.23.0", "eslint": "^9.9.0", - "fast-glob": "^3.3.2", "magic-string": "^0.30.11", "pathe": "^1.1.2", "rimraf": "^6.0.1", @@ -60,6 +59,7 @@ "rollup-plugin-dts": "^6.1.1", "rollup-plugin-esbuild": "^6.1.1", "rollup-plugin-license": "^3.5.2", + "tinyglobby": "^0.2.5", "tsx": "^4.17.0", "typescript": "^5.5.4", "vite": "^5.4.0", diff --git a/packages/browser/src/client/vite.config.ts b/packages/browser/src/client/vite.config.ts index ab3b3dd1aa04..1a5eaf305590 100644 --- a/packages/browser/src/client/vite.config.ts +++ b/packages/browser/src/client/vite.config.ts @@ -2,7 +2,7 @@ import { fileURLToPath } from 'node:url' import fs from 'node:fs' import { defineConfig } from 'vite' import { resolve } from 'pathe' -import fg from 'fast-glob' +import { globSync } from 'tinyglobby' export default defineConfig({ server: { @@ -51,7 +51,7 @@ export default defineConfig({ await waitFor(() => fs.existsSync(ui)) clearTimeout(timeout) - const files = fg.sync('**/*', { cwd: ui }) + const files = globSync(['**/*'], { cwd: ui, expandDirectories: false }) if (fs.existsSync(browser)) { fs.rmSync(browser, { recursive: true }) diff --git a/packages/ui/node/reporter.ts b/packages/ui/node/reporter.ts index 7398b9c7578b..fa6af67fa14a 100644 --- a/packages/ui/node/reporter.ts +++ b/packages/ui/node/reporter.ts @@ -3,8 +3,8 @@ import { fileURLToPath } from 'node:url' import { promisify } from 'node:util' import { gzip, constants as zlibConstants } from 'node:zlib' import { basename, dirname, relative, resolve } from 'pathe' +import { globSync } from 'tinyglobby' import c from 'tinyrainbow' -import fg from 'fast-glob' import { stringify } from 'flatted' import type { File, @@ -111,7 +111,7 @@ export default class HTMLReporter implements Reporter { await fs.writeFile(metaFile, data, 'base64') const ui = resolve(distDir, 'client') // copy ui - const files = fg.sync('**/*', { cwd: ui }) + const files = globSync(['**/*'], { cwd: ui, expandDirectories: false }) await Promise.all( files.map(async (f) => { if (f === 'index.html') { diff --git a/packages/ui/package.json b/packages/ui/package.json index b154a2759597..c3509b7cc940 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -48,11 +48,11 @@ }, "dependencies": { "@vitest/utils": "workspace:*", - "fast-glob": "^3.3.2", "fflate": "^0.8.2", "flatted": "^3.3.1", "pathe": "^1.1.2", "sirv": "^2.0.4", + "tinyglobby": "^0.2.5", "tinyrainbow": "^1.2.0" }, "devDependencies": { diff --git a/packages/vitest/LICENSE.md b/packages/vitest/LICENSE.md index 6e60241fa8d6..9babad40e933 100644 --- a/packages/vitest/LICENSE.md +++ b/packages/vitest/LICENSE.md @@ -57,90 +57,6 @@ Repository: git+https://github.com/antfu/install-pkg.git --------------------------------------- -## @nodelib/fs.scandir -License: MIT -Repository: https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.scandir - -> The MIT License (MIT) -> -> Copyright (c) Denis Malinochkin -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -> SOFTWARE. - ---------------------------------------- - -## @nodelib/fs.stat -License: MIT -Repository: https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.stat - -> The MIT License (MIT) -> -> Copyright (c) Denis Malinochkin -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -> SOFTWARE. - ---------------------------------------- - -## @nodelib/fs.walk -License: MIT -Repository: https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.walk - -> The MIT License (MIT) -> -> Copyright (c) Denis Malinochkin -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -> SOFTWARE. - ---------------------------------------- - ## @sinonjs/commons License: BSD-3-Clause Repository: git+https://github.com/sinonjs/commons.git @@ -669,53 +585,10 @@ Repository: https://github.com/mmkal/expect-type.git --------------------------------------- -## fast-glob +## fdir License: MIT -By: Denis Malinochkin -Repository: mrmlnc/fast-glob - -> The MIT License (MIT) -> -> Copyright (c) Denis Malinochkin -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -> SOFTWARE. - ---------------------------------------- - -## fastq -License: ISC -By: Matteo Collina -Repository: git+https://github.com/mcollina/fastq.git - -> Copyright (c) 2015-2020, Matteo Collina -> -> Permission to use, copy, modify, and/or distribute this software for any -> purpose with or without fee is hereby granted, provided that the above -> copyright notice and this permission notice appear in all copies. -> -> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -> OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +By: thecodrr +Repository: git+https://github.com/thecodrr/fdir.git --------------------------------------- @@ -834,58 +707,6 @@ Repository: privatenumber/get-tsconfig --------------------------------------- -## glob-parent -License: ISC -By: Gulp Team, Elan Shanker, Blaine Bublitz -Repository: gulpjs/glob-parent - -> The ISC License -> -> Copyright (c) 2015, 2019 Elan Shanker -> -> Permission to use, copy, modify, and/or distribute this software for any -> purpose with or without fee is hereby granted, provided that the above -> copyright notice and this permission notice appear in all copies. -> -> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ---------------------------------------- - -## is-extglob -License: MIT -By: Jon Schlinkert -Repository: jonschlinkert/is-extglob - -> The MIT License (MIT) -> -> Copyright (c) 2014-2016, Jon Schlinkert -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -> THE SOFTWARE. - ---------------------------------------- - ## is-fullwidth-code-point License: MIT By: Sindre Sorhus @@ -903,35 +724,6 @@ Repository: sindresorhus/is-fullwidth-code-point --------------------------------------- -## is-glob -License: MIT -By: Jon Schlinkert, Brian Woodward, Daniel Perez -Repository: micromatch/is-glob - -> The MIT License (MIT) -> -> Copyright (c) 2014-2017, Jon Schlinkert. -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -> THE SOFTWARE. - ---------------------------------------- - ## is-number License: MIT By: Jon Schlinkert, Olsten Larck, Rouven Weßling @@ -1082,34 +874,6 @@ Repository: sindresorhus/log-update --------------------------------------- -## merge2 -License: MIT -Repository: git@github.com:teambition/merge2.git - -> The MIT License (MIT) -> -> Copyright (c) 2014-2020 Teambition -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -> SOFTWARE. - ---------------------------------------- - ## micromatch License: MIT By: Jon Schlinkert, Amila Welihinda, Bogdan Chadkin, Brian Woodward, Devon Govett, Elan Shanker, Fabrício Matté, Martin Kolárik, Olsten Larck, Paul Miller, Tom Byrer, Tyler Akins, Peter Bright, Kuba Juszczyk @@ -1322,34 +1086,6 @@ Repository: terkelg/prompts --------------------------------------- -## queue-microtask -License: MIT -By: Feross Aboukhadijeh -Repository: git://github.com/feross/queue-microtask.git - -> The MIT License (MIT) -> -> Copyright (c) Feross Aboukhadijeh -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of -> this software and associated documentation files (the "Software"), to deal in -> the Software without restriction, including without limitation the rights to -> use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -> the Software, and to permit persons to whom the Software is furnished to do so, -> subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -> FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -> COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -> IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -> CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------- - ## resolve-pkg-maps License: MIT By: Hiroki Osame @@ -1396,63 +1132,6 @@ Repository: sindresorhus/restore-cursor --------------------------------------- -## reusify -License: MIT -By: Matteo Collina -Repository: git+https://github.com/mcollina/reusify.git - -> The MIT License (MIT) -> -> Copyright (c) 2015 Matteo Collina -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -> SOFTWARE. - ---------------------------------------- - -## run-parallel -License: MIT -By: Feross Aboukhadijeh -Repository: git://github.com/feross/run-parallel.git - -> The MIT License (MIT) -> -> Copyright (c) Feross Aboukhadijeh -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of -> this software and associated documentation files (the "Software"), to deal in -> the Software without restriction, including without limitation the rights to -> use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -> the Software, and to permit persons to whom the Software is furnished to do so, -> subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -> FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -> COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -> IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -> CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------- - ## signal-exit License: ISC By: Ben Coe diff --git a/packages/vitest/package.json b/packages/vitest/package.json index 8a14e08af377..423452722e70 100644 --- a/packages/vitest/package.json +++ b/packages/vitest/package.json @@ -190,7 +190,6 @@ "chai-subset": "^1.6.0", "cli-truncate": "^4.0.0", "expect-type": "^0.19.0", - "fast-glob": "^3.3.2", "find-up": "^6.3.0", "flatted": "^3.3.1", "get-tsconfig": "^4.7.6", @@ -203,6 +202,7 @@ "prompts": "^2.4.2", "strip-ansi": "^7.1.0", "strip-literal": "^2.1.0", + "tinyglobby": "^0.2.5", "ws": "^8.18.0" } } diff --git a/packages/vitest/rollup.config.js b/packages/vitest/rollup.config.js index dcb890a98181..a9a1614cf731 100644 --- a/packages/vitest/rollup.config.js +++ b/packages/vitest/rollup.config.js @@ -8,8 +8,8 @@ import nodeResolve from '@rollup/plugin-node-resolve' import commonjs from '@rollup/plugin-commonjs' import json from '@rollup/plugin-json' import license from 'rollup-plugin-license' +import { globSync } from 'tinyglobby' import c from 'tinyrainbow' -import fg from 'fast-glob' import { defineConfig } from 'rollup' const require = createRequire(import.meta.url) @@ -198,9 +198,7 @@ function licensePlugin() { preserveSymlinks: false, }), ) - const licenseFile = fg.sync(`${pkgDir}/LICENSE*`, { - caseSensitiveMatch: false, - })[0] + const [licenseFile] = globSync([`${pkgDir}/(LICENSE)|(license)*`], { expandDirectories: false }) if (licenseFile) { licenseText = fs.readFileSync(licenseFile, 'utf-8') } diff --git a/packages/vitest/src/node/workspace.ts b/packages/vitest/src/node/workspace.ts index aa5f16eea0f6..51b9a7ef207e 100644 --- a/packages/vitest/src/node/workspace.ts +++ b/packages/vitest/src/node/workspace.ts @@ -1,7 +1,6 @@ import { promises as fs } from 'node:fs' import { tmpdir } from 'node:os' import { rm } from 'node:fs/promises' -import fg from 'fast-glob' import mm from 'micromatch' import { dirname, @@ -18,6 +17,7 @@ import type { } from 'vite' import { ViteNodeRunner } from 'vite-node/client' import { ViteNodeServer } from 'vite-node/server' +import { glob } from 'tinyglobby' import type { Typechecker } from '../typecheck/typechecker' import { deepMerge, nanoid } from '../utils/base' import { setup } from '../api/setup' @@ -296,14 +296,13 @@ export class WorkspaceProject { } async globFiles(include: string[], exclude: string[], cwd: string) { - const globOptions: fg.Options = { + return glob(include, { + absolute: true, dot: true, cwd, ignore: exclude, - } - - const files = await fg(include, globOptions) - return files.map(file => resolve(cwd, file)) + expandDirectories: false, + }) } async isTargetFile(id: string, source?: string): Promise { diff --git a/packages/vitest/src/node/workspace/resolveWorkspace.ts b/packages/vitest/src/node/workspace/resolveWorkspace.ts index 314466649e4b..a9e4cc630fac 100644 --- a/packages/vitest/src/node/workspace/resolveWorkspace.ts +++ b/packages/vitest/src/node/workspace/resolveWorkspace.ts @@ -1,8 +1,8 @@ import { existsSync, promises as fs } from 'node:fs' import { isMainThread } from 'node:worker_threads' import { dirname, relative, resolve } from 'pathe' +import { type GlobOptions, glob } from 'tinyglobby' import { mergeConfig } from 'vite' -import fg from 'fast-glob' import type { Vitest } from '../core' import type { UserConfig, UserWorkspaceConfig, WorkspaceProjectConfiguration } from '../types/config' import type { WorkspaceProject } from '../workspace' @@ -198,16 +198,16 @@ async function resolveWorkspaceProjectConfigs( } if (workspaceGlobMatches.length) { - const globOptions: fg.Options = { + const globOptions: GlobOptions = { absolute: true, dot: true, onlyFiles: false, - markDirectories: true, cwd: vitest.config.root, + expandDirectories: false, ignore: ['**/node_modules/**', '**/*.timestamp-*'], } - const workspacesFs = await fg(workspaceGlobMatches, globOptions) + const workspacesFs = await glob(workspaceGlobMatches, globOptions) await Promise.all(workspacesFs.map(async (filepath) => { // directories are allowed with a glob like `packages/*` diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 919e25da0486..b080f18cb9f0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -83,9 +83,6 @@ importers: eslint: specifier: ^9.9.0 version: 9.9.0(jiti@1.21.6) - fast-glob: - specifier: ^3.3.2 - version: 3.3.2 magic-string: specifier: ^0.30.11 version: 0.30.11 @@ -107,6 +104,9 @@ importers: rollup-plugin-license: specifier: ^3.5.2 version: 3.5.2(rollup@4.20.0) + tinyglobby: + specifier: ^0.2.5 + version: 0.2.5 tsx: specifier: ^4.17.0 version: 4.17.0 @@ -153,12 +153,12 @@ importers: '@vitejs/plugin-vue': specifier: ^5.1.2 version: 5.1.2(vite@5.4.0(@types/node@22.5.2)(terser@5.22.0))(vue@3.4.37(typescript@5.5.4)) - fast-glob: - specifier: ^3.3.2 - version: 3.3.2 https-localhost: specifier: ^4.7.1 version: 4.7.1 + tinyglobby: + specifier: ^0.2.5 + version: 0.2.5 unocss: specifier: ^0.62.0 version: 0.62.0(postcss@8.4.40)(rollup@4.20.0)(vite@5.4.0(@types/node@22.5.2)(terser@5.22.0)) @@ -749,9 +749,6 @@ importers: '@vitest/utils': specifier: workspace:* version: link:../utils - fast-glob: - specifier: ^3.3.2 - version: 3.3.2 fflate: specifier: ^0.8.2 version: 0.8.2 @@ -764,6 +761,9 @@ importers: sirv: specifier: ^2.0.4 version: 2.0.4 + tinyglobby: + specifier: ^0.2.5 + version: 0.2.5 tinyrainbow: specifier: ^1.2.0 version: 1.2.0 @@ -1032,9 +1032,6 @@ importers: expect-type: specifier: ^0.19.0 version: 0.19.0 - fast-glob: - specifier: ^3.3.2 - version: 3.3.2 find-up: specifier: ^6.3.0 version: 6.3.0 @@ -1071,6 +1068,9 @@ importers: strip-literal: specifier: ^2.1.0 version: 2.1.0 + tinyglobby: + specifier: ^0.2.5 + version: 0.2.5 ws: specifier: ^8.18.0 version: 8.18.0 @@ -8583,12 +8583,8 @@ packages: tinyexec@0.3.0: resolution: {integrity: sha512-tVGE0mVJPGb0chKhqmsoosjsS+qUnJVGJpZgsHYQcGoPlG3B51R3PouqTgEGH2Dc9jjFyOqOpix6ZHNMXp1FZg==} - tinyglobby@0.2.0: - resolution: {integrity: sha512-+clyYQfAnNlt5a1x7CCQ6RLuTIztDfDAl6mAANvqRUlz6sVy5znCzJOhais8G6oyUyoeeaorLopO3HptVP8niA==} - engines: {node: '>=12.0.0'} - - tinyglobby@0.2.2: - resolution: {integrity: sha512-mZ2sDMaySvi1PkTp4lTo1In2zjU+cY8OvZsfwrDrx3YGRbXPX1/cbPwCR9zkm3O/Fz9Jo0F1HNgIQ1b8BepqyQ==} + tinyglobby@0.2.5: + resolution: {integrity: sha512-Dlqgt6h0QkoHttG53/WGADNh9QhcjCAIZMTERAVhdpmIBEejSuLI9ZmGKWzB7tweBjlk30+s/ofi4SLmBeTYhw==} engines: {node: '>=12.0.0'} tinyhighlight@0.3.2: @@ -12333,7 +12329,7 @@ snapshots: magic-string: 0.30.11 pathe: 1.1.2 perfect-debounce: 1.0.0 - tinyglobby: 0.2.2 + tinyglobby: 0.2.5 transitivePeerDependencies: - rollup - supports-color @@ -12366,7 +12362,7 @@ snapshots: css-tree: 2.3.1 magic-string: 0.30.11 postcss: 8.4.40 - tinyglobby: 0.2.2 + tinyglobby: 0.2.5 transitivePeerDependencies: - supports-color @@ -12462,7 +12458,7 @@ snapshots: '@unocss/transformer-directives': 0.62.0 chokidar: 3.6.0 magic-string: 0.30.11 - tinyglobby: 0.2.2 + tinyglobby: 0.2.5 vite: 5.4.0(@types/node@22.5.2)(terser@5.22.0) transitivePeerDependencies: - rollup @@ -17933,12 +17929,7 @@ snapshots: tinyexec@0.3.0: {} - tinyglobby@0.2.0: - dependencies: - fdir: 6.2.0(picomatch@4.0.2) - picomatch: 4.0.2 - - tinyglobby@0.2.2: + tinyglobby@0.2.5: dependencies: fdir: 6.2.0(picomatch@4.0.2) picomatch: 4.0.2 @@ -18441,7 +18432,7 @@ snapshots: dependencies: debug: 4.3.6 pretty-bytes: 6.1.1 - tinyglobby: 0.2.0 + tinyglobby: 0.2.5 vite: 5.4.0(@types/node@22.5.2)(terser@5.22.0) workbox-build: 7.1.0(@types/babel__core@7.20.5) workbox-window: 7.1.0 diff --git a/scripts/release.ts b/scripts/release.ts index b53b648e64ae..3e336925bf41 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -1,11 +1,11 @@ #!/usr/bin/env zx import { versionBump } from 'bumpp' -import glob from 'fast-glob' +import { glob } from 'tinyglobby' import { $ } from 'zx' try { - const packages = await glob(['package.json', './packages/*/package.json']) + const packages = await glob(['package.json', './packages/*/package.json'], { expandDirectories: false }) console.log('Bumping versions in packages:', packages.join(', '), '\n') diff --git a/test/cli/test/__snapshots__/list.test.ts.snap b/test/cli/test/__snapshots__/list.test.ts.snap index efc6f0b467ad..11811ce654a3 100644 --- a/test/cli/test/__snapshots__/list.test.ts.snap +++ b/test/cli/test/__snapshots__/list.test.ts.snap @@ -1,13 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`basic output shows error 1`] = ` -"Error: top level error - ❯ top-level-error.test.ts:1:7 - 1| throw new Error('top level error') - | ^ - 2| - -Error: describe error +"Error: describe error ❯ describe-error.test.ts:4:9 2| 3| describe('describe error', () => { @@ -16,6 +10,12 @@ Error: describe error 5| 6| it('wont run', () => { +Error: top level error + ❯ top-level-error.test.ts:1:7 + 1| throw new Error('top level error') + | ^ + 2| + " `; @@ -60,13 +60,7 @@ math.test.ts > failing test `; exports[`json output shows error 1`] = ` -"Error: top level error - ❯ top-level-error.test.ts:1:7 - 1| throw new Error('top level error') - | ^ - 2| - -Error: describe error +"Error: describe error ❯ describe-error.test.ts:4:9 2| 3| describe('describe error', () => { @@ -75,17 +69,17 @@ Error: describe error 5| 6| it('wont run', () => { -" -`; - -exports[`json with a file output shows error 1`] = ` -"Error: top level error +Error: top level error ❯ top-level-error.test.ts:1:7 1| throw new Error('top level error') | ^ 2| -Error: describe error +" +`; + +exports[`json with a file output shows error 1`] = ` +"Error: describe error ❯ describe-error.test.ts:4:9 2| 3| describe('describe error', () => { @@ -94,5 +88,11 @@ Error: describe error 5| 6| it('wont run', () => { +Error: top level error + ❯ top-level-error.test.ts:1:7 + 1| throw new Error('top level error') + | ^ + 2| + " `; diff --git a/test/cli/test/fails.test.ts b/test/cli/test/fails.test.ts index 20f94a7f8ced..1e3c6328ca74 100644 --- a/test/cli/test/fails.test.ts +++ b/test/cli/test/fails.test.ts @@ -1,11 +1,11 @@ import { resolve } from 'pathe' -import fg from 'fast-glob' +import { glob } from 'tinyglobby' import { expect, it } from 'vitest' import { runVitest } from '../../test-utils' const root = resolve(__dirname, '../fixtures/fails') -const files = await fg('**/*.test.ts', { cwd: root, dot: true }) +const files = await glob(['**/*.test.ts'], { cwd: root, dot: true, expandDirectories: false }) it.each(files)('should fail %s', async (file) => { const { stderr } = await runVitest({ diff --git a/test/cli/test/stacktraces.test.ts b/test/cli/test/stacktraces.test.ts index ed9776f05c25..5a7819d110c3 100644 --- a/test/cli/test/stacktraces.test.ts +++ b/test/cli/test/stacktraces.test.ts @@ -1,5 +1,5 @@ import { resolve } from 'pathe' -import fg from 'fast-glob' +import { glob } from 'tinyglobby' import { describe, expect, it } from 'vitest' import { runVitest } from '../../test-utils' @@ -9,7 +9,7 @@ process.setMaxListeners(20) describe('stacktraces should respect sourcemaps', async () => { const root = resolve(__dirname, '../fixtures/stacktraces') - const files = await fg('*.test.*', { cwd: root }) + const files = await glob(['*.test.*'], { cwd: root, expandDirectories: false }) for (const file of files) { it(file, async () => { diff --git a/test/typescript/test/runner.test.ts b/test/typescript/test/runner.test.ts index b64df34e9466..dce87bd34784 100644 --- a/test/typescript/test/runner.test.ts +++ b/test/typescript/test/runner.test.ts @@ -1,12 +1,12 @@ import { resolve } from 'pathe' -import fg from 'fast-glob' +import { glob } from 'tinyglobby' import { describe, expect, it } from 'vitest' import { runVitest } from '../../test-utils' describe('should fail', async () => { const root = resolve(__dirname, '../failing') - const files = await fg('*.test-d.*', { cwd: root }) + const files = await glob(['*.test-d.*'], { cwd: root, expandDirectories: false }) it('typecheck files', async () => { const { stderr } = await runVitest({