Skip to content

fix(core): fail when an input glob matches no file - #2955

Merged
srod merged 2 commits into
developfrom
advisor/002-fail-on-glob-with-no-match
Nov 23, 2026
Merged

srod merged 2 commits into
developfrom
advisor/002-fail-on-glob-with-no-match

Conversation

@srod

@srod srod commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

A wildcard input that matched nothing reached the compressors as input: []. With a $1 output, minify() resolved "" and wrote nothing, so a typo in a glob or an empty build directory looked like success.

 enhanceSettings()
   input = wildcards(requestedInput)
+  if any requested pattern contains "*" and input is now []
+    throw "No files matched input pattern: <patterns>"

The check uses *, the same test wildcards() uses to decide whether to glob.

Input Before After
"nope/**/*.js", output $1.min.js resolves "", writes nothing throws No files matched input pattern: nope/**/*.js
"nope/**/*.js", output all.js throws No content provided throws No files matched …
["nope/*.js", "real.js"] works works (unchanged)
"missing.js" (no glob) unchanged unchanged
input: [], in-memory content unchanged unchanged

Evidence

  • New setup-no-match.test.ts, 6 tests: before the fix 4 fail and 2 pass, after the fix all pass.
  • Real runs on the merged tree produce the "After" column above.
  • bun run test: 72 files, 1086 tests pass. Lint, typecheck, ci-guard-type-suppressions.sh pass.

Merge Danger

Door: two-way

Blast Radius: core, CLI, Action users

A build or workflow that relied on an empty glob succeeding will now fail. That is the intended fix, but the release notes should say so. Changeset: @node-minify/core patch.


Summary by cubic

Fails minify() when a wildcard input matches no file, so a typo'ed glob or empty build directory no longer looks like success. Previously an unmatched glob reached the compressors as input: [], resolved a $1 output to an empty string and wrote nothing, or failed with No content provided for a plain output; both cases now throw No files matched input pattern: <pattern>.

  • Uses the same * wildcard detection that wildcards() uses to decide whether to glob.
  • Explicit empty input arrays and in-memory content are unaffected, as are non-glob missing files such as missing.js.
  • Breaking for builds that relied on an empty glob succeeding; the changeset marks @node-minify/core as a patch.

Written for commit 4d4ca60. Summary will update on new commits.

View guided diff Turn on auto-fix

@changeset-bot

changeset-bot Bot commented Nov 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 29ba6de

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 25 packages
Name Type
@node-minify/core Patch
@node-minify/action Patch
@node-minify/benchmark Patch
@node-minify/cli Patch
@node-minify/imagemin Patch
@node-minify/sharp Patch
@node-minify/examples Patch
@node-minify/docs Patch
@node-minify/clean-css Patch
@node-minify/cssnano Patch
@node-minify/csso Patch
@node-minify/esbuild Patch
@node-minify/google-closure-compiler Patch
@node-minify/html-minifier Patch
@node-minify/jsonminify Patch
@node-minify/lightningcss Patch
@node-minify/minify-html Patch
@node-minify/no-compress Patch
@node-minify/oxc Patch
@node-minify/svgo Patch
@node-minify/swc Patch
@node-minify/terser Patch
@node-minify/types Patch
@node-minify/uglify-js Patch
@node-minify/utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread packages/core/src/setup.ts Resolved
@codecov

codecov Bot commented Nov 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.64%. Comparing base (34a46a1) to head (4d4ca60).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2955   +/-   ##
========================================
  Coverage    98.63%   98.64%           
========================================
  Files           70       70           
  Lines         2052     2060    +8     
  Branches       625      629    +4     
========================================
+ Hits          2024     2032    +8     
  Misses          28       28           

☔ View full report in Codecov by Harness.
📢 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.

@srod
srod merged commit 8903c65 into develop Nov 23, 2026
6 checks passed
@srod
srod deleted the advisor/002-fail-on-glob-with-no-match branch November 23, 2026 16:55
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.

1 participant