diff --git a/molstar-extension/esbuild.config.js b/molstar-extension/esbuild.config.js index 7dbdc9b6..027e98b9 100644 --- a/molstar-extension/esbuild.config.js +++ b/molstar-extension/esbuild.config.js @@ -1,13 +1,14 @@ import { argv } from 'node:process'; import * as esbuild from 'esbuild'; -import {sassPlugin} from 'esbuild-sass-plugin' +import { sassPlugin } from 'esbuild-sass-plugin' import copyStaticFiles from 'esbuild-copy-static-files'; +import { dtsPlugin } from 'esbuild-plugin-d.ts' const productionMode = ('development' !== (argv[2] || process.env.NODE_ENV)), target = 'chrome100,firefox100,safari15'.split(','); -console.log(`${ productionMode ? 'production' : 'development' } build`); +console.log(`${productionMode ? 'production' : 'development'} build`); const staticFilesPluginOptions = { src: './src', @@ -22,7 +23,7 @@ const buildLib = await esbuild.context({ outdir: './lib', platform: 'browser', tsconfig: 'tsconfig.json', - plugins: [copyStaticFiles(staticFilesPluginOptions)] + plugins: [copyStaticFiles(staticFilesPluginOptions), dtsPlugin()] }) const buildCSS = await esbuild.context({ @@ -44,7 +45,7 @@ const buildCSS = await esbuild.context({ // bundle TS const buildTS = await esbuild.context({ - entryPoints: [ 'src/viewer/app.ts' ], + entryPoints: ['src/viewer/app.ts'], format: "esm", bundle: true, target, diff --git a/molstar-extension/package-lock.json b/molstar-extension/package-lock.json index 275d491d..e040bf37 100644 --- a/molstar-extension/package-lock.json +++ b/molstar-extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "molstar-volseg", - "version": "0.0.7", + "version": "0.0.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "molstar-volseg", - "version": "0.0.7", + "version": "0.0.9", "license": "MIT", "dependencies": { "@types/jsoneditor": "^9.9.5", @@ -24,6 +24,7 @@ "cpx2": "^7.0.1", "esbuild": "0.21.4", "esbuild-copy-static-files": "^0.1.0", + "esbuild-plugin-d.ts": "^1.2.3", "esbuild-sass-plugin": "^3", "typescript": "^5.4.5" } @@ -1090,6 +1091,49 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/character-entities": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", @@ -1853,6 +1897,22 @@ "integrity": "sha512-KlpmYqANA1t2nZavEdItfcOjJC6wbHA21v35HJWN32DddGTWKNNGDKljUzbCPojmpD+wAw8/DXr5abJ4jFCE0w==", "dev": true }, + "node_modules/esbuild-plugin-d.ts": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/esbuild-plugin-d.ts/-/esbuild-plugin-d.ts-1.2.3.tgz", + "integrity": "sha512-JkNqcCTkv0N39izAOLaiAQcFA6DfbhDkef1ZO6NvnHtTT+7i+4VHjCcAM2yFslRTBTK1TuF41FLSwWvGm88N7w==", + "dev": true, + "dependencies": { + "chalk": "4.1.2", + "lodash.merge": "^4.6.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "typescript": "*" + } + }, "node_modules/esbuild-sass-plugin": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/esbuild-sass-plugin/-/esbuild-sass-plugin-3.3.1.tgz", @@ -2312,7 +2372,6 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, - "peer": true, "engines": { "node": ">=8" } @@ -3091,6 +3150,12 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "node_modules/longest-streak": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", diff --git a/molstar-extension/package.json b/molstar-extension/package.json index 5ea0ad67..cf8e1f23 100644 --- a/molstar-extension/package.json +++ b/molstar-extension/package.json @@ -1,6 +1,6 @@ { "name": "molstar-volseg", - "version": "0.0.7", + "version": "0.0.9", "type": "module", "description": "MolStar extension for visualizing volumetric and segmentation data", "repository": { @@ -20,7 +20,8 @@ "build-site": "npm run bundle -- production && mkdir ./site && cp ./build/* ./site/.", "start": "npm run bundle -- development", "rebuild": "npm run clean && npm run build", - "version": "npm run rebuild && cpx .npmignore lib/" + "version": "npm run rebuild && cpx .npmignore lib/", + "build:types": "tsc -d --declarationDir dist/lib --declarationMap --emitDeclarationOnly" }, "files": [ "lib/", @@ -48,6 +49,7 @@ "cpx2": "^7.0.1", "esbuild": "0.21.4", "esbuild-copy-static-files": "^0.1.0", + "esbuild-plugin-d.ts": "^1.2.3", "esbuild-sass-plugin": "^3", "typescript": "^5.4.5" }, diff --git a/molstar-extension/tsconfig.json b/molstar-extension/tsconfig.json index a7124226..ca1cd03c 100644 --- a/molstar-extension/tsconfig.json +++ b/molstar-extension/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "allowJs": true, "declaration": true, "target": "ES2018", "alwaysStrict": true, @@ -22,4 +23,5 @@ }, "include": [ "src/**/*", "src/extensions/volumes-and-segmentations", "src/extensions/meshes", "src/extensions/cvsx-extension" ], // "exclude": [ "src/servers/**/*", "src/perf-tests/*", "src/cli/**/*" ] -} \ No newline at end of file +} +