Separate stable and oxide engines (#10359)

* separate `stable` and `oxide` mode (package.json in this case)

* drop `install` script (we use a workspace now)

* change required engine to 16

* enable OXIDE by default

* ignore generated `oxide` files

* splitup package.json scripts into "public" and "private" scripts

Not ideal of course, but this should make it a tiny bit easier to know
which scripts _you_ as a developer / contributor have to run.

* drop `workspaces` from the `stable` engine

* drop `oxide` related build files from the `stable` engine

* drop `oxide` engine specific dependencies from the `stable` engine

* use the `oxide-node-api-shim` for the `stable` engine

* add little script to swap the engines

* drop `oxide:build` from `turbo` config

* configure `ci` for `stable` and `oxide` engines

- rename `nodejs.yml` -> `ci.yml`
- add `ci-stable.yml` (for stable mode and Node 12)
- ensure to use the `stable` engine in the `ci-stable.yml` workflow
- drop `oxide:___` specific scripts

* rename `release-insiders` to `release-insiders-stable`

This way we will be able to remove all files that contain `stable` once
we are ready.

* rename `release-insiders-oxide` to just `release-insiders`

* cleanup insider related workflows

* rename `release` -> `release-stable`

* rename `release-oxide` -> `release`

* change names of release workflows

* drop `oxide-` prefix from jobs

* inline node versions

* do not use `turbo` for the stable build

Can't use it because we don't have a workspace in the stable build.

* re-rename CI workflow

* encode default engine in relevant `package.json` files

* make Node 12 work

* increase `node-version` matrix

* make release workflows explicit (per engine)

* add `Oxide` to workflow name

* add integration tests for the `oxide` engine

* add integration tests for the `stable` engine

* run `oxide` integrations against node `18`

* run `stable` integration tests against node 18

We should test node 12 for tailwindcss, but integrations itself can run
against a newer version. In fact, we always ran them against node 16.

* use `localhost` instead of `0.0.0.0`

* ensure `webpack-4` works on Node 18

* run relese scripst directly

Instead of going via `npm`. It's a bit nicer and quicker!

* drop unused scripts

* sync package-lock.json

* ensure to generate the plugin list before running `jest`

We _could_ use an `npm run pretest`, but then you can't run `jest`
directly anymore (which is required for some tools like vscode
extensions).

* cleanup npm scripts

* drop pretend comments

* fix typo

* add `build:rust` as a pre-jest run script
This commit is contained in:
Robin Malfait
2023-01-19 11:58:25 -05:00
committed by GitHub
parent 9f6edbeb00
commit 668248e854
30 changed files with 13650 additions and 351 deletions
+2
View File
@@ -5,3 +5,5 @@
/tests/fixtures/cli-utils.js
/stubs/*
/src/corePluginList.js
/oxide/crates/node/index.js
/oxide/crates/node/index.d.ts
+56
View File
@@ -0,0 +1,56 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: CI — Stable
on:
push:
branches: [master]
pull_request:
branches: [master]
permissions:
contents: read
env:
CI: true
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
CACHE_PREFIX: stable
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12, 18]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Use the `stable` engine
run: |
node ./scripts/swap-engines.js
- name: Cache node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ env.CACHE_PREFIX }}-node_modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Build Tailwind CSS
run: npm run build
- name: Test
run: npm run test
- name: Lint
run: npm run style
+61
View File
@@ -0,0 +1,61 @@
name: CI — Oxide
on:
push:
branches: [master]
pull_request:
branches: [master]
permissions:
contents: read
env:
CI: true
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
CACHE_PREFIX: oxide
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Cache node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ env.CACHE_PREFIX }}-node_modules-${{ hashFiles('**/package-lock.json') }}
# Cargo already skips downloading dependencies if they already exist
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('./oxide/**/Cargo.lock') }}
- name: Install dependencies
run: npm install
- name: Build Tailwind CSS
run: npx turbo run build --filter=//
- name: Test
run: npx turbo run test --filter=//
- name: Lint
run: npx turbo run style --filter=//
@@ -1,4 +1,4 @@
name: Integration Tests
name: Integration Tests — Oxide
on:
push:
@@ -13,6 +13,7 @@ env:
CI: true
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
CACHE_PREFIX: oxide
jobs:
test:
@@ -30,7 +31,7 @@ jobs:
- vite
- webpack-4
- webpack-5
node-version: [16]
node-version: [18]
fail-fast: false
steps:
@@ -45,7 +46,7 @@ jobs:
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-node_modules-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ env.CACHE_PREFIX }}-node_modules-${{ hashFiles('**/package-lock.json') }}
# Cargo already skips downloading dependencies if they already exist
- name: Cache cargo
@@ -63,7 +64,7 @@ jobs:
run: npm install
- name: Build Tailwind CSS
run: npx turbo run oxide:build --filter=//
run: npx turbo run build --filter=//
- name: Test ${{ matrix.integration }}
run: npx turbo run test --filter=./integrations/${{ matrix.integration }}
@@ -0,0 +1,80 @@
name: Integration Tests — Stable
on:
push:
branches: [master]
pull_request:
branches: [master]
permissions:
contents: read
env:
CI: true
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
CACHE_PREFIX: stable
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
integration:
- content-resolution
- parcel
- postcss-cli
- rollup
- rollup-sass
- tailwindcss-cli
- vite
- webpack-4
- webpack-5
node-version: [18]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Use the `stable` engine
run: |
node ./scripts/swap-engines.js
- name: Cache node_modules (tailwindcss)
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ env.CACHE_PREFIX }}-node_modules-${{ hashFiles('package-lock.json') }}
- name: Cache node_modules (integrations)
uses: actions/cache@v3
with:
path: ./integrations/node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ env.CACHE_PREFIX }}-node_modules-integrations-${{ hashFiles('./integrations/package-lock.json') }}
- name: Cache node_modules (integration)
uses: actions/cache@v3
with:
path: ./integrations/${{ matrix.integration }}/node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ env.CACHE_PREFIX }}-node_modules-integrations-${{ matrix.integration }}-${{ hashFiles('./integrations/${{ matrix.integration }}/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Install dependencies (shared integrations)
run: npm install --prefix ./integrations
- name: Install dependencies (integration)
run: npm install --prefix ./integrations/${{ matrix.integration }}
- name: Build Tailwind CSS
run: npm run build
- name: Test ${{ matrix.integration }}
run: npm run test --prefix ./integrations/${{ matrix.integration }}
-92
View File
@@ -1,92 +0,0 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [master]
pull_request:
branches: [master]
permissions:
contents: read
env:
CI: true
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# cache: 'npm'
- name: Install newer version of npm on older versions of Node.js
if: matrix.node-version < 16
run: npm install -g npm@7
- name: Cache node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-node_modules-${{ hashFiles('**/package-lock.json') }}
# Cargo already skips downloading dependencies if they already exist
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('./oxide/**/Cargo.lock') }}
- name: Install dependencies
run: npm install
- name: Build Tailwind CSS
run: npx turbo run oxide:build --filter=//
- name: Test
run: npx turbo run test --filter=//
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Cache node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-node_modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Lint
run: npx turbo run style --filter=//
+2 -2
View File
@@ -15,7 +15,7 @@ permissions:
jobs:
build:
permissions:
contents: write # for softprops/action-gh-release to create GitHub release
contents: write # for softprops/action-gh-release to create GitHub release
runs-on: macos-11
@@ -35,7 +35,7 @@ jobs:
- name: Get release notes
run: |
RELEASE_NOTES=$(npm run release-notes --silent)
RELEASE_NOTES=$(node ./scripts/release-notes.js)
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
echo "$RELEASE_NOTES" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
+33 -15
View File
@@ -8,9 +8,10 @@ env:
APP_NAME: tailwindcss-oxide
NODE_VERSION: 16
OXIDE_LOCATION: ./oxide/crates/node
RELEASE_CHANNEL: oxide-insiders
jobs:
oxide-build:
build:
strategy:
fail-fast: false
matrix:
@@ -81,7 +82,7 @@ jobs:
${{ env.OXIDE_LOCATION }}/*.node
${{ matrix.binary }}
oxide-build-apple-silicon:
build-apple-silicon:
name: Build Apple Silicon (OXIDE)
runs-on: macos-latest
steps:
@@ -140,7 +141,7 @@ jobs:
${{ env.OXIDE_LOCATION }}/*.node
${{ env.APP_NAME }}
oxide-build-linux:
build-linux:
strategy:
fail-fast: false
matrix:
@@ -228,13 +229,13 @@ jobs:
${{ env.OXIDE_LOCATION }}/*.node
${{ env.APP_NAME }}
oxide-release:
release:
runs-on: ubuntu-latest
name: Build and release
needs:
- oxide-build
- oxide-build-linux
- oxide-build-apple-silicon
- build
- build-linux
- build-apple-silicon
steps:
- uses: actions/checkout@v3
@@ -283,7 +284,7 @@ jobs:
- name: Resolve version
id: vars
run: |
echo "NPM_VERSION=0.0.0-oxide-insiders.$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "NPM_VERSION=0.0.0-${{ env.RELEASE_CHANNEL }}.$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Generate entry point
run: npm run build --prefix ${{ env.OXIDE_LOCATION }}
@@ -294,7 +295,7 @@ jobs:
echo "Publishing $pkg..."
cd $pkg
npm version ${{ env.NPM_VERSION }} --force --no-git-tag-version
npm publish --tag oxide-insiders --access public
npm publish --tag ${{ env.RELEASE_CHANNEL }} --access public
cd -
done
@@ -303,7 +304,7 @@ jobs:
npm version ${{ env.NPM_VERSION }} --force --no-git-tag-version
sed "s#\"0.0.0\"#\"${{ env.NPM_VERSION }}\"#g" package.json > package_updated.json
mv package_updated.json package.json
npm publish --tag oxide-insiders --access public
npm publish --tag ${{ env.RELEASE_CHANNEL }} --access public
cd -
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -313,7 +314,7 @@ jobs:
name: Build and release Tailwind CSS
needs:
- oxide-release
- release
strategy:
matrix:
@@ -332,7 +333,7 @@ jobs:
id: vars
run: |
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "OXIDE_NPM_VERSION=0.0.0-oxide-insiders.$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "OXIDE_NPM_VERSION=0.0.0-${{ env.RELEASE_CHANNEL }}.$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Setup `@tailwindcss/oxide` version
run: |
@@ -348,10 +349,27 @@ jobs:
- name: Test
run: npm test
- name: 'Version based on commit: 0.0.0-oxide-insiders.${{ env.SHA_SHORT }}'
run: npm version 0.0.0-oxide-insiders.${{ env.SHA_SHORT }} --force --no-git-tag-version
- name: 'Version based on commit: 0.0.0-${{ env.RELEASE_CHANNEL }}.${{ env.SHA_SHORT }}'
run: npm version 0.0.0-${{ env.RELEASE_CHANNEL }}.${{ env.SHA_SHORT }} --force --no-git-tag-version
- name: Publish
run: npm publish --tag oxide-insiders
run: npm publish --tag ${{ env.RELEASE_CHANNEL }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# !! Enable this, once we are cleaning up all the `stable` engine related files.
#
# - name: Trigger Tailwind Play update
# uses: actions/github-script@v6
# with:
# github-token: ${{ secrets.TAILWIND_PLAY_TOKEN }}
# script: |
# await github.rest.actions.createWorkflowDispatch({
# owner: 'tailwindlabs',
# repo: 'play.tailwindcss.com',
# ref: 'master',
# workflow_id: 'upgrade-tailwindcss.yml',
# inputs: {
# insidersVersion: '0.0.0-${{ env.RELEASE_CHANNEL }}.${{ env.SHA_SHORT }}'
# }
# })
@@ -0,0 +1,75 @@
name: Release Insiders — Stable
on:
push:
branches: [master]
permissions:
contents: read
env:
CI: true
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
CACHE_PREFIX: stable
NODE_VERSION: 16
RELEASE_CHANNEL: insiders
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
- name: Use the `stable` engine
run: |
node ./scripts/swap-engines.js
- name: Cache node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ env.CACHE_PREFIX }}-node_modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Build Tailwind CSS
run: npm run build
- name: Test
run: npm run test
- name: Resolve version
id: vars
run: |
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: 'Version based on commit: 0.0.0-${{ env.RELEASE_CHANNEL }}.${{ env.SHA_SHORT }}'
run: npm version 0.0.0-${{ env.RELEASE_CHANNEL }}.${{ env.SHA_SHORT }} --force --no-git-tag-version
- name: Publish
run: npm publish --tag ${{ env.RELEASE_CHANNEL }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Trigger Tailwind Play update
uses: actions/github-script@v6
with:
github-token: ${{ secrets.TAILWIND_PLAY_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'tailwindlabs',
repo: 'play.tailwindcss.com',
ref: 'master',
workflow_id: 'upgrade-tailwindcss.yml',
inputs: {
insidersVersion: '0.0.0-${{ env.RELEASE_CHANNEL }}.${{ env.SHA_SHORT }}'
}
})
-92
View File
@@ -1,92 +0,0 @@
name: Release Insiders
on:
push:
branches: [master]
permissions:
contents: read
env:
CI: true
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
- name: Cache node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-node_modules-${{ hashFiles('**/package-lock.json') }}
# Cargo already skips downloading dependencies if they already exist
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('./oxide/**/Cargo.lock') }}
- name: Install dependencies
run: npm install
- name: Build Tailwind CSS
run: npx turbo run oxide:build --filter=//
- name: Test
run: npx turbo run test --filter=//
# This will swap out the Rust-based oxide version with a simple shim. So that you don't
# require all the Rust specific version at tjkhis time.
- name: Setup `@tailwindcss/oxide` shim
run: |
sed "s#\"@tailwindcss/oxide\": \".*\"#\"@tailwindcss/oxide\": \"file:./oxide-node-api-shim\"#" package.json > package_updated.json
mv package_updated.json package.json
- name: Resolve version
id: vars
run: |
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: 'Version based on commit: 0.0.0-insiders.${{ env.SHA_SHORT }}'
run: npm version 0.0.0-insiders.${{ env.SHA_SHORT }} --force --no-git-tag-version
- name: Publish
run: npm publish --tag insiders
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Trigger Tailwind Play update
uses: actions/github-script@v6
with:
github-token: ${{ secrets.TAILWIND_PLAY_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'tailwindlabs',
repo: 'play.tailwindcss.com',
ref: 'master',
workflow_id: 'upgrade-tailwindcss.yml',
inputs: {
insidersVersion: '0.0.0-insiders.${{ env.SHA_SHORT }}'
}
})
+1 -1
View File
@@ -1,4 +1,4 @@
name: Release Oxide
name: Release — Oxide
on:
workflow_dispatch:
@@ -1,4 +1,4 @@
name: Release
name: Release — Stable
on:
release:
@@ -50,14 +50,14 @@ jobs:
run: npm install
- name: Build Tailwind CSS
run: npm run oxide:build
run: npm run build
- name: Test
run: npm test
- name: Calculate environment variables
run: |
echo "RELEASE_CHANNEL=$(npm run release-channel --silent)" >> $GITHUB_ENV
echo "RELEASE_CHANNEL=$(node ./scripts/release-channel.js)" >> $GITHUB_ENV
echo "TAILWINDCSS_VERSION=$(node -e 'console.log(require(`./package.json`).version);')" >> $GITHUB_ENV
- name: Publish
+1 -1
View File
@@ -11,7 +11,7 @@ let { readOutputFile, appendToInputFile, writeInputFile } = require('../../io')(
let PORT = 1337
async function fetchCSS() {
let response = await fetch(`http://0.0.0.0:${PORT}/index.css`, {
let response = await fetch(`http://localhost:${PORT}/index.css`, {
headers: {
Accept: 'text/css',
},
+1 -1
View File
@@ -7,7 +7,7 @@
"scripts": {
"build": "webpack --mode=production",
"dev": "webpack --mode=development --watch",
"test": "jest --runInBand --forceExit"
"test": "NODE_OPTIONS=--openssl-legacy-provider jest --runInBand --forceExit"
},
"jest": {
"testTimeout": 10000,
+6
View File
@@ -0,0 +1,6 @@
let { execSync } = require('child_process')
module.exports = function () {
execSync('npm run build:rust', { stdio: 'ignore' })
execSync('npm run generate:plugin-list', { stdio: 'ignore' })
}
+1 -1
View File
@@ -64,7 +64,7 @@
"turbo": "^1.7.0"
},
"engines": {
"node": ">=12.13.0"
"node": ">=16.0.0"
},
"peerDependencies": {
"postcss": "^8.0.9"
File diff suppressed because it is too large Load Diff
+15 -18
View File
@@ -16,25 +16,22 @@
"integrations/*",
"oxide/crates/node"
],
"tailwindcss": {
"engine": "oxide"
},
"scripts": {
"prebuild": "npm run generate && rimraf lib",
"build": "swc src --out-dir lib --copy-files",
"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",
"dev": "concurrently -n tailwind,oxide-node -c green,yellow 'npm run dev:js' 'npm run dev:rust'",
"build": "npm run build:rust && npm run build:js && npm run build:peers",
"test": "jest",
"style": "eslint .",
"pretest": "npm run generate",
"test": "jest && OXIDE=1 jest",
"test:integrations": "npm run test --prefix ./integrations",
"install:integrations": "node scripts/install-integrations.js",
"prepublishOnly": "npm install --force && npm run build && npm run generate:types",
"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: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",
"generate": "npm run generate:plugin-list && npm run generate:types",
"release-channel": "node ./scripts/release-channel.js",
"release-notes": "node ./scripts/release-notes.js",
"oxide:install": "npm run install:all --prefix ./oxide",
"oxide:dev": "concurrently -n tailwind,oxide-node -c green,yellow 'npm run build -- --watch' 'npm run --prefix ./oxide dev:node'",
"oxide:build": "npm run --prefix ./oxide build:node && npm run build",
"prepublishOnly": "npm install --force && npm run build"
"generate:types": "node -r @swc/register scripts/generate-types.js"
},
"files": [
"src/*",
@@ -45,7 +42,6 @@
"stubs/*.stub.js",
"nesting/*",
"types/**/*",
"oxide-node-api-shim",
"*.d.ts",
"*.css",
"*.js"
@@ -108,6 +104,7 @@
],
"jest": {
"testTimeout": 30000,
"globalSetup": "<rootDir>/jest/global-setup.js",
"setupFilesAfterEnv": [
"<rootDir>/jest/customMatchers.js"
],
@@ -123,6 +120,6 @@
}
},
"engines": {
"node": ">=12.13.0"
"node": ">=16.0.0"
}
}
+115
View File
@@ -0,0 +1,115 @@
{
"name": "tailwindcss",
"version": "3.2.4",
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
"license": "MIT",
"main": "lib/index.js",
"types": "types/index.d.ts",
"repository": "https://github.com/tailwindlabs/tailwindcss.git",
"bugs": "https://github.com/tailwindlabs/tailwindcss/issues",
"homepage": "https://tailwindcss.com",
"bin": {
"tailwind": "lib/cli.js",
"tailwindcss": "lib/cli.js"
},
"tailwindcss": {
"engine": "stable"
},
"scripts": {
"prebuild": "npm run generate && rimraf lib",
"build": "swc src --out-dir lib --copy-files",
"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 .",
"pretest": "npm run generate",
"test": "jest",
"test:integrations": "npm run test --prefix ./integrations",
"install:integrations": "node scripts/install-integrations.js",
"generate:plugin-list": "node -r @swc/register scripts/create-plugin-list.js",
"generate:types": "node -r @swc/register scripts/generate-types.js",
"generate": "npm run generate:plugin-list && npm run generate:types",
"release-channel": "node ./scripts/release-channel.js",
"release-notes": "node ./scripts/release-notes.js",
"prepublishOnly": "npm install --force && npm run build"
},
"files": [
"src/*",
"cli/*",
"lib/*",
"peers/*",
"scripts/*.js",
"stubs/*.stub.js",
"nesting/*",
"types/**/*",
"oxide-node-api-shim",
"*.d.ts",
"*.css",
"*.js"
],
"devDependencies": {
"@swc/cli": "0.1.59",
"@swc/core": "1.3.24",
"@swc/jest": "0.2.24",
"@swc/register": "0.1.10",
"autoprefixer": "^10.4.13",
"concurrently": "^7.5.0",
"cssnano": "^5.1.14",
"esbuild": "^0.16.10",
"eslint": "^8.31.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^28.1.3",
"jest-diff": "^28.1.3",
"prettier": "^2.8.1",
"rimraf": "^3.0.0",
"source-map-js": "^1.0.2",
"turbo": "^1.6.3"
},
"peerDependencies": {
"postcss": "^8.0.9"
},
"dependencies": {
"@tailwindcss/oxide": "file:./oxide-node-api-shim",
"arg": "^5.0.2",
"chokidar": "^3.5.3",
"color-name": "^1.1.4",
"detective": "^5.2.1",
"didyoumean": "^1.2.2",
"dlv": "^1.1.3",
"fast-glob": "^3.2.12",
"glob-parent": "^6.0.2",
"is-glob": "^4.0.3",
"lilconfig": "^2.0.6",
"micromatch": "^4.0.5",
"normalize-path": "^3.0.0",
"object-hash": "^3.0.0",
"picocolors": "^1.0.0",
"postcss": "^8.4.21",
"postcss-import": "^14.1.0",
"postcss-js": "^4.0.0",
"postcss-load-config": "^3.1.4",
"postcss-nested": "6.0.0",
"postcss-selector-parser": "^6.0.11",
"postcss-value-parser": "^4.2.0",
"quick-lru": "^5.1.1",
"resolve": "^1.22.1"
},
"browserslist": ["> 1%", "not edge <= 18", "not ie 11", "not op_mini all"],
"jest": {
"testTimeout": 30000,
"setupFilesAfterEnv": ["<rootDir>/jest/customMatchers.js"],
"testPathIgnorePatterns": [
"/node_modules/",
"/integrations/",
"/standalone-cli/",
"\\.test\\.skip\\.js$"
],
"transform": {
"\\.js$": "@swc/jest",
"\\.ts$": "@swc/jest"
}
},
"engines": {
"node": ">=12.13.0"
}
}
-27
View File
@@ -1,27 +0,0 @@
let fs = require('fs/promises')
let { spawn } = require('child_process')
let path = require('path')
let root = process.cwd()
function npmInstall(cwd) {
return new Promise((resolve) => {
let childProcess = spawn('npm', ['install'], { cwd })
childProcess.on('exit', resolve)
})
}
async function install() {
let base = path.resolve(root, 'integrations')
let ignoreFolders = ['node_modules']
let integrations = (await fs.readdir(base, { withFileTypes: true }))
.filter((integration) => integration.isDirectory())
.filter((integration) => !ignoreFolders.includes(integration.name))
.map((folder) => path.resolve(base, folder.name))
.concat([base])
.map((integration) => npmInstall(integration))
await Promise.all(integrations)
console.log('Done!')
}
install()
-68
View File
@@ -1,68 +0,0 @@
import fs from 'fs'
import postcss from 'postcss'
import tailwind from '..'
function build({ from, to, config }) {
return new Promise((resolve, reject) => {
console.log(`Processing ./${from}...`)
fs.readFile(`./${from}`, (err, css) => {
if (err) throw err
return postcss([tailwind(config)])
.process(css, {
from: undefined,
})
.then((result) => {
fs.writeFileSync(`./${to}`, result.css)
return result
})
.then(resolve)
.catch((error) => {
console.log(error)
reject()
})
})
})
}
console.info('\nRebuilding fixtures...\n')
Promise.all([
build({
from: 'tests/fixtures/tailwind-input.css',
to: 'tests/fixtures/tailwind-output.css',
config: {},
}),
build({
from: 'tests/fixtures/tailwind-input.css',
to: 'tests/fixtures/tailwind-output-important.css',
config: { important: true },
}),
build({
from: 'tests/fixtures/tailwind-input.css',
to: 'tests/fixtures/tailwind-output-no-color-opacity.css',
config: {
corePlugins: {
textOpacity: false,
backgroundOpacity: false,
borderOpacity: false,
placeholderOpacity: false,
divideOpacity: false,
},
},
}),
build({
from: 'tests/fixtures/tailwind-input.css',
to: 'tests/fixtures/tailwind-output-flagged.css',
config: {
future: 'all',
experimental: 'all',
},
}),
]).then(() => {
console.log('\nFinished rebuilding fixtures.')
console.log(
'\nPlease triple check that the fixture output matches what you expect before committing this change.'
)
})
+40
View File
@@ -0,0 +1,40 @@
let fs = require('fs')
let path = require('path')
let engines = {
stable: {
files: [
path.resolve(__dirname, '..', 'package.stable.json'),
path.resolve(__dirname, '..', 'package-lock.stable.json'),
],
},
oxide: {
files: [
path.resolve(__dirname, '..', 'package.oxide.json'),
path.resolve(__dirname, '..', 'package-lock.oxide.json'),
],
},
}
// Find out what the current engine is that we are using:
let [otherEngine, info] = Object.entries(engines).find(([, info]) =>
info.files.every((file) => fs.existsSync(file))
)
let currentEngine = otherEngine === 'oxide' ? 'stable' : 'oxide'
console.log(`Current engine: \`${currentEngine}\`, swapping to \`${otherEngine}\``)
// Swap the engines
for (let file of info.files) {
fs.renameSync(
file.replace(`.${otherEngine}`, ''),
file.replace(`.${otherEngine}`, `.${currentEngine}`)
)
}
for (let file of engines[otherEngine].files) {
fs.renameSync(file, file.replace(`.${otherEngine}`, ''))
}
console.log(
'Engines have been swapped. Make sure to run `npm install` to update your dependencies.'
)
+1 -1
View File
@@ -10,7 +10,7 @@ import loadOptions from 'postcss-load-config/src/options' // Little bit scary, l
import tailwind from '../../processTailwindFeatures'
import { loadAutoprefixer, loadCssNano, loadPostcss, loadPostcssImport } from './deps'
import { formatNodes, drainStdin, outputFile } from './utils'
import { env } from '../shared'
import { env } from '../../lib/sharedState'
import resolveConfig from '../../../resolveConfig.js'
import getModuleDependencies from '../../lib/getModuleDependencies.js'
import { parseCandidateFiles } from '../../lib/content.js'
-6
View File
@@ -1,6 +0,0 @@
// @ts-check
export const env = {
DEBUG: process.env.DEBUG !== undefined && process.env.DEBUG !== '0',
OXIDE: process.env.OXIDE,
}
+17 -1
View File
@@ -1,7 +1,11 @@
import pkg from '../../package.json'
let OXIDE_DEFAULT_ENABLED = pkg.tailwindcss.engine === 'oxide'
export const env = {
NODE_ENV: process.env.NODE_ENV,
DEBUG: resolveDebug(process.env.DEBUG),
OXIDE: process.env.OXIDE,
ENGINE: pkg.tailwindcss.engine,
OXIDE: resolveBoolean(process.env.OXIDE, OXIDE_DEFAULT_ENABLED),
}
export const contextMap = new Map()
export const configContextMap = new Map()
@@ -11,6 +15,18 @@ 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
+1 -1
View File
@@ -8,7 +8,7 @@ import loadOptions from 'postcss-load-config/src/options' // Little bit scary, l
import tailwind from '../../../processTailwindFeatures'
import { loadPostcss, loadPostcssImport, lightningcss } from './deps'
import { formatNodes, drainStdin, outputFile } from './utils'
import { env } from '../shared'
import { env } from '../../../lib/sharedState'
import resolveConfig from '../../../../resolveConfig'
import getModuleDependencies from '../../../lib/getModuleDependencies'
import { parseCandidateFiles } from '../../../lib/content'
-4
View File
@@ -1,4 +0,0 @@
export const env = {
DEBUG: process.env.DEBUG !== undefined && process.env.DEBUG !== '0',
OXIDE: process.env.OXIDE,
}
+2 -1
View File
@@ -5,7 +5,8 @@ afterEach(() => {
env.OXIDE = false
})
test.each([[true], [false]])('it works (using Rust: %p)', (useOxide) => {
let cases = env.ENGINE === 'oxide' ? [[true], [false]] : [[false]]
test.each(cases)('it works (using Rust: %p)', (useOxide) => {
env.OXIDE = useOxide
let config = {
+3 -1
View File
@@ -1,6 +1,8 @@
import { run, html, css, defaults } from './util/run'
import { env } from '../src/lib/sharedState'
let t = env.ENGINE === 'oxide' ? test : test.skip
beforeEach(() => {
env.OXIDE = true
})
@@ -9,7 +11,7 @@ afterEach(() => {
env.OXIDE = false
})
test('space-x uses logical properties', () => {
t('space-x uses logical properties', () => {
let config = {
content: [{ raw: html`<div class="space-x-4"></div>` }],
corePlugins: { preflight: false },
+9 -11
View File
@@ -2,7 +2,15 @@
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"//#build": {
"outputs": ["lib/**", "peers/**", "types/generated/**"]
"outputs": [
"lib/**",
"peers/**",
"types/generated/**",
"oxide/target/**",
"oxide/crates/node/*.node",
"oxide/crates/node/index.d.ts",
"oxide/crates/node/index.js"
]
},
"test": {
"env": ["OXIDE"],
@@ -12,16 +20,6 @@
"env": ["OXIDE"],
"outputs": []
},
"//#oxide:build": {
"outputs": [
"lib/**",
"peers/**",
"oxide/target/**",
"oxide/crates/node/*.node",
"oxide/crates/node/index.d.ts",
"oxide/crates/node/index.js"
]
},
"//#style": {
"outputs": []
}