From b433d9d15ddfffbb7170fd0cbc46853a7665e5d4 Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Mon, 8 Dec 2025 11:45:29 +0900 Subject: [PATCH] enhance: use native glob --- package.json | 1 - packages/frontend-shared/build.js | 3 +-- packages/frontend/.storybook/generate.tsx | 8 +++--- .../lib/vite-plugin-create-search-index.ts | 3 +-- packages/i18n/build.ts | 3 +-- packages/i18n/package.json | 1 - packages/misskey-bubble-game/build.js | 3 +-- packages/misskey-bubble-game/package.json | 1 - packages/misskey-js/build.js | 3 +-- packages/misskey-js/package.json | 1 - packages/misskey-reversi/build.js | 3 +-- packages/misskey-reversi/package.json | 1 - pnpm-lock.yaml | 25 ------------------- 13 files changed, 9 insertions(+), 47 deletions(-) diff --git a/package.json b/package.json index 40542046eb..0eef94063b 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,6 @@ "esbuild": "0.27.0", "execa": "9.6.0", "fast-glob": "3.3.3", - "glob": "13.0.0", "ignore-walk": "8.0.0", "js-yaml": "4.1.1", "postcss": "8.5.6", diff --git a/packages/frontend-shared/build.js b/packages/frontend-shared/build.js index 9941114757..07e98ad182 100644 --- a/packages/frontend-shared/build.js +++ b/packages/frontend-shared/build.js @@ -3,14 +3,13 @@ import { fileURLToPath } from 'node:url'; import { dirname } from 'node:path'; import * as esbuild from 'esbuild'; import { build } from 'esbuild'; -import { globSync } from 'glob'; import { execa } from 'execa'; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); const _package = JSON.parse(fs.readFileSync(_dirname + '/package.json', 'utf-8')); -const entryPoints = globSync('./js/**/**.{ts,tsx}'); +const entryPoints = fs.globSync('./js/**/**.{ts,tsx}'); /** @type {import('esbuild').BuildOptions} */ const options = { diff --git a/packages/frontend/.storybook/generate.tsx b/packages/frontend/.storybook/generate.tsx index 89d4214141..ef464f2f83 100644 --- a/packages/frontend/.storybook/generate.tsx +++ b/packages/frontend/.storybook/generate.tsx @@ -3,12 +3,11 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { existsSync, readFileSync } from 'node:fs'; +import { existsSync, readFileSync, globSync as glob } from 'node:fs'; import { writeFile } from 'node:fs/promises'; import { basename, dirname } from 'node:path/posix'; import { GENERATOR, type State, generate } from 'astring'; import type * as estree from 'estree'; -import glob from 'fast-glob'; import { format } from 'prettier'; interface SatisfiesExpression extends estree.BaseExpression { @@ -439,7 +438,7 @@ function toStories(component: string): Promise { // glob('src/{components,pages,ui,widgets}/**/*.vue') (async () => { - const globs = await Promise.all([ + const components = [ glob('src/components/global/Mk*.vue'), glob('src/components/global/RouterView.vue'), glob('src/components/MkAbuseReportWindow.vue'), @@ -469,8 +468,7 @@ function toStories(component: string): Promise { glob('src/pages/admin/overview.ap-requests.vue'), glob('src/pages/user/home.vue'), glob('src/pages/search.vue'), - ]); - const components = globs.flat(); + ].flat(); await Promise.all(components.map(async (component) => { const stories = component.replace(/\.vue$/, '.stories.ts'); await writeFile(stories, await toStories(component)); diff --git a/packages/frontend/lib/vite-plugin-create-search-index.ts b/packages/frontend/lib/vite-plugin-create-search-index.ts index f17b43b0e3..cfbba0823c 100644 --- a/packages/frontend/lib/vite-plugin-create-search-index.ts +++ b/packages/frontend/lib/vite-plugin-create-search-index.ts @@ -16,7 +16,6 @@ import { type PluginOption } from 'vite'; import fs from 'node:fs'; -import { glob } from 'glob'; import JSON5 from 'json5'; import MagicString, { SourceMap } from 'magic-string'; import path from 'node:path' @@ -724,7 +723,7 @@ export function pluginCreateSearchIndexVirtualModule(options: Options, asigner: async load(id) { if (id == '\0' + allSearchIndexFile) { - const files = await Promise.all(options.targetFilePaths.map(async (filePathPattern) => await glob(filePathPattern))).then(paths => paths.flat()); + const files = options.targetFilePaths.map((filePathPattern) => fs.globSync(filePathPattern)).flat(); let generatedFile = ''; let arrayElements = ''; for (let file of files) { diff --git a/packages/i18n/build.ts b/packages/i18n/build.ts index a6bbf7dc63..21bf2996b4 100644 --- a/packages/i18n/build.ts +++ b/packages/i18n/build.ts @@ -10,7 +10,6 @@ import { watch as chokidarWatch } from 'chokidar'; import * as esbuild from 'esbuild'; import { build } from 'esbuild'; import { execa } from 'execa'; -import { globSync } from 'glob'; import { generateLocaleInterface } from './scripts/generateLocaleInterface.js'; import type { BuildOptions, BuildResult, Plugin, PluginBuild } from 'esbuild'; @@ -22,7 +21,7 @@ const _rootPackage = JSON.parse(fs.readFileSync(resolve(_rootPackageDir, 'packag const _frontendLocalesDir = resolve(_dirname, '../../built/_frontend_dist_/locales'); const _localesDir = resolve(_rootPackageDir, 'locales'); -const entryPoints = globSync('./src/**/**.{ts,tsx}'); +const entryPoints = fs.globSync('./src/**/**.{ts,tsx}'); const options: BuildOptions = { entryPoints, diff --git a/packages/i18n/package.json b/packages/i18n/package.json index 6ba41632e8..0354c26d15 100644 --- a/packages/i18n/package.json +++ b/packages/i18n/package.json @@ -35,7 +35,6 @@ "chokidar": "4.0.3", "esbuild": "0.27.0", "execa": "9.6.0", - "glob": "11.1.0", "nodemon": "3.1.11", "tsx": "4.20.6", "typescript": "5.9.3" diff --git a/packages/misskey-bubble-game/build.js b/packages/misskey-bubble-game/build.js index 5d534cc6fd..1a6f87a8e8 100644 --- a/packages/misskey-bubble-game/build.js +++ b/packages/misskey-bubble-game/build.js @@ -3,14 +3,13 @@ import { fileURLToPath } from 'node:url'; import { dirname } from 'node:path'; import * as esbuild from 'esbuild'; import { build } from 'esbuild'; -import { globSync } from 'glob'; import { execa } from 'execa'; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); const _package = JSON.parse(fs.readFileSync(_dirname + '/package.json', 'utf-8')); -const entryPoints = globSync('./src/**/**.{ts,tsx}'); +const entryPoints = fs.globSync('./src/**/**.{ts,tsx}'); /** @type {import('esbuild').BuildOptions} */ const options = { diff --git a/packages/misskey-bubble-game/package.json b/packages/misskey-bubble-game/package.json index 8dd68aec44..978d77e0e4 100644 --- a/packages/misskey-bubble-game/package.json +++ b/packages/misskey-bubble-game/package.json @@ -31,7 +31,6 @@ "@typescript-eslint/parser": "8.48.0", "esbuild": "0.27.0", "execa": "9.6.0", - "glob": "11.1.0", "nodemon": "3.1.11", "typescript": "5.9.3" }, diff --git a/packages/misskey-js/build.js b/packages/misskey-js/build.js index b794592815..68535556d3 100644 --- a/packages/misskey-js/build.js +++ b/packages/misskey-js/build.js @@ -3,14 +3,13 @@ import { fileURLToPath } from 'node:url'; import { dirname } from 'node:path'; import * as esbuild from 'esbuild'; import { build } from 'esbuild'; -import { globSync } from 'glob'; import { execa } from 'execa'; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); const _package = JSON.parse(fs.readFileSync(_dirname + '/package.json', 'utf-8')); -const entryPoints = globSync('./src/**/**.{ts,tsx}'); +const entryPoints = fs.globSync('./src/**/**.{ts,tsx}'); /** @type {import('esbuild').BuildOptions} */ const options = { diff --git a/packages/misskey-js/package.json b/packages/misskey-js/package.json index 1c0e6ceee6..c549eaf0e4 100644 --- a/packages/misskey-js/package.json +++ b/packages/misskey-js/package.json @@ -44,7 +44,6 @@ "@vitest/coverage-v8": "4.0.13", "esbuild": "0.27.0", "execa": "9.6.0", - "glob": "13.0.0", "ncp": "2.0.0", "nodemon": "3.1.11", "tsd": "0.33.0", diff --git a/packages/misskey-reversi/build.js b/packages/misskey-reversi/build.js index 5d534cc6fd..1a6f87a8e8 100644 --- a/packages/misskey-reversi/build.js +++ b/packages/misskey-reversi/build.js @@ -3,14 +3,13 @@ import { fileURLToPath } from 'node:url'; import { dirname } from 'node:path'; import * as esbuild from 'esbuild'; import { build } from 'esbuild'; -import { globSync } from 'glob'; import { execa } from 'execa'; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); const _package = JSON.parse(fs.readFileSync(_dirname + '/package.json', 'utf-8')); -const entryPoints = globSync('./src/**/**.{ts,tsx}'); +const entryPoints = fs.globSync('./src/**/**.{ts,tsx}'); /** @type {import('esbuild').BuildOptions} */ const options = { diff --git a/packages/misskey-reversi/package.json b/packages/misskey-reversi/package.json index 30eace87fe..85c829204e 100644 --- a/packages/misskey-reversi/package.json +++ b/packages/misskey-reversi/package.json @@ -29,7 +29,6 @@ "@typescript-eslint/parser": "8.48.0", "esbuild": "0.27.0", "execa": "9.6.0", - "glob": "11.1.0", "nodemon": "3.1.11", "typescript": "5.9.3" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c9fa1c4a01..6e8dbc0c9e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -25,9 +25,6 @@ importers: fast-glob: specifier: 3.3.3 version: 3.3.3 - glob: - specifier: 13.0.0 - version: 13.0.0 ignore-walk: specifier: 8.0.0 version: 8.0.0 @@ -1354,9 +1351,6 @@ importers: execa: specifier: 9.6.0 version: 9.6.0 - glob: - specifier: 11.1.0 - version: 11.1.0 nodemon: specifier: 3.1.11 version: 3.1.11 @@ -1434,9 +1428,6 @@ importers: execa: specifier: 9.6.0 version: 9.6.0 - glob: - specifier: 11.1.0 - version: 11.1.0 nodemon: specifier: 3.1.11 version: 3.1.11 @@ -1477,9 +1468,6 @@ importers: execa: specifier: 9.6.0 version: 9.6.0 - glob: - specifier: 13.0.0 - version: 13.0.0 ncp: specifier: 2.0.0 version: 2.0.0 @@ -1553,9 +1541,6 @@ importers: execa: specifier: 9.6.0 version: 9.6.0 - glob: - specifier: 11.1.0 - version: 11.1.0 nodemon: specifier: 3.1.11 version: 3.1.11 @@ -7283,10 +7268,6 @@ packages: engines: {node: 20 || >=22} hasBin: true - glob@13.0.0: - resolution: {integrity: sha512-tvZgpqk6fz4BaNZ66ZsRaZnbHvP/jG3uKJvAZOwEVUL4RTA5nJeeLYfyN9/VA8NX/V3IBG+hkeuGpKjvELkVhA==} - engines: {node: 20 || >=22} - glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} deprecated: Glob versions prior to v9 are no longer supported @@ -18789,12 +18770,6 @@ snapshots: package-json-from-dist: 1.0.1 path-scurry: 2.0.1 - glob@13.0.0: - dependencies: - minimatch: 10.1.1 - minipass: 7.1.2 - path-scurry: 2.0.1 - glob@7.2.3: dependencies: fs.realpath: 1.0.0