diff --git a/package.json b/package.json index 36c09403b..5a7e6bca4 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,7 @@ "@sentry/browser": "^7.74.1", "@sentry/react": "^7.74.1", "@soapbox.pub/wasmboy": "^0.8.0", + "@soapbox/nspec": "npm:@jsr/soapbox__nspec", "@tabler/icons": "^2.0.0", "@tailwindcss/aspect-ratio": "^0.4.2", "@tailwindcss/forms": "^0.5.7", @@ -135,7 +136,6 @@ "mini-css-extract-plugin": "^2.6.0", "nostr-machina": "^0.1.0", "nostr-tools": "^2.3.0", - "nspec": "^0.3.0", "path-browserify": "^1.0.1", "postcss": "^8.4.29", "process": "^0.11.10", diff --git a/src/api/hooks/nostr/useSignerStream.ts b/src/api/hooks/nostr/useSignerStream.ts index cc5d6403d..b6c2c8a2f 100644 --- a/src/api/hooks/nostr/useSignerStream.ts +++ b/src/api/hooks/nostr/useSignerStream.ts @@ -1,5 +1,5 @@ +import { type NostrEvent } from '@soapbox/nspec'; import { NiceRelay } from 'nostr-machina'; -import { type NostrEvent } from 'nspec'; import { useEffect, useMemo } from 'react'; import { signer } from 'soapbox/features/nostr/sign'; diff --git a/src/features/nostr/NKeyStorage.ts b/src/features/nostr/NKeyStorage.ts index 926249448..1b0ebd170 100644 --- a/src/features/nostr/NKeyStorage.ts +++ b/src/features/nostr/NKeyStorage.ts @@ -1,5 +1,5 @@ +import { NSchema as n, NostrSigner, NSecSigner } from '@soapbox/nspec'; import { getPublicKey, nip19 } from 'nostr-tools'; -import { NSchema as n, NostrSigner, NSecSigner } from 'nspec'; import { lockStorageKey } from 'soapbox/utils/storage'; diff --git a/src/features/nostr/SoapboxSigner.ts b/src/features/nostr/SoapboxSigner.ts index 98e8db51e..1b1d8bb81 100644 --- a/src/features/nostr/SoapboxSigner.ts +++ b/src/features/nostr/SoapboxSigner.ts @@ -1,5 +1,5 @@ import { hexToBytes } from '@noble/hashes/utils'; -import { type NostrSigner, type NostrEvent, NSecSigner } from 'nspec'; +import { type NostrSigner, type NostrEvent, NSecSigner } from '@soapbox/nspec'; /** Use key from `localStorage` if available, falling back to NIP-07. */ export class SoapboxSigner implements NostrSigner { diff --git a/src/features/nostr/sign.ts b/src/features/nostr/sign.ts index d33cd926a..e036678ca 100644 --- a/src/features/nostr/sign.ts +++ b/src/features/nostr/sign.ts @@ -1,4 +1,4 @@ -import { type NostrSigner } from 'nspec'; +import { type NostrSigner } from '@soapbox/nspec'; import { SoapboxSigner } from './SoapboxSigner'; diff --git a/src/features/ui/components/modals/nostr-signin-modal/nostr-signin-modal.tsx b/src/features/ui/components/modals/nostr-signin-modal/nostr-signin-modal.tsx index 40a7c86e9..91b91d964 100644 --- a/src/features/ui/components/modals/nostr-signin-modal/nostr-signin-modal.tsx +++ b/src/features/ui/components/modals/nostr-signin-modal/nostr-signin-modal.tsx @@ -1,4 +1,4 @@ -import { NostrSigner } from 'nspec'; +import { NostrSigner } from '@soapbox/nspec'; import React, { useState } from 'react'; import AccountStep from './steps/account-step'; diff --git a/src/features/ui/components/modals/nostr-signin-modal/steps/account-step.tsx b/src/features/ui/components/modals/nostr-signin-modal/steps/account-step.tsx index 4d8d889ac..28bd9d6b1 100644 --- a/src/features/ui/components/modals/nostr-signin-modal/steps/account-step.tsx +++ b/src/features/ui/components/modals/nostr-signin-modal/steps/account-step.tsx @@ -1,4 +1,4 @@ -import { NSchema as n } from 'nspec'; +import { NSchema as n } from '@soapbox/nspec'; import React, { useMemo } from 'react'; import { FormattedMessage } from 'react-intl'; diff --git a/src/features/ui/components/modals/nostr-signin-modal/steps/keygen-step.tsx b/src/features/ui/components/modals/nostr-signin-modal/steps/keygen-step.tsx index ff73fb1dd..d8bc2cc2e 100644 --- a/src/features/ui/components/modals/nostr-signin-modal/steps/keygen-step.tsx +++ b/src/features/ui/components/modals/nostr-signin-modal/steps/keygen-step.tsx @@ -1,5 +1,5 @@ +import { NostrSigner } from '@soapbox/nspec'; import { generateSecretKey, getPublicKey, nip19 } from 'nostr-tools'; -import { NostrSigner } from 'nspec'; import React, { useEffect, useMemo, useState } from 'react'; import { FormattedMessage } from 'react-intl'; diff --git a/src/schemas/account.ts b/src/schemas/account.ts index 696ed1375..21c941801 100644 --- a/src/schemas/account.ts +++ b/src/schemas/account.ts @@ -1,6 +1,6 @@ +import { NSchema as n } from '@soapbox/nspec'; import escapeTextContentForBrowser from 'escape-html'; import DOMPurify from 'isomorphic-dompurify'; -import { NSchema as n } from 'nspec'; import z from 'zod'; import emojify from 'soapbox/features/emoji'; diff --git a/src/types/window.d.ts b/src/types/window.d.ts index 71fc2587e..b155a9f00 100644 --- a/src/types/window.d.ts +++ b/src/types/window.d.ts @@ -1,4 +1,4 @@ -import type { NostrSigner } from 'nspec'; +import type { NostrSigner } from '@soapbox/nspec'; declare global { interface Window { diff --git a/tsconfig.json b/tsconfig.json index 7b6322fb1..806a33b46 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,7 @@ "target": "ESNext", "jsx": "react", "allowJs": true, - "moduleResolution": "node", + "moduleResolution": "Bundler", "resolveJsonModule": true, "esModuleInterop": true, "skipLibCheck": true, diff --git a/yarn.lock b/yarn.lock index 4ebc3be15..efe92922f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2263,6 +2263,20 @@ raf "^3.4.0" responsive-gamepad "1.1.0" +"@soapbox/nspec@npm:@jsr/soapbox__nspec": + version "0.6.0" + resolved "https://npm.jsr.io/~/6/@jsr/soapbox__nspec/0.6.0.tgz#60A75BCDBEC1B76DFA91BEFDF5505CCB8ADDAD3B" + integrity sha512-HY+MssBjm532J9SAqLek8YGxBlEaXdT1Eek3bOWkq4uLJxipJhYkdQrW+NzXhfVvGZUt6YXBobeSqRQx1JFgkQ== + dependencies: + "@noble/hashes" "^1.3.3" + "@scure/base" "^1.1.5" + "@scure/bip32" "^1.3.3" + "@scure/bip39" "^1.2.2" + lru-cache "^10.2.0" + nostr-tools "^2.3.1" + websocket-ts "^2.1.5" + zod "^3.22.4" + "@surma/rollup-plugin-off-main-thread@^2.2.3": version "2.2.3" resolved "https://registry.yarnpkg.com/@surma/rollup-plugin-off-main-thread/-/rollup-plugin-off-main-thread-2.2.3.tgz#ee34985952ca21558ab0d952f00298ad2190c053" @@ -6635,19 +6649,6 @@ npm-run-path@^5.1.0: dependencies: path-key "^4.0.0" -nspec@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/nspec/-/nspec-0.3.0.tgz#7c7ee37bab841c190201d1a43634577c42f421d8" - integrity sha512-FKdJwYuxcq9btYRVaZwukRsp6fIuFZ5QKHdfxyj/Lw7PX+GwbeYlkyAuGEAuYBrHmMd4jcozbbfOLIg40mYJnA== - dependencies: - "@noble/hashes" "^1.3.3" - "@scure/base" "^1.1.5" - "@scure/bip32" "^1.3.3" - "@scure/bip39" "^1.2.2" - lru-cache "^10.2.0" - nostr-tools "^2.3.1" - zod "^3.22.4" - nth-check@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-2.1.1.tgz#c9eab428effce36cd6b92c924bdb000ef1f1ed1d" @@ -9296,6 +9297,11 @@ webpack-sources@^3.2.3: watchpack "^2.4.0" webpack-sources "^3.2.3" +websocket-ts@^2.1.5: + version "2.1.5" + resolved "https://registry.yarnpkg.com/websocket-ts/-/websocket-ts-2.1.5.tgz#b6b51f0afca89d6bc7ff71c9e74540f19ae0262c" + integrity sha512-rCNl9w6Hsir1azFm/pbjBEFzLD/gi7Th5ZgOxMifB6STUfTSovYAzryWw0TRvSZ1+Qu1Z5Plw4z42UfTNA9idA== + whatwg-encoding@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz#d0f4ef769905d426e1688f3e34381a99b60b76e5"