use oxide

- Setup the codebase to be able to use the Rust parts based on an
  environment variable: `OXIDE=1`.
- Setup some tests that run both the non-Rust and Rust version in the
  same test.
- Sort the candidates in a consistent way, to guarantee the order for
  now (especially in tests).
- Reflect sorting related changes in tests.
- Ensure tests run in both the Rust and non-Rust version. (Some tests
  are explicitly skipped when using the Rust version since we haven't
  implemented those features yet. These include: custom prefix,
  transformers and extractors).
  - `jest`
  -`OXIDE=1 jest`
This commit is contained in:
Robin Malfait 2022-11-30 00:10:15 +01:00 • committed by Adam Wathan
parent c2c544e9f7
commit 337775da30
38 changed files with 2560 additions and 1237 deletions

View file

@ -184,10 +184,17 @@ let state = {
let files = fastGlob.sync(this.contentPatterns.all)
for (let file of files) {
content.push({
content: fs.readFileSync(path.resolve(file), 'utf8'),
extension: path.extname(file).slice(1),
})
if (env.OXIDE) {
content.push({
file,
extension: path.extname(file).slice(1),
})
} else {
content.push({
content: fs.readFileSync(path.resolve(file), 'utf8'),
extension: path.extname(file).slice(1),
})
}
}
// Resolve raw content in the tailwind config
@ -234,11 +241,9 @@ let state = {
env.DEBUG && console.timeEnd('Watch new files')
}
env.DEBUG && console.time('Reading content files')
for (let file of this.readContentPaths()) {
this.context.changedContent.push(file)
}
env.DEBUG && console.timeEnd('Reading content files')
return this.context
},

View file

@ -2,4 +2,5 @@
export const env = {
DEBUG: process.env.DEBUG !== undefined && process.env.DEBUG !== '0',
OXIDE: process.env.OXIDE,
}