fix: windows glob patterns match nothing since glob 13 - #251
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Since the glob 7 → 13 bump in assemble-lite 2.1.1 (shipped with pv-stylemark 5.x),
pv-scripts dev/prodproduces no assembled HTML at all on Windows. Consumers see one ENOENT per LSG example right before webpack's "Compiled successfully!":Root cause
resolveApp(join(...))—path.resolverewrites the whole pattern to backslashes on Windows (C:\...\src\components\**\*.hbs).asyncGlobcallsglob(pattern, {}). Since glob v9,\in patterns is strictly an escape character → the pattern matches zero files → nothing is written totarget/components/target/pages.path.septo/on Windows. minimatch 10 (glob 13) removed that default in favor of thewindowsPathsNoEscapeoption.getLsgDataalready passeswindowsPathsNoEscape: truefor its own*.mdglob, so it does find all components —buildLsgExamplesthenreadFiles the never-generated HTML, producing the ENOENT warnings.Changes
windowsPathsNoEscape: trueinasyncGlob— 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.)componentPath/srcPath(frompath.relative) and themarkup-url(from nativepath.join) withslash()— no more backslashes leaking into generated markup/URLs on Windows.getFilesToWatchreturnedlsgIndexas the only relative entry among absolute native paths, so webpackfileDependencies/modifiedFilescomparisons never matched and LSG index edits didn't retrigger the copy in watch mode (cross-platform bug). Now resolved viaresolveApp.Not touched:
pv-scripts/scripts/prod.jsfeeds apath.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, andmarkup-urlrenders as../components/lsg-helpers/vic-lsg-colors/vic-lsg-colors.html. ESLint clean.🤖 Generated with Claude Code