Skip to content

fix: windows glob patterns match nothing since glob 13 - #251

Merged
friewerts merged 3 commits into
developfrom
fix/windows-glob-patterns
Jul 6, 2026
Merged

fix: windows glob patterns match nothing since glob 13#251
friewerts merged 3 commits into
developfrom
fix/windows-glob-patterns

Conversation

@friewerts

Copy link
Copy Markdown
Member

Problem

Since the glob 7 → 13 bump in assemble-lite 2.1.1 (shipped with pv-stylemark 5.x), pv-scripts dev/prod produces no assembled HTML at all on Windows. Consumers see one ENOENT per LSG example right before webpack's "Compiled successfully!":

[Error: ENOENT: no such file or directory, open 'C:\...\frontend\target\components\lsg-helpers\vic-lsg-colors\vic-lsg-colors.html']

Root cause

  • pv-stylemark's clickdummy tasks build glob patterns via resolveApp(join(...))path.resolve rewrites the whole pattern to backslashes on Windows (C:\...\src\components\**\*.hbs).
  • assemble-lite's asyncGlob calls glob(pattern, {}). Since glob v9, \ in patterns is strictly an escape character → the pattern matches zero files → nothing is written to target/components / target/pages.
  • glob 7 tolerated this: minimatch 3 auto-converted path.sep to / on Windows. minimatch 10 (glob 13) removed that default in favor of the windowsPathsNoEscape option.
  • getLsgData already passes windowsPathsNoEscape: true for its own *.md glob, so it does find all components — buildLsgExamples then readFiles the never-generated HTML, producing the ENOENT warnings.

Changes

  • assemble-lite: pass windowsPathsNoEscape: true in asyncGlob — mirroring what pv-stylemark already does for its own glob calls. (Documented trade-off: literal *?[] can no longer be backslash-escaped in patterns; patterns here are config-derived paths.)
  • pv-stylemark: normalize componentPath/srcPath (from path.relative) and the markup-url (from native path.join) with slash() — no more backslashes leaking into generated markup/URLs on Windows.
  • pv-stylemark: getFilesToWatch returned lsgIndex as the only relative entry among absolute native paths, so webpack fileDependencies/modifiedFiles comparisons never matched and LSG index edits didn't retrigger the copy in watch mode (cross-platform bug). Now resolved via resolveApp.

Not touched: pv-scripts/scripts/prod.js feeds a path.resolved pattern to source-map-explorer, but sme uses glob ^7 whose minimatch 3 still auto-converts on Windows — not affected.

Verification

Tested against the exact installed glob 13.0.6 with a fixture tree: the Windows-style all-backslash absolute pattern now matches all files through asyncGlob/getPaths, POSIX patterns behave unchanged, results stay absolute/native-separator, and markup-url renders as ../components/lsg-helpers/vic-lsg-colors/vic-lsg-colors.html. ESLint clean.

🤖 Generated with Claude Code

friewerts added 3 commits July 3, 2026 20:06
Since glob v9, backslashes in patterns are escape characters, so the
absolute patterns pv-stylemark builds via path.resolve match nothing on
windows and no html is assembled. Pass windowsPathsNoEscape like
pv-stylemark already does for its own glob calls.
componentPath/srcPath come from path.relative and markup-url from
path.join — on windows this leaked backslashes into generated markup
and urls. Normalize with slash().
lsgIndex was the only relative entry among absolute native paths, so
webpack fileDependencies/modifiedFiles comparisons never matched and
edits to the lsg index page did not retrigger the copy in watch mode.
@friewerts
friewerts merged commit ba1edfb into develop Jul 6, 2026
2 checks passed
@friewerts
friewerts deleted the fix/windows-glob-patterns branch July 6, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant