32 Commits

Author SHA1 Message Date
Robin Malfait
a68de1df27
introduce v4 codebase 2024-03-05 14:29:15 +01:00
Robin Malfait
32cf8aa0fb
remove v3 codebase 2024-03-05 13:29:12 +01:00
Nikita Gaidakov
ffadf2ba4b Improve resolveConfig return type: merge themes (#12272)
* Generate types: do not intersect with Config theme type when generating DefaultTheme

* Merge default theme in ResolvedConfig

* UnwrapResolvables on theme.extend as well

* Apply extend to overrides and default theme

* Omit extend from DefaultTheme

* Relax generic constraints, better generic variable names

* Fall back to ThemeConfig if key not in DefaultTheme

* Split out ThemeConfigCustomizable to avoid anys in ThemeConfigResolved

* Allow custom theme properties

* handle TypeScript error

* apply prettier formatting

* update changelog

* change type name

---------

Co-authored-by: Nikita Gaidakov <ngaidakov@podfather.com>
Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-10-30 14:55:42 -04:00
Robin Malfait
b1f4da70d1
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
2023-01-19 11:58:25 -05:00
Robin Malfait
cb6e45a3bc
Prepare for release (#9605)
* rename `build-cli.yml` to `prepare-release.yml`

In other repo's we will also have a `prepare-release` so this makes it a
bit more consistent.

* use common CONSTANT_CASE for environment variables

* use `strategy` for defining the node version

* add script to get the release notes

* add release notes to release draft

* use CONSTANT_CASE for environment variables

* improve consistency for relase related scripts
2022-10-19 15:52:39 +02:00
Robin Malfait
c2854dae71
Calculate tag for releases based on package.json version (#9572)
* calculate tag for the release

This is based on the name we use in the version e.g.: `3.2.0-beta.2`. If
no name can be found in the version, we will default to `latest`

* ignore node_modules caching for now
2022-10-16 16:20:21 +02:00
Jordan Pittman
62f0791dba
Add more explicit types for the default theme (#8780)
* Add more explicit types for the default theme

* Update changelog

* Cleanup

* Cleanup code a bit

* Add special cases for a few keys

* Fix order
2022-07-07 09:05:38 -04:00
Robin Malfait
407a5c368c
Add TypeScript types for the tailwind.config.js file (#7891)
* add generate-types script

This script will generate the full list of core plugins, which will
allow you to get code completion for the `corePlugins` section.

It will also generate all the colors (and deprecated colors) which is
used in multiple places in the config.

* add types for the `tailwind.config.js` config file

* annotate stubs with a JSDoc pointing to the types

* add types to package.json

- Updated the files to make sure that the types are being published
- Add a `types` section in the `package.json`, otherwise your editor by
  default will look for the `DefinitelyTyped` types which got me really
  confused for a second.
- Added some scripts to make sure that the generation of types happens
  when needed (before tests and before building). This way you never
  ever have to think about generating them when working on Tailwind CSS
  internals.

* re-export types top-level

Having a `colors.d.ts` next to the `colors.js` file allows us to type
the `colors.js` file and your editor will pickup the types from
`colors.d.ts`.

* also publish generated types

* update changelog

* enable TypeScript only when using `init --types` for now

* update tests to verify that `--types` works
2022-03-22 10:24:28 +01:00
Robin Malfait
bd21bef99a
Polish match APIs (#5664)
* fix incorrect logic for validating content paths

* remove `includeRules` helper

* generate keyframes as part of the animate plugin

* add matchUtilities

* splitup `variantPlugins` and `corePlugins`
2021-10-01 17:31:09 +02:00
Robin Malfait
c1a156639e
Restructure core plugins, named exports to default export (#5592)
* use export default instead of named exports

I'm a little sad about this change, but it turns out that the order is
not guaranteed for named exports in ESM. It was the correct order in our
tests because of babel, but not in native ESM.

* update imports
2021-09-24 18:57:01 +02:00
Robin Malfait
688357fdde
Inline plugins (#5455)
* filter out `..Variant` plugins for the core-plugin-list

* inline all corePlugins

* move preflight css to `./src/css`

* remove individual plugins

* convert export default object to named exports

Note: Normally I would use export function ..., but since we also have
some export let xx = createUtilityPlugin in this file, it means that all
the `export function` declarations would be hoisted and therefore won't
have the correct order anymore.

To fix this, I used `export let xx = () => {}` instead of the usual
`export function xx() {}`

* drop unused `variants()` function

This was required for AOT mode.

* make a few plugins shorter
2021-09-09 09:22:50 -04:00
Robin Malfait
691ed02f63
Remove AOT (#5340)
* make `jit` mode the default when no mode is specified

* unify JIT and AOT codepaths

* ensure `Object.entries` on undefined doesn't break

It could be that sometimes you don't have values in your config (e.g.: `presets: []`), this in turn will break some plugins where we assume we have a value.

* drop AOT specific tests

These tests are all covered by JIT mode already and were AOT specific.

* simplify tests, and add a few

Some of the tests were written for AOT specifically, some were missing. We also updated the way we write those tests, essentially making Tailwind a blackbox, by testing against the final output.
Now that JIT mode is the default, this is super fast because we only generate what is used, instead of partially testing in a 3MB file or building it all, then purging.

* add some todo's to make sure we warn in a few cases

* make `darkMode: 'media'`, the default

This also includes moving dark mode tests to its own dedicated file.

* remove PostCSS 7 compat mode

* update CLI to be JIT-first

* fix integration tests

This is not a _real_ fix, but it does solve the broken test for now.

* warn when using @responsive or @variants

* remove the JIT preview warning

* remove AOT-only code paths

* remove all `mode: 'jit'` blocks

Also remove `variants: {}` since they are not useful in `JIT` mode
anymore.

* drop unused dependencies

* rename `purge` to `content`

* remove static CDN builds

* mark `--purge` as deprecated in the CLI

This will still work, but a warning will be printed and it won't show up
in the `--help` output.

* cleanup nesting plugin

We don't have to duplicate it anymore since there is no PostCSS 7
version anymore.

* make sure integration tests run in band

* cleanup folder structure

* make sure nesting folder is available

* simplify resolving of purge/content information
2021-09-01 17:13:59 +02:00
Sachin Raja
c0ee52060c
Generate plugin list file (#4725)
* Generate plugin list file

Removes the importing of all plugins in src/util/resolveConfig to avoid importing CSS.
Import the built plugin list file instead.

* Use `process.cwd()` instead of `__dirname` to resolve path

Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>

* Import core plugin list in resolveConfig test

* Generate plugin list prebabelify and on install

* Move generation from install to postinstall

Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>

Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>
2021-06-23 14:13:03 -04:00
Robin Malfait
f63b4531f5
Add tailwindcss/nesting plugin (#4673)
* add nesting plugin

* rename @tailwindcss/nesting to tailwindcss/nesting

* ignore the built `nesting` plugin

* add a postcss7 compat version

* include `nesting` plugin when publishing

* add `build-plugins` script

This will allow us to keep the plugins in their dedicated folders +
tests + postcss7 compatibility files. However, when we copy over the
plugins to the root. For example `plugins/nesting/` -> `nesting/` we
skip files like `.test.js` and `.postcss7.js`.

* build plugins when running `prepublishOnly`

* improve compat mode

We will use a glob so that we can move all *.postcss7.* files to just
*.* likewise we will also backup to *.* to *.postcss8.* for restoring
purposes.

Concrete example:

- Current state:
  - index.js            // PostCSS 8 implementation
  - index.postcss7.js   // PostCSS 7 implementation

- Run "compat"
  - index.js            // PostCSS 7 implementation
  - index.postcss7.js   // PostCSS 7 implementation
  - index.postcss8.js   // PostCSS 8 implementation (Backup of original)

- Run "compat:restore"
  - index.js            // PostCSS 8 implementation
  - index.postcss7.js   // PostCSS 7 implementation
  - X index.postcss8.js // PostCSS 8 implementation (Removed)

* Update README.md

* ensure we `npm install` before publishing

Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2021-06-17 09:43:52 -04:00
Robin Malfait
0d47ffd2d3
Fix cloning issues (#4646)
* ensure postcss 7 is dropped from dev dependencies as well

Drop incorrect "help" text

* ensure we are cloning nodes

This is an issue in postcss 7 and fixed in postcss 8. However the compat build still suffers form this issue.
2021-06-14 17:48:28 +02:00
Robin Malfait
7565099c1f
Integrations setup (#4354)
* add integration test tools

* setup jest in the integrations folder

* add `test:integrations` script

The default `npm test` script will ignore all the tests in the
`integrations` folder.

* add integration tests with `webpack 5`

* add integration tests with `postcss-cli`

* add `npm run install:integrations` script

This script will run `npm install` in every integration, and in the
integrations folder itself (to setup Jest for example).

* add `toIncludeCss` custom matcher

* increate Jest timeout for integration tests

* add integration tests with `vite`

* add integration tests with `webpack 4`

* add isomorphic fetch

* add the ability to wait for specific stdout/stderr output

* write vite tests, assert using API calls

We will wait for the correct stdout/stderr output, once we know that we
can request the fresh css, we will fetch it and make assertions
accordingly.

Port is currently hardcoded, maybe we should use a packaage to ensure
that we use a free port.

* add integration tests with `rollup`

* add integration tests with `parcel`

* run all integration tests in band

* add .gitignore in integrations folder
2021-05-18 11:21:35 -04:00
Robin Malfait
bfc61625d9
[WIP] Unify JIT and AOT code paths (#4188)
* WIP

* WIP

* Finish combining JIT and AOT plugins

Still lots of clean up that can be done in some of the more complex ones, but at least it's one file per plugin now.

* Remove unused import

* Fix AOT generation bugs

* Move corePlugins/index.js to corePlugins.js

* Convert JIT files to ESM

* Move tests

* Reorder core plugins to match JIT order

* Update AOT apply tests

* Unify utils

* Combine plugin lists to one single source of truth

* Finish resolving merge conflicts, fix tests

Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2021-04-30 10:58:40 -04:00
Robin Malfait
195ffe9f50
make some changes to compat mode 2020-11-19 17:02:58 +01:00
Robin Malfait
c238ed15b5
Improve compat mode (#2775)
* simplify compat mode

* make sure postcss is included

* make sure we cannot go into compatibility mode twice
2020-11-16 14:10:08 -05:00
Robin Malfait
1d8679d37e
Postcss7 compatibility (#2773)
* add postcss7 compatibility layers

* add compatibility mode scripts
2020-11-16 13:09:59 -05:00
Adam Wathan
e0788efd4f Generate focus, focus-within, and dark variants for ring utilities 2020-11-12 08:45:21 -05:00
Adam Wathan
38b4eeb288 Prettier likes parens a lot now
git blame is now broken forever.
2020-10-16 15:39:44 -04:00
Adam Wathan
712fe7aeb8 Remove target feature 2020-10-15 15:21:06 -04:00
Adam Wathan
2b22d72af9 Generate experimental build for CDN 2020-08-18 13:28:59 -04:00
Adam Wathan
af17966fe5 Update rebuildFixtures to use 'all' for flags 2020-08-06 16:26:55 -04:00
Adam Wathan
1ac5874732 Add scaffolding for future/experimental flags, with WIP new color palette as example 2020-08-05 14:02:43 -04:00
Martijn Cuppens
727e742142 Prevent source maps from being generated 2020-06-28 23:23:35 +02:00
Adam Wathan
e6fd316347 Don't generate color opacity code in color plugins if not necessary 2020-05-01 15:07:40 -04:00
Adam Wathan
1c353af37d Finish proof of concept for target: 'ie11' feature 2020-04-29 16:24:26 -04:00
Adam Wathan
e7c64806b5 Move build script to scripts 2020-02-03 11:02:08 -05:00
Adam Wathan
ecd1d10264 Remove unused import 2019-12-24 06:57:01 -05:00
Adam Wathan
375a87aa0d Add script for rebuilding fixtures 2019-12-24 06:25:28 -05:00