Socket
Socket
Sign inDemoInstall

tailwind-merge

Package Overview
Dependencies
Maintainers
1
Versions
276
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tailwind-merge - npm Package Compare versions

Comparing version 2.5.1 to 2.5.2-dev.0c74ac3cababfa706594629e5244995535ca70a1

14

package.json
{
"name": "tailwind-merge",
"version": "2.5.1",
"version": "2.5.2-dev.0c74ac3cababfa706594629e5244995535ca70a1",
"description": "Merge Tailwind CSS classes without style conflicts",

@@ -54,4 +54,5 @@ "keywords": [

"build": "rollup --config scripts/rollup.config.mjs",
"test": "jest test --config scripts/jest.config.mjs --coverage",
"test:watch": "jest test --config scripts/jest.config.mjs --watch",
"bench": "vitest bench --config scripts/vitest.config.mts",
"test": "vitest --config scripts/vitest.config.mts --coverage",
"test:watch": "vitest --config scripts/vitest.config.mts",
"test:exports": "node scripts/test-built-package-exports.cjs && node scripts/test-built-package-exports.mjs",

@@ -67,8 +68,9 @@ "lint": "eslint --max-warnings 0 '**'",

"@babel/preset-env": "^7.25.3",
"@codspeed/vitest-plugin": "^3.1.1",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^8.0.1",
"@typescript-eslint/parser": "^8.0.1",
"@vitest/coverage-v8": "^2.0.5",
"babel-plugin-annotate-pure-calls": "^0.4.0",

@@ -78,5 +80,3 @@ "babel-plugin-polyfill-regenerator": "^0.6.2",

"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^28.6.0",
"globby": "^11.1.0",
"jest": "^29.7.0",
"prettier": "^3.3.3",

@@ -86,5 +86,5 @@ "rollup": "^4.19.1",

"rollup-plugin-dts": "^6.1.1",
"ts-jest": "^29.2.3",
"tslib": "^2.6.3",
"typescript": "^5.5.4",
"vitest": "^2.0.5",
"zx": "^8.1.4"

@@ -91,0 +91,0 @@ },

@@ -6,3 +6,3 @@ <!-- This file is autogenerated. If you want to change this content, please do the changes in `./docs/README.md` instead. -->

<a href="https://github.com/dcastil/tailwind-merge">
<img src="https://github.com/dcastil/tailwind-merge/raw/v2.5.1/assets/logo.svg" alt="tailwind-merge" height="150px" />
<img src="https://github.com/dcastil/tailwind-merge/raw/0c74ac3cababfa706594629e5244995535ca70a1/assets/logo.svg" alt="tailwind-merge" height="150px" />
</a>

@@ -29,12 +29,12 @@ </div>

- [What is it for](https://github.com/dcastil/tailwind-merge/tree/v2.5.1/docs/what-is-it-for.md)
- [When and how to use it](https://github.com/dcastil/tailwind-merge/tree/v2.5.1/docs/when-and-how-to-use-it.md)
- [Features](https://github.com/dcastil/tailwind-merge/tree/v2.5.1/docs/features.md)
- [Limitations](https://github.com/dcastil/tailwind-merge/tree/v2.5.1/docs/limitations.md)
- [Configuration](https://github.com/dcastil/tailwind-merge/tree/v2.5.1/docs/configuration.md)
- [Recipes](https://github.com/dcastil/tailwind-merge/tree/v2.5.1/docs/recipes.md)
- [API reference](https://github.com/dcastil/tailwind-merge/tree/v2.5.1/docs/api-reference.md)
- [Writing plugins](https://github.com/dcastil/tailwind-merge/tree/v2.5.1/docs/writing-plugins.md)
- [Versioning](https://github.com/dcastil/tailwind-merge/tree/v2.5.1/docs/versioning.md)
- [Contributing](https://github.com/dcastil/tailwind-merge/tree/v2.5.1/docs/contributing.md)
- [Similar packages](https://github.com/dcastil/tailwind-merge/tree/v2.5.1/docs/similar-packages.md)
- [What is it for](https://github.com/dcastil/tailwind-merge/tree/0c74ac3cababfa706594629e5244995535ca70a1/docs/what-is-it-for.md)
- [When and how to use it](https://github.com/dcastil/tailwind-merge/tree/0c74ac3cababfa706594629e5244995535ca70a1/docs/when-and-how-to-use-it.md)
- [Features](https://github.com/dcastil/tailwind-merge/tree/0c74ac3cababfa706594629e5244995535ca70a1/docs/features.md)
- [Limitations](https://github.com/dcastil/tailwind-merge/tree/0c74ac3cababfa706594629e5244995535ca70a1/docs/limitations.md)
- [Configuration](https://github.com/dcastil/tailwind-merge/tree/0c74ac3cababfa706594629e5244995535ca70a1/docs/configuration.md)
- [Recipes](https://github.com/dcastil/tailwind-merge/tree/0c74ac3cababfa706594629e5244995535ca70a1/docs/recipes.md)
- [API reference](https://github.com/dcastil/tailwind-merge/tree/0c74ac3cababfa706594629e5244995535ca70a1/docs/api-reference.md)
- [Writing plugins](https://github.com/dcastil/tailwind-merge/tree/0c74ac3cababfa706594629e5244995535ca70a1/docs/writing-plugins.md)
- [Versioning](https://github.com/dcastil/tailwind-merge/tree/0c74ac3cababfa706594629e5244995535ca70a1/docs/versioning.md)
- [Contributing](https://github.com/dcastil/tailwind-merge/tree/0c74ac3cababfa706594629e5244995535ca70a1/docs/contributing.md)
- [Similar packages](https://github.com/dcastil/tailwind-merge/tree/0c74ac3cababfa706594629e5244995535ca70a1/docs/similar-packages.md)
import { ConfigUtils } from './config-utils'
import { IMPORTANT_MODIFIER, sortModifiers } from './parse-class-name'
const SPLIT_CLASSES_REGEX = /\s+/
export const mergeClassList = (classList: string, configUtils: ConfigUtils) => {

@@ -15,20 +17,9 @@ const { parseClassName, getClassGroupId, getConflictingClassGroupIds } = configUtils

const classGroupsInConflict: string[] = []
const classNames = classList.trim().split(SPLIT_CLASSES_REGEX)
let result = ''
let index = classList.length - 1
while (index >= 0) {
while (classList[index] === ' ') {
index -= 1
}
for (let index = classNames.length - 1; index >= 0; index -= 1) {
const originalClassName = classNames[index]!
if (index < 0) {
break
}
const nextIndex = classList.lastIndexOf(' ', index)
const originalClassName = classList.slice(nextIndex + 1, index + 1)
index = nextIndex
const { modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition } =

@@ -46,2 +37,3 @@ parseClassName(originalClassName)

if (!hasPostfixModifier) {
// Not a Tailwind class
result = originalClassName + (result.length > 0 ? ' ' + result : result)

@@ -54,2 +46,3 @@ continue

if (!classGroupId) {
// Not a Tailwind class
result = originalClassName + (result.length > 0 ? ' ' + result : result)

@@ -71,2 +64,3 @@ continue

if (classGroupsInConflict.includes(classId)) {
// Tailwind class omitted due to conflict
continue

@@ -83,2 +77,3 @@ }

// Tailwind class not in conflict
result = originalClassName + (result.length > 0 ? ' ' + result : result)

@@ -85,0 +80,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc