From f8adcc43ba9b71f8591a08714ebeff19c0a0953f Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Sat, 26 Oct 2024 21:20:28 -0700 Subject: [PATCH] chore: disable glob objectMode --- src/index.js | 15 +++++++-------- types/index.d.ts | 3 --- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/index.js b/src/index.js index 812295d2..d369bc19 100644 --- a/src/index.js +++ b/src/index.js @@ -43,7 +43,6 @@ const getGlobby = memoize(async () => { /** @typedef {import("webpack").WebpackError} WebpackError */ /** @typedef {import("webpack").Asset} Asset */ /** @typedef {import("globby").Options} GlobbyOptions */ -/** @typedef {import("globby").GlobEntry} GlobEntry */ /** @typedef {ReturnType} WebpackLogger */ /** @typedef {ReturnType} CacheFacade */ /** @typedef {ReturnType["getLazyHashedEtag"]>} Etag */ @@ -338,12 +337,12 @@ class CopyPlugin { logger.debug(`determined '${absoluteFrom}' is a glob`); } - /** @type {GlobbyOptions & { objectMode: true }} */ + /** @type {GlobbyOptions} */ const globOptions = { followSymbolicLinks: true, ...(pattern.globOptions || {}), cwd: pattern.context, - objectMode: true, + objectMode: false, onlyFiles: true, }; @@ -409,7 +408,7 @@ class CopyPlugin { logger.log(`begin globbing '${glob}'...`); /** - * @type {GlobEntry[]} + * @type {string[]} */ let globEntries; @@ -448,7 +447,7 @@ class CopyPlugin { copiedResult = await Promise.all( globEntries.map( /** - * @param {GlobEntry} globEntry + * @param {string} globEntry * @returns {Promise} */ async (globEntry) => { @@ -456,7 +455,7 @@ class CopyPlugin { let isFiltered; try { - isFiltered = await pattern.filter(globEntry.path); + isFiltered = await pattern.filter(globEntry); } catch (error) { compilation.errors.push(/** @type {WebpackError} */ (error)); @@ -464,13 +463,13 @@ class CopyPlugin { } if (!isFiltered) { - logger.log(`skip '${globEntry.path}', because it was filtered`); + logger.log(`skip '${globEntry}', because it was filtered`); return; } } - const from = globEntry.path; + const from = globEntry; logger.debug(`found '${from}'`); diff --git a/types/index.d.ts b/types/index.d.ts index 2d8a9735..97267cc8 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -5,7 +5,6 @@ export = CopyPlugin; /** @typedef {import("webpack").WebpackError} WebpackError */ /** @typedef {import("webpack").Asset} Asset */ /** @typedef {import("globby").Options} GlobbyOptions */ -/** @typedef {import("globby").GlobEntry} GlobEntry */ /** @typedef {ReturnType} WebpackLogger */ /** @typedef {ReturnType} CacheFacade */ /** @typedef {ReturnType["getLazyHashedEtag"]>} Etag */ @@ -165,7 +164,6 @@ declare namespace CopyPlugin { WebpackError, Asset, GlobbyOptions, - GlobEntry, WebpackLogger, CacheFacade, Etag, @@ -198,7 +196,6 @@ type Compilation = import("webpack").Compilation; type WebpackError = import("webpack").WebpackError; type Asset = import("webpack").Asset; type GlobbyOptions = import("globby").Options; -type GlobEntry = import("globby").GlobEntry; type WebpackLogger = ReturnType; type CacheFacade = ReturnType; type Etag = ReturnType<