Skip to content

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

Merged
merged 5 commits into from
Mar 27, 2025
Merged

Prep for new Oxide API in v4.1 #1284

merged 5 commits into from
Mar 27, 2025

Conversation

thecrypticace
Copy link
Contributor

cc @philipp-spiess @RobinMalfait

Does this change look right? (see the 2nd commit for the actual change)


interface Scanner {
files: Array<string>
sources: Array<SourceEntry>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@RobinMalfait RobinMalfait left a 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).

@thecrypticace thecrypticace force-pushed the feat/new-oxide-api branch 2 times, most recently from 4108bbc to bbe7fde Compare March 27, 2025 18:55
@thecrypticace thecrypticace merged commit 5f74714 into main Mar 27, 2025
12 checks passed
@thecrypticace thecrypticace deleted the feat/new-oxide-api branch March 27, 2025 19:10
thecrypticace added a commit that referenced this pull request Mar 27, 2025
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 🤦‍♂️
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants