nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: serpro69/kotlin-faker
Pull request #150 (2022-08-01 08:43:24)

fix StarWars quotes by character not working
this fixes https://github.com/serpro69/kotlin-faker/issues/148

I also added tests, but i am not familiar with kotest, so maybe you should have a look first.


Patch:
diff --git a/core/src/main/kotlin/io/github/serpro69/kfaker/provider/StarWars.kt b/core/src/main/kotlin/io/github/serpro69/kfaker/provider/StarWars.kt
index ba987554..b065d809 100644
--- a/core/src/main/kotlin/io/github/serpro69/kfaker/provider/StarWars.kt
+++ b/core/src/main/kotlin/io/github/serpro69/kfaker/provider/StarWars.kt
@@ -27,7 +27,7 @@ class StarWars internal constructor(fakerService: FakerService) : YamlFakeDataPr
     fun species() = resolve("species")
     fun vehicles() = resolve("vehicles")
     fun wookieeWords() = resolve("wookiee_words")
-    fun quotes(character: String) = resolve("quotes", character.lowercase().replace("_", " "))
+    fun quotes(character: String) = resolve("quotes", character.lowercase().replace(" ", "_"))
     fun quote() = resolve("quotes", "")
     fun alternateCharacterSpellings(character: String) = resolve("alternate_character_spellings", character)
 }


Test patch:
diff --git a/core/src/test/kotlin/io/github/serpro69/kfaker/provider/CrossfitTest.kt b/core/src/test/kotlin/io/github/serpro69/kfaker/provider/CrossfitTest.kt
index 8cc66390..ab27cef6 100644
--- a/core/src/test/kotlin/io/github/serpro69/kfaker/provider/CrossfitTest.kt
+++ b/core/src/test/kotlin/io/github/serpro69/kfaker/provider/CrossfitTest.kt
@@ -7,7 +7,7 @@ import io.kotest.matchers.shouldNotBe
 
 class CrossfitTest : DescribeSpec({
     describe("Crossfit provider") {
-        val crossfit = Crossfit( FakerService(faker = Faker()))
+        val crossfit = Crossfit(FakerService(faker = Faker()))
 
         context("competition fun") {
             it("should returns a Crossfit® competition name") {
diff --git a/core/src/test/kotlin/io/github/serpro69/kfaker/provider/StarWarsTest.kt b/core/src/test/kotlin/io/github/serpro69/kfaker/provider/StarWarsTest.kt
new file mode 100644
index 00000000..0b10f99e
--- /dev/null
+++ b/core/src/test/kotlin/io/github/serpro69/kfaker/provider/StarWarsTest.kt
@@ -0,0 +1,24 @@
+package io.github.serpro69.kfaker.provider
+
+import io.github.serpro69.kfaker.Faker
+import io.github.serpro69.kfaker.FakerService
+import io.kotest.core.spec.style.DescribeSpec
+import io.kotest.matchers.shouldNotBe
+
+class StarWarsTest : DescribeSpec({
+    describe("StarWars provider") {
+        val starWars = StarWars(FakerService(faker = Faker()))
+
+        context("any quote") {
+            it("should return any quote") {
+                starWars.quote() shouldNotBe null
+            }
+        }
+
+        context("quotes filter") {
+            it("should return a Admiral Ackbar quote") {
+                starWars.quotes("admiral_ackbar") shouldNotBe null
+            }
+        }
+    }
+})
Repository: tailwindlabs/tailwindcss
Pull request #5382 (2021-09-03 14:09:02)

Unify config helpers into single object
This PR makes it possible to destructure all the config helpers from the first parameter so that you don't need to have an unused `theme` parameter just to access the second parameter.

```diff
- colors: (theme, { colors }) => ({ colors })
+ colors: ({ theme, colors }) => ({ colors })
```

This is not a breaking change, and `theme` is still accessible on its own as the first parameter (both examples above still work). However moving forward we will only document the second option.


Patch:
diff --git a/src/util/resolveConfig.js b/src/util/resolveConfig.js
index ffb94d1a..c031b0ee 100644
--- a/src/util/resolveConfig.js
+++ b/src/util/resolveConfig.js
@@ -123,6 +123,12 @@ function resolveFunctionKeys(object) {
     return val === undefined ? defaultValue : val
   }
 
+  resolvePath.theme = resolvePath
+
+  for (let key in configUtils) {
+    resolvePath[key] = configUtils[key]
+  }
+
   return Object.keys(object).reduce((resolved, key) => {
     return {
       ...resolved,


Test patch:
diff --git a/tests/resolveConfig.test.js b/tests/resolveConfig.test.js
index 0be4482f..bcba03bd 100644
--- a/tests/resolveConfig.test.js
+++ b/tests/resolveConfig.test.js
@@ -2215,3 +2215,62 @@ test('plugins are merged', () => {
     plugins: ['1', '2', '3'],
   })
 })
+
+test('all helpers can be destructured from the first function argument', () => {
+  const userConfig = {
+    theme: {
+      example: ({ theme, colors, negative, breakpoints }) => ({
+        weight: theme('fontWeight.bold'),
+        black: colors.black,
+        white: colors.white,
+        ...negative(theme('spacing')),
+        ...breakpoints(theme('screens')),
+      }),
+    },
+  }
+
+  const defaultConfig = {
+    prefix: '-',
+    important: false,
+    separator: ':',
+    theme: {
+      screens: {
+        sm: '640px',
+        md: '768px',
+      },
+      fontWeight: {
+        bold: 700,
+      },
+      spacing: {
+        0: '0px',
+        1: '1px',
+        2: '2px',
+        3: '3px',
+        4: '4px',
+      },
+    },
+    variants: {},
+  }
+
+  const result = resolveConfig([userConfig, defaultConfig])
+
+  expect(result).toMatchObject({
+    prefix: '-',
+    important: false,
+    separator: ':',
+    theme: {
+      example: {
+        weight: 700,
+        black: '#000',
+        white: '#fff',
+        '-1': '-1px',
+        '-2': '-2px',
+        '-3': '-3px',
+        '-4': '-4px',
+        'screen-sm': '640px',
+        'screen-md': '768px',
+      },
+    },
+    variants: {},
+  })
+})
Repository: tailwindlabs/tailwindcss
Pull request #5481 (2021-09-12 14:06:17)

Add arbitrary value support for `transition-property`
Co-Authored-By: Eric F. <2483476+ericbf@users.noreply.github.com>



Patch:
diff --git a/src/corePlugins.js b/src/corePlugins.js
index fab1b56c..26bdb4da 100644
--- a/src/corePlugins.js
+++ b/src/corePlugins.js
@@ -2195,7 +2195,7 @@ export let transitionProperty = ({ matchUtilities, theme }) => {
         }
       },
     },
-    { values: theme('transitionProperty'), type: 'lookup' }
+    { values: theme('transitionProperty'), type: 'any' }
   )
 }
 


Test patch:
diff --git a/tests/arbitrary-values.test.css b/tests/arbitrary-values.test.css
index 3eb51fa9..3d631701 100644
--- a/tests/arbitrary-values.test.css
+++ b/tests/arbitrary-values.test.css
@@ -448,6 +448,11 @@
   --tw-backdrop-sepia: sepia(0.38);
   backdrop-filter: var(--tw-backdrop-filter);
 }
+.transition-\[opacity\2c width\] {
+  transition-property: opacity, width;
+  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
+  transition-duration: 150ms;
+}
 .delay-\[var\(--delay\)\] {
   transition-delay: var(--delay);
 }
diff --git a/tests/arbitrary-values.test.html b/tests/arbitrary-values.test.html
index 3c55dd90..1db1a4f2 100644
--- a/tests/arbitrary-values.test.html
+++ b/tests/arbitrary-values.test.html
@@ -60,6 +60,7 @@
     <div class="text-[length:var(--font-size)]"></div>
     <div class="text-[color:var(--color)]"></div>
     <div class="text-[angle:var(--angle)]"></div>
+    <div class="transition-[opacity,width]"></div>
     <div class="duration-[2s]"></div>
     <div class="m-[7px]"></div>
     <div class="mx-[7px]"></div>
Repository: tailwindlabs/tailwindcss
Pull request #2530 (2020-10-09 12:30:34)

Support disabling dark mode globally
This PR adds support setting `dark` to `false` in your config file to prevent dark mode variants from being generated.

Normally I would say just disable it individually for all of the core plugins where you have it enabled, but since we are going to enable it out of the box and it adds considerable file size and we already have a global config option for it, it seemed like a useful thing to support for people who don't care about dark mode and want their builds to purge a bit faster.


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 72972633..5a6c2ec8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Make `outline` configurable, `outline-none` more accessible by default, and add `outline-black` and `outline-white` ([#2460](https://github.com/tailwindlabs/tailwindcss/pull/2460))
 - Add additional small `rotate` and `skew` values ([#2528](https://github.com/tailwindlabs/tailwindcss/pull/2528))
 - Add `xl`, `2xl`, and `3xl` border radius values ([#2529](https://github.com/tailwindlabs/tailwindcss/pull/2529))
+- Support disabling dark mode variants globally ([#2530](https://github.com/tailwindlabs/tailwindcss/pull/2530))
 
 ## [1.8.12] - 2020-10-07
 
diff --git a/src/flagged/darkModeVariantPlugin.js b/src/flagged/darkModeVariantPlugin.js
index fb960670..7257942e 100644
--- a/src/flagged/darkModeVariantPlugin.js
+++ b/src/flagged/darkModeVariantPlugin.js
@@ -4,6 +4,10 @@ export default function({ addVariant, config, postcss, prefix }) {
   addVariant(
     'dark',
     ({ container, separator, modifySelectors }) => {
+      if (config('dark') === false) {
+        return postcss.root()
+      }
+
       if (config('dark') === 'media') {
         const modified = modifySelectors(({ selector }) => {
           return buildSelectorVariant(selector, 'dark', separator, message => {


Test patch:
diff --git a/__tests__/darkMode.test.js b/__tests__/darkMode.test.js
index eda74a49..e2b73b06 100644
--- a/__tests__/darkMode.test.js
+++ b/__tests__/darkMode.test.js
@@ -143,6 +143,29 @@ test('dark mode variants can be generated using the class strategy', () => {
   })
 })
 
+test('dark mode variants can be disabled', () => {
+  const input = `
+    @variants dark {
+      .text-red {
+        color: red;
+      }
+    }
+  `
+
+  const expected = `
+    .text-red {
+      color: red;
+    }
+  `
+
+  expect.assertions(2)
+
+  return run(input, { dark: false }).then(result => {
+    expect(result.css).toMatchCss(expected)
+    expect(result.warnings().length).toBe(0)
+  })
+})
+
 test('dark mode variants stack with other variants', () => {
   const input = `
     @variants responsive, dark, hover, focus {
Repository: tailwindlabs/tailwindcss
Pull request #2561 (2020-10-14 16:32:12)

Merge plugins when resolving config
This PR fixes what I would consider to be a bug where if you are using the new `presets` option and your preset contains plugins, those plugins are overridden by the user's config, effectively making those plugins ignored.

I think if someone has put plugins into their base config, those plugins should be included even if the user has `plugins: []` in their config.


Patch:
diff --git a/src/util/resolveConfig.js b/src/util/resolveConfig.js
index 995e3412..b1f7e24b 100644
--- a/src/util/resolveConfig.js
+++ b/src/util/resolveConfig.js
@@ -200,6 +200,14 @@ function resolveCorePlugins(corePluginConfigs) {
   return result
 }
 
+function resolvePluginLists(pluginLists) {
+  const result = [...pluginLists].reverse().reduce((resolved, pluginList) => {
+    return [...resolved, ...pluginList]
+  }, [])
+
+  return result
+}
+
 export default function resolveConfig(configs) {
   const allConfigs = extractPluginConfigs(configs)
 
@@ -210,6 +218,7 @@ export default function resolveConfig(configs) {
       ),
       variants: resolveVariants(allConfigs.map(c => c.variants)),
       corePlugins: resolveCorePlugins(allConfigs.map(c => c.corePlugins)),
+      plugins: resolvePluginLists(configs.map(c => get(c, 'plugins', []))),
     },
     ...allConfigs
   )


Test patch:
diff --git a/__tests__/resolveConfig.test.js b/__tests__/resolveConfig.test.js
index 2e7ff728..3a5a0115 100644
--- a/__tests__/resolveConfig.test.js
+++ b/__tests__/resolveConfig.test.js
@@ -1856,3 +1856,33 @@ test('core plugin configurations stack', () => {
     corePlugins: ['float', 'padding', 'margin'],
   })
 })
+
+test('plugins are merged', () => {
+  const userConfig = {
+    plugins: ['3'],
+  }
+
+  const otherConfig = {
+    plugins: ['2'],
+  }
+
+  const defaultConfig = {
+    plugins: ['1'],
+    prefix: '',
+    important: false,
+    separator: ':',
+    theme: {},
+    variants: {},
+  }
+
+  const result = resolveConfig([userConfig, otherConfig, defaultConfig])
+
+  expect(result).toMatchObject({
+    prefix: '',
+    important: false,
+    separator: ':',
+    theme: {},
+    variants: {},
+    plugins: ['1', '2', '3'],
+  })
+})
Repository: tailwindlabs/tailwindcss
Pull request #2695 (2020-10-28 12:47:52)

Ensure options for plugins are not stale between builds
<!--

👋 Hey, thanks for your interest in contributing to Tailwind!

**Please ask first before starting work on any significant new features.**

It's never a fun experience to have your pull request declined after investing a lot of time and effort into a new feature. To avoid this from happening, we request that contributors create an issue to first discuss any significant new features. This includes things like adding new utilities, creating new at-rules, or adding new component examples to the documentation.

https://github.com/tailwindcss/tailwindcss/blob/master/.github/CONTRIBUTING.md

-->



Patch:
diff --git a/src/util/createPlugin.js b/src/util/createPlugin.js
index 403acae7..c2c7f5fa 100644
--- a/src/util/createPlugin.js
+++ b/src/util/createPlugin.js
@@ -8,6 +8,7 @@ function createPlugin(plugin, config) {
 createPlugin.withOptions = function (pluginFunction, configFunction = () => ({})) {
   const optionsFunction = function (options) {
     return {
+      __options: options,
       handler: pluginFunction(options),
       config: configFunction(options),
     }


Test patch:
diff --git a/__tests__/processPlugins.test.js b/__tests__/processPlugins.test.js
index f760a3a2..764f2671 100644
--- a/__tests__/processPlugins.test.js
+++ b/__tests__/processPlugins.test.js
@@ -1766,6 +1766,55 @@ test('plugins with extra options can be created using the `createPlugin.withOpti
     })
 })
 
+test('plugins should cache correctly', () => {
+  const plugin = createPlugin.withOptions(
+    ({ className = 'banana' } = {}) => ({ addComponents, variants }) => {
+      addComponents({ [`.${className}`]: { position: 'absolute' } }, variants('testPlugin'))
+    },
+    () => ({ variants: { testPlugin: ['responsive'] } })
+  )
+
+  function run(options = {}) {
+    return _postcss([
+      tailwind({
+        corePlugins: [],
+        theme: { screens: { sm: '400px' } },
+        plugins: [plugin(options)],
+      }),
+    ]).process(`@tailwind base; @tailwind components; @tailwind utilities;`, {
+      from: undefined,
+    })
+  }
+
+  return Promise.all([run(), run({ className: 'apple' })]).then(([result1, result2]) => {
+    const expected1 = `
+      .banana {
+        position: absolute;
+      }
+
+      @media (min-width: 400px) {
+        .sm\\:banana {
+          position: absolute;
+        }
+      }
+    `
+
+    const expected2 = `
+      .apple {
+        position: absolute;
+      }
+
+      @media (min-width: 400px) {
+        .sm\\:apple {
+          position: absolute;
+        }
+      }
+    `
+    expect(result1.css).toMatchCss(expected1)
+    expect(result2.css).toMatchCss(expected2)
+  })
+})
+
 test('plugins created using `createPlugin.withOptions` do not need to be invoked if the user wants to use the default options', () => {
   const plugin = createPlugin.withOptions(
     function ({ className } = { className: 'banana' }) {
Repository: tailwindlabs/tailwindcss
Pull request #5585 (2021-09-24 13:19:27)

Fix angle brackets in content
- move to real regexes
- allow for `'>'` in `content-['>']`

Fixes: #5334


Patch:
diff --git a/src/lib/expandTailwindAtRules.js b/src/lib/expandTailwindAtRules.js
index c046bea8..4ed2c5cf 100644
--- a/src/lib/expandTailwindAtRules.js
+++ b/src/lib/expandTailwindAtRules.js
@@ -7,10 +7,10 @@ let env = sharedState.env
 let contentMatchCache = sharedState.contentMatchCache
 
 const PATTERNS = [
-  "([^<>\"'`\\s]*\\['[^<>\"'`\\s]*'\\])", // `content-['hello']` but not `content-['hello']']`
-  '([^<>"\'`\\s]*\\["[^<>"\'`\\s]*"\\])', // `content-["hello"]` but not `content-["hello"]"]`
-  '([^<>"\'`\\s]*\\[[^<>"\'`\\s]+\\])', // `fill-[#bada55]`
-  '([^<>"\'`\\s]*[^<>"\'`\\s:])', // `px-1.5`, `uppercase` but not `uppercase:`
+  /([^<>"'`\s]*\['[^"'`\s]*'\])/.source, // `content-['hello']` but not `content-['hello']']`
+  /([^<>"'`\s]*\["[^"'`\s]*"\])/.source, // `content-["hello"]` but not `content-["hello"]"]`
+  /([^<>"'`\s]*\[[^"'`\s]+\])/.source, // `fill-[#bada55]`
+  /([^<>"'`\s]*[^"'`\s:])/.source, //  `px-1.5`, `uppercase` but not `uppercase:`].join('|')
 ].join('|')
 const BROAD_MATCH_GLOBAL_REGEXP = new RegExp(PATTERNS, 'g')
 const INNER_MATCH_GLOBAL_REGEXP = /[^<>"'`\s.(){}[\]#=%]*[^<>"'`\s.(){}[\]#=%:]/g


Test patch:
diff --git a/tests/arbitrary-values.test.css b/tests/arbitrary-values.test.css
index 9188a594..2b81c782 100644
--- a/tests/arbitrary-values.test.css
+++ b/tests/arbitrary-values.test.css
@@ -477,6 +477,9 @@
 .content-\[attr\(content-before\)\] {
   content: attr(content-before);
 }
+.content-\[\'\>\'\] {
+  content: '>';
+}
 @media (min-width: 1024px) {
   .lg\:grid-cols-\[200px\2c repeat\(auto-fill\2c minmax\(15\%\2c 100px\)\)\2c 300px\] {
     grid-template-columns: 200px repeat(auto-fill, minmax(15%, 100px)) 300px;
diff --git a/tests/arbitrary-values.test.html b/tests/arbitrary-values.test.html
index 65f93df5..505f96bd 100644
--- a/tests/arbitrary-values.test.html
+++ b/tests/arbitrary-values.test.html
@@ -132,6 +132,7 @@
     <div class="will-change-[top,left] will-change-[var(--will-change)]"></div>
     <div class="content-['hello']"></div>
     <div class="content-[attr(content-before)]"></div>
+    <div class="content-['>']"></div>
     <div class="accent-[#bada55]"></div>
     <div class="accent-[var(--accent-color)]"></div>
Repository: tailwindlabs/tailwindcss
Pull request #5590 (2021-09-24 15:44:18)

Ensure invalid typehints are not generated
This PR prevents generating unknown typehints. This is because in a lot of plugins we use the value as-is (`any` typehint, which is the default).

**input:**
```html
<div class="inset-[hmm:12px]"></div>
```

**output:**
```css
```

If we didn't have this fix, this would have generated: 

**output:**
```css
.outline-\[hmm\:12px\] {
    outline: hmm: 12px;
}
```

Which in turn makes the whole css document invalid and it will break your build. No bueno!


Patch:
diff --git a/src/util/pluginUtils.js b/src/util/pluginUtils.js
index 7252314f..ddd49900 100644
--- a/src/util/pluginUtils.js
+++ b/src/util/pluginUtils.js
@@ -284,8 +284,12 @@ let typeMap = {
   lookup: asLookupValue,
 }
 
+let supportedTypes = Object.keys(typeMap)
+
 function splitAtFirst(input, delim) {
-  return (([first, ...rest]) => [first, rest.join(delim)])(input.split(delim))
+  let idx = input.indexOf(delim)
+  if (idx === -1) return [undefined, input]
+  return [input.slice(0, idx), input.slice(idx + 1)]
 }
 
 export function coerceValue(type, modifier, values, tailwindConfig) {
@@ -294,7 +298,11 @@ export function coerceValue(type, modifier, values, tailwindConfig) {
   if (isArbitraryValue(modifier)) {
     let [explicitType, value] = splitAtFirst(modifier.slice(1, -1), ':')
 
-    if (value.length > 0 && Object.keys(typeMap).includes(explicitType)) {
+    if (explicitType !== undefined && !supportedTypes.includes(explicitType)) {
+      return []
+    }
+
+    if (value.length > 0 && supportedTypes.includes(explicitType)) {
       return [asValue(`[${value}]`, values, tailwindConfig), explicitType]
     }
 


Test patch:
diff --git a/tests/arbitrary-values.test.js b/tests/arbitrary-values.test.js
index 2472d7a7..e223ddeb 100644
--- a/tests/arbitrary-values.test.js
+++ b/tests/arbitrary-values.test.js
@@ -16,6 +16,20 @@ test('arbitrary values', () => {
   })
 })
 
+it('should not generate any css if an unknown typehint is used', () => {
+  let config = {
+    content: [
+      {
+        raw: html`<div class="inset-[hmm:12px]"></div>`,
+      },
+    ],
+  }
+
+  return run('@tailwind utilities', config).then((result) => {
+    return expect(result.css).toMatchFormattedCss(css``)
+  })
+})
+
 it('should convert _ to spaces', () => {
   let config = {
     content: [
Repository: tailwindlabs/tailwindcss
Pull request #5602 (2021-09-26 11:12:09)

Ensure we don't override the `name` when parsing animations
Keep track of unknown values (like css variables) in an unknown section.
Currently we only need to know the name, so this will be good enough for now.



Patch:
diff --git a/src/util/parseAnimationValue.js b/src/util/parseAnimationValue.js
index 94c77ff3..990e7aa8 100644
--- a/src/util/parseAnimationValue.js
+++ b/src/util/parseAnimationValue.js
@@ -54,7 +54,13 @@ export default function parseAnimationValue(input) {
       } else if (!seen.has('DELAY') && TIME.test(part)) {
         result.delay = part
         seen.add('DELAY')
-      } else result.name = part
+      } else if (!seen.has('NAME')) {
+        result.name = part
+        seen.add('NAME')
+      } else {
+        if (!result.unknown) result.unknown = []
+        result.unknown.push(part)
+      }
     }
 
     return result


Test patch:
diff --git a/tests/parseAnimationValue.test.js b/tests/parseAnimationValue.test.js
index 8fd211d2..293d6fbe 100644
--- a/tests/parseAnimationValue.test.js
+++ b/tests/parseAnimationValue.test.js
@@ -38,6 +38,19 @@ describe('Tailwind Defaults', () => {
   })
 })
 
+describe('css variables', () => {
+  it('should be possible to use css variables', () => {
+    let parsed = parseAnimationValue('jump var(--animation-duration, 10s) linear infinite')
+    expect(parsed[0]).toEqual({
+      value: 'jump var(--animation-duration, 10s) linear infinite',
+      name: 'jump',
+      timingFunction: 'linear',
+      iterationCount: 'infinite',
+      unknown: ['var(--animation-duration, 10s)'],
+    })
+  })
+})
+
 describe('MDN Examples', () => {
   it.each([
     [