Skip to content

Commit

Permalink
Replace deprecated node-sass with sass #2 (elastic#173942)
Browse files Browse the repository at this point in the history
The previous PR elastic#161813 was
reverted due to the broken webpack config

elastic@eef1afc

---------

Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Jon <jon@elastic.co>
  • Loading branch information
4 people committed Jan 2, 2024
1 parent 2d2833d commit 994360b
Show file tree
Hide file tree
Showing 32 changed files with 167 additions and 395 deletions.
1 change: 0 additions & 1 deletion WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ yarn_install(
"GECKODRIVER_CDNURL": "https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache",
"CHROMEDRIVER_CDNURL": "https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache",
"CHROMEDRIVER_CDNBINARIESURL": "https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache",
"SASS_BINARY_SITE": "https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-sass",
"RE2_DOWNLOAD_MIRROR": "https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2",
"CYPRESS_DOWNLOAD_MIRROR": "https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/cypress",
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,6 @@
"multimatch": "^4.0.0",
"mutation-observer": "^1.0.3",
"ncp": "^2.0.0",
"node-sass": "^8.0.0",
"null-loader": "^3.0.0",
"nyc": "^15.0.1",
"oboe": "^2.1.4",
Expand All @@ -792,7 +791,8 @@
"regenerate": "^1.4.0",
"resolve": "^1.7.1",
"rxjs-marbles": "^5.0.6",
"sass-loader": "^10.4.1",
"sass-embedded": "^1.69.5",
"sass-loader": "^10.5.1",
"sass-resources-loader": "^2.0.1",
"selenium-webdriver": "^4.16.0",
"simple-git": "^3.16.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ RUNTIME_DEPS = [
"@npm//json-stable-stringify",
"@npm//lmdb",
"@npm//loader-utils",
"@npm//node-sass",
"@npm//sass-embedded",
"@npm//normalize-path",
"@npm//pirates",
"@npm//rxjs",
Expand Down
8 changes: 4 additions & 4 deletions packages/kbn-optimizer/src/worker/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ export function getWebpackConfig(bundle: Bundle, bundleRefs: BundleRefs, worker:
)
)};\n${content}`;
},
webpackImporter: false,
implementation: require('node-sass'),
implementation: require('sass-embedded'),
sassOptions: {
outputStyle: worker.dist ? 'compressed' : 'nested',
outputStyle: worker.dist ? 'compressed' : 'expanded',
includePaths: [Path.resolve(worker.repoRoot, 'node_modules')],
sourceMapRoot: `/${bundle.type}:${bundle.id}`,
sourceMap: true,
quietDeps: true,
},
},
},
Expand Down
2 changes: 0 additions & 2 deletions packages/kbn-pm/src/commands/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ export const BootstrapCommand: ICommand = {
await runBazel(['clean']);
await runBazel(['run', '@nodejs//:yarn'], runOffline, {
env: {
SASS_BINARY_SITE:
'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-sass',
RE2_DOWNLOAD_MIRROR:
'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2',
},
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-storybook/src/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ export default function ({ config: storybookConfig }: { config: Configuration })
resolve(REPO_ROOT, 'src/core/public/core_app/styles/_globals_v7light.scss')
)};\n${content}`;
},
implementation: require('node-sass'),
implementation: require('sass-embedded'),
sassOptions: {
includePaths: [resolve(REPO_ROOT, 'node_modules')],
quietDeps: true,
},
},
},
Expand Down
1 change: 0 additions & 1 deletion src/dev/ci_setup/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ export GECKODRIVER_CDNURL="https://us-central1-elastic-kibana-184716.cloudfuncti
export CHROMEDRIVER_CDNURL="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache"
export CHROMEDRIVER_CDNBINARIESURL="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache"
export RE2_DOWNLOAD_MIRROR="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache"
export SASS_BINARY_SITE="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-sass"
export CYPRESS_DOWNLOAD_MIRROR="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/cypress"

export CHECKS_REPORTER_ACTIVE=false
Expand Down
1 change: 1 addition & 0 deletions src/dev/license_checker/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,5 @@ export const LICENSE_OVERRIDES = {
'@elastic/eui@39.1.3': ['SSPL-1.0 OR Elastic License 2.0'],
'language-subtag-registry@0.3.21': ['CC-BY-4.0'], // retired ODC‑By license https://github.com/mattcg/language-subtag-registry
'buffers@0.1.1': ['MIT'], // license in importing module https://www.npmjs.com/package/binary
'@bufbuild/protobuf@1.2.1': ['Apache-2.0'], // license (Apache-2.0 AND BSD-3-Clause)
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
line-height: $euiSize;
border: none;
color: $euiTextColor;
padding-top: $euiSizeM / 2;
padding-bottom: $euiSizeM / 2;
padding-top: calc($euiSizeM / 2);
padding-bottom: calc($euiSizeM / 2);
white-space: normal; /* 1 */

.euiBadge__childButton {
Expand Down Expand Up @@ -65,8 +65,8 @@
left: 0;
width: $euiSizeXS;
background-color: $kbnGlobalFilterItemBorderColor;
border-top-left-radius: $euiBorderRadius / 2;
border-bottom-left-radius: $euiBorderRadius / 2;
border-top-left-radius: calc($euiBorderRadius / 2);
border-bottom-left-radius: calc($euiBorderRadius / 2);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
}

.kbnSavedQueryManagement__text {
padding: $euiSizeM $euiSizeM ($euiSizeM / 2) $euiSizeM;
padding: $euiSizeM $euiSizeM calc($euiSizeM / 2) $euiSizeM;
}

.kbnSavedQueryManagement__list {
@include euiYScrollWithShadows;
max-height: inherit; // Fixes overflow for applied max-height
// Left/Right padding is calculated to match the left alignment of the
// popover text and buttons
padding: ($euiSizeM / 2) $euiSizeXS !important; // Override flush
padding: calc($euiSizeM / 2) $euiSizeXS !important; // Override flush
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
dt {
background-color: transparentize(shade($euiColorPrimary, 20%), .9);
color: $euiTextColor;
padding: ($euiSizeXS / 2) $euiSizeXS;
padding: calc($euiSizeXS / 2) $euiSizeXS;
margin-right: $euiSizeXS;
word-break: normal;
border-radius: $euiBorderRadius;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/kibana_react/public/markdown/_markdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
$kbnDefaultFontSize: 14px;

@function canvasToEm($size) {
@return #{$size / $kbnDefaultFontSize}em;
@return #{calc($size / $kbnDefaultFontSize)}em;
}

.kbnMarkdown__body {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_default_editor/public/_agg_params.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.visEditorAggParam--half {
margin: $euiSize 0;
display: inline-block;
width: calc(50% - #{$euiSizeS / 2});
width: calc(50% - #{calc($euiSizeS / 2)});
}

.visEditorAggParam--half-size {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
> .tvbVis {
// Apply the minimum height on the vis itself so it doesn't interfere with flex calculations
// Gauges are not completely square, so the height is just slightly less than the width
min-height: $tvbSplitBlockVisMinSize / 1.25;
min-height: calc($tvbSplitBlockVisMinSize / 1.25);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
.tvbVisMetric__label--additional {
@include euiTextTruncate;
font-size: .25em; /* 1 */
padding: ($euiSizeXS / 2) 0 0;
padding: calc($euiSizeXS / 2) 0 0;
text-align: center;
color: $tvbValueColor;
line-height: 1.2; // Ensure the descenders don't get cut off
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
}

.slice {
stroke-width: $euiSizeXS / 2;
stroke-width: calc($euiSizeXS / 2);
stroke: $euiColorEmptyShade;

&:hover {
Expand Down
7 changes: 3 additions & 4 deletions x-pack/plugins/canvas/shareable_runtime/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ module.exports = {
{
loader: 'sass-loader',
options: {
implementation: require('node-sass'),
implementation: require('sass-embedded'),
sourceMap: !isProd,
},
},
Expand Down Expand Up @@ -153,10 +153,9 @@ module.exports = {
path.resolve(KIBANA_ROOT, 'src/core/public/core_app/styles/_globals_v7light.scss')
)};\n${content}`;
},
implementation: require('node-sass'),
webpackImporter: false,
implementation: require('sass-embedded'),
sassOptions: {
outputStyle: 'nested',
outputStyle: 'expanded',
includePaths: [path.resolve(KIBANA_ROOT, 'node_modules')],
},
},
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/canvas/storybook/canvas.webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const canvasWebpack = {
{
loader: 'sass-loader',
options: {
implementation: require('node-sass'),
implementation: require('sass-embedded'),
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
font-weight: normal;
text-align: left;
line-height: 1.1;
font-size: #{$euiFontSizeL / 2}; // 10px
font-size: #{calc($euiFontSizeL / 2)}; // 10px
}

.dataGridChart__legend--numeric {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
.gphGuidancePanel__itemIcon {
position: absolute;
left: 0;
top: -($euiSizeXS / 2);
top: -(calc($euiSizeXS / 2));
width: $euiSizeL;
height: $euiSizeL;
padding: $euiSizeXS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
width: $lnsSuggestionWidth !important; // sass-lint:disable-line no-important
height: $lnsSuggestionHeight;
margin-right: $euiSizeS;
margin-left: $euiSizeXS / 2;
margin-bottom: $euiSizeXS / 2;
margin-left: calc($euiSizeXS / 2);
margin-bottom: calc($euiSizeXS / 2);
box-shadow: none !important; // sass-lint:disable-line no-important

&:focus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
background-color: $euiColorEmptyShade;
border: $euiBorderThin;
color: $euiTextColor;
border-radius: $euiBorderRadius / 2;
border-radius: calc($euiBorderRadius / 2);
height: $euiSize;
width: $euiSizeXL;
line-height: $euiSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}

.progress-bar {
height: $euiSizeXS / 2;
height: calc($euiSizeXS / 2);
margin-top: $euiSizeM;
text-align: right;
line-height: 18px; // SASSTODO: Calc proper value
Expand Down Expand Up @@ -96,7 +96,7 @@
font-size: 11px;
line-height: 14px;
border-radius: $euiBorderRadius;
padding: $euiSizeXS / 2;
padding: calc($euiSizeXS / 2);
margin-top: $euiSizeXS;
display: inline-block;
border: $euiBorderThin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

// SASSTODO: Dangerous EUI overwrite
.scope-field-checkbox {
margin-right: $euiSizeXS / 2;
margin-right: calc($euiSizeXS / 2);

.euiCheckbox {
margin-top: $euiSizeXS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
rect.selected-interval {
fill: rgba(200, 200, 200, .1);
stroke: $euiColorDarkShade;
stroke-width: $euiSizeXS / 2;
stroke-width: calc($euiSizeXS / 2);
stroke-opacity: .8;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ $mlAnnotationRectDefaultFillOpacity: .05;
}

.mlAnnotationRect-isBlur {
stroke-opacity: $mlAnnotationRectDefaultStrokeOpacity / 2;
stroke-opacity: calc($mlAnnotationRectDefaultStrokeOpacity / 2);
transition: stroke-opacity $euiAnimSpeedFast;

fill-opacity: $mlAnnotationRectDefaultFillOpacity / 2;
fill-opacity: calc($mlAnnotationRectDefaultFillOpacity / 2);
transition: fill-opacity $euiAnimSpeedFast;
}

Expand Down Expand Up @@ -95,9 +95,9 @@ $mlAnnotationRectDefaultFillOpacity: .05;
}

.mlContextAnnotationRect-isBlur {
stroke-opacity: $mlAnnotationRectDefaultStrokeOpacity / 2;
stroke-opacity: calc($mlAnnotationRectDefaultStrokeOpacity / 2);
transition: stroke-opacity $euiAnimSpeedFast;

fill-opacity: $mlAnnotationRectDefaultFillOpacity / 2;
fill-opacity: calc($mlAnnotationRectDefaultFillOpacity / 2);
transition: fill-opacity $euiAnimSpeedFast;
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
margin: $euiSizeS;
border: 1px solid $euiColorMediumShade;
border-radius: $euiSizeXS;
padding: $euiSizeXS / 2 0;
padding: calc($euiSizeXS / 2) 0;

&.monChild--index {
border-left: $euiSizeXS solid $euiColorSuccess;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.monStatusIcon {
display: inline-block;
margin-left: $euiSizeXS;
padding: ($euiSizeXS / 2) $euiSizeS;
padding: calc($euiSizeXS / 2) $euiSizeS;
border-radius: $euiBorderRadius;
color: $euiColorGhost;
min-width: 1.9em;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.snapshotRestore__policyForm__stepSettings {
.euiFormRow--hasEmptyLabelSpace {
min-height: auto;
margin-top: $euiFontSizeXS + $euiSizeS + ($euiSizeXXL / 4);
margin-top: $euiFontSizeXS + $euiSizeS + calc($euiSizeXXL / 4);
}
}

Expand All @@ -13,4 +13,4 @@
*/
.snapshotRestore__policyForm__stepSettings__indicesFieldWrapper .euiFormLabel {
width: 100%;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.snapshotRestore__restoreForm__stepSettings {
.euiFormRow--hasEmptyLabelSpace {
min-height: auto;
margin-top: $euiFontSizeXS + $euiSizeS + ($euiSizeXXL / 4);
margin-top: $euiFontSizeXS + $euiSizeS + calc($euiSizeXXL / 4);
}
}

Expand All @@ -14,4 +14,4 @@
*/
.snapshotRestore__restoreForm__stepLogistics__indicesFieldWrapper .euiFormLabel {
width: 100%;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
// them. With this selector we offset the difference so that the content
// of the page doesnt jump when toggling between states.
.upgToggleLoading > .upgLoadingItem {
margin: $euiSizeM / 2;
margin: calc($euiSizeM / 2);
}
Loading

0 comments on commit 994360b

Please sign in to comment.