From 1cf0a537a0c8a0b26a9eb1b55ce23aaae1c6ff15 Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Mon, 17 Feb 2025 01:18:19 +0800 Subject: [PATCH 1/2] fix: loadFile ignore ts extend on readFileSync (#294) https://github.com/eggjs/tegg/pull/283 ## Summary by CodeRabbit - **Bug Fixes** - Updated the file loading functionality to properly differentiate TypeScript files from other file types. This modification prevents unintended processing behavior for TypeScript content, ensuring more reliable file operations and enhancing overall stability in handling various file formats. --- src/utils/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index 01dbd5fd..7bdb8026 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -78,7 +78,7 @@ export default { try { // if not js module, just return content buffer const extname = path.extname(filepath); - if (extname && !extensionNames.includes(extname)) { + if (extname && !extensionNames.includes(extname) && extname !== '.ts') { return fs.readFileSync(filepath); } const obj = await importModule(filepath, { importDefaultOnly: true }); From e281a99f546f5e48d3d795b668698c9b87adb183 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 16 Feb 2025 17:18:59 +0000 Subject: [PATCH 2/2] Release 6.3.2 [skip ci] ## [6.3.2](https://github.com/eggjs/core/compare/v6.3.1...v6.3.2) (2025-02-16) ### Bug Fixes * loadFile ignore ts extend on readFileSync ([#294](https://github.com/eggjs/core/issues/294)) ([1cf0a53](https://github.com/eggjs/core/commit/1cf0a537a0c8a0b26a9eb1b55ce23aaae1c6ff15)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5254233..8b30a3ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [6.3.2](https://github.com/eggjs/core/compare/v6.3.1...v6.3.2) (2025-02-16) + + +### Bug Fixes + +* loadFile ignore ts extend on readFileSync ([#294](https://github.com/eggjs/core/issues/294)) ([1cf0a53](https://github.com/eggjs/core/commit/1cf0a537a0c8a0b26a9eb1b55ce23aaae1c6ff15)) + ## [6.3.1](https://github.com/eggjs/core/compare/v6.3.0...v6.3.1) (2025-01-21) diff --git a/package.json b/package.json index cab0d337..0b75da11 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@eggjs/core", - "version": "6.3.1", + "version": "6.3.2", "publishConfig": { "access": "public" },