Skip to content

feat: allow extends without extension#268

Merged
pi0 merged 2 commits intounjs:mainfrom
devbro1:feat/resolve-config-files-wo-extensions
Sep 15, 2025
Merged

feat: allow extends without extension#268
pi0 merged 2 commits intounjs:mainfrom
devbro1:feat/resolve-config-files-wo-extensions

Conversation

@devbro1
Copy link
Contributor

@devbro1 devbro1 commented Sep 3, 2025

Branch name: feat/resolve-config-files-wo-extensions

resolves #267

This pull request enhances the configuration loader to support resolving config files from relative paths that do not correspond to folders, and adds tests to verify this new behavior. The changes ensure that configs like ./not-a-folder are correctly loaded even if the path points to a file rather than a directory.

Config resolution improvements:

  • Updated resolveConfig in src/loader.ts to attempt resolving config files using the original source path, enabling support for relative file paths that are not folders. [1] [2]

Test coverage for new resolution logic:

  • Added ./not-a-folder to the extends array in test/fixture/.config/test.ts to test the new resolution behavior. [1] [2]
  • Created a new config file test/fixture/not-a-folder.ts to serve as the target for the new test case.
  • Updated test assertions in test/loader.test.ts to check that the not_a_folder config is correctly loaded and included in the resolved config layers. [1] [2]

…ng processed as folder

Branch name: feat/resolve-config-files-wo-extensions
@codecov
Copy link

codecov bot commented Sep 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.36%. Comparing base (42d9697) to head (f3f84fa).
⚠️ Report is 165 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #268      +/-   ##
==========================================
+ Coverage   76.92%   78.36%   +1.44%     
==========================================
  Files           7        6       -1     
  Lines         806      638     -168     
  Branches       80      130      +50     
==========================================
- Hits          620      500     -120     
+ Misses        184      138      -46     
+ Partials        2        0       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ❤️

@pi0 pi0 changed the title feat: allow files without extensions to be used in extend without bei… feat: allow extends without extension Sep 15, 2025
@pi0 pi0 merged commit 0da2c4a into unjs:main Sep 15, 2025
3 checks passed
@BobbieGoede
Copy link

BobbieGoede commented Oct 15, 2025

This change will load index.js files at the root of cwd if no configuration files are found (this is a breaking change for some setups, as seen here https://github.com/vite-pwa/create-pwa/actions/runs/18538765008/job/52840646436#step:3:18).

/cc @userquin

Oops sorry for the ping, this was already reported and being discussed in #275

pi0 added a commit that referenced this pull request Oct 17, 2025
Co-authored-by: Pooya Parsa <pooya@pi0.io>
@pi0
Copy link
Member

pi0 commented Oct 17, 2025

We had to revert this change in #276 due to regressions (#275)

I think it is safer this way to explicitly specify extensions (also compatible with ESM)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

extend thinks of files without extension as folders

3 participants