Skip to content

Commit 48c3a59

Browse files
authored
docs: added section on customizing wildcard import identifier in module documentation (#965)
Referenced issue #725 to add this information and example to the documentation
1 parent 0e51686 commit 48c3a59

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+139
-32
lines changed

frontend/components/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export function Header({
107107
? <UserMenu user={user} sudo={sudo} logoutUrl={logoutUrl} />
108108
: (
109109
<a href={loginUrl} class="link-header flex items-center gap-2">
110-
<TbBrandGithub class="size-5 flex-none" aria-hidden={true} />
110+
<TbBrandGithub class="size-5 flex-none" aria-hidden />
111111
Sign in
112112
</a>
113113
)}

frontend/components/HomepageHero.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export function HomepageHero(
7171
<GlobalSearch
7272
apiKey={apiKey}
7373
indexId={indexId}
74-
jumbo={true}
74+
jumbo
7575
/>
7676
</div>
7777
<div class="flex flex-col items-center gap-4">

frontend/components/Markdown.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export function Markdown(
2626
return (
2727
<div
2828
class="markdown-body"
29+
// deno-lint-ignore react-no-danger
2930
dangerouslySetInnerHTML={{ __html: html }}
3031
/>
3132
);

frontend/components/Modal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export default function Modal(
3434
onClick={(e) => e.stopPropagation()}
3535
>
3636
<button
37+
type="button"
3738
class="absolute top-8 right-8 hover:text-jsr-gray-400"
3839
onClick={() => setOpen(false)}
3940
>

frontend/components/Nav.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ export function Nav(props: NavProps) {
1515
} border-b border-jsr-cyan-300/30 max-w-full flex justify-between overflow-x-auto items-end`}
1616
>
1717
<style
18+
// deno-lint-ignore react-no-danger
1819
dangerouslySetInnerHTML={{
1920
__html:
2021
"nav:has(#nav-items[data-unattached]) { visibility: hidden; }",
2122
}}
2223
/>
2324
<noscript>
2425
<style
26+
// deno-lint-ignore react-no-danger
2527
dangerouslySetInnerHTML={{
2628
__html:
2729
"nav:has(#nav-items[data-unattached]) { visibility: visible !important }",

frontend/components/NavOverflow.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export function NavOverflow() {
6262
return (
6363
<>
6464
<button
65+
type="button"
6566
class="group absolute right-4 md:right-10 rounded border-1 my-1 border-jsr-cyan-100 hover:bg-jsr-cyan-50 hover:cursor-pointer hidden"
6667
aria-expanded="false"
6768
>
@@ -73,7 +74,10 @@ export function NavOverflow() {
7374
class="absolute top-[120%] -right-2 z-[70] px-1 py-2 rounded border-1.5 border-current bg-white w-56 shadow overflow-hidden opacity-100 translate-y-0 transition [&>a]:rounded hidden"
7475
/>
7576
</button>
76-
<script dangerouslySetInnerHTML={{ __html: NAV_OVERFLOW_SCRIPT }} />
77+
<script
78+
// deno-lint-ignore react-no-danger
79+
dangerouslySetInnerHTML={{ __html: NAV_OVERFLOW_SCRIPT }}
80+
/>
7781
</>
7882
);
7983
}

frontend/components/NewsCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function NewsCard({
1919
>
2020
<img
2121
src={image}
22-
crossOrigin={"anonymous"}
22+
crossOrigin="anonymous"
2323
alt=""
2424
class="w-full h-48 object-cover border-b-1.5 border-jsr-cyan-950 group-hover:border-jsr-cyan-400 group-focus-within:border-jsr-cyan-400 transition-colors duration-150"
2525
/>

frontend/docs/writing-docs.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,29 @@ You can also include examples in module documentation:
174174
If a default entrypoint has a module documentation, it takes precedence over the
175175
README file in the "Overview" tab of the package page.
176176
[Learn more in the documentation section for packages](/docs/packages#documentation).
177+
178+
By default, when using a wildcard import, the identifier used is `mod`. For
179+
example:
180+
181+
```ts
182+
import * as mod from "@luca/esbuild-deno-loader/esbuild_types";
183+
```
184+
185+
Module authors can customize this default identifier by specifying a custom name
186+
in the module's JSDoc comment using the `@module` tag. This allows for more
187+
descriptive and context-specific import identifiers.
188+
189+
```ts
190+
/**
191+
* This module contains copy of the esbuild types that `deno_esbuild_loader` uses. This is
192+
* necessary because the `esbuild` package is not available on JSR yet.
193+
*
194+
* @module esbuild_types
195+
*/
196+
```
197+
198+
With this annotation, the import statement will now use the custom identifier:
199+
200+
```ts
201+
import * as esbuild_types from "@luca/esbuild-deno-loader/esbuild_types";
202+
```

frontend/islands/Authorize.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ export default function Authorize(
4646
return (
4747
<div class="flex gap-2 text-lg mt-4">
4848
<button
49+
type="button"
4950
class="button-primary"
5051
onClick={approve}
5152
>
5253
Approve
5354
</button>
5455
<button
56+
type="button"
5557
class="button-danger"
5658
onClick={deny}
5759
>

frontend/islands/CopyButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export function CopyButton(props: CopyButtonProps) {
2626

2727
return (
2828
<button
29+
type="button"
2930
onClick={copy}
3031
title={props.title}
3132
class={(copied.value ? "text-green-700" : "text-jsr-gray-700") +

0 commit comments

Comments
 (0)