Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
57059dc
useAuth pass
LekoArts Mar 27, 2025
fdc7ffa
improvements
LekoArts Mar 31, 2025
af1144f
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Mar 31, 2025
f947dea
more improvements
LekoArts Mar 31, 2025
6efc447
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Mar 31, 2025
e9e2b5e
wip
LekoArts Apr 2, 2025
b68d9e8
dep update
LekoArts Apr 2, 2025
2f22078
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 3, 2025
4f126b1
add missing inline
LekoArts Apr 4, 2025
59bd888
update typedoc version
LekoArts Apr 7, 2025
bcaba2e
fix blockTags
LekoArts Apr 7, 2025
8f93fc3
flatten output directories
LekoArts Apr 7, 2025
72036b1
adjust script
LekoArts Apr 8, 2025
0ae6ccb
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 8, 2025
dbb3444
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 9, 2025
d0a4398
output updates
LekoArts Apr 9, 2025
34d659a
add tests
LekoArts Apr 9, 2025
8405567
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
a748bfa
update plugin
LekoArts Apr 10, 2025
da3188b
merge fixes
LekoArts Apr 10, 2025
e23074c
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
feeac3b
lockfile
LekoArts Apr 10, 2025
2223183
add changeset
LekoArts Apr 10, 2025
361692c
simplify theme overrides ✨
LekoArts Apr 10, 2025
3eb7cd2
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
7b2af64
finishing touches
LekoArts Apr 11, 2025
0fb9ede
update snapshot
LekoArts Apr 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/giant-bats-leave.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
---
'@clerk/shared': patch
'@clerk/clerk-react': patch
'@clerk/types': patch
---

Improve JSDoc comments
237 changes: 123 additions & 114 deletions .typedoc/__tests__/__snapshots__/file-structure.test.ts.snap
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,119 +2,128 @@

exports[`Typedoc output > should have a deliberate file structure 1`] = `
[
"types/type-aliases/check-authorization-from-session-claims.mdx",
"types/type-aliases/clerk-host-router.mdx",
"types/type-aliases/clerk-pagination-request.mdx",
"types/type-aliases/element-object-key.mdx",
"types/type-aliases/elements-config.mdx",
"types/type-aliases/id-selectors.mdx",
"types/type-aliases/legacy-redirect-props.mdx",
"types/type-aliases/localization-resource.mdx",
"types/type-aliases/multi-domain-and-or-proxy.mdx",
"types/type-aliases/organization-custom-role-key.mdx",
"types/type-aliases/organization-permission-key.mdx",
"types/type-aliases/organizations-jwt-claim.mdx",
"types/type-aliases/override.mdx",
"types/type-aliases/path-value.mdx",
"types/type-aliases/record-to-path.mdx",
"types/type-aliases/redirect-options.mdx",
"types/type-aliases/saml-strategy.mdx",
"types/type-aliases/sdk-metadata.mdx",
"types/type-aliases/session-status-claim.mdx",
"types/type-aliases/set-active.mdx",
"types/type-aliases/sign-up-authenticate-with-metamask-params.mdx",
"types/type-aliases/signed-in-session-resource.mdx",
"types/type-aliases/state-selectors.mdx",
"types/type-aliases/use-auth-return.mdx",
"types/type-aliases/use-session-list-return.mdx",
"types/type-aliases/use-session-return.mdx",
"types/type-aliases/use-sign-in-return.mdx",
"types/type-aliases/use-sign-up-return.mdx",
"types/type-aliases/use-user-return.mdx",
"types/type-aliases/without.mdx",
"types/interfaces/act-claim.mdx",
"types/interfaces/act-jwt-claim.mdx",
"types/interfaces/active-session-resource.mdx",
"types/interfaces/clerk-api-error.mdx",
"types/interfaces/clerk-jwt-claims.mdx",
"types/interfaces/clerk-paginated-response.mdx",
"types/interfaces/clerk-pagination-params.mdx",
"types/interfaces/clerk-resource.mdx",
"types/interfaces/clerk.mdx",
"types/interfaces/create-organization-params.mdx",
"types/interfaces/jwt-claims.mdx",
"types/interfaces/jwt-header.mdx",
"types/interfaces/pending-session-resource.mdx",
"types/interfaces/session-resource.mdx",
"types/interfaces/set-active-params.mdx",
"types/interfaces/sign-in-resource.mdx",
"types/interfaces/sign-out.mdx",
"types/interfaces/sign-up-resource.mdx",
"shared/react/types/type-aliases/paginated-hook-config.mdx",
"shared/react/types/interfaces/pages-or-infinite-options.mdx",
"shared/react/types/interfaces/paginated-resources.mdx",
"shared/react/hooks/use-clerk.mdx",
"shared/react/hooks/use-organization-list-params.mdx",
"shared/react/hooks/use-organization-list-return.mdx",
"shared/react/hooks/use-organization-list.mdx",
"shared/react/hooks/use-organization-params.mdx",
"shared/react/hooks/use-organization-return.mdx",
"shared/react/hooks/use-organization.mdx",
"shared/react/hooks/use-reverification.mdx",
"shared/react/hooks/use-session-list.mdx",
"shared/react/hooks/use-session.mdx",
"shared/react/hooks/use-user.mdx",
"shared/index/functions/build-clerk-js-script-attributes.mdx",
"shared/index/functions/clerk-js-script-url.mdx",
"shared/index/functions/create-path-matcher.mdx",
"shared/index/functions/deep-camel-to-snake.mdx",
"shared/index/functions/deep-snake-to-camel.mdx",
"shared/index/functions/deprecated-object-property.mdx",
"shared/index/functions/derive-state.mdx",
"shared/index/functions/extract-dev-browser-jwt-from-url.mdx",
"shared/index/functions/fast-deep-merge-and-replace.mdx",
"shared/index/functions/get-clerk-js-major-version-or-tag.mdx",
"shared/index/functions/get-env-variable.mdx",
"shared/index/functions/get-script-url.mdx",
"shared/index/functions/icon-image-url.mdx",
"shared/index/functions/in-browser.mdx",
"shared/index/functions/is-browser-online.mdx",
"shared/index/functions/is-clerk-runtime-error.mdx",
"shared/index/functions/is-publishable-key.mdx",
"shared/index/functions/is-staging.mdx",
"shared/index/functions/is-truthy.mdx",
"shared/index/functions/is-valid-browser-online.mdx",
"shared/index/functions/is-valid-browser.mdx",
"shared/index/functions/isomorphic-atob.mdx",
"shared/index/functions/load-clerk-js-script.mdx",
"shared/index/functions/read-json-file.mdx",
"shared/index/functions/set-clerk-js-loading-error-package-name.mdx",
"shared/index/functions/to-sentence.mdx",
"shared/index/functions/user-agent-is-robot.mdx",
"shared/index/functions/version-selector.mdx",
"shared/index/classes/clerk-runtime-error.mdx",
"nextjs/server/create-get-auth/variables/get-auth.mdx",
"nextjs/server/create-get-auth/functions/create-async-get-auth.mdx",
"nextjs/server/create-get-auth/functions/create-sync-get-auth.mdx",
"nextjs/server/clerk-middleware/variables/clerk-middleware.mdx",
"nextjs/server/clerk-middleware/interfaces/clerk-middleware-options.mdx",
"nextjs/server/build-clerk-props/variables/build-clerk-props.mdx",
"nextjs/app-router/server/current-user/functions/current-user.mdx",
"nextjs/app-router/server/auth/variables/auth.mdx",
"clerk-react/interfaces/clerk-provider-props.mdx",
"clerk-react/functions/protect.mdx",
"clerk-react/functions/redirect-to-create-organization.mdx",
"clerk-react/functions/redirect-to-organization-profile.mdx",
"clerk-react/functions/redirect-to-user-profile.mdx",
"clerk-react/functions/use-auth.mdx",
"clerk-react/functions/use-clerk.mdx",
"clerk-react/functions/use-organization-list.mdx",
"clerk-react/functions/use-organization.mdx",
"clerk-react/functions/use-reverification.mdx",
"clerk-react/functions/use-session-list.mdx",
"clerk-react/functions/use-session.mdx",
"clerk-react/functions/use-sign-in.mdx",
"clerk-react/functions/use-sign-up.mdx",
"clerk-react/functions/use-user.mdx",
"types/act-claim.mdx",
"types/act-jwt-claim.mdx",
"types/active-session-resource.mdx",
"types/check-authorization-fn.mdx",
"types/check-authorization-from-session-claims.mdx",
"types/check-authorization-with-custom-permissions.mdx",
"types/clerk-api-error.mdx",
"types/clerk-host-router.mdx",
"types/clerk-jwt-claims.mdx",
"types/clerk-paginated-response.mdx",
"types/clerk-pagination-params.mdx",
"types/clerk-pagination-request.mdx",
"types/clerk-resource.mdx",
"types/clerk.mdx",
"types/create-organization-params.mdx",
"types/element-object-key.mdx",
"types/elements-config.mdx",
"types/get-token.mdx",
"types/id-selectors.mdx",
"types/jwt-claims.mdx",
"types/jwt-header.mdx",
"types/legacy-redirect-props.mdx",
"types/localization-resource.mdx",
"types/multi-domain-and-or-proxy.mdx",
"types/organization-custom-role-key.mdx",
"types/organization-domain-verification-status.mdx",
"types/organization-enrollment-mode.mdx",
"types/organization-invitation-status.mdx",
"types/organization-permission-key.mdx",
"types/organization-suggestion-status.mdx",
"types/organizations-jwt-claim.mdx",
"types/override.mdx",
"types/path-value.mdx",
"types/pending-session-options.mdx",
"types/pending-session-resource.mdx",
"types/record-to-path.mdx",
"types/redirect-options.mdx",
"types/saml-strategy.mdx",
"types/sdk-metadata.mdx",
"types/session-resource.mdx",
"types/session-status-claim.mdx",
"types/set-active-params.mdx",
"types/set-active.mdx",
"types/sign-in-resource.mdx",
"types/sign-out.mdx",
"types/sign-up-authenticate-with-metamask-params.mdx",
"types/sign-up-resource.mdx",
"types/signed-in-session-resource.mdx",
"types/state-selectors.mdx",
"types/use-auth-return.mdx",
"types/use-session-list-return.mdx",
"types/use-session-return.mdx",
"types/use-sign-in-return.mdx",
"types/use-sign-up-return.mdx",
"types/use-user-return.mdx",
"types/user-resource.mdx",
"types/without.mdx",
"shared/build-clerk-js-script-attributes.mdx",
"shared/clerk-js-script-url.mdx",
"shared/clerk-runtime-error.mdx",
"shared/create-path-matcher.mdx",
"shared/deep-camel-to-snake.mdx",
"shared/deep-snake-to-camel.mdx",
"shared/deprecated-object-property.mdx",
"shared/derive-state.mdx",
"shared/extract-dev-browser-jwt-from-url.mdx",
"shared/fast-deep-merge-and-replace.mdx",
"shared/get-clerk-js-major-version-or-tag.mdx",
"shared/get-env-variable.mdx",
"shared/get-script-url.mdx",
"shared/icon-image-url.mdx",
"shared/in-browser.mdx",
"shared/is-browser-online.mdx",
"shared/is-clerk-runtime-error.mdx",
"shared/is-publishable-key.mdx",
"shared/is-staging.mdx",
"shared/is-truthy.mdx",
"shared/is-valid-browser-online.mdx",
"shared/is-valid-browser.mdx",
"shared/isomorphic-atob.mdx",
"shared/load-clerk-js-script.mdx",
"shared/pages-or-infinite-options.mdx",
"shared/paginated-hook-config.mdx",
"shared/paginated-resources.mdx",
"shared/read-json-file.mdx",
"shared/set-clerk-js-loading-error-package-name.mdx",
"shared/to-sentence.mdx",
"shared/use-clerk.mdx",
"shared/use-organization-list-params.mdx",
"shared/use-organization-list-return.mdx",
"shared/use-organization-list.mdx",
"shared/use-organization-params.mdx",
"shared/use-organization-return.mdx",
"shared/use-organization.mdx",
"shared/use-reverification.mdx",
"shared/use-session-list.mdx",
"shared/use-session.mdx",
"shared/use-user.mdx",
"shared/user-agent-is-robot.mdx",
"shared/version-selector.mdx",
"nextjs/auth.mdx",
"nextjs/build-clerk-props.mdx",
"nextjs/clerk-middleware-options.mdx",
"nextjs/clerk-middleware.mdx",
"nextjs/create-async-get-auth.mdx",
"nextjs/create-sync-get-auth.mdx",
"nextjs/current-user.mdx",
"nextjs/get-auth.mdx",
"clerk-react/clerk-provider-props.mdx",
"clerk-react/protect.mdx",
"clerk-react/redirect-to-create-organization.mdx",
"clerk-react/redirect-to-organization-profile.mdx",
"clerk-react/redirect-to-user-profile.mdx",
"clerk-react/use-auth.mdx",
"clerk-react/use-clerk.mdx",
"clerk-react/use-organization-list.mdx",
"clerk-react/use-organization.mdx",
"clerk-react/use-reverification.mdx",
"clerk-react/use-session-list.mdx",
"clerk-react/use-session.mdx",
"clerk-react/use-sign-in.mdx",
"clerk-react/use-sign-up.mdx",
"clerk-react/use-user.mdx",
]
`;
27 changes: 0 additions & 27 deletions .typedoc/__tests__/file-structure.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,33 +36,6 @@ describe('Typedoc output', () => {
"nextjs",
"shared",
"types",
"types/interfaces",
"types/type-aliases",
"shared/index",
"shared/react",
"shared/react/hooks",
"shared/react/types",
"shared/react/types/interfaces",
"shared/react/types/type-aliases",
"shared/index/classes",
"shared/index/functions",
"nextjs/app-router",
"nextjs/server",
"nextjs/server/build-clerk-props",
"nextjs/server/clerk-middleware",
"nextjs/server/create-get-auth",
"nextjs/server/create-get-auth/functions",
"nextjs/server/create-get-auth/variables",
"nextjs/server/clerk-middleware/interfaces",
"nextjs/server/clerk-middleware/variables",
"nextjs/server/build-clerk-props/variables",
"nextjs/app-router/server",
"nextjs/app-router/server/auth",
"nextjs/app-router/server/current-user",
"nextjs/app-router/server/current-user/functions",
"nextjs/app-router/server/auth/variables",
"clerk-react/functions",
"clerk-react/interfaces",
]
`);
});
Expand Down
43 changes: 41 additions & 2 deletions .typedoc/custom-plugin.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,8 @@ const LINK_REPLACEMENTS = [
['session-resource', '/docs/references/javascript/session'],
['signed-in-session-resource', '/docs/references/javascript/session'],
['sign-up-resource', '/docs/references/javascript/sign-up'],
['user-resource', '/docs/references/javascript/user'],
['session-status-claim', '/docs/references/javascript/types/session-status'],
];

/**
Expand All@@ -34,16 +36,45 @@ const LINK_REPLACEMENTS = [
* It also shouldn't matter how level deep the relative link is.
*
* This function returns an array of `{ pattern: string, replace: string }` to pass into the `typedoc-plugin-replace-text` plugin.
*
* @example
* [foo](../../bar.mdx) -> [foo](/new-path)
* [foo](./bar.mdx) -> [foo](/new-path)
* [foo](bar.mdx) -> [foo](/new-path)
* [foo](bar.mdx#some-id) -> [foo](/new-path#some-id)
*/
function getRelativeLinkReplacements() {
return LINK_REPLACEMENTS.map(([fileName, newPath]) => {
return {
pattern: new RegExp(`\\((?:\\.{1,2}\\/)+.*?${fileName}\\.mdx\\)`, 'g'),
replace: `(${newPath})`,
// Match both path and optional anchor
pattern: new RegExp(`\\((?:(?:\\.{1,2}\\/)+[^()]*?|)${fileName}\\.mdx(#[^)]+)?\\)`, 'g'),

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new regex accounts for two bugs I saw:

  • A string contained multiple []() and previously it replaced parts outside of that link (until the next occurence)
  • [foo](bar.mdx) and [foo](bar.mdx#test) didn't work

// Preserve the anchor in replacement if it exists
replace: (/** @type {string} */ _match, anchor = '') => `(${newPath}${anchor})`,
};
});
}

function getUnlinkedTypesReplacements() {
return [
{
pattern: /\(setActiveParams\)/g,
replace: '([setActiveParams](/docs/references/javascript/types/set-active-params))',
},
{
pattern: /`_LocalizationResource`/g,
replace: '[Localization](/docs/customization/localization)',
},
{
pattern: /`LoadedClerk`/g,
replace: '[Clerk](/docs/references/javascript/clerk)',
},
{
pattern: /`OrganizationCustomRoleKey`/g,
replace: '[OrganizationCustomRoleKey](/docs/references/javascript/types/organization-custom-role-key)',
},
];
}

/**
* @param {import('typedoc-plugin-markdown').MarkdownApplication} app
*/
Expand All@@ -58,6 +89,14 @@ export function load(app) {
}
}

const unlinkedTypesReplacements = getUnlinkedTypesReplacements();

for (const { pattern, replace } of unlinkedTypesReplacements) {
if (output.contents) {
output.contents = output.contents.replace(pattern, replace);
}
}

if (fileName) {
if (FILES_WITHOUT_HEADINGS.includes(fileName)) {
if (output.contents) {
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
57059dc
useAuth pass
LekoArts Mar 27, 2025
fdc7ffa
improvements
LekoArts Mar 31, 2025
af1144f
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Mar 31, 2025
f947dea
more improvements
LekoArts Mar 31, 2025
6efc447
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Mar 31, 2025
e9e2b5e
wip
LekoArts Apr 2, 2025
b68d9e8
dep update
LekoArts Apr 2, 2025
2f22078
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 3, 2025
4f126b1
add missing inline
LekoArts Apr 4, 2025
59bd888
update typedoc version
LekoArts Apr 7, 2025
bcaba2e
fix blockTags
LekoArts Apr 7, 2025
8f93fc3
flatten output directories
LekoArts Apr 7, 2025
72036b1
adjust script
LekoArts Apr 8, 2025
0ae6ccb
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 8, 2025
dbb3444
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 9, 2025
d0a4398
output updates
LekoArts Apr 9, 2025
34d659a
add tests
LekoArts Apr 9, 2025
8405567
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
a748bfa
update plugin
LekoArts Apr 10, 2025
da3188b
merge fixes
LekoArts Apr 10, 2025
e23074c
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
feeac3b
lockfile
LekoArts Apr 10, 2025
2223183
add changeset
LekoArts Apr 10, 2025
361692c
simplify theme overrides ✨
LekoArts Apr 10, 2025
3eb7cd2
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
7b2af64
finishing touches
LekoArts Apr 11, 2025
0fb9ede
update snapshot
LekoArts Apr 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/giant-bats-leave.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
---
'@clerk/shared': patch
'@clerk/clerk-react': patch
'@clerk/types': patch
---

Improve JSDoc comments
237 changes: 123 additions & 114 deletions .typedoc/__tests__/__snapshots__/file-structure.test.ts.snap
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,119 +2,128 @@

exports[`Typedoc output > should have a deliberate file structure 1`] = `
[
"types/type-aliases/check-authorization-from-session-claims.mdx",
"types/type-aliases/clerk-host-router.mdx",
"types/type-aliases/clerk-pagination-request.mdx",
"types/type-aliases/element-object-key.mdx",
"types/type-aliases/elements-config.mdx",
"types/type-aliases/id-selectors.mdx",
"types/type-aliases/legacy-redirect-props.mdx",
"types/type-aliases/localization-resource.mdx",
"types/type-aliases/multi-domain-and-or-proxy.mdx",
"types/type-aliases/organization-custom-role-key.mdx",
"types/type-aliases/organization-permission-key.mdx",
"types/type-aliases/organizations-jwt-claim.mdx",
"types/type-aliases/override.mdx",
"types/type-aliases/path-value.mdx",
"types/type-aliases/record-to-path.mdx",
"types/type-aliases/redirect-options.mdx",
"types/type-aliases/saml-strategy.mdx",
"types/type-aliases/sdk-metadata.mdx",
"types/type-aliases/session-status-claim.mdx",
"types/type-aliases/set-active.mdx",
"types/type-aliases/sign-up-authenticate-with-metamask-params.mdx",
"types/type-aliases/signed-in-session-resource.mdx",
"types/type-aliases/state-selectors.mdx",
"types/type-aliases/use-auth-return.mdx",
"types/type-aliases/use-session-list-return.mdx",
"types/type-aliases/use-session-return.mdx",
"types/type-aliases/use-sign-in-return.mdx",
"types/type-aliases/use-sign-up-return.mdx",
"types/type-aliases/use-user-return.mdx",
"types/type-aliases/without.mdx",
"types/interfaces/act-claim.mdx",
"types/interfaces/act-jwt-claim.mdx",
"types/interfaces/active-session-resource.mdx",
"types/interfaces/clerk-api-error.mdx",
"types/interfaces/clerk-jwt-claims.mdx",
"types/interfaces/clerk-paginated-response.mdx",
"types/interfaces/clerk-pagination-params.mdx",
"types/interfaces/clerk-resource.mdx",
"types/interfaces/clerk.mdx",
"types/interfaces/create-organization-params.mdx",
"types/interfaces/jwt-claims.mdx",
"types/interfaces/jwt-header.mdx",
"types/interfaces/pending-session-resource.mdx",
"types/interfaces/session-resource.mdx",
"types/interfaces/set-active-params.mdx",
"types/interfaces/sign-in-resource.mdx",
"types/interfaces/sign-out.mdx",
"types/interfaces/sign-up-resource.mdx",
"shared/react/types/type-aliases/paginated-hook-config.mdx",
"shared/react/types/interfaces/pages-or-infinite-options.mdx",
"shared/react/types/interfaces/paginated-resources.mdx",
"shared/react/hooks/use-clerk.mdx",
"shared/react/hooks/use-organization-list-params.mdx",
"shared/react/hooks/use-organization-list-return.mdx",
"shared/react/hooks/use-organization-list.mdx",
"shared/react/hooks/use-organization-params.mdx",
"shared/react/hooks/use-organization-return.mdx",
"shared/react/hooks/use-organization.mdx",
"shared/react/hooks/use-reverification.mdx",
"shared/react/hooks/use-session-list.mdx",
"shared/react/hooks/use-session.mdx",
"shared/react/hooks/use-user.mdx",
"shared/index/functions/build-clerk-js-script-attributes.mdx",
"shared/index/functions/clerk-js-script-url.mdx",
"shared/index/functions/create-path-matcher.mdx",
"shared/index/functions/deep-camel-to-snake.mdx",
"shared/index/functions/deep-snake-to-camel.mdx",
"shared/index/functions/deprecated-object-property.mdx",
"shared/index/functions/derive-state.mdx",
"shared/index/functions/extract-dev-browser-jwt-from-url.mdx",
"shared/index/functions/fast-deep-merge-and-replace.mdx",
"shared/index/functions/get-clerk-js-major-version-or-tag.mdx",
"shared/index/functions/get-env-variable.mdx",
"shared/index/functions/get-script-url.mdx",
"shared/index/functions/icon-image-url.mdx",
"shared/index/functions/in-browser.mdx",
"shared/index/functions/is-browser-online.mdx",
"shared/index/functions/is-clerk-runtime-error.mdx",
"shared/index/functions/is-publishable-key.mdx",
"shared/index/functions/is-staging.mdx",
"shared/index/functions/is-truthy.mdx",
"shared/index/functions/is-valid-browser-online.mdx",
"shared/index/functions/is-valid-browser.mdx",
"shared/index/functions/isomorphic-atob.mdx",
"shared/index/functions/load-clerk-js-script.mdx",
"shared/index/functions/read-json-file.mdx",
"shared/index/functions/set-clerk-js-loading-error-package-name.mdx",
"shared/index/functions/to-sentence.mdx",
"shared/index/functions/user-agent-is-robot.mdx",
"shared/index/functions/version-selector.mdx",
"shared/index/classes/clerk-runtime-error.mdx",
"nextjs/server/create-get-auth/variables/get-auth.mdx",
"nextjs/server/create-get-auth/functions/create-async-get-auth.mdx",
"nextjs/server/create-get-auth/functions/create-sync-get-auth.mdx",
"nextjs/server/clerk-middleware/variables/clerk-middleware.mdx",
"nextjs/server/clerk-middleware/interfaces/clerk-middleware-options.mdx",
"nextjs/server/build-clerk-props/variables/build-clerk-props.mdx",
"nextjs/app-router/server/current-user/functions/current-user.mdx",
"nextjs/app-router/server/auth/variables/auth.mdx",
"clerk-react/interfaces/clerk-provider-props.mdx",
"clerk-react/functions/protect.mdx",
"clerk-react/functions/redirect-to-create-organization.mdx",
"clerk-react/functions/redirect-to-organization-profile.mdx",
"clerk-react/functions/redirect-to-user-profile.mdx",
"clerk-react/functions/use-auth.mdx",
"clerk-react/functions/use-clerk.mdx",
"clerk-react/functions/use-organization-list.mdx",
"clerk-react/functions/use-organization.mdx",
"clerk-react/functions/use-reverification.mdx",
"clerk-react/functions/use-session-list.mdx",
"clerk-react/functions/use-session.mdx",
"clerk-react/functions/use-sign-in.mdx",
"clerk-react/functions/use-sign-up.mdx",
"clerk-react/functions/use-user.mdx",
"types/act-claim.mdx",
"types/act-jwt-claim.mdx",
"types/active-session-resource.mdx",
"types/check-authorization-fn.mdx",
"types/check-authorization-from-session-claims.mdx",
"types/check-authorization-with-custom-permissions.mdx",
"types/clerk-api-error.mdx",
"types/clerk-host-router.mdx",
"types/clerk-jwt-claims.mdx",
"types/clerk-paginated-response.mdx",
"types/clerk-pagination-params.mdx",
"types/clerk-pagination-request.mdx",
"types/clerk-resource.mdx",
"types/clerk.mdx",
"types/create-organization-params.mdx",
"types/element-object-key.mdx",
"types/elements-config.mdx",
"types/get-token.mdx",
"types/id-selectors.mdx",
"types/jwt-claims.mdx",
"types/jwt-header.mdx",
"types/legacy-redirect-props.mdx",
"types/localization-resource.mdx",
"types/multi-domain-and-or-proxy.mdx",
"types/organization-custom-role-key.mdx",
"types/organization-domain-verification-status.mdx",
"types/organization-enrollment-mode.mdx",
"types/organization-invitation-status.mdx",
"types/organization-permission-key.mdx",
"types/organization-suggestion-status.mdx",
"types/organizations-jwt-claim.mdx",
"types/override.mdx",
"types/path-value.mdx",
"types/pending-session-options.mdx",
"types/pending-session-resource.mdx",
"types/record-to-path.mdx",
"types/redirect-options.mdx",
"types/saml-strategy.mdx",
"types/sdk-metadata.mdx",
"types/session-resource.mdx",
"types/session-status-claim.mdx",
"types/set-active-params.mdx",
"types/set-active.mdx",
"types/sign-in-resource.mdx",
"types/sign-out.mdx",
"types/sign-up-authenticate-with-metamask-params.mdx",
"types/sign-up-resource.mdx",
"types/signed-in-session-resource.mdx",
"types/state-selectors.mdx",
"types/use-auth-return.mdx",
"types/use-session-list-return.mdx",
"types/use-session-return.mdx",
"types/use-sign-in-return.mdx",
"types/use-sign-up-return.mdx",
"types/use-user-return.mdx",
"types/user-resource.mdx",
"types/without.mdx",
"shared/build-clerk-js-script-attributes.mdx",
"shared/clerk-js-script-url.mdx",
"shared/clerk-runtime-error.mdx",
"shared/create-path-matcher.mdx",
"shared/deep-camel-to-snake.mdx",
"shared/deep-snake-to-camel.mdx",
"shared/deprecated-object-property.mdx",
"shared/derive-state.mdx",
"shared/extract-dev-browser-jwt-from-url.mdx",
"shared/fast-deep-merge-and-replace.mdx",
"shared/get-clerk-js-major-version-or-tag.mdx",
"shared/get-env-variable.mdx",
"shared/get-script-url.mdx",
"shared/icon-image-url.mdx",
"shared/in-browser.mdx",
"shared/is-browser-online.mdx",
"shared/is-clerk-runtime-error.mdx",
"shared/is-publishable-key.mdx",
"shared/is-staging.mdx",
"shared/is-truthy.mdx",
"shared/is-valid-browser-online.mdx",
"shared/is-valid-browser.mdx",
"shared/isomorphic-atob.mdx",
"shared/load-clerk-js-script.mdx",
"shared/pages-or-infinite-options.mdx",
"shared/paginated-hook-config.mdx",
"shared/paginated-resources.mdx",
"shared/read-json-file.mdx",
"shared/set-clerk-js-loading-error-package-name.mdx",
"shared/to-sentence.mdx",
"shared/use-clerk.mdx",
"shared/use-organization-list-params.mdx",
"shared/use-organization-list-return.mdx",
"shared/use-organization-list.mdx",
"shared/use-organization-params.mdx",
"shared/use-organization-return.mdx",
"shared/use-organization.mdx",
"shared/use-reverification.mdx",
"shared/use-session-list.mdx",
"shared/use-session.mdx",
"shared/use-user.mdx",
"shared/user-agent-is-robot.mdx",
"shared/version-selector.mdx",
"nextjs/auth.mdx",
"nextjs/build-clerk-props.mdx",
"nextjs/clerk-middleware-options.mdx",
"nextjs/clerk-middleware.mdx",
"nextjs/create-async-get-auth.mdx",
"nextjs/create-sync-get-auth.mdx",
"nextjs/current-user.mdx",
"nextjs/get-auth.mdx",
"clerk-react/clerk-provider-props.mdx",
"clerk-react/protect.mdx",
"clerk-react/redirect-to-create-organization.mdx",
"clerk-react/redirect-to-organization-profile.mdx",
"clerk-react/redirect-to-user-profile.mdx",
"clerk-react/use-auth.mdx",
"clerk-react/use-clerk.mdx",
"clerk-react/use-organization-list.mdx",
"clerk-react/use-organization.mdx",
"clerk-react/use-reverification.mdx",
"clerk-react/use-session-list.mdx",
"clerk-react/use-session.mdx",
"clerk-react/use-sign-in.mdx",
"clerk-react/use-sign-up.mdx",
"clerk-react/use-user.mdx",
]
`;
27 changes: 0 additions & 27 deletions .typedoc/__tests__/file-structure.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,33 +36,6 @@ describe('Typedoc output', () => {
"nextjs",
"shared",
"types",
"types/interfaces",
"types/type-aliases",
"shared/index",
"shared/react",
"shared/react/hooks",
"shared/react/types",
"shared/react/types/interfaces",
"shared/react/types/type-aliases",
"shared/index/classes",
"shared/index/functions",
"nextjs/app-router",
"nextjs/server",
"nextjs/server/build-clerk-props",
"nextjs/server/clerk-middleware",
"nextjs/server/create-get-auth",
"nextjs/server/create-get-auth/functions",
"nextjs/server/create-get-auth/variables",
"nextjs/server/clerk-middleware/interfaces",
"nextjs/server/clerk-middleware/variables",
"nextjs/server/build-clerk-props/variables",
"nextjs/app-router/server",
"nextjs/app-router/server/auth",
"nextjs/app-router/server/current-user",
"nextjs/app-router/server/current-user/functions",
"nextjs/app-router/server/auth/variables",
"clerk-react/functions",
"clerk-react/interfaces",
]
`);
});
Expand Down
43 changes: 41 additions & 2 deletions .typedoc/custom-plugin.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,8 @@ const LINK_REPLACEMENTS = [
['session-resource', '/docs/references/javascript/session'],
['signed-in-session-resource', '/docs/references/javascript/session'],
['sign-up-resource', '/docs/references/javascript/sign-up'],
['user-resource', '/docs/references/javascript/user'],
['session-status-claim', '/docs/references/javascript/types/session-status'],
];

/**
Expand All@@ -34,16 +36,45 @@ const LINK_REPLACEMENTS = [
* It also shouldn't matter how level deep the relative link is.
*
* This function returns an array of `{ pattern: string, replace: string }` to pass into the `typedoc-plugin-replace-text` plugin.
*
* @example
* [foo](../../bar.mdx) -> [foo](/new-path)
* [foo](./bar.mdx) -> [foo](/new-path)
* [foo](bar.mdx) -> [foo](/new-path)
* [foo](bar.mdx#some-id) -> [foo](/new-path#some-id)
*/
function getRelativeLinkReplacements() {
return LINK_REPLACEMENTS.map(([fileName, newPath]) => {
return {
pattern: new RegExp(`\\((?:\\.{1,2}\\/)+.*?${fileName}\\.mdx\\)`, 'g'),
replace: `(${newPath})`,
// Match both path and optional anchor
pattern: new RegExp(`\\((?:(?:\\.{1,2}\\/)+[^()]*?|)${fileName}\\.mdx(#[^)]+)?\\)`, 'g'),

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new regex accounts for two bugs I saw:

  • A string contained multiple []() and previously it replaced parts outside of that link (until the next occurence)
  • [foo](bar.mdx) and [foo](bar.mdx#test) didn't work

// Preserve the anchor in replacement if it exists
replace: (/** @type {string} */ _match, anchor = '') => `(${newPath}${anchor})`,
};
});
}

function getUnlinkedTypesReplacements() {
return [
{
pattern: /\(setActiveParams\)/g,
replace: '([setActiveParams](/docs/references/javascript/types/set-active-params))',
},
{
pattern: /`_LocalizationResource`/g,
replace: '[Localization](/docs/customization/localization)',
},
{
pattern: /`LoadedClerk`/g,
replace: '[Clerk](/docs/references/javascript/clerk)',
},
{
pattern: /`OrganizationCustomRoleKey`/g,
replace: '[OrganizationCustomRoleKey](/docs/references/javascript/types/organization-custom-role-key)',
},
];
}

/**
* @param {import('typedoc-plugin-markdown').MarkdownApplication} app
*/
Expand All@@ -58,6 +89,14 @@ export function load(app) {
}
}

const unlinkedTypesReplacements = getUnlinkedTypesReplacements();

for (const { pattern, replace } of unlinkedTypesReplacements) {
if (output.contents) {
output.contents = output.contents.replace(pattern, replace);
}
}

if (fileName) {
if (FILES_WITHOUT_HEADINGS.includes(fileName)) {
if (output.contents) {
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
57059dc
useAuth pass
LekoArts Mar 27, 2025
fdc7ffa
improvements
LekoArts Mar 31, 2025
af1144f
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Mar 31, 2025
f947dea
more improvements
LekoArts Mar 31, 2025
6efc447
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Mar 31, 2025
e9e2b5e
wip
LekoArts Apr 2, 2025
b68d9e8
dep update
LekoArts Apr 2, 2025
2f22078
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 3, 2025
4f126b1
add missing inline
LekoArts Apr 4, 2025
59bd888
update typedoc version
LekoArts Apr 7, 2025
bcaba2e
fix blockTags
LekoArts Apr 7, 2025
8f93fc3
flatten output directories
LekoArts Apr 7, 2025
72036b1
adjust script
LekoArts Apr 8, 2025
0ae6ccb
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 8, 2025
dbb3444
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 9, 2025
d0a4398
output updates
LekoArts Apr 9, 2025
34d659a
add tests
LekoArts Apr 9, 2025
8405567
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
a748bfa
update plugin
LekoArts Apr 10, 2025
da3188b
merge fixes
LekoArts Apr 10, 2025
e23074c
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
feeac3b
lockfile
LekoArts Apr 10, 2025
2223183
add changeset
LekoArts Apr 10, 2025
361692c
simplify theme overrides ✨
LekoArts Apr 10, 2025
3eb7cd2
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
7b2af64
finishing touches
LekoArts Apr 11, 2025
0fb9ede
update snapshot
LekoArts Apr 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/giant-bats-leave.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
---
'@clerk/shared': patch
'@clerk/clerk-react': patch
'@clerk/types': patch
---

Improve JSDoc comments
237 changes: 123 additions & 114 deletions .typedoc/__tests__/__snapshots__/file-structure.test.ts.snap
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,119 +2,128 @@

exports[`Typedoc output > should have a deliberate file structure 1`] = `
[
"types/type-aliases/check-authorization-from-session-claims.mdx",
"types/type-aliases/clerk-host-router.mdx",
"types/type-aliases/clerk-pagination-request.mdx",
"types/type-aliases/element-object-key.mdx",
"types/type-aliases/elements-config.mdx",
"types/type-aliases/id-selectors.mdx",
"types/type-aliases/legacy-redirect-props.mdx",
"types/type-aliases/localization-resource.mdx",
"types/type-aliases/multi-domain-and-or-proxy.mdx",
"types/type-aliases/organization-custom-role-key.mdx",
"types/type-aliases/organization-permission-key.mdx",
"types/type-aliases/organizations-jwt-claim.mdx",
"types/type-aliases/override.mdx",
"types/type-aliases/path-value.mdx",
"types/type-aliases/record-to-path.mdx",
"types/type-aliases/redirect-options.mdx",
"types/type-aliases/saml-strategy.mdx",
"types/type-aliases/sdk-metadata.mdx",
"types/type-aliases/session-status-claim.mdx",
"types/type-aliases/set-active.mdx",
"types/type-aliases/sign-up-authenticate-with-metamask-params.mdx",
"types/type-aliases/signed-in-session-resource.mdx",
"types/type-aliases/state-selectors.mdx",
"types/type-aliases/use-auth-return.mdx",
"types/type-aliases/use-session-list-return.mdx",
"types/type-aliases/use-session-return.mdx",
"types/type-aliases/use-sign-in-return.mdx",
"types/type-aliases/use-sign-up-return.mdx",
"types/type-aliases/use-user-return.mdx",
"types/type-aliases/without.mdx",
"types/interfaces/act-claim.mdx",
"types/interfaces/act-jwt-claim.mdx",
"types/interfaces/active-session-resource.mdx",
"types/interfaces/clerk-api-error.mdx",
"types/interfaces/clerk-jwt-claims.mdx",
"types/interfaces/clerk-paginated-response.mdx",
"types/interfaces/clerk-pagination-params.mdx",
"types/interfaces/clerk-resource.mdx",
"types/interfaces/clerk.mdx",
"types/interfaces/create-organization-params.mdx",
"types/interfaces/jwt-claims.mdx",
"types/interfaces/jwt-header.mdx",
"types/interfaces/pending-session-resource.mdx",
"types/interfaces/session-resource.mdx",
"types/interfaces/set-active-params.mdx",
"types/interfaces/sign-in-resource.mdx",
"types/interfaces/sign-out.mdx",
"types/interfaces/sign-up-resource.mdx",
"shared/react/types/type-aliases/paginated-hook-config.mdx",
"shared/react/types/interfaces/pages-or-infinite-options.mdx",
"shared/react/types/interfaces/paginated-resources.mdx",
"shared/react/hooks/use-clerk.mdx",
"shared/react/hooks/use-organization-list-params.mdx",
"shared/react/hooks/use-organization-list-return.mdx",
"shared/react/hooks/use-organization-list.mdx",
"shared/react/hooks/use-organization-params.mdx",
"shared/react/hooks/use-organization-return.mdx",
"shared/react/hooks/use-organization.mdx",
"shared/react/hooks/use-reverification.mdx",
"shared/react/hooks/use-session-list.mdx",
"shared/react/hooks/use-session.mdx",
"shared/react/hooks/use-user.mdx",
"shared/index/functions/build-clerk-js-script-attributes.mdx",
"shared/index/functions/clerk-js-script-url.mdx",
"shared/index/functions/create-path-matcher.mdx",
"shared/index/functions/deep-camel-to-snake.mdx",
"shared/index/functions/deep-snake-to-camel.mdx",
"shared/index/functions/deprecated-object-property.mdx",
"shared/index/functions/derive-state.mdx",
"shared/index/functions/extract-dev-browser-jwt-from-url.mdx",
"shared/index/functions/fast-deep-merge-and-replace.mdx",
"shared/index/functions/get-clerk-js-major-version-or-tag.mdx",
"shared/index/functions/get-env-variable.mdx",
"shared/index/functions/get-script-url.mdx",
"shared/index/functions/icon-image-url.mdx",
"shared/index/functions/in-browser.mdx",
"shared/index/functions/is-browser-online.mdx",
"shared/index/functions/is-clerk-runtime-error.mdx",
"shared/index/functions/is-publishable-key.mdx",
"shared/index/functions/is-staging.mdx",
"shared/index/functions/is-truthy.mdx",
"shared/index/functions/is-valid-browser-online.mdx",
"shared/index/functions/is-valid-browser.mdx",
"shared/index/functions/isomorphic-atob.mdx",
"shared/index/functions/load-clerk-js-script.mdx",
"shared/index/functions/read-json-file.mdx",
"shared/index/functions/set-clerk-js-loading-error-package-name.mdx",
"shared/index/functions/to-sentence.mdx",
"shared/index/functions/user-agent-is-robot.mdx",
"shared/index/functions/version-selector.mdx",
"shared/index/classes/clerk-runtime-error.mdx",
"nextjs/server/create-get-auth/variables/get-auth.mdx",
"nextjs/server/create-get-auth/functions/create-async-get-auth.mdx",
"nextjs/server/create-get-auth/functions/create-sync-get-auth.mdx",
"nextjs/server/clerk-middleware/variables/clerk-middleware.mdx",
"nextjs/server/clerk-middleware/interfaces/clerk-middleware-options.mdx",
"nextjs/server/build-clerk-props/variables/build-clerk-props.mdx",
"nextjs/app-router/server/current-user/functions/current-user.mdx",
"nextjs/app-router/server/auth/variables/auth.mdx",
"clerk-react/interfaces/clerk-provider-props.mdx",
"clerk-react/functions/protect.mdx",
"clerk-react/functions/redirect-to-create-organization.mdx",
"clerk-react/functions/redirect-to-organization-profile.mdx",
"clerk-react/functions/redirect-to-user-profile.mdx",
"clerk-react/functions/use-auth.mdx",
"clerk-react/functions/use-clerk.mdx",
"clerk-react/functions/use-organization-list.mdx",
"clerk-react/functions/use-organization.mdx",
"clerk-react/functions/use-reverification.mdx",
"clerk-react/functions/use-session-list.mdx",
"clerk-react/functions/use-session.mdx",
"clerk-react/functions/use-sign-in.mdx",
"clerk-react/functions/use-sign-up.mdx",
"clerk-react/functions/use-user.mdx",
"types/act-claim.mdx",
"types/act-jwt-claim.mdx",
"types/active-session-resource.mdx",
"types/check-authorization-fn.mdx",
"types/check-authorization-from-session-claims.mdx",
"types/check-authorization-with-custom-permissions.mdx",
"types/clerk-api-error.mdx",
"types/clerk-host-router.mdx",
"types/clerk-jwt-claims.mdx",
"types/clerk-paginated-response.mdx",
"types/clerk-pagination-params.mdx",
"types/clerk-pagination-request.mdx",
"types/clerk-resource.mdx",
"types/clerk.mdx",
"types/create-organization-params.mdx",
"types/element-object-key.mdx",
"types/elements-config.mdx",
"types/get-token.mdx",
"types/id-selectors.mdx",
"types/jwt-claims.mdx",
"types/jwt-header.mdx",
"types/legacy-redirect-props.mdx",
"types/localization-resource.mdx",
"types/multi-domain-and-or-proxy.mdx",
"types/organization-custom-role-key.mdx",
"types/organization-domain-verification-status.mdx",
"types/organization-enrollment-mode.mdx",
"types/organization-invitation-status.mdx",
"types/organization-permission-key.mdx",
"types/organization-suggestion-status.mdx",
"types/organizations-jwt-claim.mdx",
"types/override.mdx",
"types/path-value.mdx",
"types/pending-session-options.mdx",
"types/pending-session-resource.mdx",
"types/record-to-path.mdx",
"types/redirect-options.mdx",
"types/saml-strategy.mdx",
"types/sdk-metadata.mdx",
"types/session-resource.mdx",
"types/session-status-claim.mdx",
"types/set-active-params.mdx",
"types/set-active.mdx",
"types/sign-in-resource.mdx",
"types/sign-out.mdx",
"types/sign-up-authenticate-with-metamask-params.mdx",
"types/sign-up-resource.mdx",
"types/signed-in-session-resource.mdx",
"types/state-selectors.mdx",
"types/use-auth-return.mdx",
"types/use-session-list-return.mdx",
"types/use-session-return.mdx",
"types/use-sign-in-return.mdx",
"types/use-sign-up-return.mdx",
"types/use-user-return.mdx",
"types/user-resource.mdx",
"types/without.mdx",
"shared/build-clerk-js-script-attributes.mdx",
"shared/clerk-js-script-url.mdx",
"shared/clerk-runtime-error.mdx",
"shared/create-path-matcher.mdx",
"shared/deep-camel-to-snake.mdx",
"shared/deep-snake-to-camel.mdx",
"shared/deprecated-object-property.mdx",
"shared/derive-state.mdx",
"shared/extract-dev-browser-jwt-from-url.mdx",
"shared/fast-deep-merge-and-replace.mdx",
"shared/get-clerk-js-major-version-or-tag.mdx",
"shared/get-env-variable.mdx",
"shared/get-script-url.mdx",
"shared/icon-image-url.mdx",
"shared/in-browser.mdx",
"shared/is-browser-online.mdx",
"shared/is-clerk-runtime-error.mdx",
"shared/is-publishable-key.mdx",
"shared/is-staging.mdx",
"shared/is-truthy.mdx",
"shared/is-valid-browser-online.mdx",
"shared/is-valid-browser.mdx",
"shared/isomorphic-atob.mdx",
"shared/load-clerk-js-script.mdx",
"shared/pages-or-infinite-options.mdx",
"shared/paginated-hook-config.mdx",
"shared/paginated-resources.mdx",
"shared/read-json-file.mdx",
"shared/set-clerk-js-loading-error-package-name.mdx",
"shared/to-sentence.mdx",
"shared/use-clerk.mdx",
"shared/use-organization-list-params.mdx",
"shared/use-organization-list-return.mdx",
"shared/use-organization-list.mdx",
"shared/use-organization-params.mdx",
"shared/use-organization-return.mdx",
"shared/use-organization.mdx",
"shared/use-reverification.mdx",
"shared/use-session-list.mdx",
"shared/use-session.mdx",
"shared/use-user.mdx",
"shared/user-agent-is-robot.mdx",
"shared/version-selector.mdx",
"nextjs/auth.mdx",
"nextjs/build-clerk-props.mdx",
"nextjs/clerk-middleware-options.mdx",
"nextjs/clerk-middleware.mdx",
"nextjs/create-async-get-auth.mdx",
"nextjs/create-sync-get-auth.mdx",
"nextjs/current-user.mdx",
"nextjs/get-auth.mdx",
"clerk-react/clerk-provider-props.mdx",
"clerk-react/protect.mdx",
"clerk-react/redirect-to-create-organization.mdx",
"clerk-react/redirect-to-organization-profile.mdx",
"clerk-react/redirect-to-user-profile.mdx",
"clerk-react/use-auth.mdx",
"clerk-react/use-clerk.mdx",
"clerk-react/use-organization-list.mdx",
"clerk-react/use-organization.mdx",
"clerk-react/use-reverification.mdx",
"clerk-react/use-session-list.mdx",
"clerk-react/use-session.mdx",
"clerk-react/use-sign-in.mdx",
"clerk-react/use-sign-up.mdx",
"clerk-react/use-user.mdx",
]
`;
27 changes: 0 additions & 27 deletions .typedoc/__tests__/file-structure.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,33 +36,6 @@ describe('Typedoc output', () => {
"nextjs",
"shared",
"types",
"types/interfaces",
"types/type-aliases",
"shared/index",
"shared/react",
"shared/react/hooks",
"shared/react/types",
"shared/react/types/interfaces",
"shared/react/types/type-aliases",
"shared/index/classes",
"shared/index/functions",
"nextjs/app-router",
"nextjs/server",
"nextjs/server/build-clerk-props",
"nextjs/server/clerk-middleware",
"nextjs/server/create-get-auth",
"nextjs/server/create-get-auth/functions",
"nextjs/server/create-get-auth/variables",
"nextjs/server/clerk-middleware/interfaces",
"nextjs/server/clerk-middleware/variables",
"nextjs/server/build-clerk-props/variables",
"nextjs/app-router/server",
"nextjs/app-router/server/auth",
"nextjs/app-router/server/current-user",
"nextjs/app-router/server/current-user/functions",
"nextjs/app-router/server/auth/variables",
"clerk-react/functions",
"clerk-react/interfaces",
]
`);
});
Expand Down
43 changes: 41 additions & 2 deletions .typedoc/custom-plugin.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,8 @@ const LINK_REPLACEMENTS = [
['session-resource', '/docs/references/javascript/session'],
['signed-in-session-resource', '/docs/references/javascript/session'],
['sign-up-resource', '/docs/references/javascript/sign-up'],
['user-resource', '/docs/references/javascript/user'],
['session-status-claim', '/docs/references/javascript/types/session-status'],
];

/**
Expand All@@ -34,16 +36,45 @@ const LINK_REPLACEMENTS = [
* It also shouldn't matter how level deep the relative link is.
*
* This function returns an array of `{ pattern: string, replace: string }` to pass into the `typedoc-plugin-replace-text` plugin.
*
* @example
* [foo](../../bar.mdx) -> [foo](/new-path)
* [foo](./bar.mdx) -> [foo](/new-path)
* [foo](bar.mdx) -> [foo](/new-path)
* [foo](bar.mdx#some-id) -> [foo](/new-path#some-id)
*/
function getRelativeLinkReplacements() {
return LINK_REPLACEMENTS.map(([fileName, newPath]) => {
return {
pattern: new RegExp(`\\((?:\\.{1,2}\\/)+.*?${fileName}\\.mdx\\)`, 'g'),
replace: `(${newPath})`,
// Match both path and optional anchor
pattern: new RegExp(`\\((?:(?:\\.{1,2}\\/)+[^()]*?|)${fileName}\\.mdx(#[^)]+)?\\)`, 'g'),

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new regex accounts for two bugs I saw:

  • A string contained multiple []() and previously it replaced parts outside of that link (until the next occurence)
  • [foo](bar.mdx) and [foo](bar.mdx#test) didn't work

// Preserve the anchor in replacement if it exists
replace: (/** @type {string} */ _match, anchor = '') => `(${newPath}${anchor})`,
};
});
}

function getUnlinkedTypesReplacements() {
return [
{
pattern: /\(setActiveParams\)/g,
replace: '([setActiveParams](/docs/references/javascript/types/set-active-params))',
},
{
pattern: /`_LocalizationResource`/g,
replace: '[Localization](/docs/customization/localization)',
},
{
pattern: /`LoadedClerk`/g,
replace: '[Clerk](/docs/references/javascript/clerk)',
},
{
pattern: /`OrganizationCustomRoleKey`/g,
replace: '[OrganizationCustomRoleKey](/docs/references/javascript/types/organization-custom-role-key)',
},
];
}

/**
* @param {import('typedoc-plugin-markdown').MarkdownApplication} app
*/
Expand All@@ -58,6 +89,14 @@ export function load(app) {
}
}

const unlinkedTypesReplacements = getUnlinkedTypesReplacements();

for (const { pattern, replace } of unlinkedTypesReplacements) {
if (output.contents) {
output.contents = output.contents.replace(pattern, replace);
}
}

if (fileName) {
if (FILES_WITHOUT_HEADINGS.includes(fileName)) {
if (output.contents) {
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
57059dc
useAuth pass
LekoArts Mar 27, 2025
fdc7ffa
improvements
LekoArts Mar 31, 2025
af1144f
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Mar 31, 2025
f947dea
more improvements
LekoArts Mar 31, 2025
6efc447
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Mar 31, 2025
e9e2b5e
wip
LekoArts Apr 2, 2025
b68d9e8
dep update
LekoArts Apr 2, 2025
2f22078
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 3, 2025
4f126b1
add missing inline
LekoArts Apr 4, 2025
59bd888
update typedoc version
LekoArts Apr 7, 2025
bcaba2e
fix blockTags
LekoArts Apr 7, 2025
8f93fc3
flatten output directories
LekoArts Apr 7, 2025
72036b1
adjust script
LekoArts Apr 8, 2025
0ae6ccb
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 8, 2025
dbb3444
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 9, 2025
d0a4398
output updates
LekoArts Apr 9, 2025
34d659a
add tests
LekoArts Apr 9, 2025
8405567
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
a748bfa
update plugin
LekoArts Apr 10, 2025
da3188b
merge fixes
LekoArts Apr 10, 2025
e23074c
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
feeac3b
lockfile
LekoArts Apr 10, 2025
2223183
add changeset
LekoArts Apr 10, 2025
361692c
simplify theme overrides ✨
LekoArts Apr 10, 2025
3eb7cd2
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
7b2af64
finishing touches
LekoArts Apr 11, 2025
0fb9ede
update snapshot
LekoArts Apr 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/giant-bats-leave.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
---
'@clerk/shared': patch
'@clerk/clerk-react': patch
'@clerk/types': patch
---

Improve JSDoc comments
237 changes: 123 additions & 114 deletions .typedoc/__tests__/__snapshots__/file-structure.test.ts.snap
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,119 +2,128 @@

exports[`Typedoc output > should have a deliberate file structure 1`] = `
[
"types/type-aliases/check-authorization-from-session-claims.mdx",
"types/type-aliases/clerk-host-router.mdx",
"types/type-aliases/clerk-pagination-request.mdx",
"types/type-aliases/element-object-key.mdx",
"types/type-aliases/elements-config.mdx",
"types/type-aliases/id-selectors.mdx",
"types/type-aliases/legacy-redirect-props.mdx",
"types/type-aliases/localization-resource.mdx",
"types/type-aliases/multi-domain-and-or-proxy.mdx",
"types/type-aliases/organization-custom-role-key.mdx",
"types/type-aliases/organization-permission-key.mdx",
"types/type-aliases/organizations-jwt-claim.mdx",
"types/type-aliases/override.mdx",
"types/type-aliases/path-value.mdx",
"types/type-aliases/record-to-path.mdx",
"types/type-aliases/redirect-options.mdx",
"types/type-aliases/saml-strategy.mdx",
"types/type-aliases/sdk-metadata.mdx",
"types/type-aliases/session-status-claim.mdx",
"types/type-aliases/set-active.mdx",
"types/type-aliases/sign-up-authenticate-with-metamask-params.mdx",
"types/type-aliases/signed-in-session-resource.mdx",
"types/type-aliases/state-selectors.mdx",
"types/type-aliases/use-auth-return.mdx",
"types/type-aliases/use-session-list-return.mdx",
"types/type-aliases/use-session-return.mdx",
"types/type-aliases/use-sign-in-return.mdx",
"types/type-aliases/use-sign-up-return.mdx",
"types/type-aliases/use-user-return.mdx",
"types/type-aliases/without.mdx",
"types/interfaces/act-claim.mdx",
"types/interfaces/act-jwt-claim.mdx",
"types/interfaces/active-session-resource.mdx",
"types/interfaces/clerk-api-error.mdx",
"types/interfaces/clerk-jwt-claims.mdx",
"types/interfaces/clerk-paginated-response.mdx",
"types/interfaces/clerk-pagination-params.mdx",
"types/interfaces/clerk-resource.mdx",
"types/interfaces/clerk.mdx",
"types/interfaces/create-organization-params.mdx",
"types/interfaces/jwt-claims.mdx",
"types/interfaces/jwt-header.mdx",
"types/interfaces/pending-session-resource.mdx",
"types/interfaces/session-resource.mdx",
"types/interfaces/set-active-params.mdx",
"types/interfaces/sign-in-resource.mdx",
"types/interfaces/sign-out.mdx",
"types/interfaces/sign-up-resource.mdx",
"shared/react/types/type-aliases/paginated-hook-config.mdx",
"shared/react/types/interfaces/pages-or-infinite-options.mdx",
"shared/react/types/interfaces/paginated-resources.mdx",
"shared/react/hooks/use-clerk.mdx",
"shared/react/hooks/use-organization-list-params.mdx",
"shared/react/hooks/use-organization-list-return.mdx",
"shared/react/hooks/use-organization-list.mdx",
"shared/react/hooks/use-organization-params.mdx",
"shared/react/hooks/use-organization-return.mdx",
"shared/react/hooks/use-organization.mdx",
"shared/react/hooks/use-reverification.mdx",
"shared/react/hooks/use-session-list.mdx",
"shared/react/hooks/use-session.mdx",
"shared/react/hooks/use-user.mdx",
"shared/index/functions/build-clerk-js-script-attributes.mdx",
"shared/index/functions/clerk-js-script-url.mdx",
"shared/index/functions/create-path-matcher.mdx",
"shared/index/functions/deep-camel-to-snake.mdx",
"shared/index/functions/deep-snake-to-camel.mdx",
"shared/index/functions/deprecated-object-property.mdx",
"shared/index/functions/derive-state.mdx",
"shared/index/functions/extract-dev-browser-jwt-from-url.mdx",
"shared/index/functions/fast-deep-merge-and-replace.mdx",
"shared/index/functions/get-clerk-js-major-version-or-tag.mdx",
"shared/index/functions/get-env-variable.mdx",
"shared/index/functions/get-script-url.mdx",
"shared/index/functions/icon-image-url.mdx",
"shared/index/functions/in-browser.mdx",
"shared/index/functions/is-browser-online.mdx",
"shared/index/functions/is-clerk-runtime-error.mdx",
"shared/index/functions/is-publishable-key.mdx",
"shared/index/functions/is-staging.mdx",
"shared/index/functions/is-truthy.mdx",
"shared/index/functions/is-valid-browser-online.mdx",
"shared/index/functions/is-valid-browser.mdx",
"shared/index/functions/isomorphic-atob.mdx",
"shared/index/functions/load-clerk-js-script.mdx",
"shared/index/functions/read-json-file.mdx",
"shared/index/functions/set-clerk-js-loading-error-package-name.mdx",
"shared/index/functions/to-sentence.mdx",
"shared/index/functions/user-agent-is-robot.mdx",
"shared/index/functions/version-selector.mdx",
"shared/index/classes/clerk-runtime-error.mdx",
"nextjs/server/create-get-auth/variables/get-auth.mdx",
"nextjs/server/create-get-auth/functions/create-async-get-auth.mdx",
"nextjs/server/create-get-auth/functions/create-sync-get-auth.mdx",
"nextjs/server/clerk-middleware/variables/clerk-middleware.mdx",
"nextjs/server/clerk-middleware/interfaces/clerk-middleware-options.mdx",
"nextjs/server/build-clerk-props/variables/build-clerk-props.mdx",
"nextjs/app-router/server/current-user/functions/current-user.mdx",
"nextjs/app-router/server/auth/variables/auth.mdx",
"clerk-react/interfaces/clerk-provider-props.mdx",
"clerk-react/functions/protect.mdx",
"clerk-react/functions/redirect-to-create-organization.mdx",
"clerk-react/functions/redirect-to-organization-profile.mdx",
"clerk-react/functions/redirect-to-user-profile.mdx",
"clerk-react/functions/use-auth.mdx",
"clerk-react/functions/use-clerk.mdx",
"clerk-react/functions/use-organization-list.mdx",
"clerk-react/functions/use-organization.mdx",
"clerk-react/functions/use-reverification.mdx",
"clerk-react/functions/use-session-list.mdx",
"clerk-react/functions/use-session.mdx",
"clerk-react/functions/use-sign-in.mdx",
"clerk-react/functions/use-sign-up.mdx",
"clerk-react/functions/use-user.mdx",
"types/act-claim.mdx",
"types/act-jwt-claim.mdx",
"types/active-session-resource.mdx",
"types/check-authorization-fn.mdx",
"types/check-authorization-from-session-claims.mdx",
"types/check-authorization-with-custom-permissions.mdx",
"types/clerk-api-error.mdx",
"types/clerk-host-router.mdx",
"types/clerk-jwt-claims.mdx",
"types/clerk-paginated-response.mdx",
"types/clerk-pagination-params.mdx",
"types/clerk-pagination-request.mdx",
"types/clerk-resource.mdx",
"types/clerk.mdx",
"types/create-organization-params.mdx",
"types/element-object-key.mdx",
"types/elements-config.mdx",
"types/get-token.mdx",
"types/id-selectors.mdx",
"types/jwt-claims.mdx",
"types/jwt-header.mdx",
"types/legacy-redirect-props.mdx",
"types/localization-resource.mdx",
"types/multi-domain-and-or-proxy.mdx",
"types/organization-custom-role-key.mdx",
"types/organization-domain-verification-status.mdx",
"types/organization-enrollment-mode.mdx",
"types/organization-invitation-status.mdx",
"types/organization-permission-key.mdx",
"types/organization-suggestion-status.mdx",
"types/organizations-jwt-claim.mdx",
"types/override.mdx",
"types/path-value.mdx",
"types/pending-session-options.mdx",
"types/pending-session-resource.mdx",
"types/record-to-path.mdx",
"types/redirect-options.mdx",
"types/saml-strategy.mdx",
"types/sdk-metadata.mdx",
"types/session-resource.mdx",
"types/session-status-claim.mdx",
"types/set-active-params.mdx",
"types/set-active.mdx",
"types/sign-in-resource.mdx",
"types/sign-out.mdx",
"types/sign-up-authenticate-with-metamask-params.mdx",
"types/sign-up-resource.mdx",
"types/signed-in-session-resource.mdx",
"types/state-selectors.mdx",
"types/use-auth-return.mdx",
"types/use-session-list-return.mdx",
"types/use-session-return.mdx",
"types/use-sign-in-return.mdx",
"types/use-sign-up-return.mdx",
"types/use-user-return.mdx",
"types/user-resource.mdx",
"types/without.mdx",
"shared/build-clerk-js-script-attributes.mdx",
"shared/clerk-js-script-url.mdx",
"shared/clerk-runtime-error.mdx",
"shared/create-path-matcher.mdx",
"shared/deep-camel-to-snake.mdx",
"shared/deep-snake-to-camel.mdx",
"shared/deprecated-object-property.mdx",
"shared/derive-state.mdx",
"shared/extract-dev-browser-jwt-from-url.mdx",
"shared/fast-deep-merge-and-replace.mdx",
"shared/get-clerk-js-major-version-or-tag.mdx",
"shared/get-env-variable.mdx",
"shared/get-script-url.mdx",
"shared/icon-image-url.mdx",
"shared/in-browser.mdx",
"shared/is-browser-online.mdx",
"shared/is-clerk-runtime-error.mdx",
"shared/is-publishable-key.mdx",
"shared/is-staging.mdx",
"shared/is-truthy.mdx",
"shared/is-valid-browser-online.mdx",
"shared/is-valid-browser.mdx",
"shared/isomorphic-atob.mdx",
"shared/load-clerk-js-script.mdx",
"shared/pages-or-infinite-options.mdx",
"shared/paginated-hook-config.mdx",
"shared/paginated-resources.mdx",
"shared/read-json-file.mdx",
"shared/set-clerk-js-loading-error-package-name.mdx",
"shared/to-sentence.mdx",
"shared/use-clerk.mdx",
"shared/use-organization-list-params.mdx",
"shared/use-organization-list-return.mdx",
"shared/use-organization-list.mdx",
"shared/use-organization-params.mdx",
"shared/use-organization-return.mdx",
"shared/use-organization.mdx",
"shared/use-reverification.mdx",
"shared/use-session-list.mdx",
"shared/use-session.mdx",
"shared/use-user.mdx",
"shared/user-agent-is-robot.mdx",
"shared/version-selector.mdx",
"nextjs/auth.mdx",
"nextjs/build-clerk-props.mdx",
"nextjs/clerk-middleware-options.mdx",
"nextjs/clerk-middleware.mdx",
"nextjs/create-async-get-auth.mdx",
"nextjs/create-sync-get-auth.mdx",
"nextjs/current-user.mdx",
"nextjs/get-auth.mdx",
"clerk-react/clerk-provider-props.mdx",
"clerk-react/protect.mdx",
"clerk-react/redirect-to-create-organization.mdx",
"clerk-react/redirect-to-organization-profile.mdx",
"clerk-react/redirect-to-user-profile.mdx",
"clerk-react/use-auth.mdx",
"clerk-react/use-clerk.mdx",
"clerk-react/use-organization-list.mdx",
"clerk-react/use-organization.mdx",
"clerk-react/use-reverification.mdx",
"clerk-react/use-session-list.mdx",
"clerk-react/use-session.mdx",
"clerk-react/use-sign-in.mdx",
"clerk-react/use-sign-up.mdx",
"clerk-react/use-user.mdx",
]
`;
27 changes: 0 additions & 27 deletions .typedoc/__tests__/file-structure.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,33 +36,6 @@ describe('Typedoc output', () => {
"nextjs",
"shared",
"types",
"types/interfaces",
"types/type-aliases",
"shared/index",
"shared/react",
"shared/react/hooks",
"shared/react/types",
"shared/react/types/interfaces",
"shared/react/types/type-aliases",
"shared/index/classes",
"shared/index/functions",
"nextjs/app-router",
"nextjs/server",
"nextjs/server/build-clerk-props",
"nextjs/server/clerk-middleware",
"nextjs/server/create-get-auth",
"nextjs/server/create-get-auth/functions",
"nextjs/server/create-get-auth/variables",
"nextjs/server/clerk-middleware/interfaces",
"nextjs/server/clerk-middleware/variables",
"nextjs/server/build-clerk-props/variables",
"nextjs/app-router/server",
"nextjs/app-router/server/auth",
"nextjs/app-router/server/current-user",
"nextjs/app-router/server/current-user/functions",
"nextjs/app-router/server/auth/variables",
"clerk-react/functions",
"clerk-react/interfaces",
]
`);
});
Expand Down
43 changes: 41 additions & 2 deletions .typedoc/custom-plugin.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,8 @@ const LINK_REPLACEMENTS = [
['session-resource', '/docs/references/javascript/session'],
['signed-in-session-resource', '/docs/references/javascript/session'],
['sign-up-resource', '/docs/references/javascript/sign-up'],
['user-resource', '/docs/references/javascript/user'],
['session-status-claim', '/docs/references/javascript/types/session-status'],
];

/**
Expand All@@ -34,16 +36,45 @@ const LINK_REPLACEMENTS = [
* It also shouldn't matter how level deep the relative link is.
*
* This function returns an array of `{ pattern: string, replace: string }` to pass into the `typedoc-plugin-replace-text` plugin.
*
* @example
* [foo](../../bar.mdx) -> [foo](/new-path)
* [foo](./bar.mdx) -> [foo](/new-path)
* [foo](bar.mdx) -> [foo](/new-path)
* [foo](bar.mdx#some-id) -> [foo](/new-path#some-id)
*/
function getRelativeLinkReplacements() {
return LINK_REPLACEMENTS.map(([fileName, newPath]) => {
return {
pattern: new RegExp(`\\((?:\\.{1,2}\\/)+.*?${fileName}\\.mdx\\)`, 'g'),
replace: `(${newPath})`,
// Match both path and optional anchor
pattern: new RegExp(`\\((?:(?:\\.{1,2}\\/)+[^()]*?|)${fileName}\\.mdx(#[^)]+)?\\)`, 'g'),

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new regex accounts for two bugs I saw:

  • A string contained multiple []() and previously it replaced parts outside of that link (until the next occurence)
  • [foo](bar.mdx) and [foo](bar.mdx#test) didn't work

// Preserve the anchor in replacement if it exists
replace: (/** @type {string} */ _match, anchor = '') => `(${newPath}${anchor})`,
};
});
}

function getUnlinkedTypesReplacements() {
return [
{
pattern: /\(setActiveParams\)/g,
replace: '([setActiveParams](/docs/references/javascript/types/set-active-params))',
},
{
pattern: /`_LocalizationResource`/g,
replace: '[Localization](/docs/customization/localization)',
},
{
pattern: /`LoadedClerk`/g,
replace: '[Clerk](/docs/references/javascript/clerk)',
},
{
pattern: /`OrganizationCustomRoleKey`/g,
replace: '[OrganizationCustomRoleKey](/docs/references/javascript/types/organization-custom-role-key)',
},
];
}

/**
* @param {import('typedoc-plugin-markdown').MarkdownApplication} app
*/
Expand All@@ -58,6 +89,14 @@ export function load(app) {
}
}

const unlinkedTypesReplacements = getUnlinkedTypesReplacements();

for (const { pattern, replace } of unlinkedTypesReplacements) {
if (output.contents) {
output.contents = output.contents.replace(pattern, replace);
}
}

if (fileName) {
if (FILES_WITHOUT_HEADINGS.includes(fileName)) {
if (output.contents) {
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
57059dc
useAuth pass
LekoArts Mar 27, 2025
fdc7ffa
improvements
LekoArts Mar 31, 2025
af1144f
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Mar 31, 2025
f947dea
more improvements
LekoArts Mar 31, 2025
6efc447
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Mar 31, 2025
e9e2b5e
wip
LekoArts Apr 2, 2025
b68d9e8
dep update
LekoArts Apr 2, 2025
2f22078
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 3, 2025
4f126b1
add missing inline
LekoArts Apr 4, 2025
59bd888
update typedoc version
LekoArts Apr 7, 2025
bcaba2e
fix blockTags
LekoArts Apr 7, 2025
8f93fc3
flatten output directories
LekoArts Apr 7, 2025
72036b1
adjust script
LekoArts Apr 8, 2025
0ae6ccb
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 8, 2025
dbb3444
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 9, 2025
d0a4398
output updates
LekoArts Apr 9, 2025
34d659a
add tests
LekoArts Apr 9, 2025
8405567
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
a748bfa
update plugin
LekoArts Apr 10, 2025
da3188b
merge fixes
LekoArts Apr 10, 2025
e23074c
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
feeac3b
lockfile
LekoArts Apr 10, 2025
2223183
add changeset
LekoArts Apr 10, 2025
361692c
simplify theme overrides ✨
LekoArts Apr 10, 2025
3eb7cd2
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
7b2af64
finishing touches
LekoArts Apr 11, 2025
0fb9ede
update snapshot
LekoArts Apr 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/giant-bats-leave.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
---
'@clerk/shared': patch
'@clerk/clerk-react': patch
'@clerk/types': patch
---

Improve JSDoc comments
237 changes: 123 additions & 114 deletions .typedoc/__tests__/__snapshots__/file-structure.test.ts.snap
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,119 +2,128 @@

exports[`Typedoc output > should have a deliberate file structure 1`] = `
[
"types/type-aliases/check-authorization-from-session-claims.mdx",
"types/type-aliases/clerk-host-router.mdx",
"types/type-aliases/clerk-pagination-request.mdx",
"types/type-aliases/element-object-key.mdx",
"types/type-aliases/elements-config.mdx",
"types/type-aliases/id-selectors.mdx",
"types/type-aliases/legacy-redirect-props.mdx",
"types/type-aliases/localization-resource.mdx",
"types/type-aliases/multi-domain-and-or-proxy.mdx",
"types/type-aliases/organization-custom-role-key.mdx",
"types/type-aliases/organization-permission-key.mdx",
"types/type-aliases/organizations-jwt-claim.mdx",
"types/type-aliases/override.mdx",
"types/type-aliases/path-value.mdx",
"types/type-aliases/record-to-path.mdx",
"types/type-aliases/redirect-options.mdx",
"types/type-aliases/saml-strategy.mdx",
"types/type-aliases/sdk-metadata.mdx",
"types/type-aliases/session-status-claim.mdx",
"types/type-aliases/set-active.mdx",
"types/type-aliases/sign-up-authenticate-with-metamask-params.mdx",
"types/type-aliases/signed-in-session-resource.mdx",
"types/type-aliases/state-selectors.mdx",
"types/type-aliases/use-auth-return.mdx",
"types/type-aliases/use-session-list-return.mdx",
"types/type-aliases/use-session-return.mdx",
"types/type-aliases/use-sign-in-return.mdx",
"types/type-aliases/use-sign-up-return.mdx",
"types/type-aliases/use-user-return.mdx",
"types/type-aliases/without.mdx",
"types/interfaces/act-claim.mdx",
"types/interfaces/act-jwt-claim.mdx",
"types/interfaces/active-session-resource.mdx",
"types/interfaces/clerk-api-error.mdx",
"types/interfaces/clerk-jwt-claims.mdx",
"types/interfaces/clerk-paginated-response.mdx",
"types/interfaces/clerk-pagination-params.mdx",
"types/interfaces/clerk-resource.mdx",
"types/interfaces/clerk.mdx",
"types/interfaces/create-organization-params.mdx",
"types/interfaces/jwt-claims.mdx",
"types/interfaces/jwt-header.mdx",
"types/interfaces/pending-session-resource.mdx",
"types/interfaces/session-resource.mdx",
"types/interfaces/set-active-params.mdx",
"types/interfaces/sign-in-resource.mdx",
"types/interfaces/sign-out.mdx",
"types/interfaces/sign-up-resource.mdx",
"shared/react/types/type-aliases/paginated-hook-config.mdx",
"shared/react/types/interfaces/pages-or-infinite-options.mdx",
"shared/react/types/interfaces/paginated-resources.mdx",
"shared/react/hooks/use-clerk.mdx",
"shared/react/hooks/use-organization-list-params.mdx",
"shared/react/hooks/use-organization-list-return.mdx",
"shared/react/hooks/use-organization-list.mdx",
"shared/react/hooks/use-organization-params.mdx",
"shared/react/hooks/use-organization-return.mdx",
"shared/react/hooks/use-organization.mdx",
"shared/react/hooks/use-reverification.mdx",
"shared/react/hooks/use-session-list.mdx",
"shared/react/hooks/use-session.mdx",
"shared/react/hooks/use-user.mdx",
"shared/index/functions/build-clerk-js-script-attributes.mdx",
"shared/index/functions/clerk-js-script-url.mdx",
"shared/index/functions/create-path-matcher.mdx",
"shared/index/functions/deep-camel-to-snake.mdx",
"shared/index/functions/deep-snake-to-camel.mdx",
"shared/index/functions/deprecated-object-property.mdx",
"shared/index/functions/derive-state.mdx",
"shared/index/functions/extract-dev-browser-jwt-from-url.mdx",
"shared/index/functions/fast-deep-merge-and-replace.mdx",
"shared/index/functions/get-clerk-js-major-version-or-tag.mdx",
"shared/index/functions/get-env-variable.mdx",
"shared/index/functions/get-script-url.mdx",
"shared/index/functions/icon-image-url.mdx",
"shared/index/functions/in-browser.mdx",
"shared/index/functions/is-browser-online.mdx",
"shared/index/functions/is-clerk-runtime-error.mdx",
"shared/index/functions/is-publishable-key.mdx",
"shared/index/functions/is-staging.mdx",
"shared/index/functions/is-truthy.mdx",
"shared/index/functions/is-valid-browser-online.mdx",
"shared/index/functions/is-valid-browser.mdx",
"shared/index/functions/isomorphic-atob.mdx",
"shared/index/functions/load-clerk-js-script.mdx",
"shared/index/functions/read-json-file.mdx",
"shared/index/functions/set-clerk-js-loading-error-package-name.mdx",
"shared/index/functions/to-sentence.mdx",
"shared/index/functions/user-agent-is-robot.mdx",
"shared/index/functions/version-selector.mdx",
"shared/index/classes/clerk-runtime-error.mdx",
"nextjs/server/create-get-auth/variables/get-auth.mdx",
"nextjs/server/create-get-auth/functions/create-async-get-auth.mdx",
"nextjs/server/create-get-auth/functions/create-sync-get-auth.mdx",
"nextjs/server/clerk-middleware/variables/clerk-middleware.mdx",
"nextjs/server/clerk-middleware/interfaces/clerk-middleware-options.mdx",
"nextjs/server/build-clerk-props/variables/build-clerk-props.mdx",
"nextjs/app-router/server/current-user/functions/current-user.mdx",
"nextjs/app-router/server/auth/variables/auth.mdx",
"clerk-react/interfaces/clerk-provider-props.mdx",
"clerk-react/functions/protect.mdx",
"clerk-react/functions/redirect-to-create-organization.mdx",
"clerk-react/functions/redirect-to-organization-profile.mdx",
"clerk-react/functions/redirect-to-user-profile.mdx",
"clerk-react/functions/use-auth.mdx",
"clerk-react/functions/use-clerk.mdx",
"clerk-react/functions/use-organization-list.mdx",
"clerk-react/functions/use-organization.mdx",
"clerk-react/functions/use-reverification.mdx",
"clerk-react/functions/use-session-list.mdx",
"clerk-react/functions/use-session.mdx",
"clerk-react/functions/use-sign-in.mdx",
"clerk-react/functions/use-sign-up.mdx",
"clerk-react/functions/use-user.mdx",
"types/act-claim.mdx",
"types/act-jwt-claim.mdx",
"types/active-session-resource.mdx",
"types/check-authorization-fn.mdx",
"types/check-authorization-from-session-claims.mdx",
"types/check-authorization-with-custom-permissions.mdx",
"types/clerk-api-error.mdx",
"types/clerk-host-router.mdx",
"types/clerk-jwt-claims.mdx",
"types/clerk-paginated-response.mdx",
"types/clerk-pagination-params.mdx",
"types/clerk-pagination-request.mdx",
"types/clerk-resource.mdx",
"types/clerk.mdx",
"types/create-organization-params.mdx",
"types/element-object-key.mdx",
"types/elements-config.mdx",
"types/get-token.mdx",
"types/id-selectors.mdx",
"types/jwt-claims.mdx",
"types/jwt-header.mdx",
"types/legacy-redirect-props.mdx",
"types/localization-resource.mdx",
"types/multi-domain-and-or-proxy.mdx",
"types/organization-custom-role-key.mdx",
"types/organization-domain-verification-status.mdx",
"types/organization-enrollment-mode.mdx",
"types/organization-invitation-status.mdx",
"types/organization-permission-key.mdx",
"types/organization-suggestion-status.mdx",
"types/organizations-jwt-claim.mdx",
"types/override.mdx",
"types/path-value.mdx",
"types/pending-session-options.mdx",
"types/pending-session-resource.mdx",
"types/record-to-path.mdx",
"types/redirect-options.mdx",
"types/saml-strategy.mdx",
"types/sdk-metadata.mdx",
"types/session-resource.mdx",
"types/session-status-claim.mdx",
"types/set-active-params.mdx",
"types/set-active.mdx",
"types/sign-in-resource.mdx",
"types/sign-out.mdx",
"types/sign-up-authenticate-with-metamask-params.mdx",
"types/sign-up-resource.mdx",
"types/signed-in-session-resource.mdx",
"types/state-selectors.mdx",
"types/use-auth-return.mdx",
"types/use-session-list-return.mdx",
"types/use-session-return.mdx",
"types/use-sign-in-return.mdx",
"types/use-sign-up-return.mdx",
"types/use-user-return.mdx",
"types/user-resource.mdx",
"types/without.mdx",
"shared/build-clerk-js-script-attributes.mdx",
"shared/clerk-js-script-url.mdx",
"shared/clerk-runtime-error.mdx",
"shared/create-path-matcher.mdx",
"shared/deep-camel-to-snake.mdx",
"shared/deep-snake-to-camel.mdx",
"shared/deprecated-object-property.mdx",
"shared/derive-state.mdx",
"shared/extract-dev-browser-jwt-from-url.mdx",
"shared/fast-deep-merge-and-replace.mdx",
"shared/get-clerk-js-major-version-or-tag.mdx",
"shared/get-env-variable.mdx",
"shared/get-script-url.mdx",
"shared/icon-image-url.mdx",
"shared/in-browser.mdx",
"shared/is-browser-online.mdx",
"shared/is-clerk-runtime-error.mdx",
"shared/is-publishable-key.mdx",
"shared/is-staging.mdx",
"shared/is-truthy.mdx",
"shared/is-valid-browser-online.mdx",
"shared/is-valid-browser.mdx",
"shared/isomorphic-atob.mdx",
"shared/load-clerk-js-script.mdx",
"shared/pages-or-infinite-options.mdx",
"shared/paginated-hook-config.mdx",
"shared/paginated-resources.mdx",
"shared/read-json-file.mdx",
"shared/set-clerk-js-loading-error-package-name.mdx",
"shared/to-sentence.mdx",
"shared/use-clerk.mdx",
"shared/use-organization-list-params.mdx",
"shared/use-organization-list-return.mdx",
"shared/use-organization-list.mdx",
"shared/use-organization-params.mdx",
"shared/use-organization-return.mdx",
"shared/use-organization.mdx",
"shared/use-reverification.mdx",
"shared/use-session-list.mdx",
"shared/use-session.mdx",
"shared/use-user.mdx",
"shared/user-agent-is-robot.mdx",
"shared/version-selector.mdx",
"nextjs/auth.mdx",
"nextjs/build-clerk-props.mdx",
"nextjs/clerk-middleware-options.mdx",
"nextjs/clerk-middleware.mdx",
"nextjs/create-async-get-auth.mdx",
"nextjs/create-sync-get-auth.mdx",
"nextjs/current-user.mdx",
"nextjs/get-auth.mdx",
"clerk-react/clerk-provider-props.mdx",
"clerk-react/protect.mdx",
"clerk-react/redirect-to-create-organization.mdx",
"clerk-react/redirect-to-organization-profile.mdx",
"clerk-react/redirect-to-user-profile.mdx",
"clerk-react/use-auth.mdx",
"clerk-react/use-clerk.mdx",
"clerk-react/use-organization-list.mdx",
"clerk-react/use-organization.mdx",
"clerk-react/use-reverification.mdx",
"clerk-react/use-session-list.mdx",
"clerk-react/use-session.mdx",
"clerk-react/use-sign-in.mdx",
"clerk-react/use-sign-up.mdx",
"clerk-react/use-user.mdx",
]
`;
27 changes: 0 additions & 27 deletions .typedoc/__tests__/file-structure.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,33 +36,6 @@ describe('Typedoc output', () => {
"nextjs",
"shared",
"types",
"types/interfaces",
"types/type-aliases",
"shared/index",
"shared/react",
"shared/react/hooks",
"shared/react/types",
"shared/react/types/interfaces",
"shared/react/types/type-aliases",
"shared/index/classes",
"shared/index/functions",
"nextjs/app-router",
"nextjs/server",
"nextjs/server/build-clerk-props",
"nextjs/server/clerk-middleware",
"nextjs/server/create-get-auth",
"nextjs/server/create-get-auth/functions",
"nextjs/server/create-get-auth/variables",
"nextjs/server/clerk-middleware/interfaces",
"nextjs/server/clerk-middleware/variables",
"nextjs/server/build-clerk-props/variables",
"nextjs/app-router/server",
"nextjs/app-router/server/auth",
"nextjs/app-router/server/current-user",
"nextjs/app-router/server/current-user/functions",
"nextjs/app-router/server/auth/variables",
"clerk-react/functions",
"clerk-react/interfaces",
]
`);
});
Expand Down
43 changes: 41 additions & 2 deletions .typedoc/custom-plugin.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,8 @@ const LINK_REPLACEMENTS = [
['session-resource', '/docs/references/javascript/session'],
['signed-in-session-resource', '/docs/references/javascript/session'],
['sign-up-resource', '/docs/references/javascript/sign-up'],
['user-resource', '/docs/references/javascript/user'],
['session-status-claim', '/docs/references/javascript/types/session-status'],
];

/**
Expand All@@ -34,16 +36,45 @@ const LINK_REPLACEMENTS = [
* It also shouldn't matter how level deep the relative link is.
*
* This function returns an array of `{ pattern: string, replace: string }` to pass into the `typedoc-plugin-replace-text` plugin.
*
* @example
* [foo](../../bar.mdx) -> [foo](/new-path)
* [foo](./bar.mdx) -> [foo](/new-path)
* [foo](bar.mdx) -> [foo](/new-path)
* [foo](bar.mdx#some-id) -> [foo](/new-path#some-id)
*/
function getRelativeLinkReplacements() {
return LINK_REPLACEMENTS.map(([fileName, newPath]) => {
return {
pattern: new RegExp(`\\((?:\\.{1,2}\\/)+.*?${fileName}\\.mdx\\)`, 'g'),
replace: `(${newPath})`,
// Match both path and optional anchor
pattern: new RegExp(`\\((?:(?:\\.{1,2}\\/)+[^()]*?|)${fileName}\\.mdx(#[^)]+)?\\)`, 'g'),

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new regex accounts for two bugs I saw:

  • A string contained multiple []() and previously it replaced parts outside of that link (until the next occurence)
  • [foo](bar.mdx) and [foo](bar.mdx#test) didn't work

// Preserve the anchor in replacement if it exists
replace: (/** @type {string} */ _match, anchor = '') => `(${newPath}${anchor})`,
};
});
}

function getUnlinkedTypesReplacements() {
return [
{
pattern: /\(setActiveParams\)/g,
replace: '([setActiveParams](/docs/references/javascript/types/set-active-params))',
},
{
pattern: /`_LocalizationResource`/g,
replace: '[Localization](/docs/customization/localization)',
},
{
pattern: /`LoadedClerk`/g,
replace: '[Clerk](/docs/references/javascript/clerk)',
},
{
pattern: /`OrganizationCustomRoleKey`/g,
replace: '[OrganizationCustomRoleKey](/docs/references/javascript/types/organization-custom-role-key)',
},
];
}

/**
* @param {import('typedoc-plugin-markdown').MarkdownApplication} app
*/
Expand All@@ -58,6 +89,14 @@ export function load(app) {
}
}

const unlinkedTypesReplacements = getUnlinkedTypesReplacements();

for (const { pattern, replace } of unlinkedTypesReplacements) {
if (output.contents) {
output.contents = output.contents.replace(pattern, replace);
}
}

if (fileName) {
if (FILES_WITHOUT_HEADINGS.includes(fileName)) {
if (output.contents) {
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
57059dc
useAuth pass
LekoArts Mar 27, 2025
fdc7ffa
improvements
LekoArts Mar 31, 2025
af1144f
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Mar 31, 2025
f947dea
more improvements
LekoArts Mar 31, 2025
6efc447
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Mar 31, 2025
e9e2b5e
wip
LekoArts Apr 2, 2025
b68d9e8
dep update
LekoArts Apr 2, 2025
2f22078
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 3, 2025
4f126b1
add missing inline
LekoArts Apr 4, 2025
59bd888
update typedoc version
LekoArts Apr 7, 2025
bcaba2e
fix blockTags
LekoArts Apr 7, 2025
8f93fc3
flatten output directories
LekoArts Apr 7, 2025
72036b1
adjust script
LekoArts Apr 8, 2025
0ae6ccb
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 8, 2025
dbb3444
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 9, 2025
d0a4398
output updates
LekoArts Apr 9, 2025
34d659a
add tests
LekoArts Apr 9, 2025
8405567
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
a748bfa
update plugin
LekoArts Apr 10, 2025
da3188b
merge fixes
LekoArts Apr 10, 2025
e23074c
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
feeac3b
lockfile
LekoArts Apr 10, 2025
2223183
add changeset
LekoArts Apr 10, 2025
361692c
simplify theme overrides ✨
LekoArts Apr 10, 2025
3eb7cd2
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
7b2af64
finishing touches
LekoArts Apr 11, 2025
0fb9ede
update snapshot
LekoArts Apr 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/giant-bats-leave.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
---
'@clerk/shared': patch
'@clerk/clerk-react': patch
'@clerk/types': patch
---

Improve JSDoc comments
237 changes: 123 additions & 114 deletions .typedoc/__tests__/__snapshots__/file-structure.test.ts.snap
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,119 +2,128 @@

exports[`Typedoc output > should have a deliberate file structure 1`] = `
[
"types/type-aliases/check-authorization-from-session-claims.mdx",
"types/type-aliases/clerk-host-router.mdx",
"types/type-aliases/clerk-pagination-request.mdx",
"types/type-aliases/element-object-key.mdx",
"types/type-aliases/elements-config.mdx",
"types/type-aliases/id-selectors.mdx",
"types/type-aliases/legacy-redirect-props.mdx",
"types/type-aliases/localization-resource.mdx",
"types/type-aliases/multi-domain-and-or-proxy.mdx",
"types/type-aliases/organization-custom-role-key.mdx",
"types/type-aliases/organization-permission-key.mdx",
"types/type-aliases/organizations-jwt-claim.mdx",
"types/type-aliases/override.mdx",
"types/type-aliases/path-value.mdx",
"types/type-aliases/record-to-path.mdx",
"types/type-aliases/redirect-options.mdx",
"types/type-aliases/saml-strategy.mdx",
"types/type-aliases/sdk-metadata.mdx",
"types/type-aliases/session-status-claim.mdx",
"types/type-aliases/set-active.mdx",
"types/type-aliases/sign-up-authenticate-with-metamask-params.mdx",
"types/type-aliases/signed-in-session-resource.mdx",
"types/type-aliases/state-selectors.mdx",
"types/type-aliases/use-auth-return.mdx",
"types/type-aliases/use-session-list-return.mdx",
"types/type-aliases/use-session-return.mdx",
"types/type-aliases/use-sign-in-return.mdx",
"types/type-aliases/use-sign-up-return.mdx",
"types/type-aliases/use-user-return.mdx",
"types/type-aliases/without.mdx",
"types/interfaces/act-claim.mdx",
"types/interfaces/act-jwt-claim.mdx",
"types/interfaces/active-session-resource.mdx",
"types/interfaces/clerk-api-error.mdx",
"types/interfaces/clerk-jwt-claims.mdx",
"types/interfaces/clerk-paginated-response.mdx",
"types/interfaces/clerk-pagination-params.mdx",
"types/interfaces/clerk-resource.mdx",
"types/interfaces/clerk.mdx",
"types/interfaces/create-organization-params.mdx",
"types/interfaces/jwt-claims.mdx",
"types/interfaces/jwt-header.mdx",
"types/interfaces/pending-session-resource.mdx",
"types/interfaces/session-resource.mdx",
"types/interfaces/set-active-params.mdx",
"types/interfaces/sign-in-resource.mdx",
"types/interfaces/sign-out.mdx",
"types/interfaces/sign-up-resource.mdx",
"shared/react/types/type-aliases/paginated-hook-config.mdx",
"shared/react/types/interfaces/pages-or-infinite-options.mdx",
"shared/react/types/interfaces/paginated-resources.mdx",
"shared/react/hooks/use-clerk.mdx",
"shared/react/hooks/use-organization-list-params.mdx",
"shared/react/hooks/use-organization-list-return.mdx",
"shared/react/hooks/use-organization-list.mdx",
"shared/react/hooks/use-organization-params.mdx",
"shared/react/hooks/use-organization-return.mdx",
"shared/react/hooks/use-organization.mdx",
"shared/react/hooks/use-reverification.mdx",
"shared/react/hooks/use-session-list.mdx",
"shared/react/hooks/use-session.mdx",
"shared/react/hooks/use-user.mdx",
"shared/index/functions/build-clerk-js-script-attributes.mdx",
"shared/index/functions/clerk-js-script-url.mdx",
"shared/index/functions/create-path-matcher.mdx",
"shared/index/functions/deep-camel-to-snake.mdx",
"shared/index/functions/deep-snake-to-camel.mdx",
"shared/index/functions/deprecated-object-property.mdx",
"shared/index/functions/derive-state.mdx",
"shared/index/functions/extract-dev-browser-jwt-from-url.mdx",
"shared/index/functions/fast-deep-merge-and-replace.mdx",
"shared/index/functions/get-clerk-js-major-version-or-tag.mdx",
"shared/index/functions/get-env-variable.mdx",
"shared/index/functions/get-script-url.mdx",
"shared/index/functions/icon-image-url.mdx",
"shared/index/functions/in-browser.mdx",
"shared/index/functions/is-browser-online.mdx",
"shared/index/functions/is-clerk-runtime-error.mdx",
"shared/index/functions/is-publishable-key.mdx",
"shared/index/functions/is-staging.mdx",
"shared/index/functions/is-truthy.mdx",
"shared/index/functions/is-valid-browser-online.mdx",
"shared/index/functions/is-valid-browser.mdx",
"shared/index/functions/isomorphic-atob.mdx",
"shared/index/functions/load-clerk-js-script.mdx",
"shared/index/functions/read-json-file.mdx",
"shared/index/functions/set-clerk-js-loading-error-package-name.mdx",
"shared/index/functions/to-sentence.mdx",
"shared/index/functions/user-agent-is-robot.mdx",
"shared/index/functions/version-selector.mdx",
"shared/index/classes/clerk-runtime-error.mdx",
"nextjs/server/create-get-auth/variables/get-auth.mdx",
"nextjs/server/create-get-auth/functions/create-async-get-auth.mdx",
"nextjs/server/create-get-auth/functions/create-sync-get-auth.mdx",
"nextjs/server/clerk-middleware/variables/clerk-middleware.mdx",
"nextjs/server/clerk-middleware/interfaces/clerk-middleware-options.mdx",
"nextjs/server/build-clerk-props/variables/build-clerk-props.mdx",
"nextjs/app-router/server/current-user/functions/current-user.mdx",
"nextjs/app-router/server/auth/variables/auth.mdx",
"clerk-react/interfaces/clerk-provider-props.mdx",
"clerk-react/functions/protect.mdx",
"clerk-react/functions/redirect-to-create-organization.mdx",
"clerk-react/functions/redirect-to-organization-profile.mdx",
"clerk-react/functions/redirect-to-user-profile.mdx",
"clerk-react/functions/use-auth.mdx",
"clerk-react/functions/use-clerk.mdx",
"clerk-react/functions/use-organization-list.mdx",
"clerk-react/functions/use-organization.mdx",
"clerk-react/functions/use-reverification.mdx",
"clerk-react/functions/use-session-list.mdx",
"clerk-react/functions/use-session.mdx",
"clerk-react/functions/use-sign-in.mdx",
"clerk-react/functions/use-sign-up.mdx",
"clerk-react/functions/use-user.mdx",
"types/act-claim.mdx",
"types/act-jwt-claim.mdx",
"types/active-session-resource.mdx",
"types/check-authorization-fn.mdx",
"types/check-authorization-from-session-claims.mdx",
"types/check-authorization-with-custom-permissions.mdx",
"types/clerk-api-error.mdx",
"types/clerk-host-router.mdx",
"types/clerk-jwt-claims.mdx",
"types/clerk-paginated-response.mdx",
"types/clerk-pagination-params.mdx",
"types/clerk-pagination-request.mdx",
"types/clerk-resource.mdx",
"types/clerk.mdx",
"types/create-organization-params.mdx",
"types/element-object-key.mdx",
"types/elements-config.mdx",
"types/get-token.mdx",
"types/id-selectors.mdx",
"types/jwt-claims.mdx",
"types/jwt-header.mdx",
"types/legacy-redirect-props.mdx",
"types/localization-resource.mdx",
"types/multi-domain-and-or-proxy.mdx",
"types/organization-custom-role-key.mdx",
"types/organization-domain-verification-status.mdx",
"types/organization-enrollment-mode.mdx",
"types/organization-invitation-status.mdx",
"types/organization-permission-key.mdx",
"types/organization-suggestion-status.mdx",
"types/organizations-jwt-claim.mdx",
"types/override.mdx",
"types/path-value.mdx",
"types/pending-session-options.mdx",
"types/pending-session-resource.mdx",
"types/record-to-path.mdx",
"types/redirect-options.mdx",
"types/saml-strategy.mdx",
"types/sdk-metadata.mdx",
"types/session-resource.mdx",
"types/session-status-claim.mdx",
"types/set-active-params.mdx",
"types/set-active.mdx",
"types/sign-in-resource.mdx",
"types/sign-out.mdx",
"types/sign-up-authenticate-with-metamask-params.mdx",
"types/sign-up-resource.mdx",
"types/signed-in-session-resource.mdx",
"types/state-selectors.mdx",
"types/use-auth-return.mdx",
"types/use-session-list-return.mdx",
"types/use-session-return.mdx",
"types/use-sign-in-return.mdx",
"types/use-sign-up-return.mdx",
"types/use-user-return.mdx",
"types/user-resource.mdx",
"types/without.mdx",
"shared/build-clerk-js-script-attributes.mdx",
"shared/clerk-js-script-url.mdx",
"shared/clerk-runtime-error.mdx",
"shared/create-path-matcher.mdx",
"shared/deep-camel-to-snake.mdx",
"shared/deep-snake-to-camel.mdx",
"shared/deprecated-object-property.mdx",
"shared/derive-state.mdx",
"shared/extract-dev-browser-jwt-from-url.mdx",
"shared/fast-deep-merge-and-replace.mdx",
"shared/get-clerk-js-major-version-or-tag.mdx",
"shared/get-env-variable.mdx",
"shared/get-script-url.mdx",
"shared/icon-image-url.mdx",
"shared/in-browser.mdx",
"shared/is-browser-online.mdx",
"shared/is-clerk-runtime-error.mdx",
"shared/is-publishable-key.mdx",
"shared/is-staging.mdx",
"shared/is-truthy.mdx",
"shared/is-valid-browser-online.mdx",
"shared/is-valid-browser.mdx",
"shared/isomorphic-atob.mdx",
"shared/load-clerk-js-script.mdx",
"shared/pages-or-infinite-options.mdx",
"shared/paginated-hook-config.mdx",
"shared/paginated-resources.mdx",
"shared/read-json-file.mdx",
"shared/set-clerk-js-loading-error-package-name.mdx",
"shared/to-sentence.mdx",
"shared/use-clerk.mdx",
"shared/use-organization-list-params.mdx",
"shared/use-organization-list-return.mdx",
"shared/use-organization-list.mdx",
"shared/use-organization-params.mdx",
"shared/use-organization-return.mdx",
"shared/use-organization.mdx",
"shared/use-reverification.mdx",
"shared/use-session-list.mdx",
"shared/use-session.mdx",
"shared/use-user.mdx",
"shared/user-agent-is-robot.mdx",
"shared/version-selector.mdx",
"nextjs/auth.mdx",
"nextjs/build-clerk-props.mdx",
"nextjs/clerk-middleware-options.mdx",
"nextjs/clerk-middleware.mdx",
"nextjs/create-async-get-auth.mdx",
"nextjs/create-sync-get-auth.mdx",
"nextjs/current-user.mdx",
"nextjs/get-auth.mdx",
"clerk-react/clerk-provider-props.mdx",
"clerk-react/protect.mdx",
"clerk-react/redirect-to-create-organization.mdx",
"clerk-react/redirect-to-organization-profile.mdx",
"clerk-react/redirect-to-user-profile.mdx",
"clerk-react/use-auth.mdx",
"clerk-react/use-clerk.mdx",
"clerk-react/use-organization-list.mdx",
"clerk-react/use-organization.mdx",
"clerk-react/use-reverification.mdx",
"clerk-react/use-session-list.mdx",
"clerk-react/use-session.mdx",
"clerk-react/use-sign-in.mdx",
"clerk-react/use-sign-up.mdx",
"clerk-react/use-user.mdx",
]
`;
27 changes: 0 additions & 27 deletions .typedoc/__tests__/file-structure.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,33 +36,6 @@ describe('Typedoc output', () => {
"nextjs",
"shared",
"types",
"types/interfaces",
"types/type-aliases",
"shared/index",
"shared/react",
"shared/react/hooks",
"shared/react/types",
"shared/react/types/interfaces",
"shared/react/types/type-aliases",
"shared/index/classes",
"shared/index/functions",
"nextjs/app-router",
"nextjs/server",
"nextjs/server/build-clerk-props",
"nextjs/server/clerk-middleware",
"nextjs/server/create-get-auth",
"nextjs/server/create-get-auth/functions",
"nextjs/server/create-get-auth/variables",
"nextjs/server/clerk-middleware/interfaces",
"nextjs/server/clerk-middleware/variables",
"nextjs/server/build-clerk-props/variables",
"nextjs/app-router/server",
"nextjs/app-router/server/auth",
"nextjs/app-router/server/current-user",
"nextjs/app-router/server/current-user/functions",
"nextjs/app-router/server/auth/variables",
"clerk-react/functions",
"clerk-react/interfaces",
]
`);
});
Expand Down
43 changes: 41 additions & 2 deletions .typedoc/custom-plugin.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,8 @@ const LINK_REPLACEMENTS = [
['session-resource', '/docs/references/javascript/session'],
['signed-in-session-resource', '/docs/references/javascript/session'],
['sign-up-resource', '/docs/references/javascript/sign-up'],
['user-resource', '/docs/references/javascript/user'],
['session-status-claim', '/docs/references/javascript/types/session-status'],
];

/**
Expand All@@ -34,16 +36,45 @@ const LINK_REPLACEMENTS = [
* It also shouldn't matter how level deep the relative link is.
*
* This function returns an array of `{ pattern: string, replace: string }` to pass into the `typedoc-plugin-replace-text` plugin.
*
* @example
* [foo](../../bar.mdx) -> [foo](/new-path)
* [foo](./bar.mdx) -> [foo](/new-path)
* [foo](bar.mdx) -> [foo](/new-path)
* [foo](bar.mdx#some-id) -> [foo](/new-path#some-id)
*/
function getRelativeLinkReplacements() {
return LINK_REPLACEMENTS.map(([fileName, newPath]) => {
return {
pattern: new RegExp(`\\((?:\\.{1,2}\\/)+.*?${fileName}\\.mdx\\)`, 'g'),
replace: `(${newPath})`,
// Match both path and optional anchor
pattern: new RegExp(`\\((?:(?:\\.{1,2}\\/)+[^()]*?|)${fileName}\\.mdx(#[^)]+)?\\)`, 'g'),

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new regex accounts for two bugs I saw:

  • A string contained multiple []() and previously it replaced parts outside of that link (until the next occurence)
  • [foo](bar.mdx) and [foo](bar.mdx#test) didn't work

// Preserve the anchor in replacement if it exists
replace: (/** @type {string} */ _match, anchor = '') => `(${newPath}${anchor})`,
};
});
}

function getUnlinkedTypesReplacements() {
return [
{
pattern: /\(setActiveParams\)/g,
replace: '([setActiveParams](/docs/references/javascript/types/set-active-params))',
},
{
pattern: /`_LocalizationResource`/g,
replace: '[Localization](/docs/customization/localization)',
},
{
pattern: /`LoadedClerk`/g,
replace: '[Clerk](/docs/references/javascript/clerk)',
},
{
pattern: /`OrganizationCustomRoleKey`/g,
replace: '[OrganizationCustomRoleKey](/docs/references/javascript/types/organization-custom-role-key)',
},
];
}

/**
* @param {import('typedoc-plugin-markdown').MarkdownApplication} app
*/
Expand All@@ -58,6 +89,14 @@ export function load(app) {
}
}

const unlinkedTypesReplacements = getUnlinkedTypesReplacements();

for (const { pattern, replace } of unlinkedTypesReplacements) {
if (output.contents) {
output.contents = output.contents.replace(pattern, replace);
}
}

if (fileName) {
if (FILES_WITHOUT_HEADINGS.includes(fileName)) {
if (output.contents) {
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
57059dc
useAuth pass
LekoArts Mar 27, 2025
fdc7ffa
improvements
LekoArts Mar 31, 2025
af1144f
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Mar 31, 2025
f947dea
more improvements
LekoArts Mar 31, 2025
6efc447
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Mar 31, 2025
e9e2b5e
wip
LekoArts Apr 2, 2025
b68d9e8
dep update
LekoArts Apr 2, 2025
2f22078
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 3, 2025
4f126b1
add missing inline
LekoArts Apr 4, 2025
59bd888
update typedoc version
LekoArts Apr 7, 2025
bcaba2e
fix blockTags
LekoArts Apr 7, 2025
8f93fc3
flatten output directories
LekoArts Apr 7, 2025
72036b1
adjust script
LekoArts Apr 8, 2025
0ae6ccb
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 8, 2025
dbb3444
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 9, 2025
d0a4398
output updates
LekoArts Apr 9, 2025
34d659a
add tests
LekoArts Apr 9, 2025
8405567
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
a748bfa
update plugin
LekoArts Apr 10, 2025
da3188b
merge fixes
LekoArts Apr 10, 2025
e23074c
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
feeac3b
lockfile
LekoArts Apr 10, 2025
2223183
add changeset
LekoArts Apr 10, 2025
361692c
simplify theme overrides ✨
LekoArts Apr 10, 2025
3eb7cd2
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
7b2af64
finishing touches
LekoArts Apr 11, 2025
0fb9ede
update snapshot
LekoArts Apr 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/giant-bats-leave.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
---
'@clerk/shared': patch
'@clerk/clerk-react': patch
'@clerk/types': patch
---

Improve JSDoc comments
237 changes: 123 additions & 114 deletions .typedoc/__tests__/__snapshots__/file-structure.test.ts.snap
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,119 +2,128 @@

exports[`Typedoc output > should have a deliberate file structure 1`] = `
[
"types/type-aliases/check-authorization-from-session-claims.mdx",
"types/type-aliases/clerk-host-router.mdx",
"types/type-aliases/clerk-pagination-request.mdx",
"types/type-aliases/element-object-key.mdx",
"types/type-aliases/elements-config.mdx",
"types/type-aliases/id-selectors.mdx",
"types/type-aliases/legacy-redirect-props.mdx",
"types/type-aliases/localization-resource.mdx",
"types/type-aliases/multi-domain-and-or-proxy.mdx",
"types/type-aliases/organization-custom-role-key.mdx",
"types/type-aliases/organization-permission-key.mdx",
"types/type-aliases/organizations-jwt-claim.mdx",
"types/type-aliases/override.mdx",
"types/type-aliases/path-value.mdx",
"types/type-aliases/record-to-path.mdx",
"types/type-aliases/redirect-options.mdx",
"types/type-aliases/saml-strategy.mdx",
"types/type-aliases/sdk-metadata.mdx",
"types/type-aliases/session-status-claim.mdx",
"types/type-aliases/set-active.mdx",
"types/type-aliases/sign-up-authenticate-with-metamask-params.mdx",
"types/type-aliases/signed-in-session-resource.mdx",
"types/type-aliases/state-selectors.mdx",
"types/type-aliases/use-auth-return.mdx",
"types/type-aliases/use-session-list-return.mdx",
"types/type-aliases/use-session-return.mdx",
"types/type-aliases/use-sign-in-return.mdx",
"types/type-aliases/use-sign-up-return.mdx",
"types/type-aliases/use-user-return.mdx",
"types/type-aliases/without.mdx",
"types/interfaces/act-claim.mdx",
"types/interfaces/act-jwt-claim.mdx",
"types/interfaces/active-session-resource.mdx",
"types/interfaces/clerk-api-error.mdx",
"types/interfaces/clerk-jwt-claims.mdx",
"types/interfaces/clerk-paginated-response.mdx",
"types/interfaces/clerk-pagination-params.mdx",
"types/interfaces/clerk-resource.mdx",
"types/interfaces/clerk.mdx",
"types/interfaces/create-organization-params.mdx",
"types/interfaces/jwt-claims.mdx",
"types/interfaces/jwt-header.mdx",
"types/interfaces/pending-session-resource.mdx",
"types/interfaces/session-resource.mdx",
"types/interfaces/set-active-params.mdx",
"types/interfaces/sign-in-resource.mdx",
"types/interfaces/sign-out.mdx",
"types/interfaces/sign-up-resource.mdx",
"shared/react/types/type-aliases/paginated-hook-config.mdx",
"shared/react/types/interfaces/pages-or-infinite-options.mdx",
"shared/react/types/interfaces/paginated-resources.mdx",
"shared/react/hooks/use-clerk.mdx",
"shared/react/hooks/use-organization-list-params.mdx",
"shared/react/hooks/use-organization-list-return.mdx",
"shared/react/hooks/use-organization-list.mdx",
"shared/react/hooks/use-organization-params.mdx",
"shared/react/hooks/use-organization-return.mdx",
"shared/react/hooks/use-organization.mdx",
"shared/react/hooks/use-reverification.mdx",
"shared/react/hooks/use-session-list.mdx",
"shared/react/hooks/use-session.mdx",
"shared/react/hooks/use-user.mdx",
"shared/index/functions/build-clerk-js-script-attributes.mdx",
"shared/index/functions/clerk-js-script-url.mdx",
"shared/index/functions/create-path-matcher.mdx",
"shared/index/functions/deep-camel-to-snake.mdx",
"shared/index/functions/deep-snake-to-camel.mdx",
"shared/index/functions/deprecated-object-property.mdx",
"shared/index/functions/derive-state.mdx",
"shared/index/functions/extract-dev-browser-jwt-from-url.mdx",
"shared/index/functions/fast-deep-merge-and-replace.mdx",
"shared/index/functions/get-clerk-js-major-version-or-tag.mdx",
"shared/index/functions/get-env-variable.mdx",
"shared/index/functions/get-script-url.mdx",
"shared/index/functions/icon-image-url.mdx",
"shared/index/functions/in-browser.mdx",
"shared/index/functions/is-browser-online.mdx",
"shared/index/functions/is-clerk-runtime-error.mdx",
"shared/index/functions/is-publishable-key.mdx",
"shared/index/functions/is-staging.mdx",
"shared/index/functions/is-truthy.mdx",
"shared/index/functions/is-valid-browser-online.mdx",
"shared/index/functions/is-valid-browser.mdx",
"shared/index/functions/isomorphic-atob.mdx",
"shared/index/functions/load-clerk-js-script.mdx",
"shared/index/functions/read-json-file.mdx",
"shared/index/functions/set-clerk-js-loading-error-package-name.mdx",
"shared/index/functions/to-sentence.mdx",
"shared/index/functions/user-agent-is-robot.mdx",
"shared/index/functions/version-selector.mdx",
"shared/index/classes/clerk-runtime-error.mdx",
"nextjs/server/create-get-auth/variables/get-auth.mdx",
"nextjs/server/create-get-auth/functions/create-async-get-auth.mdx",
"nextjs/server/create-get-auth/functions/create-sync-get-auth.mdx",
"nextjs/server/clerk-middleware/variables/clerk-middleware.mdx",
"nextjs/server/clerk-middleware/interfaces/clerk-middleware-options.mdx",
"nextjs/server/build-clerk-props/variables/build-clerk-props.mdx",
"nextjs/app-router/server/current-user/functions/current-user.mdx",
"nextjs/app-router/server/auth/variables/auth.mdx",
"clerk-react/interfaces/clerk-provider-props.mdx",
"clerk-react/functions/protect.mdx",
"clerk-react/functions/redirect-to-create-organization.mdx",
"clerk-react/functions/redirect-to-organization-profile.mdx",
"clerk-react/functions/redirect-to-user-profile.mdx",
"clerk-react/functions/use-auth.mdx",
"clerk-react/functions/use-clerk.mdx",
"clerk-react/functions/use-organization-list.mdx",
"clerk-react/functions/use-organization.mdx",
"clerk-react/functions/use-reverification.mdx",
"clerk-react/functions/use-session-list.mdx",
"clerk-react/functions/use-session.mdx",
"clerk-react/functions/use-sign-in.mdx",
"clerk-react/functions/use-sign-up.mdx",
"clerk-react/functions/use-user.mdx",
"types/act-claim.mdx",
"types/act-jwt-claim.mdx",
"types/active-session-resource.mdx",
"types/check-authorization-fn.mdx",
"types/check-authorization-from-session-claims.mdx",
"types/check-authorization-with-custom-permissions.mdx",
"types/clerk-api-error.mdx",
"types/clerk-host-router.mdx",
"types/clerk-jwt-claims.mdx",
"types/clerk-paginated-response.mdx",
"types/clerk-pagination-params.mdx",
"types/clerk-pagination-request.mdx",
"types/clerk-resource.mdx",
"types/clerk.mdx",
"types/create-organization-params.mdx",
"types/element-object-key.mdx",
"types/elements-config.mdx",
"types/get-token.mdx",
"types/id-selectors.mdx",
"types/jwt-claims.mdx",
"types/jwt-header.mdx",
"types/legacy-redirect-props.mdx",
"types/localization-resource.mdx",
"types/multi-domain-and-or-proxy.mdx",
"types/organization-custom-role-key.mdx",
"types/organization-domain-verification-status.mdx",
"types/organization-enrollment-mode.mdx",
"types/organization-invitation-status.mdx",
"types/organization-permission-key.mdx",
"types/organization-suggestion-status.mdx",
"types/organizations-jwt-claim.mdx",
"types/override.mdx",
"types/path-value.mdx",
"types/pending-session-options.mdx",
"types/pending-session-resource.mdx",
"types/record-to-path.mdx",
"types/redirect-options.mdx",
"types/saml-strategy.mdx",
"types/sdk-metadata.mdx",
"types/session-resource.mdx",
"types/session-status-claim.mdx",
"types/set-active-params.mdx",
"types/set-active.mdx",
"types/sign-in-resource.mdx",
"types/sign-out.mdx",
"types/sign-up-authenticate-with-metamask-params.mdx",
"types/sign-up-resource.mdx",
"types/signed-in-session-resource.mdx",
"types/state-selectors.mdx",
"types/use-auth-return.mdx",
"types/use-session-list-return.mdx",
"types/use-session-return.mdx",
"types/use-sign-in-return.mdx",
"types/use-sign-up-return.mdx",
"types/use-user-return.mdx",
"types/user-resource.mdx",
"types/without.mdx",
"shared/build-clerk-js-script-attributes.mdx",
"shared/clerk-js-script-url.mdx",
"shared/clerk-runtime-error.mdx",
"shared/create-path-matcher.mdx",
"shared/deep-camel-to-snake.mdx",
"shared/deep-snake-to-camel.mdx",
"shared/deprecated-object-property.mdx",
"shared/derive-state.mdx",
"shared/extract-dev-browser-jwt-from-url.mdx",
"shared/fast-deep-merge-and-replace.mdx",
"shared/get-clerk-js-major-version-or-tag.mdx",
"shared/get-env-variable.mdx",
"shared/get-script-url.mdx",
"shared/icon-image-url.mdx",
"shared/in-browser.mdx",
"shared/is-browser-online.mdx",
"shared/is-clerk-runtime-error.mdx",
"shared/is-publishable-key.mdx",
"shared/is-staging.mdx",
"shared/is-truthy.mdx",
"shared/is-valid-browser-online.mdx",
"shared/is-valid-browser.mdx",
"shared/isomorphic-atob.mdx",
"shared/load-clerk-js-script.mdx",
"shared/pages-or-infinite-options.mdx",
"shared/paginated-hook-config.mdx",
"shared/paginated-resources.mdx",
"shared/read-json-file.mdx",
"shared/set-clerk-js-loading-error-package-name.mdx",
"shared/to-sentence.mdx",
"shared/use-clerk.mdx",
"shared/use-organization-list-params.mdx",
"shared/use-organization-list-return.mdx",
"shared/use-organization-list.mdx",
"shared/use-organization-params.mdx",
"shared/use-organization-return.mdx",
"shared/use-organization.mdx",
"shared/use-reverification.mdx",
"shared/use-session-list.mdx",
"shared/use-session.mdx",
"shared/use-user.mdx",
"shared/user-agent-is-robot.mdx",
"shared/version-selector.mdx",
"nextjs/auth.mdx",
"nextjs/build-clerk-props.mdx",
"nextjs/clerk-middleware-options.mdx",
"nextjs/clerk-middleware.mdx",
"nextjs/create-async-get-auth.mdx",
"nextjs/create-sync-get-auth.mdx",
"nextjs/current-user.mdx",
"nextjs/get-auth.mdx",
"clerk-react/clerk-provider-props.mdx",
"clerk-react/protect.mdx",
"clerk-react/redirect-to-create-organization.mdx",
"clerk-react/redirect-to-organization-profile.mdx",
"clerk-react/redirect-to-user-profile.mdx",
"clerk-react/use-auth.mdx",
"clerk-react/use-clerk.mdx",
"clerk-react/use-organization-list.mdx",
"clerk-react/use-organization.mdx",
"clerk-react/use-reverification.mdx",
"clerk-react/use-session-list.mdx",
"clerk-react/use-session.mdx",
"clerk-react/use-sign-in.mdx",
"clerk-react/use-sign-up.mdx",
"clerk-react/use-user.mdx",
]
`;
27 changes: 0 additions & 27 deletions .typedoc/__tests__/file-structure.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,33 +36,6 @@ describe('Typedoc output', () => {
"nextjs",
"shared",
"types",
"types/interfaces",
"types/type-aliases",
"shared/index",
"shared/react",
"shared/react/hooks",
"shared/react/types",
"shared/react/types/interfaces",
"shared/react/types/type-aliases",
"shared/index/classes",
"shared/index/functions",
"nextjs/app-router",
"nextjs/server",
"nextjs/server/build-clerk-props",
"nextjs/server/clerk-middleware",
"nextjs/server/create-get-auth",
"nextjs/server/create-get-auth/functions",
"nextjs/server/create-get-auth/variables",
"nextjs/server/clerk-middleware/interfaces",
"nextjs/server/clerk-middleware/variables",
"nextjs/server/build-clerk-props/variables",
"nextjs/app-router/server",
"nextjs/app-router/server/auth",
"nextjs/app-router/server/current-user",
"nextjs/app-router/server/current-user/functions",
"nextjs/app-router/server/auth/variables",
"clerk-react/functions",
"clerk-react/interfaces",
]
`);
});
Expand Down
43 changes: 41 additions & 2 deletions .typedoc/custom-plugin.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,8 @@ const LINK_REPLACEMENTS = [
['session-resource', '/docs/references/javascript/session'],
['signed-in-session-resource', '/docs/references/javascript/session'],
['sign-up-resource', '/docs/references/javascript/sign-up'],
['user-resource', '/docs/references/javascript/user'],
['session-status-claim', '/docs/references/javascript/types/session-status'],
];

/**
Expand All@@ -34,16 +36,45 @@ const LINK_REPLACEMENTS = [
* It also shouldn't matter how level deep the relative link is.
*
* This function returns an array of `{ pattern: string, replace: string }` to pass into the `typedoc-plugin-replace-text` plugin.
*
* @example
* [foo](../../bar.mdx) -> [foo](/new-path)
* [foo](./bar.mdx) -> [foo](/new-path)
* [foo](bar.mdx) -> [foo](/new-path)
* [foo](bar.mdx#some-id) -> [foo](/new-path#some-id)
*/
function getRelativeLinkReplacements() {
return LINK_REPLACEMENTS.map(([fileName, newPath]) => {
return {
pattern: new RegExp(`\\((?:\\.{1,2}\\/)+.*?${fileName}\\.mdx\\)`, 'g'),
replace: `(${newPath})`,
// Match both path and optional anchor
pattern: new RegExp(`\\((?:(?:\\.{1,2}\\/)+[^()]*?|)${fileName}\\.mdx(#[^)]+)?\\)`, 'g'),

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new regex accounts for two bugs I saw:

  • A string contained multiple []() and previously it replaced parts outside of that link (until the next occurence)
  • [foo](bar.mdx) and [foo](bar.mdx#test) didn't work

// Preserve the anchor in replacement if it exists
replace: (/** @type {string} */ _match, anchor = '') => `(${newPath}${anchor})`,
};
});
}

function getUnlinkedTypesReplacements() {
return [
{
pattern: /\(setActiveParams\)/g,
replace: '([setActiveParams](/docs/references/javascript/types/set-active-params))',
},
{
pattern: /`_LocalizationResource`/g,
replace: '[Localization](/docs/customization/localization)',
},
{
pattern: /`LoadedClerk`/g,
replace: '[Clerk](/docs/references/javascript/clerk)',
},
{
pattern: /`OrganizationCustomRoleKey`/g,
replace: '[OrganizationCustomRoleKey](/docs/references/javascript/types/organization-custom-role-key)',
},
];
}

/**
* @param {import('typedoc-plugin-markdown').MarkdownApplication} app
*/
Expand All@@ -58,6 +89,14 @@ export function load(app) {
}
}

const unlinkedTypesReplacements = getUnlinkedTypesReplacements();

for (const { pattern, replace } of unlinkedTypesReplacements) {
if (output.contents) {
output.contents = output.contents.replace(pattern, replace);
}
}

if (fileName) {
if (FILES_WITHOUT_HEADINGS.includes(fileName)) {
if (output.contents) {
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
57059dc
useAuth pass
LekoArts Mar 27, 2025
fdc7ffa
improvements
LekoArts Mar 31, 2025
af1144f
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Mar 31, 2025
f947dea
more improvements
LekoArts Mar 31, 2025
6efc447
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Mar 31, 2025
e9e2b5e
wip
LekoArts Apr 2, 2025
b68d9e8
dep update
LekoArts Apr 2, 2025
2f22078
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 3, 2025
4f126b1
add missing inline
LekoArts Apr 4, 2025
59bd888
update typedoc version
LekoArts Apr 7, 2025
bcaba2e
fix blockTags
LekoArts Apr 7, 2025
8f93fc3
flatten output directories
LekoArts Apr 7, 2025
72036b1
adjust script
LekoArts Apr 8, 2025
0ae6ccb
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 8, 2025
dbb3444
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 9, 2025
d0a4398
output updates
LekoArts Apr 9, 2025
34d659a
add tests
LekoArts Apr 9, 2025
8405567
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
a748bfa
update plugin
LekoArts Apr 10, 2025
da3188b
merge fixes
LekoArts Apr 10, 2025
e23074c
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
feeac3b
lockfile
LekoArts Apr 10, 2025
2223183
add changeset
LekoArts Apr 10, 2025
361692c
simplify theme overrides ✨
LekoArts Apr 10, 2025
3eb7cd2
Merge branch 'main' into lekoarts/eco-534-first-review-pass
LekoArts Apr 10, 2025
7b2af64
finishing touches
LekoArts Apr 11, 2025
0fb9ede
update snapshot
LekoArts Apr 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/giant-bats-leave.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
---
'@clerk/shared': patch
'@clerk/clerk-react': patch
'@clerk/types': patch
---

Improve JSDoc comments
237 changes: 123 additions & 114 deletions .typedoc/__tests__/__snapshots__/file-structure.test.ts.snap
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,119 +2,128 @@

exports[`Typedoc output > should have a deliberate file structure 1`] = `
[
"types/type-aliases/check-authorization-from-session-claims.mdx",
"types/type-aliases/clerk-host-router.mdx",
"types/type-aliases/clerk-pagination-request.mdx",
"types/type-aliases/element-object-key.mdx",
"types/type-aliases/elements-config.mdx",
"types/type-aliases/id-selectors.mdx",
"types/type-aliases/legacy-redirect-props.mdx",
"types/type-aliases/localization-resource.mdx",
"types/type-aliases/multi-domain-and-or-proxy.mdx",
"types/type-aliases/organization-custom-role-key.mdx",
"types/type-aliases/organization-permission-key.mdx",
"types/type-aliases/organizations-jwt-claim.mdx",
"types/type-aliases/override.mdx",
"types/type-aliases/path-value.mdx",
"types/type-aliases/record-to-path.mdx",
"types/type-aliases/redirect-options.mdx",
"types/type-aliases/saml-strategy.mdx",
"types/type-aliases/sdk-metadata.mdx",
"types/type-aliases/session-status-claim.mdx",
"types/type-aliases/set-active.mdx",
"types/type-aliases/sign-up-authenticate-with-metamask-params.mdx",
"types/type-aliases/signed-in-session-resource.mdx",
"types/type-aliases/state-selectors.mdx",
"types/type-aliases/use-auth-return.mdx",
"types/type-aliases/use-session-list-return.mdx",
"types/type-aliases/use-session-return.mdx",
"types/type-aliases/use-sign-in-return.mdx",
"types/type-aliases/use-sign-up-return.mdx",
"types/type-aliases/use-user-return.mdx",
"types/type-aliases/without.mdx",
"types/interfaces/act-claim.mdx",
"types/interfaces/act-jwt-claim.mdx",
"types/interfaces/active-session-resource.mdx",
"types/interfaces/clerk-api-error.mdx",
"types/interfaces/clerk-jwt-claims.mdx",
"types/interfaces/clerk-paginated-response.mdx",
"types/interfaces/clerk-pagination-params.mdx",
"types/interfaces/clerk-resource.mdx",
"types/interfaces/clerk.mdx",
"types/interfaces/create-organization-params.mdx",
"types/interfaces/jwt-claims.mdx",
"types/interfaces/jwt-header.mdx",
"types/interfaces/pending-session-resource.mdx",
"types/interfaces/session-resource.mdx",
"types/interfaces/set-active-params.mdx",
"types/interfaces/sign-in-resource.mdx",
"types/interfaces/sign-out.mdx",
"types/interfaces/sign-up-resource.mdx",
"shared/react/types/type-aliases/paginated-hook-config.mdx",
"shared/react/types/interfaces/pages-or-infinite-options.mdx",
"shared/react/types/interfaces/paginated-resources.mdx",
"shared/react/hooks/use-clerk.mdx",
"shared/react/hooks/use-organization-list-params.mdx",
"shared/react/hooks/use-organization-list-return.mdx",
"shared/react/hooks/use-organization-list.mdx",
"shared/react/hooks/use-organization-params.mdx",
"shared/react/hooks/use-organization-return.mdx",
"shared/react/hooks/use-organization.mdx",
"shared/react/hooks/use-reverification.mdx",
"shared/react/hooks/use-session-list.mdx",
"shared/react/hooks/use-session.mdx",
"shared/react/hooks/use-user.mdx",
"shared/index/functions/build-clerk-js-script-attributes.mdx",
"shared/index/functions/clerk-js-script-url.mdx",
"shared/index/functions/create-path-matcher.mdx",
"shared/index/functions/deep-camel-to-snake.mdx",
"shared/index/functions/deep-snake-to-camel.mdx",
"shared/index/functions/deprecated-object-property.mdx",
"shared/index/functions/derive-state.mdx",
"shared/index/functions/extract-dev-browser-jwt-from-url.mdx",
"shared/index/functions/fast-deep-merge-and-replace.mdx",
"shared/index/functions/get-clerk-js-major-version-or-tag.mdx",
"shared/index/functions/get-env-variable.mdx",
"shared/index/functions/get-script-url.mdx",
"shared/index/functions/icon-image-url.mdx",
"shared/index/functions/in-browser.mdx",
"shared/index/functions/is-browser-online.mdx",
"shared/index/functions/is-clerk-runtime-error.mdx",
"shared/index/functions/is-publishable-key.mdx",
"shared/index/functions/is-staging.mdx",
"shared/index/functions/is-truthy.mdx",
"shared/index/functions/is-valid-browser-online.mdx",
"shared/index/functions/is-valid-browser.mdx",
"shared/index/functions/isomorphic-atob.mdx",
"shared/index/functions/load-clerk-js-script.mdx",
"shared/index/functions/read-json-file.mdx",
"shared/index/functions/set-clerk-js-loading-error-package-name.mdx",
"shared/index/functions/to-sentence.mdx",
"shared/index/functions/user-agent-is-robot.mdx",
"shared/index/functions/version-selector.mdx",
"shared/index/classes/clerk-runtime-error.mdx",
"nextjs/server/create-get-auth/variables/get-auth.mdx",
"nextjs/server/create-get-auth/functions/create-async-get-auth.mdx",
"nextjs/server/create-get-auth/functions/create-sync-get-auth.mdx",
"nextjs/server/clerk-middleware/variables/clerk-middleware.mdx",
"nextjs/server/clerk-middleware/interfaces/clerk-middleware-options.mdx",
"nextjs/server/build-clerk-props/variables/build-clerk-props.mdx",
"nextjs/app-router/server/current-user/functions/current-user.mdx",
"nextjs/app-router/server/auth/variables/auth.mdx",
"clerk-react/interfaces/clerk-provider-props.mdx",
"clerk-react/functions/protect.mdx",
"clerk-react/functions/redirect-to-create-organization.mdx",
"clerk-react/functions/redirect-to-organization-profile.mdx",
"clerk-react/functions/redirect-to-user-profile.mdx",
"clerk-react/functions/use-auth.mdx",
"clerk-react/functions/use-clerk.mdx",
"clerk-react/functions/use-organization-list.mdx",
"clerk-react/functions/use-organization.mdx",
"clerk-react/functions/use-reverification.mdx",
"clerk-react/functions/use-session-list.mdx",
"clerk-react/functions/use-session.mdx",
"clerk-react/functions/use-sign-in.mdx",
"clerk-react/functions/use-sign-up.mdx",
"clerk-react/functions/use-user.mdx",
"types/act-claim.mdx",
"types/act-jwt-claim.mdx",
"types/active-session-resource.mdx",
"types/check-authorization-fn.mdx",
"types/check-authorization-from-session-claims.mdx",
"types/check-authorization-with-custom-permissions.mdx",
"types/clerk-api-error.mdx",
"types/clerk-host-router.mdx",
"types/clerk-jwt-claims.mdx",
"types/clerk-paginated-response.mdx",
"types/clerk-pagination-params.mdx",
"types/clerk-pagination-request.mdx",
"types/clerk-resource.mdx",
"types/clerk.mdx",
"types/create-organization-params.mdx",
"types/element-object-key.mdx",
"types/elements-config.mdx",
"types/get-token.mdx",
"types/id-selectors.mdx",
"types/jwt-claims.mdx",
"types/jwt-header.mdx",
"types/legacy-redirect-props.mdx",
"types/localization-resource.mdx",
"types/multi-domain-and-or-proxy.mdx",
"types/organization-custom-role-key.mdx",
"types/organization-domain-verification-status.mdx",
"types/organization-enrollment-mode.mdx",
"types/organization-invitation-status.mdx",
"types/organization-permission-key.mdx",
"types/organization-suggestion-status.mdx",
"types/organizations-jwt-claim.mdx",
"types/override.mdx",
"types/path-value.mdx",
"types/pending-session-options.mdx",
"types/pending-session-resource.mdx",
"types/record-to-path.mdx",
"types/redirect-options.mdx",
"types/saml-strategy.mdx",
"types/sdk-metadata.mdx",
"types/session-resource.mdx",
"types/session-status-claim.mdx",
"types/set-active-params.mdx",
"types/set-active.mdx",
"types/sign-in-resource.mdx",
"types/sign-out.mdx",
"types/sign-up-authenticate-with-metamask-params.mdx",
"types/sign-up-resource.mdx",
"types/signed-in-session-resource.mdx",
"types/state-selectors.mdx",
"types/use-auth-return.mdx",
"types/use-session-list-return.mdx",
"types/use-session-return.mdx",
"types/use-sign-in-return.mdx",
"types/use-sign-up-return.mdx",
"types/use-user-return.mdx",
"types/user-resource.mdx",
"types/without.mdx",
"shared/build-clerk-js-script-attributes.mdx",
"shared/clerk-js-script-url.mdx",
"shared/clerk-runtime-error.mdx",
"shared/create-path-matcher.mdx",
"shared/deep-camel-to-snake.mdx",
"shared/deep-snake-to-camel.mdx",
"shared/deprecated-object-property.mdx",
"shared/derive-state.mdx",
"shared/extract-dev-browser-jwt-from-url.mdx",
"shared/fast-deep-merge-and-replace.mdx",
"shared/get-clerk-js-major-version-or-tag.mdx",
"shared/get-env-variable.mdx",
"shared/get-script-url.mdx",
"shared/icon-image-url.mdx",
"shared/in-browser.mdx",
"shared/is-browser-online.mdx",
"shared/is-clerk-runtime-error.mdx",
"shared/is-publishable-key.mdx",
"shared/is-staging.mdx",
"shared/is-truthy.mdx",
"shared/is-valid-browser-online.mdx",
"shared/is-valid-browser.mdx",
"shared/isomorphic-atob.mdx",
"shared/load-clerk-js-script.mdx",
"shared/pages-or-infinite-options.mdx",
"shared/paginated-hook-config.mdx",
"shared/paginated-resources.mdx",
"shared/read-json-file.mdx",
"shared/set-clerk-js-loading-error-package-name.mdx",
"shared/to-sentence.mdx",
"shared/use-clerk.mdx",
"shared/use-organization-list-params.mdx",
"shared/use-organization-list-return.mdx",
"shared/use-organization-list.mdx",
"shared/use-organization-params.mdx",
"shared/use-organization-return.mdx",
"shared/use-organization.mdx",
"shared/use-reverification.mdx",
"shared/use-session-list.mdx",
"shared/use-session.mdx",
"shared/use-user.mdx",
"shared/user-agent-is-robot.mdx",
"shared/version-selector.mdx",
"nextjs/auth.mdx",
"nextjs/build-clerk-props.mdx",
"nextjs/clerk-middleware-options.mdx",
"nextjs/clerk-middleware.mdx",
"nextjs/create-async-get-auth.mdx",
"nextjs/create-sync-get-auth.mdx",
"nextjs/current-user.mdx",
"nextjs/get-auth.mdx",
"clerk-react/clerk-provider-props.mdx",
"clerk-react/protect.mdx",
"clerk-react/redirect-to-create-organization.mdx",
"clerk-react/redirect-to-organization-profile.mdx",
"clerk-react/redirect-to-user-profile.mdx",
"clerk-react/use-auth.mdx",
"clerk-react/use-clerk.mdx",
"clerk-react/use-organization-list.mdx",
"clerk-react/use-organization.mdx",
"clerk-react/use-reverification.mdx",
"clerk-react/use-session-list.mdx",
"clerk-react/use-session.mdx",
"clerk-react/use-sign-in.mdx",
"clerk-react/use-sign-up.mdx",
"clerk-react/use-user.mdx",
]
`;
27 changes: 0 additions & 27 deletions .typedoc/__tests__/file-structure.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,33 +36,6 @@ describe('Typedoc output', () => {
"nextjs",
"shared",
"types",
"types/interfaces",
"types/type-aliases",
"shared/index",
"shared/react",
"shared/react/hooks",
"shared/react/types",
"shared/react/types/interfaces",
"shared/react/types/type-aliases",
"shared/index/classes",
"shared/index/functions",
"nextjs/app-router",
"nextjs/server",
"nextjs/server/build-clerk-props",
"nextjs/server/clerk-middleware",
"nextjs/server/create-get-auth",
"nextjs/server/create-get-auth/functions",
"nextjs/server/create-get-auth/variables",
"nextjs/server/clerk-middleware/interfaces",
"nextjs/server/clerk-middleware/variables",
"nextjs/server/build-clerk-props/variables",
"nextjs/app-router/server",
"nextjs/app-router/server/auth",
"nextjs/app-router/server/current-user",
"nextjs/app-router/server/current-user/functions",
"nextjs/app-router/server/auth/variables",
"clerk-react/functions",
"clerk-react/interfaces",
]
`);
});
Expand Down
43 changes: 41 additions & 2 deletions .typedoc/custom-plugin.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,8 @@ const LINK_REPLACEMENTS = [
['session-resource', '/docs/references/javascript/session'],
['signed-in-session-resource', '/docs/references/javascript/session'],
['sign-up-resource', '/docs/references/javascript/sign-up'],
['user-resource', '/docs/references/javascript/user'],
['session-status-claim', '/docs/references/javascript/types/session-status'],
];

/**
Expand All@@ -34,16 +36,45 @@ const LINK_REPLACEMENTS = [
* It also shouldn't matter how level deep the relative link is.
*
* This function returns an array of `{ pattern: string, replace: string }` to pass into the `typedoc-plugin-replace-text` plugin.
*
* @example
* [foo](../../bar.mdx) -> [foo](/new-path)
* [foo](./bar.mdx) -> [foo](/new-path)
* [foo](bar.mdx) -> [foo](/new-path)
* [foo](bar.mdx#some-id) -> [foo](/new-path#some-id)
*/
function getRelativeLinkReplacements() {
return LINK_REPLACEMENTS.map(([fileName, newPath]) => {
return {
pattern: new RegExp(`\\((?:\\.{1,2}\\/)+.*?${fileName}\\.mdx\\)`, 'g'),
replace: `(${newPath})`,
// Match both path and optional anchor
pattern: new RegExp(`\\((?:(?:\\.{1,2}\\/)+[^()]*?|)${fileName}\\.mdx(#[^)]+)?\\)`, 'g'),

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new regex accounts for two bugs I saw:

  • A string contained multiple []() and previously it replaced parts outside of that link (until the next occurence)
  • [foo](bar.mdx) and [foo](bar.mdx#test) didn't work

// Preserve the anchor in replacement if it exists
replace: (/** @type {string} */ _match, anchor = '') => `(${newPath}${anchor})`,
};
});
}

function getUnlinkedTypesReplacements() {
return [
{
pattern: /\(setActiveParams\)/g,
replace: '([setActiveParams](/docs/references/javascript/types/set-active-params))',
},
{
pattern: /`_LocalizationResource`/g,
replace: '[Localization](/docs/customization/localization)',
},
{
pattern: /`LoadedClerk`/g,
replace: '[Clerk](/docs/references/javascript/clerk)',
},
{
pattern: /`OrganizationCustomRoleKey`/g,
replace: '[OrganizationCustomRoleKey](/docs/references/javascript/types/organization-custom-role-key)',
},
];
}

/**
* @param {import('typedoc-plugin-markdown').MarkdownApplication} app
*/
Expand All@@ -58,6 +89,14 @@ export function load(app) {
}
}

const unlinkedTypesReplacements = getUnlinkedTypesReplacements();

for (const { pattern, replace } of unlinkedTypesReplacements) {
if (output.contents) {
output.contents = output.contents.replace(pattern, replace);
}
}

if (fileName) {
if (FILES_WITHOUT_HEADINGS.includes(fileName)) {
if (output.contents) {
Expand Down
Loading