From 706c7f6a59d325ca7f9ceacd642bd8444526d8ec Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Fri, 13 Jun 2025 12:53:42 +0200 Subject: [PATCH 1/2] chore: update to bio-dts@0.13.0 Adjusted our use of @overlord to the new generation behavior (overloads are generated in definition order, not vice versa). Relevant changelog entries: * https://github.com/nikku/bio-dts/blob/main/CHANGELOG.md#0120 * https://github.com/nikku/bio-dts/blob/main/CHANGELOG.md#0130 --- lib/Diagram.js | 18 +++---- lib/core/EventBus.js | 13 ++--- package-lock.json | 115 ++++++++++++++----------------------------- package.json | 2 +- 4 files changed, 55 insertions(+), 93 deletions(-) diff --git a/lib/Diagram.js b/lib/Diagram.js index c1bd69ed8..4c060f678 100644 --- a/lib/Diagram.js +++ b/lib/Diagram.js @@ -147,11 +147,11 @@ export default function Diagram(options, injector) { * * Resolves a diagram service. * - * @template T + * @template {keyof ServiceMap} Name * - * @param {string} name The name of the service to get. + * @param {Name} name The name of the service to get. * - * @return {T} + * @return {ServiceMap[Name]} */ /** * @overlord @@ -161,7 +161,6 @@ export default function Diagram(options, injector) { * @template T * * @param {string} name The name of the service to get. - * @param {true} strict If false, resolve missing services to null. * * @return {T} */ @@ -173,18 +172,19 @@ export default function Diagram(options, injector) { * @template T * * @param {string} name The name of the service to get. - * @param {boolean} strict If false, resolve missing services to null. + * @param {true} strict If false, resolve missing services to null. * - * @return {T|null} + * @return {T} */ /** * Resolves a diagram service. * - * @template {keyof ServiceMap} Name + * @template T * - * @param {Name} name The name of the service to get. + * @param {string} name The name of the service to get. + * @param {boolean} strict If false, resolve missing services to null. * - * @return {ServiceMap[Name]} + * @return {T|null} */ Diagram.prototype.get = function(name, strict) { return this._injector.get(name, strict); diff --git a/lib/core/EventBus.js b/lib/core/EventBus.js index eb3242065..d317e8f61 100644 --- a/lib/core/EventBus.js +++ b/lib/core/EventBus.js @@ -147,14 +147,15 @@ export default function EventBus() { * * Returning anything but `undefined` from a listener will stop the listener propagation. * - * @template T + * @template {keyof EventMap} EventName * - * @param {string|string[]} events to subscribe to + * @param {EventName} events to subscribe to * @param {number} [priority=1000] listen priority - * @param {EventBusEventCallback} callback + * @param {EventBusEventCallback} callback * @param {any} [that] callback context */ /** + * * Register an event listener for events with the given name. * * The callback will be invoked with `event, ...additionalArguments` @@ -166,11 +167,11 @@ export default function EventBus() { * * Returning anything but `undefined` from a listener will stop the listener propagation. * - * @template {keyof EventMap} EventName + * @template T * - * @param {EventName} events to subscribe to + * @param {string|string[]} events to subscribe to * @param {number} [priority=1000] listen priority - * @param {EventBusEventCallback} callback + * @param {EventBusEventCallback} callback * @param {any} [that] callback context */ EventBus.prototype.on = function(events, priority, callback, that) { diff --git a/package-lock.json b/package-lock.json index 3dbc0d343..6cdac4ba1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "@testing-library/preact": "^3.2.4", "babel-loader": "^10.0.0", "babel-plugin-istanbul": "^7.0.0", - "bio-dts": "^0.11.0", + "bio-dts": "^0.13.0", "chai": "^4.5.0", "del-cli": "^6.0.0", "eslint": "^9.11.1", @@ -243,19 +243,21 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz", - "integrity": "sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", - "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", + "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } @@ -298,12 +300,13 @@ } }, "node_modules/@babel/parser": { - "version": "7.25.6", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.6.tgz", - "integrity": "sha512-trGdfBdbD0l1ZPmcJ83eNxB9rbEax4ALFTF7fN386TMYbeCQbyme5cOEXQhbGXKebwGaB/J52w1mrklMcbgy6Q==", + "version": "7.27.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.5.tgz", + "integrity": "sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/types": "^7.25.6" + "@babel/types": "^7.27.3" }, "bin": { "parser": "bin/babel-parser.js" @@ -357,14 +360,14 @@ } }, "node_modules/@babel/types": { - "version": "7.25.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.6.tgz", - "integrity": "sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw==", + "version": "7.27.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.6.tgz", + "integrity": "sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.24.8", - "@babel/helper-validator-identifier": "^7.24.7", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -1414,19 +1417,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/assert": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-2.1.0.tgz", - "integrity": "sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "is-nan": "^1.3.2", - "object-is": "^1.1.5", - "object.assign": "^4.1.4", - "util": "^0.12.5" - } - }, "node_modules/assertion-error": { "version": "1.1.0", "dev": true, @@ -1440,6 +1430,7 @@ "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.16.1.tgz", "integrity": "sha512-6t10qk83GOG8p0vKmaCr8eiilZwO171AvbROMtvvNiwrTly62t+7XkA8RdIIVbpMhCASAsxgAzdRSwh6nw/5Dg==", "dev": true, + "license": "MIT", "dependencies": { "tslib": "^2.0.1" }, @@ -1650,14 +1641,14 @@ } }, "node_modules/bio-dts": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/bio-dts/-/bio-dts-0.11.0.tgz", - "integrity": "sha512-1MnieDX8orKc1LL7NscyFY7SLfcf69kyC9PHC7W07icNxSlw78WIDzzkYhVAKMikC3qamXfEqjlirO6aUXt0PA==", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/bio-dts/-/bio-dts-0.13.0.tgz", + "integrity": "sha512-eIbfn0p3m1O+BGPHAF8pqGMe9J8rfeVhgClEAsvmwa8/0sBiYWIP1cNWqBvEIh1Qw57iotmJSywfRfbKNDXYFg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/parser": "^7.23.9", - "recast": "^0.23.4", + "@babel/parser": "^7.26.3", + "recast": "^0.23.9", "tiny-glob": "^0.2.9" }, "bin": { @@ -4334,22 +4325,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-nan": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", - "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-negative-zero": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", @@ -6398,15 +6373,16 @@ } }, "node_modules/recast": { - "version": "0.23.4", - "resolved": "https://registry.npmjs.org/recast/-/recast-0.23.4.tgz", - "integrity": "sha512-qtEDqIZGVcSZCHniWwZWbRy79Dc6Wp3kT/UmDA2RJKBPg7+7k51aQBZirHmUGn5uvHf2rg8DkjizrN26k61ATw==", + "version": "0.23.11", + "resolved": "https://registry.npmjs.org/recast/-/recast-0.23.11.tgz", + "integrity": "sha512-YTUo+Flmw4ZXiWfQKGcwwc11KnoRAYgzAE2E7mXKCjSviTKShtxBsN6YUUBB2gtaBzKzeKunxhUwNHQuRryhWA==", "dev": true, + "license": "MIT", "dependencies": { - "assert": "^2.0.0", "ast-types": "^0.16.1", "esprima": "~4.0.0", "source-map": "~0.6.1", + "tiny-invariant": "^1.3.3", "tslib": "^2.0.1" }, "engines": { @@ -7245,6 +7221,13 @@ "globrex": "^0.1.2" } }, + "node_modules/tiny-invariant": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", + "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==", + "dev": true, + "license": "MIT" + }, "node_modules/tiny-svg": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/tiny-svg/-/tiny-svg-3.1.2.tgz", @@ -7261,15 +7244,6 @@ "node": ">=8.17.0" } }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -7546,19 +7520,6 @@ "punycode": "^2.1.0" } }, - "node_modules/util": { - "version": "0.12.5", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", - "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", - "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "which-typed-array": "^1.1.2" - } - }, "node_modules/utils-merge": { "version": "1.0.1", "dev": true, diff --git a/package.json b/package.json index e9d0cbf79..bfc137150 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@testing-library/preact": "^3.2.4", "babel-loader": "^10.0.0", "babel-plugin-istanbul": "^7.0.0", - "bio-dts": "^0.11.0", + "bio-dts": "^0.13.0", "chai": "^4.5.0", "del-cli": "^6.0.0", "eslint": "^9.11.1", From 33fe410e6322816dc733b7c3d258b34fad639396 Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Fri, 13 Jun 2025 12:49:50 +0200 Subject: [PATCH 2/2] chore: generate declaration maps Recommended practice for library authors (that ship source code with their modules, cf. https://github.com/microsoft/TypeScript/issues/49003). --- .gitignore | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f5532e2c2..9f8187d4a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ dist/ tmp/ coverage/ lib/**/*.d.ts +lib/**/*.d.ts.map .idea/ .vscode/ .DS_Store diff --git a/package.json b/package.json index bfc137150..b85695f63 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "lint": "eslint .", "dev": "npm test -- --auto-watch --no-single-run", "generate-types": "run-s generate-types:*", - "generate-types:generate": "del-cli \"lib/**/*.d.ts\" && npx bio-dts -r lib", + "generate-types:generate": "del-cli \"lib/**/*.d.ts(.map)?\" && npx bio-dts -r lib --declarationMap", "generate-types:test": "tsc --noEmit --noImplicitAny", "test": "karma start", "prepublishOnly": "run-s generate-types"