Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions .changeset/humble-rules-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@repo/eslint-config': patch
'@repo/hono-cjs': patch
'@repo/hono-esm': patch
'@repo/tsconfig': patch
---

Upgrade dependencies
5 changes: 5 additions & 0 deletions .changeset/tricky-regions-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'better-auth-harmony': patch
---

Upgrade dependencies, migrate to tsdown for bundling
942 changes: 0 additions & 942 deletions .yarn/releases/yarn-4.12.0.cjs

This file was deleted.

940 changes: 940 additions & 0 deletions .yarn/releases/yarn-4.13.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ supportedArchitectures:
- current
- linux

yarnPath: .yarn/releases/yarn-4.12.0.cjs
yarnPath: .yarn/releases/yarn-4.13.0.cjs
12 changes: 6 additions & 6 deletions examples/hono-cjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"@repo/eslint-config": "workspace:*",
"@repo/tsconfig": "workspace:*",
"@types/eslint": "^9.6.1",
"@types/node": "^24.10.14",
"eslint": "^9.39.3",
"typescript": "^5.9.3"
"@types/node": "^24.12.2",
"eslint": "^9.39.4",
"typescript": "^6.0.2"
},
"dependencies": {
"@hono/node-server": "1.19.10",
"better-auth": "1.4.19",
"@hono/node-server": "1.19.14",
"better-auth": "1.6.4",
"better-auth-harmony": "workspace:*",
"hono": "4.12.7"
"hono": "4.12.14"
}
}
12 changes: 6 additions & 6 deletions examples/hono-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"@repo/eslint-config": "workspace:*",
"@repo/tsconfig": "workspace:*",
"@types/eslint": "^9.6.1",
"@types/node": "^24.10.14",
"eslint": "^9.39.3",
"typescript": "^5.9.3"
"@types/node": "^24.12.2",
"eslint": "^9.39.4",
"typescript": "^6.0.2"
},
"dependencies": {
"@hono/node-server": "1.19.10",
"better-auth": "1.4.19",
"@hono/node-server": "1.19.14",
"better-auth": "1.6.4",
"better-auth-harmony": "workspace:*",
"hono": "4.12.7"
"hono": "4.12.14"
}
}
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"engines": {
"node": ">=20"
},
"packageManager": "yarn@4.12.0",
"packageManager": "yarn@4.13.0",
"workspaces": [
"examples/*",
"packages/*"
Expand All @@ -25,14 +25,15 @@
"format": "prettier --write \"**/*.{cjs,js,mjs,ts,tsx,md,json}\""
},
"devDependencies": {
"@changesets/cli": "^2.29.8",
"@changesets/cli": "^2.30.0",
"@opentelemetry/api": "1.9.1",
"@repo/eslint-config": "workspace:*",
"@repo/tsconfig": "workspace:*",
"changesets-changelog-clean": "^1.3.0",
"eslint": "^9.39.3",
"prettier": "^3.8.1",
"turbo": "^2.8.11",
"typescript": "^5.9.3"
"eslint": "^9.39.4",
"prettier": "^3.8.3",
"turbo": "2.9.6",
"typescript": "^6.0.2"
},
"dependenciesMeta": {
"better-sqlite3": {
Expand Down
40 changes: 20 additions & 20 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,36 @@
"./ignorePatterns": "./src/ignorePatterns.js"
},
"devDependencies": {
"eslint": "^9.39.3",
"turbo": "^2.8.11",
"typescript": "^5.9.3"
"eslint": "^9.39.4",
"turbo": "^2.9.6",
"typescript": "^6.0.2"
},
"dependencies": {
"@eslint-community/eslint-plugin-eslint-comments": "^4.6.0",
"@eslint/eslintrc": "^3.3.4",
"@eslint/js": "^9.39.3",
"@eslint/json": "^1.0.1",
"@eslint/markdown": "^7.5.1",
"@typescript-eslint/parser": "^8.56.1",
"@typescript-eslint/utils": "^8.56.1",
"@vitest/eslint-plugin": "^1.6.9",
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
"@eslint/eslintrc": "^3.3.5",
"@eslint/js": "^9.39.4",
"@eslint/json": "^1.2.0",
"@eslint/markdown": "^8.0.1",
"@typescript-eslint/parser": "^8.58.2",
"@typescript-eslint/utils": "^8.58.2",
"@vitest/eslint-plugin": "^1.6.16",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^10.1.8",
"eslint-config-turbo": "^2.8.11",
"eslint-import-resolver-node": "^0.3.9",
"eslint-config-turbo": "^2.9.6",
"eslint-import-resolver-node": "^0.3.10",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jsdoc": "^62.7.1",
"eslint-plugin-jsdoc": "^62.9.0",
"eslint-plugin-n": "^17.24.0",
"eslint-plugin-promise": "^7.2.1",
"eslint-plugin-redos": "^4.5.0",
"eslint-plugin-regexp": "^3.0.0",
"eslint-plugin-regexp": "^3.1.0",
"eslint-plugin-security": "^4.0.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-turbo": "^2.8.11",
"eslint-plugin-unicorn": "^63.0.0",
"eslint-plugin-yml": "^3.3.0",
"typescript-eslint": "^8.56.1"
"eslint-plugin-simple-import-sort": "^13.0.0",
"eslint-plugin-turbo": "^2.9.6",
"eslint-plugin-unicorn": "^64.0.0",
"eslint-plugin-yml": "^3.3.1",
"typescript-eslint": "^8.58.2"
},
"peerDependencies": {
"eslint": "^9.39.0",
Expand Down
47 changes: 23 additions & 24 deletions packages/plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"lint": "eslint .",
"typecheck": "tsc --noEmit --project tsconfig.build.json",
"emit-types": "rimraf -g dist/**/*{.ts,.ts.map}; tsc --emitDeclarationOnly --declaration --project tsconfig.build.json",
"build": "tsup",
"build": "tsdown",
"test": "vitest run --coverage --coverage.include=src",
"test:watch": "vitest"
},
Expand Down Expand Up @@ -39,8 +39,8 @@
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
Expand All @@ -49,8 +49,8 @@
},
"./phone": {
"import": {
"types": "./dist/phone.d.ts",
"default": "./dist/phone.js"
"types": "./dist/phone.d.mts",
"default": "./dist/phone.mjs"
},
"require": {
"types": "./dist/phone.d.cts",
Expand All @@ -59,8 +59,8 @@
},
"./email": {
"import": {
"types": "./dist/email.d.ts",
"default": "./dist/email.js"
"types": "./dist/email.d.mts",
"default": "./dist/email.mjs"
},
"require": {
"types": "./dist/email.d.cts",
Expand All @@ -69,8 +69,8 @@
},
"./email/matchers": {
"import": {
"types": "./dist/email/matchers.d.ts",
"default": "./dist/email/matchers.js"
"types": "./dist/email/matchers.d.mts",
"default": "./dist/email/matchers.mjs"
},
"require": {
"types": "./dist/email/matchers.d.cts",
Expand All @@ -79,8 +79,8 @@
},
"./phone/matchers": {
"import": {
"types": "./dist/phone/matchers.d.ts",
"default": "./dist/phone/matchers.js"
"types": "./dist/phone/matchers.d.mts",
"default": "./dist/phone/matchers.mjs"
},
"require": {
"types": "./dist/phone/matchers.d.cts",
Expand All @@ -97,27 +97,26 @@
"@repo/eslint-config": "*",
"@repo/tsconfig": "*",
"@types/eslint": "^9.6.1",
"@types/node": "^24.10.14",
"@types/node": "^24.12.2",
"@types/react": "^19.2.14",
"@types/react-dom": "19.2.3",
"@types/validator": "^13.15.10",
"@vitest/coverage-v8": "^4.0.18",
"better-auth": "1.4.19",
"better-sqlite3": "^12.6.2",
"eslint": "^9.39.3",
"@vitest/coverage-v8": "^4.1.4",
"better-auth": "1.6.4",
"better-sqlite3": "^12.9.0",
"eslint": "^9.39.4",
"rimraf": "^6.1.3",
"tsup": "^8.5.1",
"typescript": "^5.9.3",
"vite": "^7.3.1",
"vite-tsconfig-paths": "^6.1.1",
"vitest": "^4.0.18"
"tsdown": "^0.21.8",
"typescript": "^6.0.2",
"vite": "^8.0.8",
"vitest": "^4.1.4"
},
"peerDependencies": {
"better-auth": "^1.0.3"
},
"dependencies": {
"libphonenumber-js": "^1.12.37",
"mailchecker": "^6.0.19",
"validator": "^13.15.26"
"libphonenumber-js": "^1.12.41",
"mailchecker": "^6.0.20",
"validator": "^13.15.35"
}
}
2 changes: 1 addition & 1 deletion packages/plugins/src/email/email-otp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ describe('email-otp', async () => {
email: 'test@mailinator.com'
}
})
).rejects.toThrowError('Invalid email');
).rejects.toThrow('Invalid email');
});

it('should get verification otp on server', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/src/email/email-schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe('Mapped schema', async () => {
name: 'new-name'
});

expect(error?.status).toBe(422);
expect(error?.status).toBe(400);
});
});
});
2 changes: 1 addition & 1 deletion packages/plugins/src/email/email.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('email harmony', async () => {
name: 'new-name'
});

expect(error?.status).toBe(422);
expect(error?.status).toBe(400);
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/src/email/magic-link.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('magic link harmony', async () => {
onError(context) {
expect(context.response.status).toBe(302);
const location = context.response.headers.get('location');
expect(location).toContain('?error=INVALID_TOKEN');
expect(location).toContain('?error=ATTEMPTS_EXCEEDED');
}
}
);
Expand Down
3 changes: 3 additions & 0 deletions packages/plugins/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "@repo/tsconfig/base.json",
"compilerOptions": {
"rootDir": "./src"
},
"exclude": [
"node_modules",
"${configDir}/dist",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from 'tsup';
import path from 'node:path';
import { defineConfig } from 'tsdown';

/**
* Matches validator/es imports
Expand Down Expand Up @@ -62,50 +63,63 @@ export default defineConfig(() => ({
phone: './src/phone/index.ts',
'phone/matchers': './src/phone/matchers.ts'
},
format: ['esm', 'cjs'],
bundle: true,
format: {
esm: {
target: ['node22']
},
cjs: {
target: ['node20']
}
},
clean: true,
dts: true,
minify: true,
tsconfig: 'tsconfig.build.json',
treeshake: {
preset: 'smallest'
propertyReadSideEffects: false,
propertyWriteSideEffects: false,
moduleSideEffects: false,
// tryCatchDeoptimization: false, Not implemented https://github.com/rolldown/rolldown/issues/5872
unknownGlobalSideEffects: false
},
splitting: false,
cjsInterop: true,
esbuildPlugins: [
cjsDefault: true,
plugins: [
{
name: 'fix-validator-import',
setup(build) {
build.onEnd((result) => {
// Determine the output file extension based on the build options.
const outExtension = build.initialOptions.outExtension?.['.js'] ?? '.js';
// Determine if the output format is ESM (ECMAScript Module).
const isEsm = outExtension !== '.cjs';
renderChunk: {
// Optional, but helps avoid running on unrelated chunks.
filter: { code: /validator\/es\// },

// If there are build errors, do not proceed.
if (result.errors.length > 0) {
handler(code, chunk, outputOptions) {
// This plugin only makes sense for JS module outputs.
if (outputOptions.format !== 'es' && outputOptions.format !== 'cjs') {
return;
}

// Iterate over each output file generated by ESBuild.
for (const outputFile of result.outputFiles ?? []) {
// Only target files with the specified output extension.
// This ignores additional files emitted, like sourcemaps (e.g., "*.js.map").
if (outputFile.path.endsWith(outExtension)) {
// Get the original file contents.
const fileContents = outputFile.text;
// Modify the file contents by appending the correct file extensions.
const modify = isEsm ? modifyEsmImports : convertToCjsImports;
const nextFileContents = modify(fileContents, outExtension);
// Derive the emitted extension from the actual chunk filename.
// Falls back to a sane default if needed.
const outExtension =
path.extname(chunk.fileName) || (outputOptions.format === 'cjs' ? '.cjs' : '.js');

const modify = outputOptions.format === 'cjs' ? convertToCjsImports : modifyEsmImports;

// Update the output file contents with the modified contents.
outputFile.contents = Buffer.from(nextFileContents);
}
const nextCode = modify(code, outExtension);

if (nextCode === code) {
return;
}
});

return {
code: nextCode,
// Replace with a precise sourcemap via MagicString if you need it.
map: { mappings: '' }
};
}
}
}
],
skipNodeModulesBundle: true
deps: {
skipNodeModulesBundle: true
}
}));
Loading