fix(modules): add stylus loader as an option to be uncommented (#3710)

This commit is contained in:
Alireza 2023-10-10 13:21:17 -04:00 committed by GitHub
parent dc929d3df5
commit 7c57f67844
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 92 additions and 9 deletions

View File

@ -0,0 +1,10 @@
const stylusToJavaScript = {
test: /\.styl$/,
use: [
{ loader: 'style-loader' }, // 3. Style nodes from JS Strings
{ loader: 'css-loader' }, // 2. CSS to CommonJS
{ loader: 'stylus-loader' }, // 1. Stylus to CSS
],
};
module.exports = stylusToJavaScript;

View File

@ -18,6 +18,7 @@ const loadShadersRule = require('./rules/loadShaders.js');
const loadWebWorkersRule = require('./rules/loadWebWorkers.js');
const transpileJavaScriptRule = require('./rules/transpileJavaScript.js');
const cssToJavaScript = require('./rules/cssToJavaScript.js');
const stylusToJavaScript = require('./rules/stylusToJavaScript.js');
// ~~ ENV VARS
const NODE_ENV = process.env.NODE_ENV;
@ -112,6 +113,9 @@ module.exports = (env, argv, { SRC_DIR, ENTRY }) => {
},
},
cssToJavaScript,
// Note: Only uncomment the following if you are using the old style of stylus in v2
// Also you need to uncomment this platform/app/.webpack/rules/extractStyleChunks.js
// stylusToJavaScript,
{
test: /\.wasm/,
type: 'asset/resource',

View File

@ -189,7 +189,7 @@ class SegmentationService extends PubSubService {
);
}
if (active !== undefined) {
if (active === true) {
this._setActiveSegment(segmentationId, segmentIndex, suppressEvents);
}
@ -399,6 +399,23 @@ class SegmentationService extends PubSubService {
return segmentations && segmentations.map(m => this.segmentations[Object.keys(m)[0]]);
}
public getActiveSegmentation(): Segmentation {
const segmentations = this.getSegmentations();
return segmentations.find(segmentation => segmentation.isActive);
}
public getActiveSegment() {
const activeSegmentation = this.getActiveSegmentation();
const { activeSegmentIndex, segments } = activeSegmentation;
if (activeSegmentIndex === null) {
return;
}
return segments[activeSegmentIndex];
}
/**
* Get specific segmentation by its id.
*

View File

@ -12,7 +12,8 @@ export default function toggleStackImageSync({
const { syncGroupService, viewportGridService, displaySetService, cornerstoneViewportService } =
servicesManager.services;
const viewports = providedViewports || getReconstructableStackViewports(viewportGridService, displaySetService);
const viewports =
providedViewports || getReconstructableStackViewports(viewportGridService, displaySetService);
// create synchronization group and add the viewports to it.
viewports.forEach(gridViewport => {
@ -46,7 +47,7 @@ function disableSync(syncName, servicesManager) {
syncName
);
});
};
}
/**
* Gets the consistent spacing stack viewport types, which are the ones which
@ -77,4 +78,4 @@ function getReconstructableStackViewports(viewportGridService, displaySetService
}
});
return viewports;
};
}

View File

@ -40,7 +40,7 @@ const dicomSeg = {
panel: '@ohif/extension-cornerstone-dicom-seg.panelModule.panelSegmentation',
};
const dicomRt = {
const dicomRT = {
viewport: '@ohif/extension-cornerstone-dicom-rt.viewportModule.dicom-rt',
sopClassHandler: '@ohif/extension-cornerstone-dicom-rt.sopClassHandlerModule.dicom-rt',
};
@ -218,8 +218,8 @@ function modeFactory({ modeConfiguration }) {
displaySetsToDisplay: [dicomSeg.sopClassHandler],
},
{
namespace: dicomRt.viewport,
displaySetsToDisplay: [dicomRt.sopClassHandler],
namespace: dicomRT.viewport,
displaySetsToDisplay: [dicomRT.sopClassHandler],
},
],
},
@ -240,7 +240,7 @@ function modeFactory({ modeConfiguration }) {
ohif.sopClassHandler,
dicompdf.sopClassHandler,
dicomsr.sopClassHandler,
dicomRt.sopClassHandler,
dicomRT.sopClassHandler,
],
hotkeys: [...hotkeys.defaults.hotkeyBindings],
...modeConfiguration,

View File

@ -0,0 +1,11 @@
{
"trailingComma": "es5",
"printWidth": 100,
"proseWrap": "always",
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"arrowParens": "avoid",
"singleAttributePerLine": true,
"endOfLine": "auto"
}

View File

@ -130,6 +130,8 @@
"source-map-loader": "^4.0.1",
"start-server-and-test": "^1.10.0",
"style-loader": "^1.0.0",
"stylus": "^0.59.0",
"stylus-loader": "^7.1.3",
"terser-webpack-plugin": "^5.1.4",
"typescript": "4.6.4",
"unused-webpack-plugin": "2.4.0",

View File

@ -2,6 +2,20 @@ const ExtractCssChunksPlugin = require('extract-css-chunks-webpack-plugin');
function extractStyleChunks(isProdBuild) {
return [
// If you are using the old stylus, you should uncomment this
// {
// test: /\.styl$/,
// use: [
// {
// loader: ExtractCssChunksPlugin.loader,
// options: {
// hot: !isProdBuild,
// },
// },
// { loader: 'css-loader' },
// { loader: 'stylus-loader' },
// ],
// },
{
test: /\.(sa|sc|c)ss$/,
use: [

View File

@ -7,6 +7,11 @@
resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf"
integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==
"@adobe/css-tools@^4.0.1":
version "4.2.0"
resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.2.0.tgz#e1a84fca468f4b337816fcb7f0964beb620ba855"
integrity sha512-E09FiIft46CmH5Qnjb0wsW54/YQd69LsxeKUOWawmws1XWvyFGURnAChH0mlr7YPFR1ofwvUQfcL0J3lMxXqPA==
"@algolia/autocomplete-core@1.9.3":
version "1.9.3"
resolved "https://registry.yarnpkg.com/@algolia/autocomplete-core/-/autocomplete-core-1.9.3.tgz#1d56482a768c33aae0868c8533049e02e8961be7"
@ -8456,7 +8461,7 @@ debug@2.6.9, debug@^2.6.0, debug@^2.6.9:
dependencies:
ms "2.0.0"
debug@4, debug@4.3.4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.3, debug@^4.3.4:
debug@4, debug@4.3.4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
@ -19344,6 +19349,25 @@ stylis@4.2.0:
resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.2.0.tgz#79daee0208964c8fe695a42fcffcac633a211a51"
integrity sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw==
stylus-loader@^7.1.3:
version "7.1.3"
resolved "https://registry.yarnpkg.com/stylus-loader/-/stylus-loader-7.1.3.tgz#1fdfa0d34e8c05a569bc0902e1ecdb857d764964"
integrity sha512-TY0SKwiY7D2kMd3UxaWKSf3xHF0FFN/FAfsSqfrhxRT/koXTwffq2cgEWDkLQz7VojMu7qEEHt5TlMjkPx9UDw==
dependencies:
fast-glob "^3.2.12"
normalize-path "^3.0.0"
stylus@^0.59.0:
version "0.59.0"
resolved "https://registry.yarnpkg.com/stylus/-/stylus-0.59.0.tgz#a344d5932787142a141946536d6e24e6a6be7aa6"
integrity sha512-lQ9w/XIOH5ZHVNuNbWW8D822r+/wBSO/d6XvtyHLF7LW4KaCIDeVbvn5DF8fGCJAUCwVhVi/h6J0NUcnylUEjg==
dependencies:
"@adobe/css-tools" "^4.0.1"
debug "^4.3.2"
glob "^7.1.6"
sax "~1.2.4"
source-map "^0.7.3"
supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"