Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Windows support for escaped glob syntax #12718

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix CS
  • Loading branch information
thecrypticace committed Jan 12, 2024
commit 26161e95f1513a4c01c9398d213574de4a2a41be
20 changes: 15 additions & 5 deletions integrations/content-resolution/tests/content.test.js
Original file line number Diff line number Diff line change
@@ -305,10 +305,20 @@ it('handles some special glob characters in paths', async () => {
let result = await build({ cwd: path.resolve(__dirname, '..') })

expect(result.css).toMatchFormattedCss(css`
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 0.75rem; }
.mr-4 { margin-right: 1rem; }
.mr-5 { margin-right: 1.25rem; }
.mr-1 {
margin-right: 0.25rem;
}
.mr-2 {
margin-right: 0.5rem;
}
.mr-3 {
margin-right: 0.75rem;
}
.mr-4 {
margin-right: 1rem;
}
.mr-5 {
margin-right: 1.25rem;
}
`)
})
5 changes: 1 addition & 4 deletions integrations/execute.js
Original file line number Diff line number Diff line change
@@ -53,10 +53,7 @@ module.exports = function $(command, options = {}) {
: (() => {
let args = command.trim().split(/\s+/)
command = args.shift()
command =
command === 'node'
? command
: resolveCommandPath(root, command)
command = command === 'node' ? command : resolveCommandPath(root, command)
return [command, args]
})()

18 changes: 10 additions & 8 deletions src/lib/content.js
Original file line number Diff line number Diff line change
@@ -132,22 +132,22 @@ export function parseCandidateFiles(context, tailwindConfig) {

let paths = [...included, ...excluded]

console.log("parseCandidateFiles 0", { paths })
console.log('parseCandidateFiles 0', { paths })

// Resolve paths relative to the config file or cwd
paths = resolveRelativePaths(context, paths)

console.log("parseCandidateFiles 1", { paths })
console.log('parseCandidateFiles 1', { paths })

// Resolve symlinks if possible
paths = paths.flatMap(resolvePathSymlinks)

console.log("parseCandidateFiles 2", { paths })
console.log('parseCandidateFiles 2', { paths })

// Update cached patterns
paths = paths.map(resolveGlobPattern)

console.log("parseCandidateFiles 3", { paths })
console.log('parseCandidateFiles 3', { paths })

return paths
}
@@ -201,9 +201,7 @@ function resolveGlobPattern(contentPath) {
? `${contentPath.base}/${contentPath.glob}`
: contentPath.base

contentPath.pattern = contentPath.ignore
? `!${contentPath.pattern}`
: contentPath.pattern
contentPath.pattern = contentPath.ignore ? `!${contentPath.pattern}` : contentPath.pattern

return contentPath
}
@@ -227,7 +225,11 @@ function resolveRelativePaths(context, contentPaths) {
return contentPaths.map((contentPath) => {
contentPath.base = path.posix.resolve(...resolveFrom, contentPath.base)

if (path.sep === '\\' && contentPath.base.startsWith('/') && !contentPath.base.startsWith('//?/')) {
if (
path.sep === '\\' &&
contentPath.base.startsWith('/') &&
!contentPath.base.startsWith('//?/')
) {
contentPath.base = `C:${contentPath.base}`
}