diff --git a/browser-detection/BrowserDetection.ts b/browser-detection/BrowserDetection.ts index 3320bcf..2f34825 100644 --- a/browser-detection/BrowserDetection.ts +++ b/browser-detection/BrowserDetection.ts @@ -58,7 +58,7 @@ function _getJitsiBrowserInfo(browserInfo: IBrowserInfo): IBrowserInfo { return { name: PARSER_TO_JITSI_NAME[name], version, - engine: ENGINES[engine], + engine: engine ? ENGINES[engine] : undefined, engineVersion: engineVersion }; } diff --git a/package-lock.json b/package-lock.json index 33700db..2567e08 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,8 @@ "@jitsi/eslint-config": "4.1.5", "@types/ua-parser-js": "0.7.39", "eslint": "8.50.0", - "eslint-plugin-import": "2.28.1" + "eslint-plugin-import": "2.28.1", + "typescript": "5.8.3" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -2951,6 +2952,20 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/ua-parser-js": { "version": "1.0.35", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.35.tgz", @@ -5257,6 +5272,12 @@ "is-typed-array": "^1.1.9" } }, + "typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "dev": true + }, "ua-parser-js": { "version": "1.0.35", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.35.tgz", diff --git a/package.json b/package.json index f42f423..ac58e45 100644 --- a/package.json +++ b/package.json @@ -23,10 +23,12 @@ "@babel/eslint-parser": "7.22.15", "@types/ua-parser-js": "0.7.39", "eslint": "8.50.0", - "eslint-plugin-import": "2.28.1" + "eslint-plugin-import": "2.28.1", + "typescript": "5.8.3" }, "scripts": { - "lint": "eslint ." + "lint": "eslint .", + "build": "tsc --project tsconfig.json" }, "pre-commit": [ "lint", @@ -34,5 +36,8 @@ ], "type": "module", "main": "./index.js", + "files": [ + "dist/index.d.ts" + ], "license": "Apache-2.0" } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..ea2afd0 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "declaration": true, // Generate .d.ts files + "emitDeclarationOnly": true, // Emit only .d.ts files (optional for type generation) + "outDir": "./dist", // Output directory for compiled files and declarations + "moduleResolution": "node", + "target": "ES6", + "module": "ES6", + "strict": true + }, + "include": [ + "./browser-detection/BrowserDetection.ts" + ], + "exclude": [ + "node_modules", + "dist", + "docs", + "test", + "**/*.spec.ts", + "**/*.spec.js", + "*.conf*.js", + "index.js" + ] +}