From 25aa1fa64733d8eeb7ed8061f94585231d2199d8 Mon Sep 17 00:00:00 2001 From: Andrew Powell Date: Mon, 21 Oct 2024 07:41:53 -0400 Subject: [PATCH] chore(dynamic-import-vars): revert 2.1.4 changes (#1799) --- packages/dynamic-import-vars/package.json | 4 +-- .../src/dynamic-import-to-glob.js | 4 +-- packages/dynamic-import-vars/src/index.js | 4 +-- pnpm-lock.yaml | 27 +++---------------- 4 files changed, 9 insertions(+), 30 deletions(-) diff --git a/packages/dynamic-import-vars/package.json b/packages/dynamic-import-vars/package.json index a3e6b46b2..aed0033ab 100644 --- a/packages/dynamic-import-vars/package.json +++ b/packages/dynamic-import-vars/package.json @@ -66,8 +66,8 @@ "@rollup/pluginutils": "^5.0.1", "astring": "^1.8.5", "estree-walker": "^2.0.2", - "magic-string": "^0.30.3", - "tinyglobby": "^0.2.8" + "fast-glob": "^3.2.12", + "magic-string": "^0.30.3" }, "devDependencies": { "acorn": "^8.8.0", diff --git a/packages/dynamic-import-vars/src/dynamic-import-to-glob.js b/packages/dynamic-import-vars/src/dynamic-import-to-glob.js index de63b90b1..ed1ae978e 100644 --- a/packages/dynamic-import-vars/src/dynamic-import-to-glob.js +++ b/packages/dynamic-import-vars/src/dynamic-import-to-glob.js @@ -1,6 +1,6 @@ import path from 'path'; -import { escapePath } from 'tinyglobby'; +import fastGlob from 'fast-glob'; export class VariableDynamicImportError extends Error {} @@ -12,7 +12,7 @@ function sanitizeString(str) { if (str.includes('*')) { throw new VariableDynamicImportError('A dynamic import cannot contain * characters.'); } - return escapePath(str); + return fastGlob.escapePath(str); } function templateLiteralToGlob(node) { diff --git a/packages/dynamic-import-vars/src/index.js b/packages/dynamic-import-vars/src/index.js index 3351a1582..b44770c45 100644 --- a/packages/dynamic-import-vars/src/index.js +++ b/packages/dynamic-import-vars/src/index.js @@ -2,7 +2,7 @@ import path from 'path'; import { walk } from 'estree-walker'; import MagicString from 'magic-string'; -import { globSync } from 'tinyglobby'; +import fastGlob from 'fast-glob'; import { generate } from 'astring'; import { createFilter } from '@rollup/pluginutils'; @@ -50,7 +50,7 @@ function dynamicImportVariables({ include, exclude, warnOnError, errorWhenNoFile } // execute the glob - const result = globSync(glob, { cwd: path.dirname(id), expandDirectories: false }); + const result = fastGlob.sync(glob, { cwd: path.dirname(id) }); const paths = result.map((r) => r.startsWith('./') || r.startsWith('../') ? r : `./${r}` ); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3d2776de6..3f75e203e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -295,12 +295,12 @@ importers: estree-walker: specifier: ^2.0.2 version: 2.0.2 + fast-glob: + specifier: ^3.2.12 + version: 3.2.12 magic-string: specifier: ^0.30.3 version: 0.30.3 - tinyglobby: - specifier: ^0.2.8 - version: 0.2.8 devDependencies: acorn: specifier: ^8.8.0 @@ -2731,14 +2731,6 @@ packages: picomatch: optional: true - fdir@6.4.0: - resolution: {integrity: sha512-3oB133prH1o4j/L5lLW7uOCF1PlD+/It2L0eL/iAqWMB91RBbqTewABqxhj0ibBd90EEmWZq7ntIWzVaWcXTGQ==} - peerDependencies: - picomatch: ^3 || ^4 - peerDependenciesMeta: - picomatch: - optional: true - figures@4.0.1: resolution: {integrity: sha512-rElJwkA/xS04Vfg+CaZodpso7VqBknOYbzi6I76hI4X80RUjkSxO2oAyPmGbuXUppywjqndOrQDl817hDnI++w==} engines: {node: '>=12'} @@ -4415,10 +4407,6 @@ packages: resolution: {integrity: sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA==} engines: {node: '>=4'} - tinyglobby@0.2.8: - resolution: {integrity: sha512-AMLZywN0vbhiZi2neFEaj9VIIxC+PjDMsp0nAK6tpR86LJavZgHqGz0S/FOONwBygC+mu7R0/TyAQw0gx0Mu9Q==} - engines: {node: '>=12.0.0'} - to-fast-properties@2.0.0: resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} engines: {node: '>=4'} @@ -6979,10 +6967,6 @@ snapshots: optionalDependencies: picomatch: 4.0.2 - fdir@6.4.0(picomatch@4.0.2): - optionalDependencies: - picomatch: 4.0.2 - figures@4.0.1: dependencies: escape-string-regexp: 5.0.0 @@ -8642,11 +8626,6 @@ snapshots: time-zone@1.0.0: {} - tinyglobby@0.2.8: - dependencies: - fdir: 6.4.0(picomatch@4.0.2) - picomatch: 4.0.2 - to-fast-properties@2.0.0: {} to-regex-range@5.0.1: