diff --git a/packages/nexus/biome.json b/packages/nexus/biome.json new file mode 100644 index 00000000000..709230af37e --- /dev/null +++ b/packages/nexus/biome.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://biomejs.dev/schemas/2.0.6/schema.json", + "extends": "//", + "overrides": [ + { + "assist": { + "actions": { + "source": { + "useSortedKeys": "off" + } + } + }, + "includes": ["package.json"] + } + ] +} diff --git a/packages/nexus/knip.json b/packages/nexus/knip.json new file mode 100644 index 00000000000..00e313b9413 --- /dev/null +++ b/packages/nexus/knip.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://unpkg.com/knip@5/schema.json", + "entry": ["src/exports/**"], + "ignore": ["src/**/__generated__/**", "**/*.bench.ts"], + "ignoreBinaries": ["printf"], + "ignoreDependencies": ["tslib"], + "project": ["src/**/*.{ts,tsx}"], + "rules": { + "enumMembers": "off", + "optionalPeerDependencies": "off" + } +} diff --git a/packages/nexus/package.json b/packages/nexus/package.json new file mode 100644 index 00000000000..76b0951df62 --- /dev/null +++ b/packages/nexus/package.json @@ -0,0 +1,76 @@ +{ + "author": "thirdweb eng ", + "browser": { + "crypto": false + }, + "bugs": { + "url": "https://github.com/thirdweb-dev/js/issues" + }, + "dependencies": {}, + "devDependencies": { + "@biomejs/biome": "2.0.6", + "knip": "5.60.2", + "size-limit": "11.2.0", + "typescript": "5.8.3", + "rimraf": "6.0.1" + }, + "engines": { + "node": ">=22" + }, + "exports": { + ".": { + "types": "./dist/types/exports/nexus.d.ts", + "import": "./dist/esm/exports/nexus.js", + "default": "./dist/cjs/exports/nexus.js" + } + }, + "files": [ + "dist/*", + "src/*", + "!**/*.tsbuildinfo", + "!**/*.test.ts", + "!**/*.test.tsx", + "!**/*.test.ts.snap", + "!**/*.test-d.ts", + "!**/*.bench.ts", + "!tsconfig.build.json" + ], + "license": "Apache-2.0", + "main": "./dist/cjs/exports/nexus.js", + "module": "./dist/esm/exports/nexus.js", + "name": "@thirdweb-dev/nexus", + "peerDependencies": { + "typescript": ">=5.0.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/thirdweb-dev/js.git#main" + }, + "scripts": { + "build": "pnpm clean && pnpm build:types && pnpm build:cjs && pnpm build:esm", + "build:cjs": "tsc --noCheck --project ./tsconfig.build.json --module commonjs --outDir ./dist/cjs --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./dist/cjs/package.json", + "build:esm": "tsc --noCheck --project ./tsconfig.build.json --module es2020 --outDir ./dist/esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/esm/package.json", + "build:types": "tsc --project ./tsconfig.build.json --module nodenext --moduleResolution nodenext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap", + "clean": "rimraf dist", + "dev": "tsc --project ./tsconfig.build.json --module nodenext --moduleResolution nodenext --outDir ./dist/esm --watch", + "dev:cjs": "printf '{\"type\":\"commonjs\"}' > ./dist/cjs/package.json && tsc --noCheck --project ./tsconfig.build.json --module commonjs --outDir ./dist/cjs --verbatimModuleSyntax false --watch", + "dev:esm": "printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/esm/package.json && tsc --noCheck --project ./tsconfig.build.json --module es2020 --outDir ./dist/esm --watch", + "fix": "biome check ./src --fix", + "format": "biome format ./src --write", + "knip": "knip", + "lint": "knip && biome check ./src && tsc --project ./tsconfig.build.json --module nodenext --moduleResolution nodenext --noEmit", + "size": "size-limit", + "typecheck": "tsc --project ./tsconfig.build.json --module nodenext --moduleResolution nodenext --noEmit", + "update-version": "node scripts/version.mjs" + }, + "sideEffects": false, + "type": "module", + "types": "./dist/types/exports/nexus.d.ts", + "typings": "./dist/types/exports/nexus.d.ts", + "version": "0.1.0" +} diff --git a/packages/nexus/scripts/version.mjs b/packages/nexus/scripts/version.mjs new file mode 100644 index 00000000000..0bdf10967ff --- /dev/null +++ b/packages/nexus/scripts/version.mjs @@ -0,0 +1,9 @@ +import { readFile, writeFile } from "node:fs/promises"; + +const packageVersion = JSON.parse(await readFile("./package.json")).version; + +await writeFile( + "./src/version.ts", + `// this file is auto-generated by the version.mjs script +export const version = "${packageVersion}";\n`, +); diff --git a/packages/nexus/src/exports/nexus.ts b/packages/nexus/src/exports/nexus.ts new file mode 100644 index 00000000000..e41afc858b8 --- /dev/null +++ b/packages/nexus/src/exports/nexus.ts @@ -0,0 +1,3 @@ +import { version } from "../version.js"; + +console.log("Hello, nexus!", version); diff --git a/packages/nexus/src/version.ts b/packages/nexus/src/version.ts new file mode 100644 index 00000000000..2372e274fcb --- /dev/null +++ b/packages/nexus/src/version.ts @@ -0,0 +1,2 @@ +// this file is auto-generated by the version.mjs script +export const version = "0.0.0"; diff --git a/packages/nexus/tsconfig.base.json b/packages/nexus/tsconfig.base.json new file mode 100644 index 00000000000..25c55988d49 --- /dev/null +++ b/packages/nexus/tsconfig.base.json @@ -0,0 +1,48 @@ +{ + // This tsconfig file contains the shared config for the build (tsconfig.build.json) and type checking (tsconfig.json) config. + "compilerOptions": { + // Incremental builds + // NOTE: Enabling incremental builds speeds up `tsc`. Keep in mind though that it does not reliably bust the cache when the `tsconfig.json` file changes. + "allowJs": false, + "allowSyntheticDefaultImports": true, + "checkJs": false, + + // Interop constraints + "esModuleInterop": false, + "exactOptionalPropertyTypes": false, + "forceConsistentCasingInFileNames": true, + "importHelpers": true, + // Incremental builds + // NOTE: Enabling incremental builds speeds up `tsc`. Keep in mind though that it does not reliably bust the cache when the `tsconfig.json` file changes. + "incremental": false, + + // jsx for "/react" portion + "jsx": "react-jsx", + "lib": [ + "ES2022", // By using ES2022 we get access to the `.cause` property on `Error` instances. + "DOM" // We are adding `DOM` here to get the `fetch`, etc. types. This should be removed once these types are available via DefinitelyTyped. + ], + "module": "NodeNext", + + // Language and environment + "moduleResolution": "NodeNext", + "noFallthroughCasesInSwitch": true, + "noImplicitOverride": true, + "noImplicitReturns": true, + "noUncheckedIndexedAccess": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + + // Skip type checking for node modules + "skipLibCheck": true, + + // Type checking + "strict": true, + "target": "ES2021", + "useDefineForClassFields": true, + "useUnknownInCatchVariables": true, + "verbatimModuleSyntax": true + }, + // This tsconfig file contains the shared config for the build (tsconfig.build.json) and type checking (tsconfig.json) config. + "include": [] +} diff --git a/packages/nexus/tsconfig.build.json b/packages/nexus/tsconfig.build.json new file mode 100644 index 00000000000..63325457c67 --- /dev/null +++ b/packages/nexus/tsconfig.build.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "moduleResolution": "node", + "rootDir": "./src", + "sourceMap": true + }, + "exclude": [ + "src/**/*.test.ts", + "src/**/*.test.tsx", + "src/**/*.test-d.ts", + "src/**/*.bench.ts", + "src/**/*.macro.ts" + ], + "extends": "./tsconfig.base.json", + "include": ["src"] +} diff --git a/packages/nexus/tsconfig.json b/packages/nexus/tsconfig.json new file mode 100644 index 00000000000..b9912d33c04 --- /dev/null +++ b/packages/nexus/tsconfig.json @@ -0,0 +1,13 @@ +{ + // This configuration is used for local development and type checking. + "compilerOptions": { + "baseUrl": ".", + "outDir": "./dist", + "paths": { + "~test/*": ["./test/src/*"] + } + }, + "exclude": [], + "extends": "./tsconfig.base.json", + "include": ["src", "test"] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0e0f118c050..e79c51dbd16 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1249,6 +1249,24 @@ importers: specifier: ^2.8.1 version: 2.8.1 + packages/nexus: + devDependencies: + '@biomejs/biome': + specifier: 2.0.6 + version: 2.0.6 + knip: + specifier: 5.60.2 + version: 5.60.2(@types/node@24.0.10)(typescript@5.8.3) + rimraf: + specifier: 6.0.1 + version: 6.0.1 + size-limit: + specifier: 11.2.0 + version: 11.2.0 + typescript: + specifier: 5.8.3 + version: 5.8.3 + packages/react-native-adapter: dependencies: '@aws-sdk/client-kms': @@ -8272,6 +8290,7 @@ packages: '@walletconnect/sign-client@2.19.2': resolution: {integrity: sha512-a/K5PRIFPCjfHq5xx3WYKHAAF8Ft2I1LtxloyibqiQOoUtNLfKgFB1r8sdMvXM7/PADNPe4iAw4uSE6PrARrfg==} + deprecated: 'Reliability and performance improvements. See: https://github.com/WalletConnect/walletconnect-monorepo/releases' '@walletconnect/sign-client@2.21.0': resolution: {integrity: sha512-z7h+PeLa5Au2R591d/8ZlziE0stJvdzP9jNFzFolf2RG/OiXulgFKum8PrIyXy+Rg2q95U9nRVUF9fWcn78yBA==} @@ -8281,6 +8300,7 @@ packages: '@walletconnect/sign-client@2.21.5': resolution: {integrity: sha512-IAs/IqmE1HVL9EsvqkNRU4NeAYe//h9NwqKi7ToKYZv4jhcC3BBemUD1r8iQJSTHMhO41EKn1G9/DiBln3ZiwQ==} + deprecated: 'Reliability and performance improvements. See: https://github.com/WalletConnect/walletconnect-monorepo/releases' '@walletconnect/sign-client@2.21.8': resolution: {integrity: sha512-lTcUbMjQ0YUZ5wzCLhpBeS9OkWYgLLly6BddEp2+pm4QxiwCCU2Nao0nBJXgzKbZYQOgrEGqtdm/7ze67gjzRA==} @@ -8305,6 +8325,7 @@ packages: '@walletconnect/universal-provider@2.19.2': resolution: {integrity: sha512-LkKg+EjcSUpPUhhvRANgkjPL38wJPIWumAYD8OK/g4OFuJ4W3lS/XTCKthABQfFqmiNbNbVllmywiyE44KdpQg==} + deprecated: 'Reliability and performance improvements. See: https://github.com/WalletConnect/walletconnect-monorepo/releases' '@walletconnect/universal-provider@2.21.0': resolution: {integrity: sha512-mtUQvewt+X0VBQay/xOJBvxsB3Xsm1lTwFjZ6WUwSOTR1X+FNb71hSApnV5kbsdDIpYPXeQUbGt2se1n5E5UBg==} @@ -8314,6 +8335,7 @@ packages: '@walletconnect/universal-provider@2.21.5': resolution: {integrity: sha512-SMXGGXyj78c8Ru2f665ZFZU24phn0yZyCP5Ej7goxVQxABwqWKM/odj3j/IxZv+hxA8yU13yxaubgVefnereqw==} + deprecated: 'Reliability and performance improvements. See: https://github.com/WalletConnect/walletconnect-monorepo/releases' '@walletconnect/universal-provider@2.21.8': resolution: {integrity: sha512-Nc1Z6VXnya152yucNDPnlTkrhG289tCUfcjiWqDmwNYzFSfdT5oJQHlnffQXlvoks90kn5Ru8Rnwag2CH1YOVQ==} @@ -34914,7 +34936,7 @@ snapshots: minimist: 1.2.8 oxc-resolver: 11.2.0 picocolors: 1.1.1 - picomatch: 4.0.2 + picomatch: 4.0.3 smol-toml: 1.3.4 strip-json-comments: 5.0.2 typescript: 5.8.3 @@ -34932,7 +34954,7 @@ snapshots: minimist: 1.2.8 oxc-resolver: 11.2.0 picocolors: 1.1.1 - picomatch: 4.0.2 + picomatch: 4.0.3 smol-toml: 1.3.4 strip-json-comments: 5.0.2 typescript: 5.8.3 @@ -38764,7 +38786,7 @@ snapshots: lilconfig: 3.1.3 nanospinner: 1.2.2 picocolors: 1.1.1 - tinyglobby: 0.2.14 + tinyglobby: 0.2.15 slash@3.0.0: {} diff --git a/turbo.json b/turbo.json index 00c7029f13d..d2be01aba66 100644 --- a/turbo.json +++ b/turbo.json @@ -96,7 +96,7 @@ "thirdweb-dashboard#dev": { "dependsOn": ["^build"] }, - "thirdweb#update-version": { + "update-version": { "inputs": ["$TURBO_DEFAULT$", "package.json"], "outputs": ["src/version.ts"] },