Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
23147ff
handle `source(…)`
RobinMalfait Oct 23, 2024
a62b010
add integration test for `source(…)`
RobinMalfait Oct 23, 2024
7b45b77
forward correct `source(…)` to the oxide scanner
RobinMalfait Oct 23, 2024
165718a
update test
RobinMalfait Oct 25, 2024
d0731d1
fix turbo input paths
RobinMalfait Oct 25, 2024
9b25bf8
fix some clippy warnings
RobinMalfait Oct 25, 2024
fcf0a9d
promote sources to auto source detection
RobinMalfait Oct 25, 2024
dea08ba
refactor, remove a level of nesting
RobinMalfait Oct 25, 2024
77e8bf9
merge `globs` and `detectSources`
RobinMalfait Oct 25, 2024
c3c82eb
Remove @tailwind utility nodes with parameters
philipp-spiess Oct 25, 2024
98f74f4
validate existence `source(…)` base path
RobinMalfait Oct 25, 2024
193e7bc
provide base and pattern separately
RobinMalfait Oct 25, 2024
2cc2a33
add `bexpand` for expanding glob expressions
RobinMalfait Oct 25, 2024
d612e66
expand patterns in `GlobEntry`
RobinMalfait Oct 25, 2024
9e46992
run prettier
RobinMalfait Oct 25, 2024
810d98a
update test name
RobinMalfait Oct 25, 2024
ec70c4c
refactor: use variable directly
RobinMalfait Oct 25, 2024
1c140a8
update `@tailwindcss/postcss` with new `source(…)` setup
RobinMalfait Oct 25, 2024
894290a
update `@tailwindcss/vite` with new `source(…)` setup
RobinMalfait Oct 25, 2024
6a3159e
cleanup `console.log`
RobinMalfait Oct 25, 2024
9f6ab1a
add todo for follow up PR
RobinMalfait Oct 25, 2024
86e9e4d
add CLI watch mode tests for `@source` and `source(…)`
RobinMalfait Oct 25, 2024
5747d1c
migrate detect sources to sources
RobinMalfait Oct 25, 2024
f3fe3ce
resolves base path in tests
RobinMalfait Oct 25, 2024
d600964
update all instances of `new Scanner(…)`
RobinMalfait Oct 25, 2024
bf39acd
Update crates/oxide/src/lib.rs
RobinMalfait Oct 25, 2024
d549337
Update packages/@tailwindcss-vite/src/index.ts
RobinMalfait Oct 25, 2024
d5b724c
Update packages/@tailwindcss-vite/src/index.ts
RobinMalfait Oct 25, 2024
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
Next Next commit
validate existence source(…) base path
  • Loading branch information
RobinMalfait committed Oct 28, 2024
commit 98f74f485d761dd89b2f223460df7f7055a078b1
28 changes: 26 additions & 2 deletions packages/@tailwindcss-node/src/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import {
} from 'tailwindcss'
import { getModuleDependencies } from './get-module-dependencies'

export function compile(
export async function compile(
css: string,
{ base, onDependency }: { base: string; onDependency: (path: string) => void },
) {
return _compile(css, {
let compiler = await _compile(css, {
base,
async loadModule(id, base) {
return loadModule(id, base, onDependency)
Expand All @@ -23,6 +23,30 @@ export function compile(
return loadStylesheet(id, base, onDependency)
},
})

// Verify if the `source(…)` path exists (until the glob pattern starts)
if (compiler.root && compiler.root !== 'none') {
let globSymbols = /[*{]/
let basePath = []
for (let segment of compiler.root.pattern.split('/')) {
if (globSymbols.test(segment)) {
break
}

basePath.push(segment)
}

let exists = await fsPromises
.stat(path.resolve(base, basePath.join('/')))
.then((stat) => stat.isDirectory())
.catch(() => false)

if (!exists) {
throw new Error(`The \`source(${compiler.root.pattern})\` does not exist`)
}
}

return compiler
}

export async function __unstable__loadDesignSystem(css: string, { base }: { base: string }) {
Expand Down