mirror of
https://github.com/molstar/molstar.git
synced 2026-06-04 13:30:24 +08:00
`Transformer.Definition.dispose` is documented as "automatically called on deleting an object," but `State.dispose()` only disposed its own event subjects and action manager — it never iterated still-live cells to call their per-transformer dispose. Cells holding GL buffers, mesh data, etc. only had their dispose fired on explicit deletion (e.g. `clear()`), so any consumer that called `plugin.dispose()` without first awaiting `plugin.clear()` retained the callback chain, the GL buffers it points at, and any closures captured by it. In a long-running single-page app where the user navigates between routes that mount/unmount a Mol* viewer, this leaked roughly 25–50 MB of process RSS per cycle even with `plugin.dispose()` correctly called. A 20-cycle E2E mount/unmount harness on a 1AKE structure measured a +541 MB RSS / +266 MB JS-heap delta in the unconditional-`dispose()` case; calling `await plugin.clear()` before `plugin.dispose()` halved the residual leak, confirming the per-cell dispose path was missing on the unconditional `dispose()` route. This change walks the cell tree once (post-order via the existing `StateTree.doPostOrder` helper) and invokes the per-transformer dispose for every still-live cell, swallowing+warning on errors so a single faulty transformer can't prevent siblings from cleaning up. The existing per-cell `dispose` helper is reused for consistency with `updateNode`/`findDeletes` semantics. Tests cover: chained transformers, sibling subtrees, throwing-dispose isolation, and transformers without a dispose definition. Also adds `useDefineForClassFields: false` to the jest esbuild transform so tests can construct `State` (the `TransientTree` parameter property + class field pattern relies on legacy class-field semantics, which `tsc` honors via `target: es2018` but esbuild's default `esnext` target does not). Fixes #1825 Co-authored-by: Armando Pellegrini <tech.tools@boltz.bio>
209 lines
7.1 KiB
JSON
209 lines
7.1 KiB
JSON
{
|
|
"name": "molstar",
|
|
"version": "5.9.0",
|
|
"description": "A comprehensive macromolecular library.",
|
|
"homepage": "https://github.com/molstar/molstar#readme",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://github.com/molstar/molstar.git"
|
|
},
|
|
"bugs": {
|
|
"url": "https://github.com/molstar/molstar/issues"
|
|
},
|
|
"engines": {
|
|
"node": ">=22.0.0"
|
|
},
|
|
"scripts": {
|
|
"lint": "eslint .",
|
|
"lint-fix": "eslint . --fix",
|
|
"test": "npm install --no-save \"gl@^6.0.2\" && npm run lint && jest",
|
|
"jest": "jest",
|
|
"clean": "node ./scripts/clean.js --all",
|
|
"clean:build": "node ./scripts/clean.js --build",
|
|
"build": "npm run build:apps && npm run build:lib",
|
|
"build:apps": "node ./scripts/build.mjs -a -e --prd",
|
|
"build:lib": "concurrently \"tsc --incremental\" \"tsc --build tsconfig.commonjs.json --incremental\" && npm run build:lib-extra",
|
|
"build:lib-extra": "node scripts/write-version.mjs && cpx \"src/**/*.{scss,html,ico,jpg}\" lib/ && cpx \"src/**/*.{scss,html,ico,jpg}\" lib/commonjs/ && tsc-alias -p tsconfig.json",
|
|
"rebuild": "npm run clean && npm run build",
|
|
"dev": "node ./scripts/build.mjs",
|
|
"dev:all": "node ./scripts/build.mjs -a -e -bt",
|
|
"dev:viewer": "node ./scripts/build.mjs -a viewer",
|
|
"dev:apps": "node ./scripts/build.mjs -a",
|
|
"dev:examples": "node ./scripts/build.mjs -e",
|
|
"dev:browser-tests": "node ./scripts/build.mjs -bt",
|
|
"serve": "http-server -p 1338 -g",
|
|
"deploy:local": "npm run clean:build && npm run build:apps && node ./scripts/deploy.js --local",
|
|
"deploy:remote": "npm run clean:build && npm run build:apps && node ./scripts/deploy.js",
|
|
"model-server": "node lib/commonjs/servers/model/server.js",
|
|
"model-server-watch": "nodemon --watch lib lib/commonjs/servers/model/server.js",
|
|
"volume-server-test": "node lib/commonjs/servers/volume/server.js --idMap em 'test/${id}.mdb' --defaultPort 1336",
|
|
"plugin-state": "node lib/commonjs/servers/plugin-state/index.js --working-folder ./build/state --port 1339",
|
|
"preversion": "npm run test",
|
|
"version": "npm run rebuild && cpx .npmignore lib/",
|
|
"postversion": "git push && git push --tags"
|
|
},
|
|
"files": [
|
|
"lib/",
|
|
"build/viewer/",
|
|
"build/mvs-stories/"
|
|
],
|
|
"bin": {
|
|
"cif2bcif": "lib/commonjs/cli/cif2bcif/index.js",
|
|
"cifschema": "lib/commonjs/cli/cifschema/index.js",
|
|
"mvs-validate": "lib/commonjs/cli/mvs/mvs-validate.js",
|
|
"mvs-render": "lib/commonjs/cli/mvs/mvs-render.js",
|
|
"mvs-print-schema": "lib/commonjs/cli/mvs/mvs-print-schema.js",
|
|
"model-server": "lib/commonjs/servers/model/server.js",
|
|
"model-server-query": "lib/commonjs/servers/model/query.js",
|
|
"model-server-preprocess": "lib/commonjs/servers/model/preprocess.js",
|
|
"volume-server": "lib/commonjs/servers/volume/server.js",
|
|
"volume-server-query": "lib/commonjs/servers/volume/query.js",
|
|
"volume-server-pack": "lib/commonjs/servers/volume/pack.js"
|
|
},
|
|
"nodemonConfig": {
|
|
"ignoreRoot": [
|
|
"./node_modules",
|
|
".git"
|
|
],
|
|
"ignore": [],
|
|
"delay": "2500"
|
|
},
|
|
"jest": {
|
|
"moduleFileExtensions": [
|
|
"ts",
|
|
"js"
|
|
],
|
|
"transform": {
|
|
"\\.ts$": ["esbuild-jest-transform", { "tsconfigRaw": "{\"compilerOptions\":{\"useDefineForClassFields\":false}}" }]
|
|
},
|
|
"moduleDirectories": [
|
|
"node_modules",
|
|
"lib"
|
|
],
|
|
"testEnvironmentOptions": {
|
|
"url": "http://localhost/"
|
|
},
|
|
"testRegex": "\\.spec\\.ts$"
|
|
},
|
|
"author": "Mol* Contributors",
|
|
"contributors": [
|
|
"Alexander Rose <alexander.rose@weirdbyte.de>",
|
|
"David Sehnal <david.sehnal@gmail.com>",
|
|
"Sebastian Bittrich <sebastian.bittrich@rcsb.org>",
|
|
"Áron Samuel Kovács <aron.kovacs@mail.muni.cz>",
|
|
"Ludovic Autin <autin@scripps.edu>",
|
|
"Michal Malý <michal.maly@ibt.cas.cz>",
|
|
"Jiří Černý <jiri.cerny@ibt.cas.cz>",
|
|
"Panagiotis Tourlas <panagiot_tourlov@hotmail.com>",
|
|
"Adam Midlik <midlik@gmail.com>",
|
|
"Koya Sakuma <koya.sakuma.work@gmail.com>",
|
|
"Gianluca Tomasello <giagitom@gmail.com>",
|
|
"Ke Ma <mark.ma@rcsb.org>",
|
|
"Jason Pattle <jpattle@exscientia.co.uk>",
|
|
"David Williams <dwilliams@nobiastx.com>",
|
|
"Zhenyu Zhang <jump2cn@gmail.com>",
|
|
"Russell Parker <russell@benchling.com>",
|
|
"Dominik Tichy <tichydominik451@gmail.com>",
|
|
"Yana Rose <yana.v.rose@gmail.com>",
|
|
"Yakov Pechersky <ffxen158@gmail.com>",
|
|
"Christian Dominguez <christian.99dominguez@gmail.com>",
|
|
"Cai Huiyu <szmun.caihy@gmail.com>",
|
|
"Ryan DiRisio <rjdiris@gmail.com>",
|
|
"Dušan Veľký <dvelky@mail.muni.cz>",
|
|
"Neli Fonseca <neli@ebi.ac.uk>",
|
|
"Paul Pillot <paul.pillot@tandemai.com>",
|
|
"Herman Bergwerf <post@hbergwerf.nl>",
|
|
"Eric E <etongfu@outlook.com>",
|
|
"Xavier Martinez <xavier.martinez.xm@gmail.com>",
|
|
"Alex Chan <smalldirkalex@gmail.com>",
|
|
"Simeon Borko <simeon.borko@gmail.com>",
|
|
"Ventura Rivera <venturaxrivera@gmail.com>",
|
|
"Andy Turner <agdturner@gmail.com>",
|
|
"Lukáš Polák <admin@lukaspolak.cz>",
|
|
"Chetan Mishra <chetan.s115@gmail.com>",
|
|
"Zach Charlop-Powers <zach.charlop.powers@gmail.com>",
|
|
"Kim Juho <juho_kim@outlook.com>",
|
|
"Victoria Doshchenko <doshchenko.victoria@gmail.com>",
|
|
"Diego del Alamo <diego.delalamo@gmail.com>",
|
|
"Tianzhen Lin (Tangent) <tangent@usa.net>"
|
|
],
|
|
"license": "MIT",
|
|
"devDependencies": {
|
|
"@types/cors": "^2.8.19",
|
|
"@types/gl": "^6.0.5",
|
|
"@types/jest": "^30.0.0",
|
|
"@types/pngjs": "^6.0.5",
|
|
"@types/react": "^18.3.28",
|
|
"@types/react-dom": "^18.3.7",
|
|
"@types/webxr": "^0.5.24",
|
|
"@typescript-eslint/eslint-plugin": "^8.59.1",
|
|
"@typescript-eslint/parser": "^8.59.1",
|
|
"benchmark": "^2.1.4",
|
|
"concurrently": "^9.2.1",
|
|
"cpx2": "^8.0.2",
|
|
"css-loader": "^7.1.4",
|
|
"esbuild": "^0.28.0",
|
|
"esbuild-jest-transform": "^2.0.1",
|
|
"esbuild-sass-plugin": "^3.7.0",
|
|
"eslint": "^10.3.0",
|
|
"fs-extra": "^11.3.4",
|
|
"globals": "^17.6.0",
|
|
"http-server": "^14.1.1",
|
|
"jest": "^30.3.0",
|
|
"jpeg-js": "^0.4.4",
|
|
"react": "^18.3.1",
|
|
"react-dom": "^18.3.1",
|
|
"sass": "^1.99.0",
|
|
"simple-git": "^3.36.0",
|
|
"tsc-alias": "^1.8.17",
|
|
"typescript": "^6.0.3"
|
|
},
|
|
"dependencies": {
|
|
"@types/argparse": "^2.0.17",
|
|
"@types/benchmark": "^2.1.5",
|
|
"@types/compression": "1.8.1",
|
|
"@types/express": "^5.0.6",
|
|
"@types/node": "^22.19.17",
|
|
"@types/swagger-ui-dist": "3.30.6",
|
|
"argparse": "^2.0.1",
|
|
"compression": "^1.8.1",
|
|
"cors": "^2.8.6",
|
|
"express": "^5.2.1",
|
|
"h264-mp4-encoder": "^1.0.12",
|
|
"immutable": "^5.1.5",
|
|
"io-ts": "^2.2.22",
|
|
"mutative": "^1.3.0",
|
|
"react-markdown": "^10.1.0",
|
|
"remark-gfm": "^4.0.1",
|
|
"rxjs": "^7.8.2",
|
|
"swagger-ui-dist": "^5.32.5",
|
|
"tslib": "^2.8.1"
|
|
},
|
|
"peerDependencies": {
|
|
"@google-cloud/storage": "^7.14.0",
|
|
"canvas": "^2.11.2",
|
|
"gl": "^6.0.2",
|
|
"jpeg-js": "^0.4.4",
|
|
"pngjs": "^6.0.0",
|
|
"react": ">=16.14.0",
|
|
"react-dom": ">=16.14.0"
|
|
},
|
|
"peerDependenciesMeta": {
|
|
"@google-cloud/storage": {
|
|
"optional": true
|
|
},
|
|
"canvas": {
|
|
"optional": true
|
|
},
|
|
"gl": {
|
|
"optional": true
|
|
},
|
|
"jpeg-js": {
|
|
"optional": true
|
|
},
|
|
"pngjs": {
|
|
"optional": true
|
|
}
|
|
}
|
|
}
|