diff --git a/packages/astro/src/index.server.ts b/packages/astro/src/index.server.ts index 98e5486894db..bbaae475e068 100644 --- a/packages/astro/src/index.server.ts +++ b/packages/astro/src/index.server.ts @@ -68,8 +68,6 @@ export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData, - // eslint-disable-next-line deprecation/deprecation - deepReadDirSync, Integrations, consoleIntegration, onUncaughtExceptionIntegration, diff --git a/packages/bun/src/index.ts b/packages/bun/src/index.ts index f1958c53404d..e48be07a948d 100644 --- a/packages/bun/src/index.ts +++ b/packages/bun/src/index.ts @@ -89,8 +89,6 @@ export { } from '@sentry/core'; export type { SpanStatusType } from '@sentry/core'; export { - // eslint-disable-next-line deprecation/deprecation - deepReadDirSync, // eslint-disable-next-line deprecation/deprecation enableAnrDetection, // eslint-disable-next-line deprecation/deprecation diff --git a/packages/node-experimental/src/index.ts b/packages/node-experimental/src/index.ts index b5ffeb6de0c9..171af5251107 100644 --- a/packages/node-experimental/src/index.ts +++ b/packages/node-experimental/src/index.ts @@ -66,8 +66,6 @@ export { DEFAULT_USER_INCLUDES, extractRequestData, // eslint-disable-next-line deprecation/deprecation - deepReadDirSync, - // eslint-disable-next-line deprecation/deprecation getModuleFromFilename, createGetModuleFromFilename, close, diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index 44630d871260..aaaf23dc290f 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -102,8 +102,6 @@ export { getSentryRelease, } from './sdk'; export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData } from '@sentry/utils'; -// eslint-disable-next-line deprecation/deprecation -export { deepReadDirSync } from './utils'; import { createGetModuleFromFilename } from './module'; /** diff --git a/packages/node/src/utils.ts b/packages/node/src/utils.ts deleted file mode 100644 index 475709208ed9..000000000000 --- a/packages/node/src/utils.ts +++ /dev/null @@ -1,40 +0,0 @@ -import * as fs from 'fs'; -import * as path from 'path'; - -/** - * Recursively read the contents of a directory. - * - * @param targetDir Absolute or relative path of the directory to scan. All returned paths will be relative to this - * directory. - * @returns Array holding all relative paths - * @deprecated This function will be removed in the next major version. - */ -export function deepReadDirSync(targetDir: string): string[] { - const targetDirAbsPath = path.resolve(targetDir); - - if (!fs.existsSync(targetDirAbsPath)) { - throw new Error(`Cannot read contents of ${targetDirAbsPath}. Directory does not exist.`); - } - - if (!fs.statSync(targetDirAbsPath).isDirectory()) { - throw new Error(`Cannot read contents of ${targetDirAbsPath}, because it is not a directory.`); - } - - // This does the same thing as its containing function, `deepReadDirSync` (except that - purely for convenience - it - // deals in absolute paths rather than relative ones). We need this to be separate from the outer function to preserve - // the difference between `targetDirAbsPath` and `currentDirAbsPath`. - const deepReadCurrentDir = (currentDirAbsPath: string): string[] => { - return fs.readdirSync(currentDirAbsPath).reduce((absPaths: string[], itemName: string) => { - const itemAbsPath = path.join(currentDirAbsPath, itemName); - - if (fs.statSync(itemAbsPath).isDirectory()) { - return absPaths.concat(deepReadCurrentDir(itemAbsPath)); - } - - absPaths.push(itemAbsPath); - return absPaths; - }, []); - }; - - return deepReadCurrentDir(targetDirAbsPath).map(absPath => path.relative(targetDirAbsPath, absPath)); -} diff --git a/packages/node/test/utils.test.ts b/packages/node/test/utils.test.ts deleted file mode 100644 index bcee236c070c..000000000000 --- a/packages/node/test/utils.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as fs from 'fs'; -import * as os from 'os'; -import * as path from 'path'; - -import { deepReadDirSync } from '../src/utils'; - -// The parent directory for the new temporary directory - -describe('deepReadDirSync', () => { - it('handles nested files', () => { - const expected = [ - // root level - 'debra.txt', - // one level deep - 'cats/eddy.txt', - 'cats/persephone.txt', - 'cats/piper.txt', - 'cats/sassafras.txt', - 'cats/teaberry.txt', - // two levels deep - 'dogs/theBigs/charlie.txt', - 'dogs/theBigs/maisey.txt', - 'dogs/theSmalls/bodhi.txt', - 'dogs/theSmalls/cory.txt', - ].map(p => (process.platform === 'win32' ? p.replace(/\//g, '\\') : p)); - - // compare sets so that order doesn't matter - // eslint-disable-next-line deprecation/deprecation - expect(new Set(deepReadDirSync('./test/fixtures/testDeepReadDirSync'))).toEqual(new Set(expected)); - }); - - it('handles empty target directory', (done: (error?: Error) => void) => { - expect.assertions(1); - const tmpDir = os.tmpdir(); - - fs.mkdtemp(`${tmpDir}${path.sep}`, (err, dirPath) => { - if (err) throw err; - try { - // eslint-disable-next-line deprecation/deprecation - expect(deepReadDirSync(dirPath)).toEqual([]); - done(); - } catch (error) { - done(error as Error); - } - }); - }); - - it('errors if directory does not exist', () => { - // eslint-disable-next-line deprecation/deprecation - expect(() => deepReadDirSync('./IDontExist')).toThrowError('Directory does not exist.'); - }); - - it('errors if given path is not a directory', () => { - // eslint-disable-next-line deprecation/deprecation - expect(() => deepReadDirSync('package.json')).toThrowError('it is not a directory'); - }); -}); diff --git a/packages/remix/src/index.server.ts b/packages/remix/src/index.server.ts index a34250100287..3abfc76c4372 100644 --- a/packages/remix/src/index.server.ts +++ b/packages/remix/src/index.server.ts @@ -72,8 +72,6 @@ export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData, - // eslint-disable-next-line deprecation/deprecation - deepReadDirSync, Integrations, consoleIntegration, onUncaughtExceptionIntegration, diff --git a/packages/serverless/src/index.ts b/packages/serverless/src/index.ts index 24ee21115f0b..8c1e732bfda8 100644 --- a/packages/serverless/src/index.ts +++ b/packages/serverless/src/index.ts @@ -70,8 +70,6 @@ export { DEFAULT_USER_INCLUDES, addRequestDataToEvent, extractRequestData, - // eslint-disable-next-line deprecation/deprecation - deepReadDirSync, Handlers, // eslint-disable-next-line deprecation/deprecation Integrations, diff --git a/packages/sveltekit/src/server/index.ts b/packages/sveltekit/src/server/index.ts index 7a886334cfbc..105da4026c06 100644 --- a/packages/sveltekit/src/server/index.ts +++ b/packages/sveltekit/src/server/index.ts @@ -66,8 +66,6 @@ export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData, - // eslint-disable-next-line deprecation/deprecation - deepReadDirSync, Integrations, consoleIntegration, onUncaughtExceptionIntegration,