better-auth-extensions 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.editorconfig ADDED
@@ -0,0 +1,8 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = tab
5
+ indent_size = 4
6
+ trim_trailing_whitespace = true
7
+ end_of_line = lf
8
+ insert_final_newline = true
@@ -0,0 +1,2 @@
1
+ node_modules
2
+ dist
package/.prettierrc ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "useTabs": true,
3
+ "tabWidth": 4,
4
+ "arrowParens": "avoid"
5
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Garikai Gumbo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # better-auth-extensions
2
+
3
+ Miscellaneous extensions and plugins for better-auth
4
+
5
+ ## See More
6
+
7
+ - [@better-auth-extensions/yandex](https://github.com/Grod56/better-auth-extensions/tree/main/packages/yandex#readme)
@@ -0,0 +1,44 @@
1
+ import js from "@eslint/js";
2
+ import { defineConfig } from "eslint/config";
3
+ import globals from "globals";
4
+ import tseslint from "typescript-eslint";
5
+ import eslintConfigPrettier from "eslint-config-prettier/flat";
6
+
7
+ export default defineConfig([
8
+ {
9
+ files: ["**/*.{js,ts,tsx}"],
10
+ plugins: { js },
11
+ extends: ["js/recommended"],
12
+ },
13
+ {
14
+ settings: {
15
+ react: {
16
+ version: "detect",
17
+ },
18
+ },
19
+ },
20
+ {
21
+ files: ["**/*.{js,mjs,cjs,ts,tsx}"],
22
+ languageOptions: { globals: globals.browser },
23
+ },
24
+ { languageOptions: { globals: globals.jest } },
25
+ tseslint.configs.recommended,
26
+ {
27
+ plugins: {
28
+ js,
29
+ },
30
+ rules: {
31
+ "no-empty-pattern": "error",
32
+ },
33
+ },
34
+ {
35
+ rules: {
36
+ "@typescript-eslint/no-empty-object-type": "error",
37
+ "@typescript-eslint/no-unused-vars": [
38
+ "error",
39
+ { argsIgnorePattern: "^_" },
40
+ ],
41
+ },
42
+ },
43
+ eslintConfigPrettier,
44
+ ]);
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "better-auth-extensions",
3
+ "version": "1.0.0",
4
+ "description": "Miscellaneous extensions and plugins for better-auth",
5
+ "keywords": [
6
+ "better-auth",
7
+ "yandex",
8
+ "auth",
9
+ "nextjs"
10
+ ],
11
+ "license": "MIT",
12
+ "author": "Grod56",
13
+ "type": "commonjs",
14
+ "main": "index.js",
15
+ "devDependencies": {
16
+ "@eslint/js": "^10.0.1",
17
+ "@rollup/plugin-typescript": "^12.3.0",
18
+ "@types/node": "^25.6.0",
19
+ "better-auth": "^1.6.2",
20
+ "eslint": "^10.2.0",
21
+ "eslint-config-prettier": "^10.1.8",
22
+ "globals": "^17.5.0",
23
+ "rollup": "^4.60.3",
24
+ "rollup-plugin-delete": "^3.0.2",
25
+ "rollup-plugin-dts": "^6.4.1",
26
+ "rollup-plugin-sourcemaps": "^0.6.3",
27
+ "ts-node": "^10.9.2",
28
+ "tslib": "^2.8.1",
29
+ "typescript": "^6.0.2",
30
+ "typescript-eslint": "^8.58.1"
31
+ }
32
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Garikai Gumbo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,78 @@
1
+ # better-auth-extensions/yandex
2
+
3
+ [![npm](https://img.shields.io/npm/v/%40better-auth-extensions%2Fyandex)](https://www.npmjs.com/package/@better-auth-extensions/yandex) [![NPM Downloads](https://img.shields.io/npm/d18m/%40better-auth-extensions%2Fyandex)](https://www.npmjs.com/package/better-auth-extensions/yandex)
4
+
5
+ Yandex extensions and plugins for better-auth.
6
+
7
+ ## Installation
8
+
9
+ ```console
10
+ npm install @better-auth-extensions/yandex
11
+ ```
12
+
13
+ ## Documentation
14
+
15
+ ### `getYandexOAuthPlugin(clientId, clientSecret, permissions?)`
16
+
17
+ Produces Yandex [`GenericOAuthConfig`](https://better-auth.com/docs/plugins/generic-oauth) object which may be used as a Generic OAuth plugin. It takes in the Client ID, and Client Secret of the Yandex Application and an optional list of permissions to be used for the application.
18
+
19
+ #### Example
20
+
21
+ Including the Yandex plugin in the `better-auth` configuration:
22
+
23
+ `auth.ts`
24
+
25
+ ```typescript
26
+ import { betterAuth } from "better-auth";
27
+ import { genericOAuth } from "better-auth/plugins";
28
+
29
+ const yandexConfig = getYandexOAuthPlugin(
30
+ process.env.YANDEX_CLIENT_ID,
31
+ process.env.YANDEX_CLIENT_SECRET,
32
+ );
33
+
34
+ export const auth = betterAuth({
35
+ // ... other config options
36
+ plugins: [
37
+ genericOAuth({
38
+ config: [yandexConfig],
39
+ }),
40
+ ],
41
+ });
42
+ ```
43
+
44
+ Setting up the `better-auth` client:
45
+
46
+ `lib/auth-client.ts`
47
+
48
+ ```typescript
49
+ import { createAuthClient } from "better-auth/react";
50
+ import { genericOAuthClient } from "better-auth/client/plugins";
51
+
52
+ export const { signIn, signUp, useSession } = createAuthClient({
53
+ plugins: [genericOAuthClient()],
54
+ });
55
+ ```
56
+
57
+ Using the Yandex plugin to sign in:
58
+
59
+ `lib/components/SignInButton.tsx`
60
+
61
+ ```tsx
62
+ import { signIn } from "../auth-client";
63
+
64
+ export default function SignInButton({ endpoint }: { endpoint: string }) {
65
+ return (
66
+ <button
67
+ onClick={() => {
68
+ signIn.oauth2({
69
+ providerId: "yandex",
70
+ callbackURL: endpoint,
71
+ });
72
+ }}
73
+ >
74
+ {"Sign in with Yandex"}
75
+ </button>
76
+ );
77
+ }
78
+ ```
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "yandex",
3
+ "version": "1.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "yandex",
9
+ "version": "1.0.0",
10
+ "license": "MIT"
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@better-auth-extensions/yandex",
3
+ "version": "0.1.0",
4
+ "description": "Yandex extensions for better-auth",
5
+ "homepage": "https://github.com/Grod56/better-auth-extensions/tree/main/packages/yandex",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Grod56/better-auth-extensions.git",
9
+ "directory": "packages/yandex"
10
+ },
11
+ "keywords": [
12
+ "yandex",
13
+ "better-auth",
14
+ "auth",
15
+ "nextjs"
16
+ ],
17
+ "license": "MIT",
18
+ "author": "Grod56",
19
+ "type": "module",
20
+ "module": "./dist/index.mjs",
21
+ "main": "./dist/index.cjs",
22
+ "types": "./dist/index.d.ts",
23
+ "files": [
24
+ "dist/**/*"
25
+ ],
26
+ "exports": {
27
+ ".": {
28
+ "import": "./dist/index.mjs",
29
+ "require": "./dist/index.cjs",
30
+ "types": "./dist/index.d.ts"
31
+ }
32
+ },
33
+ "scripts": {
34
+ "clean": "del-cli ./dist",
35
+ "build": "npm run clean && rollup -c",
36
+ "prepack": "npm run build",
37
+ "test": "jest"
38
+ }
39
+ }
@@ -0,0 +1,42 @@
1
+ import typescript from "@rollup/plugin-typescript";
2
+ import sourcemaps from "rollup-plugin-sourcemaps";
3
+ import del from "rollup-plugin-delete";
4
+ import { dts } from "rollup-plugin-dts";
5
+
6
+ export default [
7
+ {
8
+ input: "src/index.ts",
9
+ output: [
10
+ {
11
+ sourcemap: "inline",
12
+ file: "dist/index.cjs",
13
+ format: "cjs",
14
+ },
15
+ {
16
+ sourcemap: "inline",
17
+ file: "dist/index.mjs",
18
+ format: "es",
19
+ },
20
+ ],
21
+ external: ["better-auth/plugins"],
22
+ plugins: [
23
+ typescript({
24
+ sourceMap: true,
25
+ inlineSources: true,
26
+ tsconfig: "./tsconfig.json",
27
+ }),
28
+ sourcemaps(),
29
+ ],
30
+ },
31
+ {
32
+ input: "dist/dts/index.d.ts",
33
+ output: [
34
+ {
35
+ file: "dist/index.d.ts",
36
+ format: "es",
37
+ plugins: [],
38
+ },
39
+ ],
40
+ plugins: [dts(), del({ targets: "dist/dts", hook: "buildEnd" })],
41
+ },
42
+ ];
@@ -0,0 +1,80 @@
1
+ import type { GenericOAuthConfig } from "better-auth/plugins";
2
+
3
+ type Scope = "login:email" | "login:info" | "login:avatar";
4
+
5
+ export type YandexPermission = "email" | "user-info" | "profile-picture";
6
+
7
+ function getScope(permission: YandexPermission): Scope {
8
+ switch (permission) {
9
+ case "email":
10
+ return "login:email";
11
+ case "user-info":
12
+ return "login:info";
13
+ case "profile-picture":
14
+ return "login:avatar";
15
+ }
16
+ }
17
+
18
+ /**
19
+ * Returns Yandex config which may be used as a Generic OAuth plugin.
20
+ *
21
+ * @example
22
+ * import { betterAuth } from "better-auth"
23
+ * import { genericOAuth } from "better-auth/plugins"
24
+
25
+ * const yandexConfig = getYandexOAuthPlugin(
26
+ * process.env.YANDEX_CLIENT_ID,
27
+ * process.env.YANDEX_CLIENT_SECRET
28
+ * )
29
+ *
30
+ * export const auth = betterAuth({
31
+ * // ... other config options
32
+ * plugins: [
33
+ * genericOAuth({
34
+ * config: [yandexConfig]
35
+ * })
36
+ * ]
37
+ * })
38
+ *
39
+ * @param clientId Yandex Client ID
40
+ * @param clientSecret Yandex Client Secret
41
+ * @param permissions OAuth Permissions to be used for application. Defaults to email, user info, and profile picture when left undefined.
42
+ * @see https://better-auth.com/docs/plugins/generic-oauth
43
+ */
44
+ export function getYandexOAuthPlugin(
45
+ clientId: string,
46
+ clientSecret: string,
47
+ permissions?: YandexPermission[],
48
+ ): GenericOAuthConfig {
49
+ const uniquePermissions: YandexPermission[] =
50
+ permissions != undefined
51
+ ? [...new Set(permissions)]
52
+ : [...new Set(["email", "user-info", "profile-picture"] as const)];
53
+ return {
54
+ providerId: "yandex",
55
+ clientId: clientId,
56
+ clientSecret: clientSecret,
57
+ authorizationUrl: "https://oauth.yandex.com/authorize",
58
+ authorizationUrlParams: {
59
+ scope: uniquePermissions
60
+ .map(permission => getScope(permission))
61
+ .join(" "),
62
+ },
63
+ tokenUrl: "https://oauth.yandex.com/token",
64
+ userInfoUrl: "https://login.yandex.ru/info?format=json",
65
+ mapProfileToUser(profile) {
66
+ return {
67
+ id: profile.id,
68
+ name:
69
+ profile.display_name ??
70
+ profile.real_name ??
71
+ profile.first_name,
72
+ email: profile.default_email ?? profile.emails?.[0] ?? null,
73
+ image:
74
+ !profile.is_avatar_empty && profile.default_avatar_id
75
+ ? `https://avatars.yandex.net/get-yapic/${profile.default_avatar_id}/islands-200`
76
+ : null,
77
+ };
78
+ },
79
+ } satisfies GenericOAuthConfig;
80
+ }
@@ -0,0 +1,118 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
+
5
+ /* Projects */
6
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
+
13
+ /* Language and Environment */
14
+ "target": "ES2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
15
+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
17
+ // "libReplacement": true, /* Enable lib replacement. */
18
+ // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
19
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
20
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
21
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
22
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
23
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
24
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
25
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
26
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
27
+
28
+ /* Modules */
29
+ "module": "NodeNext" /* Specify what module code is generated. */,
30
+ "rootDir": "./src" /* Specify the root folder within your source files. */,
31
+ "moduleResolution": "nodenext" /* Specify how TypeScript looks up a file from a given module specifier. */,
32
+ // "baseUrl": "./src" /* Specify the base directory to resolve non-relative module names. */,
33
+ // "paths": {
34
+ // "@/*": ["./src/*"]
35
+ // },
36
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
37
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
38
+ "types": [
39
+ "node"
40
+ ] /* Specify type package names to be included without being referenced in a source file. */,
41
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
42
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
43
+ // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
44
+ // "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
45
+ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
46
+ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
47
+ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
48
+ // "noUncheckedSideEffectImports": true, /* Check side effect imports. */
49
+ // "resolveJsonModule": true, /* Enable importing .json files. */
50
+ // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
51
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
52
+
53
+ /* JavaScript Support */
54
+ "allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */,
55
+ "checkJs": true /* Enable error reporting in type-checked JavaScript files. */,
56
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
57
+
58
+ /* Emit */
59
+ "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
60
+ // "declarationMap": true /* Create sourcemaps for d.ts files. */,
61
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
62
+ "sourceMap": true /* Create source map files for emitted JavaScript files. */,
63
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
64
+ // "noEmit": true, /* Disable emitting files from a compilation. */
65
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
66
+ "outDir": "./dist" /* Specify an output folder for all emitted files. */,
67
+ // "removeComments": true, /* Disable emitting comments. */
68
+ "importHelpers": true /* Allow importing helper functions from tslib once per project, instead of including them per-file. */,
69
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
70
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
71
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
72
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
73
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
74
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
75
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
76
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
77
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
78
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
79
+ "declarationDir": "./dist/dts" /* Specify the output directory for generated declaration files. */,
80
+
81
+ /* Interop Constraints */
82
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
83
+ // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
84
+ // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
85
+ // "erasableSyntaxOnly": true, /* Do not allow runtime constructs that are not part of ECMAScript. */
86
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
87
+ "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
88
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
89
+ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
90
+
91
+ /* Type Checking */
92
+ "strict": true /* Enable all strict type-checking options. */,
93
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
94
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
95
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
96
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
97
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
98
+ // "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
99
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
100
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
101
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
102
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
103
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
104
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
105
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
106
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
107
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
108
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
109
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
110
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
111
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
112
+
113
+ /* Completeness */
114
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
115
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
116
+ },
117
+ "include": ["src/index.ts"]
118
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,116 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
+
5
+ /* Projects */
6
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
+
13
+ /* Language and Environment */
14
+ "target": "ES2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
15
+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
17
+ // "libReplacement": true, /* Enable lib replacement. */
18
+ // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
19
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
20
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
21
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
22
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
23
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
24
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
25
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
26
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
27
+
28
+ /* Modules */
29
+ "module": "NodeNext" /* Specify what module code is generated. */,
30
+ "rootDir": "./" /* Specify the root folder within your source files. */,
31
+ "moduleResolution": "nodenext" /* Specify how TypeScript looks up a file from a given module specifier. */,
32
+ // "baseUrl": "./src" /* Specify the base directory to resolve non-relative module names. */,
33
+ // "paths": {
34
+ // "@/*": ["./src/*"]
35
+ // },
36
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
37
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
38
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
39
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
40
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
41
+ // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
42
+ // "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
43
+ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
44
+ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
45
+ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
46
+ // "noUncheckedSideEffectImports": true, /* Check side effect imports. */
47
+ // "resolveJsonModule": true, /* Enable importing .json files. */
48
+ // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
49
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
50
+
51
+ /* JavaScript Support */
52
+ "allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */,
53
+ "checkJs": true /* Enable error reporting in type-checked JavaScript files. */,
54
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
55
+
56
+ /* Emit */
57
+ "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
58
+ // "declarationMap": true /* Create sourcemaps for d.ts files. */,
59
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
60
+ "sourceMap": true /* Create source map files for emitted JavaScript files. */,
61
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
62
+ // "noEmit": true, /* Disable emitting files from a compilation. */
63
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
64
+ "outDir": "./dist" /* Specify an output folder for all emitted files. */,
65
+ // "removeComments": true, /* Disable emitting comments. */
66
+ "importHelpers": true /* Allow importing helper functions from tslib once per project, instead of including them per-file. */,
67
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
68
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
69
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
70
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
71
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
72
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
73
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
74
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
75
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
76
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
77
+ "declarationDir": "./dist/dts" /* Specify the output directory for generated declaration files. */,
78
+
79
+ /* Interop Constraints */
80
+ // "isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */,
81
+ // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
82
+ // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
83
+ // "erasableSyntaxOnly": true, /* Do not allow runtime constructs that are not part of ECMAScript. */
84
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
85
+ "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
86
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
87
+ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
88
+
89
+ /* Type Checking */
90
+ "strict": true /* Enable all strict type-checking options. */,
91
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
92
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
93
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
94
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
95
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
96
+ // "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
97
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
98
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
99
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
100
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
101
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
102
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
103
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
104
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
105
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
106
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
107
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
108
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
109
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
110
+
111
+ /* Completeness */
112
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
113
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
114
+ },
115
+ "include": ["./**/*.ts"]
116
+ }