diff --git a/package.json b/package.json index 44ca91d..dcbbead 100644 --- a/package.json +++ b/package.json @@ -17,15 +17,25 @@ "url": "https://opencollective.com/express" }, "license": "MIT", - "exports": "./dist/index.js", - "main": "dist/index.js", - "typings": "dist/index.d.ts", + "exports": { + "import": { + "types": "./dist/index.d.mts", + "import": "./dist/index.mjs" + }, + "require": { + "types": "./dist/index.d.ts", + "require": "./dist/index.js" + } + }, + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", "files": [ "dist/" ], "scripts": { "bench": "vitest bench", - "build": "ts-scripts build", + "build": "tsdown src/index.ts --format cjs,esm --platform neutral --sourcemap", "format": "ts-scripts format", "lint": "ts-scripts lint", "prepare": "ts-scripts install && npm run build", @@ -41,6 +51,7 @@ "@vitest/coverage-v8": "^3.0.5", "recheck": "^4.5.0", "size-limit": "^11.1.2", + "tsdown": "^0.21.7", "typescript": "^5.7.3", "vitest": "^3.0.5" }, @@ -56,9 +67,11 @@ "ts-scripts": { "dist": [ "dist" - ], - "project": [ - "tsconfig.build.json" ] + }, + "tsdown": { + "outputOptions": { + "esModule": true + } } } diff --git a/src/index.ts b/src/index.ts index a1f162f..3e57ad7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -667,3 +667,13 @@ function stringifyName(name: string, next: Token | undefined): string { return name; } + +export default { + PathError, + TokenData, + compile, + match, + parse, + pathToRegexp, + stringify, +}; diff --git a/tsconfig.build.json b/tsconfig.build.json deleted file mode 100644 index 3db8e88..0000000 --- a/tsconfig.build.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "types": [] - }, - "exclude": ["src/**/*.spec.ts", "src/**/*.bench.ts"] -}