-
Notifications
You must be signed in to change notification settings - Fork 219
Prep for new Oxide API in v4.1 #1284
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
Conversation
|
||
interface Scanner { | ||
files: Array<string> | ||
sources: Array<SourceEntry> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1be9acd
to
5cad143
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are mixing GlobEntry
and SourceEntry
a bit. The fully generated TS file for the latest @tailwindcss/oxide
looks like this:
/* tslint:disable */
/* eslint-disable */
/* auto-generated by NAPI-RS */
export interface ChangedContent {
/** File path to the changed file */
file?: string
/** Contents of the changed file */
content?: string
/** File extension */
extension: string
}
export interface GlobEntry {
/** Base path of the glob */
base: string
/** Glob pattern */
pattern: string
}
export interface SourceEntry {
/** Base path of the glob */
base: string
/** Glob pattern */
pattern: string
/** Negated flag */
negated: boolean
}
export interface ScannerOptions {
/** Glob sources */
sources?: Array<SourceEntry>
}
export interface CandidateWithPosition {
/** The candidate string */
candidate: string
/** The position of the candidate inside the content file */
position: number
}
export declare class Scanner {
constructor(opts: ScannerOptions)
scan(): Array<string>
scanFiles(input: Array<ChangedContent>): Array<string>
getCandidatesWithPositions(input: ChangedContent): Array<CandidateWithPosition>
get files(): Array<string>
get globs(): Array<GlobEntry>
get normalizedSources(): Array<GlobEntry>
}
So essentially, SourceEntry
has a negated
flag and is an input to the scanner, GlobEntry
does not have a negated
flag and is returned from the scanner (to register dependencies in PostCSS / CLI later).
5cad143
to
fd83226
Compare
4108bbc
to
bbe7fde
Compare
These are now created on the fly during the test itself
bbe7fde
to
1c93433
Compare
I forgot to add support for reading `@source not` in #1284 Also realized I forgot to add the `negated` field for `@source` globs. I'd already written the test — just not tested it with the new version like I did the others 🤦♂️
cc @philipp-spiess @RobinMalfait
Does this change look right? (see the 2nd commit for the actual change)