From db018e83f5875f664caef59b5523c77765afed56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Wed, 4 Feb 2026 10:11:02 +0100 Subject: [PATCH 1/8] typedoc config --- LICENSE => LICENSE.md | 0 docs-assets/custom-styles.css | 21 +++++++++++++++++++++ typedoc.config.mjs | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) rename LICENSE => LICENSE.md (100%) create mode 100644 docs-assets/custom-styles.css create mode 100644 typedoc.config.mjs diff --git a/LICENSE b/LICENSE.md similarity index 100% rename from LICENSE rename to LICENSE.md diff --git a/docs-assets/custom-styles.css b/docs-assets/custom-styles.css new file mode 100644 index 000000000..0fe534ad8 --- /dev/null +++ b/docs-assets/custom-styles.css @@ -0,0 +1,21 @@ +/* Remove ugly square in bottom-right corner when scroll shows up. */ +*::-webkit-scrollbar { + width: 0px; +} + +/* Add margin after code. */ +.tsd-comment { + margin-bottom: 2em; +} + +/* Avoid word wrapping when code doesn't fit into avaiable width. */ +.tsd-comment > pre { + white-space: pre; + overflow: scroll; +} + +/* Remove ugly border radius in code. */ +.tsd-comment > pre, +.tsd-comment > code { + border-radius: 0px; +} diff --git a/typedoc.config.mjs b/typedoc.config.mjs new file mode 100644 index 000000000..3e46f9501 --- /dev/null +++ b/typedoc.config.mjs @@ -0,0 +1,33 @@ +/** + * Configuration for Typedoc. + */ + +/** @type {Partial} */ +const config = { + entryPoints: ['src/JsSIP.ts'], + out: 'docs', + skipErrorChecking: false, + exclude: ['src/**/*.d.ts', 'src/test/**/test-*.ts'], + excludePrivate: true, + excludeProtected: true, + excludeNotDocumented: true, + excludeInternal: true, + excludeExternals: true, + includeVersion: true, + gitRemote: 'origin', + hideGenerator: false, + treatWarningsAsErrors: true, + cacheBust: true, + categorizeByGroup: false, + categoryOrder: ['Config', 'UA', 'RTCSession', '*'], + searchInComments: true, + readme: 'README.md', + projectDocuments: ['README.md', 'LICENSE.md'], + navigationLinks: { + GitHub: 'https://github.com/versatica/jssip', + NPM: 'https://www.npmjs.com/package/jssip', + }, + customCss: './docs-assets/custom-styles.css', +}; + +export default config; From 504f2d729cdba3b1e45ee7e1e5ebd67c304ea841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Wed, 4 Feb 2026 10:11:50 +0100 Subject: [PATCH 2/8] JsSIP.ts --- src/JsSIP.js | 36 ------------------ src/JsSIP.ts | 59 +++++++++++++++++++++++++++++ src/test/test-JsSIP.ts | 8 ++-- src/test/test-NameAddrHeader.ts | 4 +- src/test/test-SubscriberNotifier.ts | 4 +- src/test/test-UA.ts | 4 +- src/test/test-URI.ts | 4 +- src/test/test-Utils.ts | 4 +- src/test/test-parser.ts | 4 +- 9 files changed, 69 insertions(+), 58 deletions(-) delete mode 100644 src/JsSIP.js create mode 100644 src/JsSIP.ts diff --git a/src/JsSIP.js b/src/JsSIP.js deleted file mode 100644 index 39481d171..000000000 --- a/src/JsSIP.js +++ /dev/null @@ -1,36 +0,0 @@ -const pkg = require('../package.json'); -const C = require('./Constants'); -const Exceptions = require('./Exceptions'); -const Utils = require('./Utils'); -const UA = require('./UA'); -const URI = require('./URI'); -const NameAddrHeader = require('./NameAddrHeader'); -const Grammar = require('./Grammar'); -const WebSocketInterface = require('./WebSocketInterface'); -const debug = require('debug')('JsSIP'); -const RTCSession = require('./RTCSession'); - -debug('version %s', pkg.version); - -/** - * Expose the JsSIP module. - */ -module.exports = { - C, - Exceptions, - Utils, - UA, - URI, - NameAddrHeader, - WebSocketInterface, - Grammar, - RTCSession, - // Expose the debug module. - debug: require('debug'), - get name() { - return pkg.title; - }, - get version() { - return pkg.version; - }, -}; diff --git a/src/JsSIP.ts b/src/JsSIP.ts new file mode 100644 index 000000000..6f8bf32e3 --- /dev/null +++ b/src/JsSIP.ts @@ -0,0 +1,59 @@ +import * as debug from 'debug'; + +// eslint-disable-next-line @typescript-eslint/no-require-imports +const pkg = require('../package.json'); + +// eslint-disable-next-line @typescript-eslint/no-require-imports +const C = require('./Constants'); +// eslint-disable-next-line @typescript-eslint/no-require-imports +const Exceptions = require('./Exceptions'); +// eslint-disable-next-line @typescript-eslint/no-require-imports +const Utils = require('./Utils'); +// eslint-disable-next-line @typescript-eslint/no-require-imports +const UA = require('./UA'); +// eslint-disable-next-line @typescript-eslint/no-require-imports +const URI = require('./URI'); +// eslint-disable-next-line @typescript-eslint/no-require-imports +const NameAddrHeader = require('./NameAddrHeader'); +// eslint-disable-next-line @typescript-eslint/no-require-imports +const Grammar = require('./Grammar'); +// eslint-disable-next-line @typescript-eslint/no-require-imports +const WebSocketInterface = require('./WebSocketInterface'); +// eslint-disable-next-line @typescript-eslint/no-require-imports +const RTCSession = require('./RTCSession'); + +const logger = debug('JsSIP'); + +logger('version %s', pkg.version); + +/** + * JsSIP main module. + * + * @category JsSIP + */ +export { + C, + Exceptions, + Utils, + UA, + URI, + NameAddrHeader, + WebSocketInterface, + Grammar, + RTCSession, +}; + +/** + * Expose the debug module. + */ +export { debug }; + +/** + * Library name. + */ +export const name: string = pkg.title; + +/** + * Library version. + */ +export const version: string = pkg.version; diff --git a/src/test/test-JsSIP.ts b/src/test/test-JsSIP.ts index 3231862d6..baf465ff8 100644 --- a/src/test/test-JsSIP.ts +++ b/src/test/test-JsSIP.ts @@ -1,16 +1,16 @@ import './include/common'; -// eslint-disable-next-line @typescript-eslint/no-require-imports -const JsSIP = require('../JsSIP.js'); +import { version, name } from '../JsSIP'; + // eslint-disable-next-line @typescript-eslint/no-require-imports const pkg = require('../../package.json'); describe('Properties', () => { test('should have a name property', () => { - expect(JsSIP.name).toEqual(pkg.title); + expect(name).toEqual(pkg.title); }); test('should have a version property', () => { - expect(JsSIP.version).toEqual(pkg.version); + expect(version).toEqual(pkg.version); }); }); diff --git a/src/test/test-NameAddrHeader.ts b/src/test/test-NameAddrHeader.ts index 694fb6904..0335745b1 100644 --- a/src/test/test-NameAddrHeader.ts +++ b/src/test/test-NameAddrHeader.ts @@ -1,8 +1,6 @@ import './include/common'; -// eslint-disable-next-line @typescript-eslint/no-require-imports -const JsSIP = require('../JsSIP.js'); -const { URI, NameAddrHeader } = JsSIP; +import { URI, NameAddrHeader } from '../JsSIP'; describe('NameAddrHeader', () => { test('new NameAddrHeader', () => { diff --git a/src/test/test-SubscriberNotifier.ts b/src/test/test-SubscriberNotifier.ts index b96d8fdad..0b125b6bf 100644 --- a/src/test/test-SubscriberNotifier.ts +++ b/src/test/test-SubscriberNotifier.ts @@ -1,9 +1,7 @@ import './include/common'; import LoopSocket from './include/LoopSocket'; -// eslint-disable-next-line @typescript-eslint/no-require-imports -const JsSIP = require('../JsSIP.js'); -const { UA } = JsSIP; +import { UA } from '../JsSIP'; const enum STEP { INIT = 0, diff --git a/src/test/test-UA.ts b/src/test/test-UA.ts index febf4ea37..40d08e619 100644 --- a/src/test/test-UA.ts +++ b/src/test/test-UA.ts @@ -3,9 +3,7 @@ import './include/common'; import * as consts from './include/consts'; -// eslint-disable-next-line @typescript-eslint/no-require-imports -const JsSIP = require('../JsSIP.js'); -const { UA, WebSocketInterface, Exceptions, C } = JsSIP; +import { UA, WebSocketInterface, Exceptions, C } from '../JsSIP'; describe('UA', () => { test('UA wrong configuration', () => { diff --git a/src/test/test-URI.ts b/src/test/test-URI.ts index 11a514d10..f4f77084c 100644 --- a/src/test/test-URI.ts +++ b/src/test/test-URI.ts @@ -1,8 +1,6 @@ import './include/common'; -// eslint-disable-next-line @typescript-eslint/no-require-imports -const JsSIP = require('../JsSIP.js'); -const { URI } = JsSIP; +import { URI } from '../JsSIP'; describe('URI', () => { test('new URI', () => { diff --git a/src/test/test-Utils.ts b/src/test/test-Utils.ts index cd65c3cfd..531923926 100644 --- a/src/test/test-Utils.ts +++ b/src/test/test-Utils.ts @@ -1,8 +1,6 @@ import './include/common'; -// eslint-disable-next-line @typescript-eslint/no-require-imports -const JsSIP = require('../JsSIP.js'); -const { URI, Utils } = JsSIP; +import { URI, Utils } from '../JsSIP'; describe('Utils', () => { test('normalizeTarget() valid targets', () => { diff --git a/src/test/test-parser.ts b/src/test/test-parser.ts index eee4e5c21..31c2a8400 100644 --- a/src/test/test-parser.ts +++ b/src/test/test-parser.ts @@ -1,9 +1,7 @@ import './include/common'; import * as consts from './include/consts'; -// eslint-disable-next-line @typescript-eslint/no-require-imports -const JsSIP = require('../JsSIP.js'); -const { URI, NameAddrHeader, Grammar, WebSocketInterface, UA } = JsSIP; +import { URI, NameAddrHeader, Grammar, WebSocketInterface, UA } from '../JsSIP'; // eslint-disable-next-line @typescript-eslint/no-require-imports const Parser = require('../Parser.js'); From 29086ced0514641d4deaaa45645ad678963a97a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Wed, 4 Feb 2026 10:37:15 +0100 Subject: [PATCH 3/8] CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20c682835..de26dee53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Use prettier. - Prepare environment for TS. - Rewrite tests to TS (#958). +- Move JsSIP.js to JsSIP.ts. ### 3.12.0 From 8ee4e3c94236016d4f371f455e9ee46a698480b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Wed, 4 Feb 2026 10:41:19 +0100 Subject: [PATCH 4/8] CHANGELOG --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de26dee53..e4320395f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ - Use prettier. - Prepare environment for TS. - Rewrite tests to TS (#958). -- Move JsSIP.js to JsSIP.ts. +- Move JsSIP.js to JsSIP.ts (#959). ### 3.12.0 From 31cf69670d4cdc49b722b95e8c2861ff530ec47c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Wed, 4 Feb 2026 10:48:53 +0100 Subject: [PATCH 5/8] Revert "JsSIP.ts" This reverts commit 504f2d729cdba3b1e45ee7e1e5ebd67c304ea841. --- src/JsSIP.js | 36 ++++++++++++++++++ src/JsSIP.ts | 59 ----------------------------- src/test/test-JsSIP.ts | 8 ++-- src/test/test-NameAddrHeader.ts | 4 +- src/test/test-SubscriberNotifier.ts | 4 +- src/test/test-UA.ts | 4 +- src/test/test-URI.ts | 4 +- src/test/test-Utils.ts | 4 +- src/test/test-parser.ts | 4 +- 9 files changed, 58 insertions(+), 69 deletions(-) create mode 100644 src/JsSIP.js delete mode 100644 src/JsSIP.ts diff --git a/src/JsSIP.js b/src/JsSIP.js new file mode 100644 index 000000000..39481d171 --- /dev/null +++ b/src/JsSIP.js @@ -0,0 +1,36 @@ +const pkg = require('../package.json'); +const C = require('./Constants'); +const Exceptions = require('./Exceptions'); +const Utils = require('./Utils'); +const UA = require('./UA'); +const URI = require('./URI'); +const NameAddrHeader = require('./NameAddrHeader'); +const Grammar = require('./Grammar'); +const WebSocketInterface = require('./WebSocketInterface'); +const debug = require('debug')('JsSIP'); +const RTCSession = require('./RTCSession'); + +debug('version %s', pkg.version); + +/** + * Expose the JsSIP module. + */ +module.exports = { + C, + Exceptions, + Utils, + UA, + URI, + NameAddrHeader, + WebSocketInterface, + Grammar, + RTCSession, + // Expose the debug module. + debug: require('debug'), + get name() { + return pkg.title; + }, + get version() { + return pkg.version; + }, +}; diff --git a/src/JsSIP.ts b/src/JsSIP.ts deleted file mode 100644 index 6f8bf32e3..000000000 --- a/src/JsSIP.ts +++ /dev/null @@ -1,59 +0,0 @@ -import * as debug from 'debug'; - -// eslint-disable-next-line @typescript-eslint/no-require-imports -const pkg = require('../package.json'); - -// eslint-disable-next-line @typescript-eslint/no-require-imports -const C = require('./Constants'); -// eslint-disable-next-line @typescript-eslint/no-require-imports -const Exceptions = require('./Exceptions'); -// eslint-disable-next-line @typescript-eslint/no-require-imports -const Utils = require('./Utils'); -// eslint-disable-next-line @typescript-eslint/no-require-imports -const UA = require('./UA'); -// eslint-disable-next-line @typescript-eslint/no-require-imports -const URI = require('./URI'); -// eslint-disable-next-line @typescript-eslint/no-require-imports -const NameAddrHeader = require('./NameAddrHeader'); -// eslint-disable-next-line @typescript-eslint/no-require-imports -const Grammar = require('./Grammar'); -// eslint-disable-next-line @typescript-eslint/no-require-imports -const WebSocketInterface = require('./WebSocketInterface'); -// eslint-disable-next-line @typescript-eslint/no-require-imports -const RTCSession = require('./RTCSession'); - -const logger = debug('JsSIP'); - -logger('version %s', pkg.version); - -/** - * JsSIP main module. - * - * @category JsSIP - */ -export { - C, - Exceptions, - Utils, - UA, - URI, - NameAddrHeader, - WebSocketInterface, - Grammar, - RTCSession, -}; - -/** - * Expose the debug module. - */ -export { debug }; - -/** - * Library name. - */ -export const name: string = pkg.title; - -/** - * Library version. - */ -export const version: string = pkg.version; diff --git a/src/test/test-JsSIP.ts b/src/test/test-JsSIP.ts index baf465ff8..3231862d6 100644 --- a/src/test/test-JsSIP.ts +++ b/src/test/test-JsSIP.ts @@ -1,16 +1,16 @@ import './include/common'; -import { version, name } from '../JsSIP'; - +// eslint-disable-next-line @typescript-eslint/no-require-imports +const JsSIP = require('../JsSIP.js'); // eslint-disable-next-line @typescript-eslint/no-require-imports const pkg = require('../../package.json'); describe('Properties', () => { test('should have a name property', () => { - expect(name).toEqual(pkg.title); + expect(JsSIP.name).toEqual(pkg.title); }); test('should have a version property', () => { - expect(version).toEqual(pkg.version); + expect(JsSIP.version).toEqual(pkg.version); }); }); diff --git a/src/test/test-NameAddrHeader.ts b/src/test/test-NameAddrHeader.ts index 0335745b1..694fb6904 100644 --- a/src/test/test-NameAddrHeader.ts +++ b/src/test/test-NameAddrHeader.ts @@ -1,6 +1,8 @@ import './include/common'; -import { URI, NameAddrHeader } from '../JsSIP'; +// eslint-disable-next-line @typescript-eslint/no-require-imports +const JsSIP = require('../JsSIP.js'); +const { URI, NameAddrHeader } = JsSIP; describe('NameAddrHeader', () => { test('new NameAddrHeader', () => { diff --git a/src/test/test-SubscriberNotifier.ts b/src/test/test-SubscriberNotifier.ts index 0b125b6bf..b96d8fdad 100644 --- a/src/test/test-SubscriberNotifier.ts +++ b/src/test/test-SubscriberNotifier.ts @@ -1,7 +1,9 @@ import './include/common'; import LoopSocket from './include/LoopSocket'; -import { UA } from '../JsSIP'; +// eslint-disable-next-line @typescript-eslint/no-require-imports +const JsSIP = require('../JsSIP.js'); +const { UA } = JsSIP; const enum STEP { INIT = 0, diff --git a/src/test/test-UA.ts b/src/test/test-UA.ts index 40d08e619..febf4ea37 100644 --- a/src/test/test-UA.ts +++ b/src/test/test-UA.ts @@ -3,7 +3,9 @@ import './include/common'; import * as consts from './include/consts'; -import { UA, WebSocketInterface, Exceptions, C } from '../JsSIP'; +// eslint-disable-next-line @typescript-eslint/no-require-imports +const JsSIP = require('../JsSIP.js'); +const { UA, WebSocketInterface, Exceptions, C } = JsSIP; describe('UA', () => { test('UA wrong configuration', () => { diff --git a/src/test/test-URI.ts b/src/test/test-URI.ts index f4f77084c..11a514d10 100644 --- a/src/test/test-URI.ts +++ b/src/test/test-URI.ts @@ -1,6 +1,8 @@ import './include/common'; -import { URI } from '../JsSIP'; +// eslint-disable-next-line @typescript-eslint/no-require-imports +const JsSIP = require('../JsSIP.js'); +const { URI } = JsSIP; describe('URI', () => { test('new URI', () => { diff --git a/src/test/test-Utils.ts b/src/test/test-Utils.ts index 531923926..cd65c3cfd 100644 --- a/src/test/test-Utils.ts +++ b/src/test/test-Utils.ts @@ -1,6 +1,8 @@ import './include/common'; -import { URI, Utils } from '../JsSIP'; +// eslint-disable-next-line @typescript-eslint/no-require-imports +const JsSIP = require('../JsSIP.js'); +const { URI, Utils } = JsSIP; describe('Utils', () => { test('normalizeTarget() valid targets', () => { diff --git a/src/test/test-parser.ts b/src/test/test-parser.ts index 31c2a8400..eee4e5c21 100644 --- a/src/test/test-parser.ts +++ b/src/test/test-parser.ts @@ -1,7 +1,9 @@ import './include/common'; import * as consts from './include/consts'; -import { URI, NameAddrHeader, Grammar, WebSocketInterface, UA } from '../JsSIP'; +// eslint-disable-next-line @typescript-eslint/no-require-imports +const JsSIP = require('../JsSIP.js'); +const { URI, NameAddrHeader, Grammar, WebSocketInterface, UA } = JsSIP; // eslint-disable-next-line @typescript-eslint/no-require-imports const Parser = require('../Parser.js'); From e90e79d56b037bcc615ee539bc4bd041689a0667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Wed, 4 Feb 2026 10:50:04 +0100 Subject: [PATCH 6/8] typedoc: fix entrypoint --- typedoc.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typedoc.config.mjs b/typedoc.config.mjs index 3e46f9501..56c02a0c8 100644 --- a/typedoc.config.mjs +++ b/typedoc.config.mjs @@ -4,7 +4,7 @@ /** @type {Partial} */ const config = { - entryPoints: ['src/JsSIP.ts'], + entryPoints: ['src/JsSIP.js'], out: 'docs', skipErrorChecking: false, exclude: ['src/**/*.d.ts', 'src/test/**/test-*.ts'], From 6b44d4fb98dd5a92b1f29621a29276696b3eda6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Wed, 4 Feb 2026 10:57:51 +0100 Subject: [PATCH 7/8] Add docs workflow --- .github/workflows/docs.yaml | 72 +++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/docs.yaml diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 000000000..586436899 --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,72 @@ +# Workflow for deploying docs static content to GitHub Pages. +name: docs + +on: + push: + branches: [master] + # Allows you to run this workflow manually from the Actions tab. + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run +# in-progress and latest queued. However, do NOT cancel in-progress runs as we +# want to allow these production deployments to complete. +concurrency: + group: 'pages' + cancel-in-progress: false + +jobs: + # Single deploy job since we're just deploying. + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Node.js + uses: actions/setup-node@v4 + with: + node-version: 24 + + - name: Check if version has been updated + id: versionCheck + uses: EndBug/version-check@v2 + + - name: Log when version has changed + if: steps.versionCheck.outputs.changed == 'true' + run: 'echo "Version changed, new version: ${{ steps.versionCheck.outputs.version }} (${{ steps.versionCheck.outputs.type }})"' + + - name: Log when version has not changed + if: steps.versionCheck.outputs.changed == 'false' + run: 'echo "Version did not change"' + + - name: npm ci + if: steps.versionCheck.outputs.changed == 'true' + run: npm ci --foreground-scripts + + - name: npm run docs + if: steps.versionCheck.outputs.changed == 'true' + run: npm run docs + + - name: Upload docs + if: steps.versionCheck.outputs.changed == 'true' + uses: actions/upload-pages-artifact@v3 + with: + path: docs/ + + - name: Deploy docs to GitHub Pages + if: steps.versionCheck.outputs.changed == 'true' + id: deployment + uses: actions/deploy-pages@v4 From 2c7ca21e01439b7f78c592e2f7dba79efa0ec0f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Wed, 4 Feb 2026 11:01:15 +0100 Subject: [PATCH 8/8] CHANGELOG --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4320395f..a8fd7410b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ - Use prettier. - Prepare environment for TS. - Rewrite tests to TS (#958). -- Move JsSIP.js to JsSIP.ts (#959). +- Prepare typedoc (#959). ### 3.12.0