From 98e8e33c0769077308742d4ccaafa26d84e1d572 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 12 Apr 2023 00:44:03 +0200 Subject: [PATCH 1/3] replace `env.OXIDE` with global `__OXIDE__` This will allow us to replace the `__OXIDE__` at build time, and fully remove the branches from the final code so that there is not even any reference to `@tailwindcss/oxide` on the stable engine. --- package.json | 2 +- package.stable.json | 2 +- src/cli.js | 2 +- src/cli/build/plugin.js | 2 +- src/corePlugins.js | 5 ++--- src/featureFlags.js | 5 ++--- src/lib/expandTailwindAtRules.js | 4 ++-- src/lib/sharedState.js | 15 --------------- src/oxide/cli/build/plugin.ts | 2 +- src/plugin.js | 2 +- tests/util/run.js | 4 +++- 11 files changed, 15 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index 6a240fd5c697..c8acfb6fcb0d 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "dev:rust": "npm run --prefix ./oxide dev:node", "dev:js": "npm run build:js -- --watch", "build:rust": "npm run --prefix ./oxide build:node", - "build:js": "npm run generate:plugin-list && swc src --out-dir lib --copy-files --delete-dir-on-start", + "build:js": "npm run generate:plugin-list && swc src --out-dir lib --copy-files --delete-dir-on-start --config jsc.transform.optimizer.globals.vars.__OXIDE__='\"true\"'", "build:peers": "esbuild lib/cli-peer-dependencies.js --bundle --platform=node --outfile=peers/index.js --define:process.env.CSS_TRANSFORMER_WASM=false", "generate:plugin-list": "node -r @swc/register scripts/create-plugin-list.js", "generate:types": "node -r @swc/register scripts/generate-types.js" diff --git a/package.stable.json b/package.stable.json index f758ded10e78..0dd8ffb28318 100644 --- a/package.stable.json +++ b/package.stable.json @@ -17,7 +17,7 @@ }, "scripts": { "prebuild": "npm run generate && rimraf lib", - "build": "swc src --out-dir lib --copy-files", + "build": "swc src --out-dir lib --copy-files --config jsc.transform.optimizer.globals.vars.__OXIDE__='\"false\"'", "postbuild": "esbuild lib/cli-peer-dependencies.js --bundle --platform=node --outfile=peers/index.js --define:process.env.CSS_TRANSFORMER_WASM=false", "rebuild-fixtures": "npm run build && node -r @swc/register scripts/rebuildFixtures.js", "style": "eslint .", diff --git a/src/cli.js b/src/cli.js index 11c219549b2d..4b73accbbbdd 100644 --- a/src/cli.js +++ b/src/cli.js @@ -1,6 +1,6 @@ #!/usr/bin/env node -if (process.env.OXIDE) { +if (__OXIDE__) { module.exports = require('./oxide/cli') } else { module.exports = require('./cli/index') diff --git a/src/cli/build/plugin.js b/src/cli/build/plugin.js index 5705326c988a..9f3f6f52ff27 100644 --- a/src/cli/build/plugin.js +++ b/src/cli/build/plugin.js @@ -185,7 +185,7 @@ let state = { let files = fastGlob.sync(this.contentPatterns.all) for (let file of files) { - if (env.OXIDE) { + if (__OXIDE__) { content.push({ file, extension: path.extname(file).slice(1), diff --git a/src/corePlugins.js b/src/corePlugins.js index 2c3b99283a5a..022f147f0fce 100644 --- a/src/corePlugins.js +++ b/src/corePlugins.js @@ -1,7 +1,6 @@ import fs from 'fs' import * as path from 'path' import postcss from 'postcss' -import { env } from './lib/sharedState' import createUtilityPlugin from './util/createUtilityPlugin' import buildMediaQuery from './util/buildMediaQuery' import escapeClassName from './util/escapeClassName' @@ -1262,7 +1261,7 @@ export let corePlugins = { 'space-x': (value) => { value = value === '0' ? '0px' : value - if (env.OXIDE) { + if (__OXIDE__) { return { '& > :not([hidden]) ~ :not([hidden])': { '--tw-space-x-reverse': '0', @@ -1307,7 +1306,7 @@ export let corePlugins = { 'divide-x': (value) => { value = value === '0' ? '0px' : value - if (env.OXIDE) { + if (__OXIDE__) { return { '& > :not([hidden]) ~ :not([hidden])': { '@defaults border-width': {}, diff --git a/src/featureFlags.js b/src/featureFlags.js index bc5f167a0ff7..dc9f2d7c46e2 100644 --- a/src/featureFlags.js +++ b/src/featureFlags.js @@ -1,15 +1,14 @@ import colors from 'picocolors' import log from './util/log' -import { env } from './lib/sharedState' let defaults = { optimizeUniversalDefaults: false, generalizedModifiers: true, get disableColorOpacityUtilitiesByDefault() { - return env.OXIDE + return __OXIDE__ }, get relativeContentPathsByDefault() { - return env.OXIDE + return __OXIDE__ }, } diff --git a/src/lib/expandTailwindAtRules.js b/src/lib/expandTailwindAtRules.js index 504575755ab6..066d3d53a33a 100644 --- a/src/lib/expandTailwindAtRules.js +++ b/src/lib/expandTailwindAtRules.js @@ -130,7 +130,7 @@ export default function expandTailwindAtRules(context) { env.DEBUG && console.time('Reading changed files') - if (env.OXIDE) { + if (__OXIDE__) { // TODO: Pass through or implement `extractor` for (let candidate of require('@tailwindcss/oxide').parseCandidateStringsFromFiles( context.changedContent @@ -162,7 +162,7 @@ export default function expandTailwindAtRules(context) { env.DEBUG && console.time('Generate rules') env.DEBUG && console.time('Sorting candidates') - let sortedCandidates = env.OXIDE + let sortedCandidates = __OXIDE__ ? candidates : new Set( [...candidates].sort((a, z) => { diff --git a/src/lib/sharedState.js b/src/lib/sharedState.js index 1a4a8d5e5b17..97bdf09c5c43 100644 --- a/src/lib/sharedState.js +++ b/src/lib/sharedState.js @@ -1,5 +1,4 @@ import pkg from '../../package.json' -let OXIDE_DEFAULT_ENABLED = pkg.tailwindcss.engine === 'oxide' export const env = typeof process !== 'undefined' @@ -7,13 +6,11 @@ export const env = NODE_ENV: process.env.NODE_ENV, DEBUG: resolveDebug(process.env.DEBUG), ENGINE: pkg.tailwindcss.engine, - OXIDE: resolveBoolean(process.env.OXIDE, OXIDE_DEFAULT_ENABLED), } : { NODE_ENV: 'production', DEBUG: false, ENGINE: pkg.tailwindcss.engine, - OXIDE: OXIDE_DEFAULT_ENABLED, } export const contextMap = new Map() @@ -24,18 +21,6 @@ export const NOT_ON_DEMAND = new String('*') export const NONE = Symbol('__NONE__') -function resolveBoolean(value, defaultValue) { - if (value === undefined) { - return defaultValue - } - - if (value === '0' || value === 'false') { - return false - } - - return true -} - export function resolveDebug(debug) { if (debug === undefined) { return false diff --git a/src/oxide/cli/build/plugin.ts b/src/oxide/cli/build/plugin.ts index 078820c85c9a..4141ec439b0e 100644 --- a/src/oxide/cli/build/plugin.ts +++ b/src/oxide/cli/build/plugin.ts @@ -184,7 +184,7 @@ let state = { let files = fastGlob.sync(this.contentPatterns.all) for (let file of files) { - if (env.OXIDE) { + if (__OXIDE__) { content.push({ file, extension: path.extname(file).slice(1), diff --git a/src/plugin.js b/src/plugin.js index 4fa8ce757885..59f5fab014c6 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -34,7 +34,7 @@ module.exports = function tailwindcss(configOrPath) { processTailwindFeatures(context)(root, result) }, - env.OXIDE && + __OXIDE__ && function lightningCssPlugin(_root, result) { let postcss = require('postcss') let lightningcss = require('lightningcss') diff --git a/tests/util/run.js b/tests/util/run.js index 167b7fc78ce2..118edcb75e9c 100644 --- a/tests/util/run.js +++ b/tests/util/run.js @@ -14,6 +14,8 @@ export let map = JSON.stringify({ mappings: '', }) +globalThis.__OXIDE__ = env.ENGINE === 'oxide' + export function run(input, config, plugin = tailwind) { let { currentTestName } = expect.getState() @@ -84,7 +86,7 @@ export function crosscheck(fn) { } beforeEach(() => { - env.OXIDE = engines.engine.oxide + globalThis.__OXIDE__ = engines.engine.oxide }) fn(engines) From a49f3d808e874ba3bf961758247696ff5edc6d9f Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 12 Apr 2023 00:56:25 +0200 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dea972556ff4..641d5f9efe60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Don’t move unknown pseudo-elements to the end of selectors ([#10943](https://github.com/tailwindlabs/tailwindcss/pull/10943), [#10962](https://github.com/tailwindlabs/tailwindcss/pull/10962)) +- Replace `__OXIDE__` at build time to prevent `@tailwindcss/oxide` leaks in the stable engine ([#10988](https://github.com/tailwindlabs/tailwindcss/pull/10988)) ## [3.3.1] - 2023-03-30 From 290176a825f0569c5d212c566c8c6eb596efb92e Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 12 Apr 2023 12:59:56 +0200 Subject: [PATCH 3/3] use `env.ENGINE` in integration tests --- integrations/parcel/tests/integration.test.js | 20 ++++---- .../postcss-cli/tests/integration.test.js | 12 ++--- .../rollup-sass/tests/integration.test.js | 16 +++---- integrations/rollup/tests/integration.test.js | 20 ++++---- .../tailwindcss-cli/tests/cli.test.js | 8 ++-- .../tailwindcss-cli/tests/integration.test.js | 48 +++++++++---------- integrations/vite/tests/integration.test.js | 20 ++++---- .../webpack-4/tests/integration.test.js | 20 ++++---- .../webpack-5/tests/integration.test.js | 24 +++++----- 9 files changed, 94 insertions(+), 94 deletions(-) diff --git a/integrations/parcel/tests/integration.test.js b/integrations/parcel/tests/integration.test.js index 55e7f83a38b0..b86af727ecce 100644 --- a/integrations/parcel/tests/integration.test.js +++ b/integrations/parcel/tests/integration.test.js @@ -74,7 +74,7 @@ describe('static build', () => { env: { NODE_ENV: 'production' }, }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss( css` .bg-primary { @@ -85,7 +85,7 @@ describe('static build', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss( css` .bg-primary { @@ -138,7 +138,7 @@ describe('static build', () => { env: { NODE_ENV: 'production' }, }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss( css` .bg-primary { @@ -149,7 +149,7 @@ describe('static build', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss( css` .bg-primary { @@ -202,7 +202,7 @@ describe('watcher', () => { await appendToInputFile('index.html', html`
`) }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss( css` .bg-red-500 { @@ -219,7 +219,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss( css` .bg-red-500 { @@ -274,7 +274,7 @@ describe('watcher', () => { await appendToInputFile('glob/index.html', html`
`) }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss( css` .bg-red-500 { @@ -291,7 +291,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss( css` .bg-red-500 { @@ -445,7 +445,7 @@ describe('watcher', () => { ) }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss( css` .btn { @@ -461,7 +461,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss( css` .btn { diff --git a/integrations/postcss-cli/tests/integration.test.js b/integrations/postcss-cli/tests/integration.test.js index 36cfe7f4c4f5..46f5a61a6dc3 100644 --- a/integrations/postcss-cli/tests/integration.test.js +++ b/integrations/postcss-cli/tests/integration.test.js @@ -61,7 +61,7 @@ describe('watcher', () => { await appendToInputFile('index.html', html`
`) await runningProcess.onStderr(ready) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -78,7 +78,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -128,7 +128,7 @@ describe('watcher', () => { await appendToInputFile('glob/index.html', html`
`) await runningProcess.onStderr(ready) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -145,7 +145,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -284,7 +284,7 @@ describe('watcher', () => { ) await runningProcess.onStderr(ready) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .btn { @@ -303,7 +303,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` /* prettier-ignore */ diff --git a/integrations/rollup-sass/tests/integration.test.js b/integrations/rollup-sass/tests/integration.test.js index 7d359577eea1..19a7695659d8 100644 --- a/integrations/rollup-sass/tests/integration.test.js +++ b/integrations/rollup-sass/tests/integration.test.js @@ -61,7 +61,7 @@ describe('watcher', () => { await appendToInputFile('index.html', html`
`) await runningProcess.onStderr(ready) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('index.css')).toIncludeCss( css` .bg-red-500 { @@ -78,7 +78,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('index.css')).toIncludeCss( css` .bg-red-500 { @@ -128,7 +128,7 @@ describe('watcher', () => { await appendToInputFile('glob/index.html', html`
`) await runningProcess.onStderr(ready) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('index.css')).toIncludeCss( css` .bg-red-500 { @@ -145,7 +145,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('index.css')).toIncludeCss( css` .bg-red-500 { @@ -282,7 +282,7 @@ describe('watcher', () => { ) await runningProcess.onStderr(ready) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('index.css')).toIncludeCss( css` .btn { @@ -298,7 +298,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('index.css')).toIncludeCss( css` .btn { @@ -377,7 +377,7 @@ describe('watcher', () => { ) await runningProcess.onStderr(ready) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('index.css')).toIncludeCss( css` .btn { @@ -393,7 +393,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('index.css')).toIncludeCss( css` .btn { diff --git a/integrations/rollup/tests/integration.test.js b/integrations/rollup/tests/integration.test.js index dbbfcc8d11f1..c3209af6589a 100644 --- a/integrations/rollup/tests/integration.test.js +++ b/integrations/rollup/tests/integration.test.js @@ -62,7 +62,7 @@ describe('static build', () => { env: { NODE_ENV: 'production' }, }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('index.css')).toIncludeCss( css` .bg-primary { @@ -73,7 +73,7 @@ describe('static build', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('index.css')).toIncludeCss( css` .bg-primary { @@ -120,7 +120,7 @@ describe('static build', () => { env: { NODE_ENV: 'production' }, }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('index.css')).toIncludeCss( css` .bg-primary { @@ -131,7 +131,7 @@ describe('static build', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('index.css')).toIncludeCss( css` .bg-primary { @@ -175,7 +175,7 @@ describe('watcher', () => { await appendToInputFile('index.html', html`
`) await runningProcess.onStderr(ready) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('index.css')).toIncludeCss( css` .bg-red-500 { @@ -192,7 +192,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('index.css')).toIncludeCss( css` .bg-red-500 { @@ -242,7 +242,7 @@ describe('watcher', () => { await appendToInputFile('glob/index.html', html`
`) await runningProcess.onStderr(ready) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('index.css')).toIncludeCss( css` .bg-red-500 { @@ -259,7 +259,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('index.css')).toIncludeCss( css` .bg-red-500 { @@ -396,7 +396,7 @@ describe('watcher', () => { ) await runningProcess.onStderr(ready) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('index.css')).toIncludeCss( css` .btn { @@ -415,7 +415,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('index.css')).toIncludeCss( css` .btn { diff --git a/integrations/tailwindcss-cli/tests/cli.test.js b/integrations/tailwindcss-cli/tests/cli.test.js index f30260b0b6de..b6b366d8701b 100644 --- a/integrations/tailwindcss-cli/tests/cli.test.js +++ b/integrations/tailwindcss-cli/tests/cli.test.js @@ -216,7 +216,7 @@ describe('Build command', () => { await $(`${EXECUTABLE} --output ./dist/main.css --postcss`) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .font-bold-after { @@ -235,7 +235,7 @@ describe('Build command', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .font-bold-after { @@ -287,7 +287,7 @@ describe('Build command', () => { await $(`${EXECUTABLE} --output ./dist/main.css --postcss ./custom.postcss.config.js`) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .font-bold-after { @@ -306,7 +306,7 @@ describe('Build command', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .font-bold-after { diff --git a/integrations/tailwindcss-cli/tests/integration.test.js b/integrations/tailwindcss-cli/tests/integration.test.js index 6efa9fdf5e44..75c9779af8f8 100644 --- a/integrations/tailwindcss-cli/tests/integration.test.js +++ b/integrations/tailwindcss-cli/tests/integration.test.js @@ -72,7 +72,7 @@ describe('static build', () => { env: { NODE_ENV: 'production' }, }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -92,7 +92,7 @@ describe('static build', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -145,7 +145,7 @@ describe('static build', () => { env: { NODE_ENV: 'production' }, }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-primary { @@ -156,7 +156,7 @@ describe('static build', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-primary { @@ -203,7 +203,7 @@ describe('static build', () => { env: { NODE_ENV: 'production' }, }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-primary { @@ -214,7 +214,7 @@ describe('static build', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-primary { @@ -262,7 +262,7 @@ describe('static build', () => { env: { NODE_ENV: 'production' }, }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-yellow { @@ -273,7 +273,7 @@ describe('static build', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-yellow { @@ -329,7 +329,7 @@ describe('static build', () => { env: { NODE_ENV: 'production' }, }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-yellow { @@ -340,7 +340,7 @@ describe('static build', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-yellow { @@ -375,7 +375,7 @@ describe('static build', () => { env: { NODE_ENV: 'production' }, }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -386,7 +386,7 @@ describe('static build', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -430,7 +430,7 @@ describe('watcher', () => { await appendToInputFile('index.html', html`
`) await runningProcess.onStderr(ready) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -447,7 +447,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -497,7 +497,7 @@ describe('watcher', () => { await appendToInputFile('glob/index.html', html`
`) await runningProcess.onStderr(ready) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -514,7 +514,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -703,7 +703,7 @@ describe('watcher', () => { ) await runningProcess.onStderr(ready) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .btn { @@ -722,7 +722,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .btn { @@ -800,7 +800,7 @@ describe('watcher', () => { let runningProcess = $('node ../../lib/cli.js -i ./src/index.css -o ./dist/main.css -w') await runningProcess.onStderr(ready) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-yellow { @@ -811,7 +811,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-yellow { @@ -832,7 +832,7 @@ describe('watcher', () => { ) await runningProcess.onStderr(ready) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-yellow { @@ -843,7 +843,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-yellow { @@ -876,7 +876,7 @@ describe('watcher', () => { ) await runningProcess.onStderr(ready) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-yellow { @@ -887,7 +887,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-yellow { diff --git a/integrations/vite/tests/integration.test.js b/integrations/vite/tests/integration.test.js index a07a2a9a6efc..b1a8163b2b35 100644 --- a/integrations/vite/tests/integration.test.js +++ b/integrations/vite/tests/integration.test.js @@ -75,7 +75,7 @@ describe('static build', () => { env: { NODE_ENV: 'production', NO_COLOR: '1' }, }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss( css` .bg-primary { @@ -86,7 +86,7 @@ describe('static build', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss( css` .bg-primary { @@ -131,7 +131,7 @@ describe('static build', () => { env: { NODE_ENV: 'production', NO_COLOR: '1' }, }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss( css` .bg-primary { @@ -142,7 +142,7 @@ describe('static build', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss( css` .bg-primary { @@ -194,7 +194,7 @@ describe('watcher', () => { await appendToInputFile('index.html', html`
`) await runningProcess.onStdout((message) => message.includes('page reload')) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await fetchCSS()).toIncludeCss( css` .bg-red-500 { @@ -211,7 +211,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await fetchCSS()).toIncludeCss( css` .bg-red-500 { @@ -265,7 +265,7 @@ describe('watcher', () => { await appendToInputFile('glob/index.html', html`
`) await runningProcess.onStdout((message) => message.includes('page reload')) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await fetchCSS()).toIncludeCss( css` .bg-red-500 { @@ -282,7 +282,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await fetchCSS()).toIncludeCss( css` .bg-red-500 { @@ -435,7 +435,7 @@ describe('watcher', () => { ) await runningProcess.onStdout((message) => message.includes('hmr update /index.css')) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await fetchCSS()).toIncludeCss( css` .btn { @@ -454,7 +454,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await fetchCSS()).toIncludeCss( css` .btn { diff --git a/integrations/webpack-4/tests/integration.test.js b/integrations/webpack-4/tests/integration.test.js index a666721bbdc1..e2e24cf45cac 100644 --- a/integrations/webpack-4/tests/integration.test.js +++ b/integrations/webpack-4/tests/integration.test.js @@ -58,7 +58,7 @@ describe('static build', () => { await $('webpack --mode=production') - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-primary { @@ -69,7 +69,7 @@ describe('static build', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-primary { @@ -114,7 +114,7 @@ describe('static build', () => { await $('webpack --mode=production') - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-primary { @@ -125,7 +125,7 @@ describe('static build', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-primary { @@ -172,7 +172,7 @@ describe('watcher', () => { await appendToInputFile('index.html', html`
`) }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -189,7 +189,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -242,7 +242,7 @@ describe('watcher', () => { await appendToInputFile('glob/index.html', html`
`) }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -259,7 +259,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -401,7 +401,7 @@ describe('watcher', () => { ) }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .btn { @@ -420,7 +420,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .btn { diff --git a/integrations/webpack-5/tests/integration.test.js b/integrations/webpack-5/tests/integration.test.js index ae493fbdbb66..83b42f5f867f 100644 --- a/integrations/webpack-5/tests/integration.test.js +++ b/integrations/webpack-5/tests/integration.test.js @@ -58,7 +58,7 @@ describe('static build', () => { await $('webpack --mode=production') - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-primary { @@ -69,7 +69,7 @@ describe('static build', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-primary { @@ -114,7 +114,7 @@ describe('static build', () => { await $('webpack --mode=production') - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-primary { @@ -125,7 +125,7 @@ describe('static build', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-primary { @@ -172,7 +172,7 @@ describe('watcher', () => { await appendToInputFile('index.html', html`
`) }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -189,7 +189,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -242,7 +242,7 @@ describe('watcher', () => { await appendToInputFile('index.html', html`
`) }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -259,7 +259,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -401,7 +401,7 @@ describe('watcher', () => { ) }) - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .btn { @@ -420,7 +420,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .btn { @@ -464,7 +464,7 @@ describe('watcher', () => { await waitForOutputFileCreation('main.css') - if (!env.OXIDE) { + if (env.ENGINE === 'stable') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 { @@ -484,7 +484,7 @@ describe('watcher', () => { ) } - if (env.OXIDE) { + if (env.ENGINE === 'oxide') { expect(await readOutputFile('main.css')).toIncludeCss( css` .bg-red-500 {