tailwindcss/packages
Jordan Pittman 9df5ba78bf
Fix PostCSS crash when using toJSON() (#18083)
When I added source maps to PostCSS I mistakenly assumed that `.source`
on a node could be `undefined`. The comment above the property in
PostCSS says that `source` can be `undefined` but this is a commentary
on the value upon **access** not its expected value on **write**:

```ts
declare abstract class Node_ {
  /**
   * …
   *
   * The nodes that are created manually using the public APIs
   * provided by PostCSS will have `source` undefined and
   * will be absent in the source map.
   *
   * …
   */
  source?: Node.Source
}
```

Rather, what these types mean is that *if the property exists* it must
be defined. But otherwise the property can be missing if a node has no
source location metadata. This generally wasn't a problem with the
string-returning APIs but the `toJSON()` API in PostCSS expects that
`source` is defined if present. This caused a crash because our license
comment doesn't have a source location.

I've addressed this by deleting the `source` property from the node if
source location data is not available.

Fixes #18082

ref https://github.com/parcel-bundler/parcel/issues/10161
2025-05-19 11:28:09 -04:00
..
@tailwindcss-browser Prepare v4.1.7 release (#18040) 2025-05-15 15:31:18 +02:00
@tailwindcss-cli Prepare v4.1.7 release (#18040) 2025-05-15 15:31:18 +02:00
@tailwindcss-node Prepare v4.1.7 release (#18040) 2025-05-15 15:31:18 +02:00
@tailwindcss-postcss Fix PostCSS crash when using toJSON() (#18083) 2025-05-19 11:28:09 -04:00
@tailwindcss-standalone Prepare v4.1.7 release (#18040) 2025-05-15 15:31:18 +02:00
@tailwindcss-upgrade Improve performance of upgrade tool (#18068) 2025-05-19 10:41:40 -04:00
@tailwindcss-vite Prepare v4.1.7 release (#18040) 2025-05-15 15:31:18 +02:00
internal-example-plugin Prefix internal modules with internal-* (#14074) 2024-07-29 10:58:07 -04:00
tailwindcss Prepare v4.1.7 release (#18040) 2025-05-15 15:31:18 +02:00
tsconfig.base.json Improve debug logs (#15303) 2024-12-11 15:27:20 +01:00