diff --git a/.changeset/neat-rats-rescue.md b/.changeset/neat-rats-rescue.md new file mode 100644 index 0000000..3a63514 --- /dev/null +++ b/.changeset/neat-rats-rescue.md @@ -0,0 +1,5 @@ +--- +'@vtbag/turn-signal': patch +--- + +Adds .d.ts declarations diff --git a/bin/bundle b/bin/bundle index 756cef9..6880bef 100755 --- a/bin/bundle +++ b/bin/bundle @@ -7,3 +7,5 @@ else (cd lib && rm *.js.map) >> /dev/null 2>&1 fi npx esbuild src/index.ts src/forced-traversal.ts --bundle $OPTS --target=ESnext --outdir=lib + +tsc diff --git a/package-lock.json b/package-lock.json index 162b97c..a6e335d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@changesets/cli": "^2.27.9", "@eslint/js": "^9.12.0", "@types/dom-navigation": "^1.0.4", + "@types/dom-view-transitions": "^1.0.5", "esbuild": "^0.24.0", "prettier": "^3.3.3", "typescript": "^5.6.2" @@ -783,6 +784,12 @@ "integrity": "sha512-s4pCS4jogEzXQsqoPZdLU+GA/5Wq+GoFsgiN2VGI8tw5I2Y/CftGJpC76iVhyoD7JTTEo+p0w+eh8SItMaxmgg==", "dev": true }, + "node_modules/@types/dom-view-transitions": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/dom-view-transitions/-/dom-view-transitions-1.0.5.tgz", + "integrity": "sha512-N2sILR7fxSMnaFaAPwGj4DtHCXjIyQTHt+xJyf9jATpzUsTkMNM0DWtqZB6W7f501B/Y0tq3uqat/VlbjuTpMA==", + "dev": true + }, "node_modules/@types/node": { "version": "12.20.55", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", diff --git a/package.json b/package.json index 9b25512..ef060e5 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,14 @@ { "name": "@vtbag/turn-signal", + "type": "module", "version": "1.0.2", "main": "lib/index.js", "description": "Turn-Signal is a lightweight script that enhances cross-document navigation by detecting the direction of browser navigation. It enables developers to create smooth, responsive transitions that adjust based on forward or backward navigation, delivering a more intuitive user experience.", "files": [ "lib/index.js", - "lib/forced-traversal.js" + "lib/index.d.ts", + "lib/forced-traversal.js", + "lib/forced-traversal.d.ts" ], "exports": { ".": "./lib/index.js", @@ -48,6 +51,7 @@ "@changesets/cli": "^2.27.9", "@eslint/js": "^9.12.0", "@types/dom-navigation": "^1.0.4", + "@types/dom-view-transitions": "^1.0.5", "esbuild": "^0.24.0", "prettier": "^3.3.3", "typescript": "^5.6.2" diff --git a/tsconfig.json b/tsconfig.json index 66c3f62..3630d1d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -51,9 +51,9 @@ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ /* Emit */ - //"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ // "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. */ @@ -71,7 +71,7 @@ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ - // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + "declarationDir": "./lib", /* Specify the output directory for generated declaration files. */ /* Interop Constraints */ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */