chore: migrate docsearch and imagescript to npm/jsr imports (#3732)

## Summary
- **docsearch**: Replaced `esm.sh` URL with `npm:@docsearch/js@^3.5.2`.
Added a type cast workaround in `SearchButton.tsx` since Deno's type
checker treats this npm package as CJS (missing `"type": "module"`).
- **imagescript**: Replaced `deno.land/x` URL with
`jsr:@matmen/imagescript@^1.3.0`. Clean swap, no code changes needed.

These were legacy URL-based imports from before Deno had native `npm:`
and `jsr:` support.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bartek Iwańczuk
2026-03-28 11:44:37 +00:00
committed by GitHub
co-authored by Claude Opus 4.6
parent 25e6357e1a
commit 220368aa15
3 changed files with 200 additions and 33 deletions
+6 -1
View File
@@ -1,5 +1,5 @@
import { useEffect, useRef } from "preact/hooks";
import docsearch from "docsearch";
import docsearchModule from "docsearch";
// Copied from algolia source code
type DocSearchProps = {
@@ -9,6 +9,11 @@ type DocSearchProps = {
container: HTMLElement | string;
};
// Workaround: Deno resolves this npm package as CJS, hiding the callable default export
const docsearch = docsearchModule as unknown as (
props: DocSearchProps,
) => void;
export default function SearchButton(
props: { docsearch?: (args: DocSearchProps) => void; class?: string },
) {