diff --git a/package-lock.json b/package-lock.json index ce8966c..4e7c216 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "prettier-plugin-organize-imports": "4.1.0", "rimraf": "6.0.1", "rollup": "4.24.2", + "rollup-plugin-dts": "6.1.1", "ts-jest": "29.2.5", "tslib": "2.8.0", "typescript": "5.6.3" @@ -4454,6 +4455,15 @@ "yallist": "^3.0.2" } }, + "node_modules/magic-string": { + "version": "0.30.12", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.12.tgz", + "integrity": "sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==", + "dev": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, "node_modules/make-dir": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", @@ -5278,6 +5288,28 @@ "fsevents": "~2.3.2" } }, + "node_modules/rollup-plugin-dts": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-dts/-/rollup-plugin-dts-6.1.1.tgz", + "integrity": "sha512-aSHRcJ6KG2IHIioYlvAOcEq6U99sVtqDDKVhnwt70rW6tsz3tv5OSjEiWcgzfsHdLyGXZ/3b/7b/+Za3Y6r1XA==", + "dev": true, + "dependencies": { + "magic-string": "^0.30.10" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/Swatinem" + }, + "optionalDependencies": { + "@babel/code-frame": "^7.24.2" + }, + "peerDependencies": { + "rollup": "^3.29.4 || ^4", + "typescript": "^4.5 || ^5.0" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", diff --git a/package.json b/package.json index d5b0d90..bad013a 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,9 @@ "format:check": "prettier . --check && eslint \"**/*.{js,vue}\"", "test": "npx jest" }, - "dependencies": {}, "devDependencies": { "@eslint/js": "9.13.0", + "@rollup/plugin-terser": "0.4.4", "@rollup/plugin-typescript": "12.1.1", "@types/jest": "29.5.14", "eslint": "9.13.0", @@ -41,9 +41,9 @@ "prettier-plugin-organize-imports": "4.1.0", "rimraf": "6.0.1", "rollup": "4.24.2", - "@rollup/plugin-terser": "0.4.4", + "rollup-plugin-dts": "6.1.1", + "ts-jest": "29.2.5", "tslib": "2.8.0", - "typescript": "5.6.3", - "ts-jest": "29.2.5" + "typescript": "5.6.3" } } diff --git a/rollup.config.js b/rollup.config.js index 4a99070..85853f8 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,5 +1,6 @@ import terser from '@rollup/plugin-terser'; import typescript from '@rollup/plugin-typescript'; +import dts from 'rollup-plugin-dts'; const createPlugins = (compact) => (compact ? [terser()] : []); @@ -37,17 +38,26 @@ const cjs = (compact) => ({ plugins: createPlugins(compact) }); -export default { - input: 'src/passwordless.ts', - plugins: [typescript()], - output: [ - iife(false), - iife(true), - es6(false), - es6(true), - umd(false), - umd(true), - cjs(false), - cjs(true) - ] -}; +export default [ + { + input: 'src/passwordless.ts', + plugins: [typescript()], + output: [ + iife(false), + iife(true), + es6(false), + es6(true), + umd(false), + umd(true), + cjs(false), + cjs(true) + ] + }, + { + input: 'src/types.ts', + plugins: [dts()], + output: { + file: 'dist/types.d.ts' + } + } +];