chore: migrate fast-glob to tinyglobby (#23020)

* chore: migrate fast-glob to tinyglobby

* fix: ssr tests
This commit is contained in:
Noblet Ouways
2025-12-09 10:52:09 +01:00
committed by GitHub
parent a5d2064936
commit 899eeab499
16 changed files with 34 additions and 34 deletions

View File

@@ -1,8 +1,8 @@
import { execSync } from 'child_process'
import fg from 'fast-glob'
import { globSync } from 'tinyglobby'
const getPackages = (packagePath) =>
fg.sync('*', { cwd: packagePath, onlyDirectories: true })
globSync('*', { cwd: packagePath, onlyDirectories: true })
const scopes = [
...getPackages('packages'),

View File

@@ -1,6 +1,6 @@
import path from 'path'
import fs from 'fs-extra'
import fg from 'fast-glob'
import { glob } from 'tinyglobby'
async function generateLLms() {
const cwd = process.cwd()
@@ -12,7 +12,7 @@ async function generateLLms() {
// Ensure siteDir exists
await fs.ensureDir(siteDir)
const docs = await fg(
const docs = await glob(
`{${docsDir.join(',')}}/**/*{${matchSuffixes.join(',')}}`,
{
cwd,
@@ -72,7 +72,7 @@ async function generateLLms() {
// 在examples目录下查找对应的Vue示例文件
const examplesDir = path.join(cwd, 'examples', componentName)
if (fs.existsSync(examplesDir)) {
const vueFiles = await fg('**/*.vue', {
const vueFiles = await glob('**/*.vue', {
cwd: examplesDir,
absolute: true,
})

View File

@@ -2,7 +2,7 @@ import path from 'path'
import Inspect from 'vite-plugin-inspect'
import UnoCSS from 'unocss/vite'
import mkcert from 'vite-plugin-mkcert'
import glob from 'fast-glob'
import { glob } from 'tinyglobby'
import vueJsx from '@vitejs/plugin-vue-jsx'
import Components from 'unplugin-vue-components/vite'
import Icons from 'unplugin-icons/vite'

View File

@@ -1,7 +1,7 @@
import fs from 'fs'
import path from 'path'
import { camelize } from '@vue/shared'
import glob from 'fast-glob'
import { glob } from 'tinyglobby'
import { docRoot, docsDirName, projRoot } from '@element-plus/build-utils'
import { REPO_BRANCH, REPO_PATH } from '@element-plus/build-constants'
import { getLang, languages } from '../utils/lang'

View File

@@ -30,7 +30,7 @@
"@vitejs/plugin-vue-jsx": "^4.0.1",
"chalk": "^4.1.2",
"consola": "^2.15.3",
"fast-glob": "^3.2.11",
"tinyglobby": "^0.2.15",
"markdown-it-container": "^3.0.0",
"unocss": "^66.5.6",
"unplugin-icons": "^0.14.15",

View File

@@ -27,7 +27,7 @@
"components-helper": "^2.1.4",
"consola": "^2.15.3",
"esbuild": "^0.14.47",
"fast-glob": "^3.2.11",
"tinyglobby": "^0.2.15",
"fs-extra": "^10.1.0",
"gulp": "^4.0.2",
"lodash": "^4.17.21",

View File

@@ -8,7 +8,7 @@ import VueMacros from 'unplugin-vue-macros/rollup'
import vueJsx from '@vitejs/plugin-vue-jsx'
import esbuild, { minify as minifyPlugin } from 'rollup-plugin-esbuild'
import { parallel } from 'gulp'
import glob from 'fast-glob'
import { glob } from 'tinyglobby'
import { camelCase, upperFirst } from 'lodash-unified'
import {
PKG_BRAND_NAME,

View File

@@ -7,7 +7,7 @@ import VueMacros from 'unplugin-vue-macros/rollup'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import esbuild from 'rollup-plugin-esbuild'
import glob from 'fast-glob'
import { glob } from 'tinyglobby'
import { epRoot, excludeFiles, pkgRoot } from '@element-plus/build-utils'
import { generateExternal, withTaskName, writeBundles } from '../utils'
import { ElementPlusAlias } from '../plugins/element-plus-alias'

View File

@@ -1,6 +1,6 @@
import path from 'path'
import { readFile, writeFile } from 'fs/promises'
import glob from 'fast-glob'
import { glob } from 'tinyglobby'
import { copy, remove } from 'fs-extra'
import { buildOutput } from '@element-plus/build-utils'
import { pathRewriter, run } from '../utils'

View File

@@ -28,7 +28,7 @@
"@types/lodash-es": "^4.17.12",
"chalk": "^5.3.0",
"consola": "^2.15.3",
"fast-glob": "^3.3.2",
"tinyglobby": "^0.2.15",
"lodash-es": "^4.17.21",
"octokit": "^2.1.0",
"tsx": "^4.7.1"

View File

@@ -1,6 +1,6 @@
import path from 'path'
import { existsSync } from 'fs'
import glob from 'fast-glob'
import { glob } from 'tinyglobby'
import { Octokit } from 'octokit'
import consola from 'consola'
import chalk from 'chalk'

View File

@@ -95,7 +95,6 @@
"czg": "^1.11.1",
"eslint": "^9.37.0",
"expect-type": "^0.13.0",
"fast-glob": "^3.2.11",
"happy-dom": "^17.4.4",
"husky": "^9.0.11",
"jsdom": "16.4.0",
@@ -105,6 +104,7 @@
"resize-observer-polyfill": "^1.5.1",
"rimraf": "^4.4.1",
"sass": "^1.79.3",
"tinyglobby": "^0.2.15",
"tsx": "^4.19.3",
"typescript": "~5.5.4",
"unplugin-vue-macros": "^2.7.11",

View File

@@ -6,7 +6,7 @@ import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import Inspect from 'vite-plugin-inspect'
import mkcert from 'vite-plugin-mkcert'
import glob from 'fast-glob'
import { glob } from 'tinyglobby'
import VueMacros from 'unplugin-vue-macros/vite'
import {
epPackage,

24
pnpm-lock.yaml generated
View File

@@ -192,9 +192,6 @@ importers:
expect-type:
specifier: ^0.13.0
version: 0.13.0
fast-glob:
specifier: ^3.2.11
version: 3.2.11
happy-dom:
specifier: ^17.4.4
version: 17.4.4
@@ -222,6 +219,9 @@ importers:
sass:
specifier: ^1.79.3
version: 1.79.3
tinyglobby:
specifier: ^0.2.15
version: 0.2.15
tsx:
specifier: ^4.19.3
version: 4.19.3
@@ -301,12 +301,12 @@ importers:
consola:
specifier: ^2.15.3
version: 2.15.3
fast-glob:
specifier: ^3.2.11
version: 3.2.11
markdown-it-container:
specifier: ^3.0.0
version: 3.0.0
tinyglobby:
specifier: ^0.2.15
version: 0.2.15
unocss:
specifier: ^66.5.6
version: 66.5.6(postcss@8.5.6)(vite@5.4.10(@types/node@22.9.0)(sass@1.79.3)(terser@5.36.0))
@@ -370,9 +370,6 @@ importers:
esbuild:
specifier: ^0.14.47
version: 0.14.47
fast-glob:
specifier: ^3.2.11
version: 3.2.11
fs-extra:
specifier: ^10.1.0
version: 10.1.0
@@ -388,6 +385,9 @@ importers:
rollup-plugin-esbuild:
specifier: ^4.9.1
version: 4.9.1(esbuild@0.14.47)(rollup@2.75.7)
tinyglobby:
specifier: ^0.2.15
version: 0.2.15
unplugin-vue-macros:
specifier: ^0.11.2
version: 0.11.2(esbuild@0.14.47)(rollup@2.75.7)(vite@5.4.10(@types/node@22.9.0)(sass@1.79.3)(terser@5.36.0))(vue@3.2.37)
@@ -490,15 +490,15 @@ importers:
consola:
specifier: ^2.15.3
version: 2.15.3
fast-glob:
specifier: ^3.3.2
version: 3.3.2
lodash-es:
specifier: ^4.17.21
version: 4.17.21
octokit:
specifier: ^2.1.0
version: 2.1.0
tinyglobby:
specifier: ^0.2.15
version: 0.2.15
tsx:
specifier: ^4.7.1
version: 4.7.1

View File

@@ -1,6 +1,6 @@
import { readFileSync, writeFileSync } from 'node:fs'
import { basename, resolve } from 'node:path'
import glob from 'fast-glob'
import { globSync } from 'tinyglobby'
import consola from 'consola'
import { isArray, isObject, isString } from 'lodash-unified'
import { localeRoot, normalizePath } from '@element-plus/build-utils'
@@ -193,7 +193,7 @@ function main() {
const enContent = readFileSync(enFile, 'utf-8')
const enObject = parseLocaleFile(enContent)
const localeFiles = glob.sync(localePath)
const localeFiles = globSync(localePath)
let totalUpdated = 0
let totalAdded = 0

View File

@@ -3,7 +3,7 @@ import { createApp } from 'vue'
import { renderToString } from '@vue/server-renderer'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
import puppeteer from 'puppeteer'
import glob from 'fast-glob'
import { globSync } from 'tinyglobby'
import ElementPlus, {
ID_INJECTION_KEY,
ZINDEX_INJECTION_KEY,
@@ -29,9 +29,9 @@ describe('Cypress Button', () => {
})
describe('when initialized', () => {
const demoPaths = glob
.sync(`${demoRoot}/*.vue`)
.map((demo) => demo.slice(demoRoot.length + 1))
const demoPaths = globSync(`${demoRoot}/*.vue`, { absolute: true }).map(
(demo) => demo.slice(demoRoot.length + 1)
)
it.each(demoPaths)(`render %s correctly`, async (demoPath) => {
const page = await browser.newPage()