nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: honojs/honox
Pull request #164 (2024-04-30 11:42:46)

feat: Enable to pass nonce to script component
https://github.com/honojs/honox/issues/157

It is more effective when used together with https://github.com/honojs/hono/pull/2577


Patch:
diff --git a/mocks/app-script/routes/_nonce_renderer.tsx b/mocks/app-script/routes/_nonce_renderer.tsx
new file mode 100644
index 0000000..6777d08
--- /dev/null
+++ b/mocks/app-script/routes/_nonce_renderer.tsx
@@ -0,0 +1,27 @@
+import { jsxRenderer } from 'hono/jsx-renderer'
+import { Script } from '../../../src/server'
+
+export default jsxRenderer(
+  ({ children }) => {
+    return (
+      <html>
+        <body>
+          {children}
+          <Script
+            nonce="hono"
+            src='/app/client.ts'
+            prod={true}
+            manifest={{
+              'app/client.ts': {
+                file: 'static/client-abc.js',
+              },
+            }}
+          />
+        </body>
+      </html>
+    )
+  },
+  {
+    docType: false,
+  }
+)
diff --git a/src/server/components/script.tsx b/src/server/components/script.tsx
index c4b3dbd..3552d4f 100644
--- a/src/server/components/script.tsx
+++ b/src/server/components/script.tsx
@@ -7,6 +7,7 @@ type Options = {
   async?: boolean
   prod?: boolean
   manifest?: Manifest
+  nonce?: string
 }
 
 export const Script: FC<Options> = async (options) => {
@@ -33,6 +34,7 @@ export const Script: FC<Options> = async (options) => {
               type='module'
               async={!!options.async}
               src={`/${scriptInManifest.file}`}
+              nonce={options.nonce}
             ></script>
           </HasIslands>
         )
@@ -40,6 +42,6 @@ export const Script: FC<Options> = async (options) => {
     }
     return <></>
   } else {
-    return <script type='module' async={!!options.async} src={src}></script>
+    return <script type='module' async={!!options.async} src={src} nonce={options.nonce}></script>
   }
 }


Test patch:
diff --git a/test-integration/apps.test.ts b/test-integration/apps.test.ts
index 3045c46..3c42a54 100644
--- a/test-integration/apps.test.ts
+++ b/test-integration/apps.test.ts
@@ -538,6 +538,26 @@ describe('<Script /> component', () => {
       )
     })
   })
+
+  describe('With nonce', () => {
+    const RENDERER = import.meta.glob('../mocks/app-script/routes/**/_nonce_renderer.tsx', {
+      eager: true,
+    })
+
+    const app = createApp({
+      root: '../mocks/app-script/routes',
+      ROUTES: ROUTES as any,
+      RENDERER: RENDERER as any,
+    })
+
+    it('Should convert the script path correctly', async () => {
+      const res = await app.request('/')
+      expect(res.status).toBe(200)
+      expect(await res.text()).toBe(
+        '<html><body><main><honox-island component-name="/islands/Component.tsx" data-serialized-props="{}"><p>Component</p></honox-island></main><script type="module" src="/static/client-abc.js" nonce="hono"></script></body></html>'
+      )
+    })
+  })
 })
 
 describe('<HasIslands /> Component with path aliases', () => {
Repository: honojs/node-server
Pull request #10 (2022-11-29 12:32:58)

fix: handle the error thrown by `fetchCallback`


Patch:
diff --git a/src/server.ts b/src/server.ts
index a0f34c9..987cd5b 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -55,7 +55,13 @@ const getRequestListener = (fetchCallback: FetchCallback) => {
       init['body'] = buffer
     }
 
-    const res = (await fetchCallback(new Request(url.toString(), init))) as Response
+    let res: Response
+
+    try {
+      res = (await fetchCallback(new Request(url.toString(), init))) as Response
+    } catch {
+      res = new Response(null, { status: 500 })
+    }
 
     const contentType = res.headers.get('content-type') || ''
 


Test patch:
diff --git a/test/server.test.ts b/test/server.test.ts
index a8f963b..e1e01dd 100644
--- a/test/server.test.ts
+++ b/test/server.test.ts
@@ -201,6 +201,11 @@ describe('Error handling', () => {
     expect(res.status).toBe(500)
     expect(res.text).toBe('Custom Error!')
   })
+
+  it('Should return 500 response - PURGE method', async () => {
+    const res = await request(server).purge('/')
+    expect(res.status).toBe(500)
+  })
 })
 
 describe('Basic Auth Middleware', () => {
Repository: gcanti/fp-ts
Pull request #1089 (2020-01-15 11:22:22)

Add `fold` to `NonEmptyArray`



vicrac: Resolves https://github.com/gcanti/fp-ts/issues/1088

Patch:
diff --git a/src/NonEmptyArray.ts b/src/NonEmptyArray.ts
index 526c92ee..77d575d5 100644
--- a/src/NonEmptyArray.ts
+++ b/src/NonEmptyArray.ts
@@ -10,7 +10,7 @@ import { FunctorWithIndex1 } from './FunctorWithIndex'
 import { TraversableWithIndex1 } from './TraversableWithIndex'
 import { FoldableWithIndex1 } from './FoldableWithIndex'
 import { Ord } from './Ord'
-import { getMeetSemigroup, getJoinSemigroup, Semigroup } from './Semigroup'
+import { getMeetSemigroup, getJoinSemigroup, Semigroup, fold as sfold } from './Semigroup'
 import { Option, some, none } from './Option'
 import { Eq } from './Eq'
 import { Predicate, Refinement } from './function'
@@ -364,6 +364,8 @@ const {
   reduceWithIndex
 } = pipeable(nonEmptyArray)
 
+const fold = <A>(S: Semigroup<A>) => (fa: NonEmptyArray<A>) => sfold(S)(head(fa), tail(fa))
+
 const foldMapWithIndex = <S>(S: Semigroup<S>) => <A>(f: (i: number, a: A) => S) => (fa: NonEmptyArray<A>) =>
   fa.slice(1).reduce((s, a, i) => S.concat(s, f(i + 1, a)), f(0, fa[0]))
 
@@ -403,6 +405,10 @@ export {
    * @since 2.0.0
    */
   flatten,
+  /**
+   * @since 2.5.0
+   */
+  fold,
   /**
    * @since 2.0.0
    */


Test patch:
diff --git a/test/NonEmptyArray.ts b/test/NonEmptyArray.ts
index 59d3646b..edaab368 100644
--- a/test/NonEmptyArray.ts
+++ b/test/NonEmptyArray.ts
@@ -10,6 +10,7 @@ import {
   copy,
   filter,
   filterWithIndex,
+  fold as nfold,
   foldMap,
   foldMapWithIndex,
   fromArray,
@@ -36,7 +37,7 @@ import {
 } from '../src/NonEmptyArray'
 import { isSome, none, option, some } from '../src/Option'
 import { ordNumber } from '../src/Ord'
-import { semigroupSum } from '../src/Semigroup'
+import { semigroupSum, semigroupString } from '../src/Semigroup'
 import { showString } from '../src/Show'
 
 describe('NonEmptyArray', () => {
@@ -345,4 +346,10 @@ describe('NonEmptyArray', () => {
     assert.deepStrictEqual(f(['a']), 1)
     assert.deepStrictEqual(f(['a', 'bb']), 4)
   })
+
+  it('fold', () => {
+    const f = nfold(semigroupString)
+    assert.deepStrictEqual(f(['a']), 'a')
+    assert.deepStrictEqual(f(['a', 'bb']), 'abb')
+  })
 })
Repository: kaliber5/ember-responsive-image
Pull request #131 (2021-02-05 16:25:52)

Let the browser decode images asynchronously


Patch:
diff --git a/addon/components/responsive-image.hbs b/addon/components/responsive-image.hbs
index b19d33ce..e9fdc954 100644
--- a/addon/components/responsive-image.hbs
+++ b/addon/components/responsive-image.hbs
@@ -12,6 +12,7 @@
     height={{this.height}}
     class="eri-{{this.layout}}"
     loading="lazy"
+    decoding="async"
     ...attributes
   />
 </picture>
\ No newline at end of file


Test patch:
diff --git a/tests/integration/components/responsive-image-test.js b/tests/integration/components/responsive-image-test.js
index 04fe5083..6cfbb3ea 100644
--- a/tests/integration/components/responsive-image-test.js
+++ b/tests/integration/components/responsive-image-test.js
@@ -319,6 +319,11 @@ module('Integration: Responsive Image Component', function (hooks) {
     assert.dom('img').hasAttribute('loading', 'eager');
   });
 
+  test('it decodes async', async function (assert) {
+    await render(hbs`<ResponsiveImage @image="assets/images/test.png" />`);
+    assert.dom('img').hasAttribute('decoding', 'async');
+  });
+
   test('it renders arbitrary HTML attributes', async function (assert) {
     await render(
       hbs`<ResponsiveImage @image="assets/images/test.png" class="foo" role="button" data-test-image />`
Repository: kaliber5/ember-responsive-image
Pull request #184 (2021-03-07 10:50:31)

Fix use of absolute path for `src` attribute


Patch:
diff --git a/addon/services/responsive-image.ts b/addon/services/responsive-image.ts
index b13559e8..60f2cd0d 100644
--- a/addon/services/responsive-image.ts
+++ b/addon/services/responsive-image.ts
@@ -151,6 +151,7 @@ export default class ResponsiveImageService extends Service {
   }
 
   getImageFilename(image: string, width: number, format: ImageType): string {
+    image = this.normalizeImageName(image);
     // this must match `generateFilename()` of ImageWriter broccoli plugin!
     const ext = imageExtensions.get(format) ?? format;
     const base = image.substr(0, image.lastIndexOf('.'));


Test patch:
diff --git a/tests/dummy/app/templates/index.hbs b/tests/dummy/app/templates/index.hbs
index 833f27af..d393b2ef 100644
--- a/tests/dummy/app/templates/index.hbs
+++ b/tests/dummy/app/templates/index.hbs
@@ -1,9 +1,9 @@
 
 
-<ResponsiveImage @src="assets/images/docs/lqip-blurhash.jpg"/>
+<ResponsiveImage @src="/assets/images/docs/lqip-blurhash.jpg"/>
 
 
 
-<ResponsiveImage @src="assets/images/docs/dog.jpg" @width={{320}}/>
-<ResponsiveImage @src="assets/images/docs/lqip-color.jpg" @width={{320}}/>
-<ResponsiveImage @src="assets/images/docs/lqip-blurhash.jpg" @width={{320}}/>
+<ResponsiveImage @src="/assets/images/docs/dog.jpg" @width={{320}}/>
+<ResponsiveImage @src="/assets/images/docs/lqip-color.jpg" @width={{320}}/>
+<ResponsiveImage @src="/assets/images/docs/lqip-blurhash.jpg" @width={{320}}/>
diff --git a/tests/integration/components/responsive-image-test.js b/tests/integration/components/responsive-image-test.js
index d520b305..954863b3 100644
--- a/tests/integration/components/responsive-image-test.js
+++ b/tests/integration/components/responsive-image-test.js
@@ -23,7 +23,12 @@ module('Integration: Responsive Image Component', function (hooks) {
         hbs`<ResponsiveImage @src="/assets/images/tests/test.png"/>`
       );
 
-      assert.dom('img').exists();
+      assert
+        .dom('img')
+        .hasAttribute(
+          'src',
+          new RegExp('^/assets/images/tests/test([0-9])+w(-\\w+)?.png')
+        );
     });
 
     test('it renders width and height attributes', async function (assert) {
Repository: melt-ui/melt-ui
Pull request #401 (2023-08-17 20:42:04)

feat(#389) after selecting, check multiple is false before closing select menu
Updated related test accordingly.

Since this is an expected behaviour I did not changed the docs. 

Side note: I tested the Esc Key to close the Select menu, that may not be necessary or a separate test


Patch:
diff --git a/.changeset/funny-lizards-grow.md b/.changeset/funny-lizards-grow.md
new file mode 100644
index 00000000..a870da4a
--- /dev/null
+++ b/.changeset/funny-lizards-grow.md
@@ -0,0 +1,6 @@
+---
+"@melt-ui/svelte": patch
+---
+
+Keep Select menu open on select when `multiple` prop is `true`
+
diff --git a/src/lib/builders/select/create.ts b/src/lib/builders/select/create.ts
index 77bda369..de882117 100644
--- a/src/lib/builders/select/create.ts
+++ b/src/lib/builders/select/create.ts
@@ -514,7 +514,8 @@ export function createSelect<
 					handleRovingFocus(itemElement);
 
 					setValue(props.value);
-					open.set(false);
+					const $multiple = get(multiple);
+					if (!$multiple) open.set(false);
 				}),
 
 				addMeltEventListener(node, 'keydown', (e) => {
@@ -530,7 +531,8 @@ export function createSelect<
 						node.setAttribute('data-selected', '');
 
 						setValue(props.value);
-						open.set(false);
+						const $multiple = get(multiple);
+						if (!$multiple) open.set(false);
 					}
 				}),
 				addMeltEventListener(node, 'pointermove', (e) => {


Test patch:
diff --git a/src/tests/select/Select.spec.ts b/src/tests/select/Select.spec.ts
index b5f26013..854a6a82 100644
--- a/src/tests/select/Select.spec.ts
+++ b/src/tests/select/Select.spec.ts
@@ -126,11 +126,8 @@ describe('Select (Default)', () => {
 		await expect(firstItem).toHaveAttribute('data-selected');
 		await expect(firstItem).toHaveAttribute('aria-selected', 'true');
 
-		await expect(menu).not.toBeVisible();
-		await expect(trigger).toHaveTextContent('Caramel');
-
-		await user.click(trigger);
 		await expect(menu).toBeVisible();
+		await expect(trigger).toHaveTextContent('Caramel');
 
 		const secondItem = menu.querySelectorAll('[data-melt-select-option]')[1];
 		if (!secondItem) throw new Error('No option found');
@@ -139,8 +136,11 @@ describe('Select (Default)', () => {
 		await expect(secondItem).toHaveAttribute('data-selected');
 		await expect(secondItem).toHaveAttribute('aria-selected', 'true');
 
-		await expect(menu).not.toBeVisible();
+		await expect(menu).toBeVisible();
 		await expect(trigger).toHaveTextContent('Caramel, Chocolate');
+
+		await user.keyboard(`{${kbd.ESCAPE}}`);
+		await expect(menu).not.toBeVisible();
 	});
 
 	test('Shows correct label when defaultValue is provided', async () => {