Skip to content

Commit 73d72aa

Browse files
Spencerspalger
authored andcommitted
[@kbn/optimizer] rewrite url(ui/*) in legacy scss files (#57869)
* [@kbn/optimizer] rewrite url(ui/*) in legacy scss files * update kbn/pm dist
1 parent 48b2a33 commit 73d72aa

4 files changed

Lines changed: 142 additions & 30 deletions

File tree

packages/kbn-optimizer/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"node-sass": "^4.13.0",
3232
"postcss-loader": "^3.0.0",
3333
"raw-loader": "^3.1.0",
34+
"resolve-url-loader": "^3.1.1",
3435
"rxjs": "^6.5.3",
3536
"sass-loader": "^8.0.2",
3637
"style-loader": "^1.1.3",

packages/kbn-optimizer/src/worker/webpack.config.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,27 @@ export function getWebpackConfig(bundle: Bundle, worker: WorkerConfig) {
124124
},
125125
},
126126
},
127+
{
128+
loader: 'resolve-url-loader',
129+
options: {
130+
join: (_: string, __: any) => (uri: string, base?: string) => {
131+
if (!base) {
132+
return null;
133+
}
134+
135+
// manually force ui/* urls in legacy styles to resolve to ui/legacy/public
136+
if (uri.startsWith('ui/') && base.split(Path.sep).includes('legacy')) {
137+
return Path.resolve(
138+
worker.repoRoot,
139+
'src/legacy/ui/public',
140+
uri.replace('ui/', '')
141+
);
142+
}
143+
144+
return null;
145+
},
146+
},
147+
},
127148
{
128149
loader: 'sass-loader',
129150
options: {

packages/kbn-pm/dist/index.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43046,21 +43046,28 @@ module.exports = require("tty");
4304643046
const os = __webpack_require__(11);
4304743047
const hasFlag = __webpack_require__(12);
4304843048

43049-
const env = process.env;
43049+
const {env} = process;
4305043050

4305143051
let forceColor;
4305243052
if (hasFlag('no-color') ||
4305343053
hasFlag('no-colors') ||
43054-
hasFlag('color=false')) {
43055-
forceColor = false;
43054+
hasFlag('color=false') ||
43055+
hasFlag('color=never')) {
43056+
forceColor = 0;
4305643057
} else if (hasFlag('color') ||
4305743058
hasFlag('colors') ||
4305843059
hasFlag('color=true') ||
4305943060
hasFlag('color=always')) {
43060-
forceColor = true;
43061+
forceColor = 1;
4306143062
}
4306243063
if ('FORCE_COLOR' in env) {
43063-
forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
43064+
if (env.FORCE_COLOR === true || env.FORCE_COLOR === 'true') {
43065+
forceColor = 1;
43066+
} else if (env.FORCE_COLOR === false || env.FORCE_COLOR === 'false') {
43067+
forceColor = 0;
43068+
} else {
43069+
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
43070+
}
4306443071
}
4306543072

4306643073
function translateLevel(level) {
@@ -43077,7 +43084,7 @@ function translateLevel(level) {
4307743084
}
4307843085

4307943086
function supportsColor(stream) {
43080-
if (forceColor === false) {
43087+
if (forceColor === 0) {
4308143088
return 0;
4308243089
}
4308343090

@@ -43091,11 +43098,15 @@ function supportsColor(stream) {
4309143098
return 2;
4309243099
}
4309343100

43094-
if (stream && !stream.isTTY && forceColor !== true) {
43101+
if (stream && !stream.isTTY && forceColor === undefined) {
4309543102
return 0;
4309643103
}
4309743104

43098-
const min = forceColor ? 1 : 0;
43105+
const min = forceColor || 0;
43106+
43107+
if (env.TERM === 'dumb') {
43108+
return min;
43109+
}
4309943110

4310043111
if (process.platform === 'win32') {
4310143112
// Node.js 7.5.0 is the first version of Node.js to include a patch to
@@ -43156,10 +43167,6 @@ function supportsColor(stream) {
4315643167
return 1;
4315743168
}
4315843169

43159-
if (env.TERM === 'dumb') {
43160-
return min;
43161-
}
43162-
4316343170
return min;
4316443171
}
4316543172

yarn.lock

Lines changed: 101 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6560,6 +6560,17 @@ address@^1.0.1:
65606560
resolved "https://registry.yarnpkg.com/address/-/address-1.0.3.tgz#b5f50631f8d6cec8bd20c963963afb55e06cbce9"
65616561
integrity sha512-z55ocwKBRLryBs394Sm3ushTtBeg6VAeuku7utSoSnsJKvKcnXFIyC6vh27n3rXyxSgkJBBCAvyOn7gSUcTYjg==
65626562

6563+
adjust-sourcemap-loader@2.0.0:
6564+
version "2.0.0"
6565+
resolved "https://registry.yarnpkg.com/adjust-sourcemap-loader/-/adjust-sourcemap-loader-2.0.0.tgz#6471143af75ec02334b219f54bc7970c52fb29a4"
6566+
integrity sha512-4hFsTsn58+YjrU9qKzML2JSSDqKvN8mUGQ0nNIrfPi8hmIONT4L3uUaT6MKdMsZ9AjsU6D2xDkZxCkbQPxChrA==
6567+
dependencies:
6568+
assert "1.4.1"
6569+
camelcase "5.0.0"
6570+
loader-utils "1.2.3"
6571+
object-path "0.11.4"
6572+
regex-parser "2.2.10"
6573+
65636574
adm-zip@0.4.11:
65646575
version "0.4.11"
65656576
resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.11.tgz#2aa54c84c4b01a9d0fb89bb11982a51f13e3d62a"
@@ -7315,6 +7326,11 @@ aria-query@3.0.0, aria-query@^3.0.0:
73157326
ast-types-flow "0.0.7"
73167327
commander "^2.11.0"
73177328

7329+
arity-n@^1.0.4:
7330+
version "1.0.4"
7331+
resolved "https://registry.yarnpkg.com/arity-n/-/arity-n-1.0.4.tgz#d9e76b11733e08569c0847ae7b39b2860b30b745"
7332+
integrity sha1-2edrEXM+CFacCEeuezmyhgswt0U=
7333+
73187334
arr-diff@^4.0.0:
73197335
version "4.0.0"
73207336
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520"
@@ -7549,7 +7565,7 @@ assert-plus@^0.2.0:
75497565
resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234"
75507566
integrity sha1-104bh+ev/A24qttwIfP+SBAasjQ=
75517567

7552-
assert@^1.1.1:
7568+
assert@1.4.1, assert@^1.1.1:
75537569
version "1.4.1"
75547570
resolved "https://registry.yarnpkg.com/assert/-/assert-1.4.1.tgz#99912d591836b5a6f5b345c0f07eefc08fc65d91"
75557571
integrity sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=
@@ -9324,6 +9340,16 @@ camelcase-keys@^4.0.0:
93249340
map-obj "^2.0.0"
93259341
quick-lru "^1.0.0"
93269342

9343+
camelcase@5.0.0, camelcase@^5.0.0:
9344+
version "5.0.0"
9345+
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.0.0.tgz#03295527d58bd3cd4aa75363f35b2e8d97be2f42"
9346+
integrity sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==
9347+
9348+
camelcase@5.3.1, camelcase@^5.3.1:
9349+
version "5.3.1"
9350+
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
9351+
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
9352+
93279353
camelcase@^1.0.2:
93289354
version "1.2.1"
93299355
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39"
@@ -9344,16 +9370,6 @@ camelcase@^4.0.0, camelcase@^4.1.0:
93449370
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd"
93459371
integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=
93469372

9347-
camelcase@^5.0.0:
9348-
version "5.0.0"
9349-
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.0.0.tgz#03295527d58bd3cd4aa75363f35b2e8d97be2f42"
9350-
integrity sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==
9351-
9352-
camelcase@^5.3.1:
9353-
version "5.3.1"
9354-
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
9355-
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
9356-
93579373
camelize@^1.0.0:
93589374
version "1.0.0"
93599375
resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.0.tgz#164a5483e630fa4321e5af07020e531831b2609b"
@@ -10345,6 +10361,13 @@ component-inherit@0.0.3:
1034510361
resolved "https://registry.yarnpkg.com/component-inherit/-/component-inherit-0.0.3.tgz#645fc4adf58b72b649d5cae65135619db26ff143"
1034610362
integrity sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=
1034710363

10364+
compose-function@3.0.3:
10365+
version "3.0.3"
10366+
resolved "https://registry.yarnpkg.com/compose-function/-/compose-function-3.0.3.tgz#9ed675f13cc54501d30950a486ff6a7ba3ab185f"
10367+
integrity sha1-ntZ18TzFRQHTCVCkhv9qe6OrGF8=
10368+
dependencies:
10369+
arity-n "^1.0.4"
10370+
1034810371
compress-commons@^2.1.1:
1034910372
version "2.1.1"
1035010373
resolved "https://registry.yarnpkg.com/compress-commons/-/compress-commons-2.1.1.tgz#9410d9a534cf8435e3fbbb7c6ce48de2dc2f0610"
@@ -10592,11 +10615,23 @@ contour_plot@^0.0.1:
1059210615
resolved "https://registry.yarnpkg.com/contour_plot/-/contour_plot-0.0.1.tgz#475870f032b8e338412aa5fc507880f0bf495c77"
1059310616
integrity sha1-R1hw8DK44zhBKqX8UHiA8L9JXHc=
1059410617

10618+
convert-source-map@1.7.0:
10619+
version "1.7.0"
10620+
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442"
10621+
integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==
10622+
dependencies:
10623+
safe-buffer "~5.1.1"
10624+
1059510625
convert-source-map@1.X, convert-source-map@^1.1.0, convert-source-map@^1.4.0, convert-source-map@^1.5.0:
1059610626
version "1.5.1"
1059710627
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5"
1059810628
integrity sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=
1059910629

10630+
convert-source-map@^0.3.3:
10631+
version "0.3.5"
10632+
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-0.3.5.tgz#f1d802950af7dd2631a1febe0596550c86ab3190"
10633+
integrity sha1-8dgClQr33SYxof6+BZZVDIarMZA=
10634+
1060010635
convert-source-map@^1.5.1, convert-source-map@^1.6.0:
1060110636
version "1.6.0"
1060210637
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20"
@@ -11216,7 +11251,7 @@ css.escape@^1.5.1:
1121611251
resolved "https://registry.yarnpkg.com/css.escape/-/css.escape-1.5.1.tgz#42e27d4fa04ae32f931a4b4d4191fa9cddee97cb"
1121711252
integrity sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s=
1121811253

11219-
css@2.X, css@^2.2.1, css@^2.2.3, css@^2.2.4:
11254+
css@2.X, css@^2.0.0, css@^2.2.1, css@^2.2.3, css@^2.2.4:
1122011255
version "2.2.4"
1122111256
resolved "https://registry.yarnpkg.com/css/-/css-2.2.4.tgz#c646755c73971f2bba6a601e2cf2fd71b1298929"
1122211257
integrity sha512-oUnjmWpy0niI3x/mPL8dVEI1l7MnG3+HHyRPHf+YFSbK+svOhXpmSOcDURUh2aOCgl2grzrOPt1nHLuCVFULLw==
@@ -13099,7 +13134,7 @@ es6-error@^4.0.1:
1309913134
resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.1.1.tgz#9e3af407459deed47e9a91f9b885a84eb05c561d"
1310013135
integrity sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==
1310113136

13102-
es6-iterator@^2.0.1, es6-iterator@~2.0.1, es6-iterator@~2.0.3:
13137+
es6-iterator@2.0.3, es6-iterator@^2.0.1, es6-iterator@~2.0.1, es6-iterator@~2.0.3:
1310313138
version "2.0.3"
1310413139
resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7"
1310513140
integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c=
@@ -22568,6 +22603,11 @@ object-path-immutable@^3.1.1:
2256822603
dependencies:
2256922604
is-plain-object "3.0.0"
2257022605

22606+
object-path@0.11.4:
22607+
version "0.11.4"
22608+
resolved "https://registry.yarnpkg.com/object-path/-/object-path-0.11.4.tgz#370ae752fbf37de3ea70a861c23bba8915691949"
22609+
integrity sha1-NwrnUvvzfePqcKhhwju6iRVpGUk=
22610+
2257122611
object-values@^1.0.0:
2257222612
version "1.0.0"
2257322613
resolved "https://registry.yarnpkg.com/object-values/-/object-values-1.0.0.tgz#72af839630119e5b98c3b02bb8c27e3237158105"
@@ -24004,6 +24044,15 @@ postcss-values-parser@^1.5.0:
2400424044
indexes-of "^1.0.1"
2400524045
uniq "^1.0.1"
2400624046

24047+
postcss@7.0.21:
24048+
version "7.0.21"
24049+
resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.21.tgz#06bb07824c19c2021c5d056d5b10c35b989f7e17"
24050+
integrity sha512-uIFtJElxJo29QC753JzhidoAhvp/e/Exezkdhfmt8AymWT6/5B7W1WmponYWkHk2eg6sONyTch0A3nkMPun3SQ==
24051+
dependencies:
24052+
chalk "^2.4.2"
24053+
source-map "^0.6.1"
24054+
supports-color "^6.1.0"
24055+
2400724056
postcss@^7.0.0, postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.2, postcss@^7.0.23, postcss@^7.0.26, postcss@^7.0.5, postcss@^7.0.6:
2400824057
version "7.0.26"
2400924058
resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.26.tgz#5ed615cfcab35ba9bbb82414a4fa88ea10429587"
@@ -26142,6 +26191,11 @@ regex-not@^1.0.2:
2614226191
extend-shallow "^3.0.2"
2614326192
safe-regex "^1.1.0"
2614426193

26194+
regex-parser@2.2.10:
26195+
version "2.2.10"
26196+
resolved "https://registry.yarnpkg.com/regex-parser/-/regex-parser-2.2.10.tgz#9e66a8f73d89a107616e63b39d4deddfee912b37"
26197+
integrity sha512-8t6074A68gHfU8Neftl0Le6KTDwfGAj7IyjPIMSfikI2wJUTHDMaIq42bUsfVnj8mhx0R+45rdUXHGpN164avA==
26198+
2614526199
regex-regex@^1.0.0:
2614626200
version "1.0.0"
2614726201
resolved "https://registry.yarnpkg.com/regex-regex/-/regex-regex-1.0.0.tgz#9048a1eaeb870f4d480dabc76fc42cdcc0bc3a72"
@@ -26698,6 +26752,22 @@ resolve-protobuf-schema@^2.0.0:
2669826752
dependencies:
2669926753
protocol-buffers-schema "^3.3.1"
2670026754

26755+
resolve-url-loader@^3.1.1:
26756+
version "3.1.1"
26757+
resolved "https://registry.yarnpkg.com/resolve-url-loader/-/resolve-url-loader-3.1.1.tgz#28931895fa1eab9be0647d3b2958c100ae3c0bf0"
26758+
integrity sha512-K1N5xUjj7v0l2j/3Sgs5b8CjrrgtC70SmdCuZiJ8tSyb5J+uk3FoeZ4b7yTnH6j7ngI+Bc5bldHJIa8hYdu2gQ==
26759+
dependencies:
26760+
adjust-sourcemap-loader "2.0.0"
26761+
camelcase "5.3.1"
26762+
compose-function "3.0.3"
26763+
convert-source-map "1.7.0"
26764+
es6-iterator "2.0.3"
26765+
loader-utils "1.2.3"
26766+
postcss "7.0.21"
26767+
rework "1.0.1"
26768+
rework-visit "1.0.0"
26769+
source-map "0.6.1"
26770+
2670126771
resolve-url@^0.2.1:
2670226772
version "0.2.1"
2670326773
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
@@ -26836,6 +26906,19 @@ reusify@^1.0.0:
2683626906
resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
2683726907
integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==
2683826908

26909+
rework-visit@1.0.0:
26910+
version "1.0.0"
26911+
resolved "https://registry.yarnpkg.com/rework-visit/-/rework-visit-1.0.0.tgz#9945b2803f219e2f7aca00adb8bc9f640f842c9a"
26912+
integrity sha1-mUWygD8hni96ygCtuLyfZA+ELJo=
26913+
26914+
rework@1.0.1:
26915+
version "1.0.1"
26916+
resolved "https://registry.yarnpkg.com/rework/-/rework-1.0.1.tgz#30806a841342b54510aa4110850cd48534144aa7"
26917+
integrity sha1-MIBqhBNCtUUQqkEQhQzUhTQUSqc=
26918+
dependencies:
26919+
convert-source-map "^0.3.3"
26920+
css "^2.0.0"
26921+
2683926922
rfdc@^1.1.2:
2684026923
version "1.1.2"
2684126924
resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.1.2.tgz#e6e72d74f5dc39de8f538f65e00c36c18018e349"
@@ -28015,6 +28098,11 @@ source-map@0.5.6:
2801528098
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412"
2801628099
integrity sha1-dc449SvwczxafwwRjYEzSiu19BI=
2801728100

28101+
source-map@0.6.1, source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1:
28102+
version "0.6.1"
28103+
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
28104+
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
28105+
2801828106
source-map@^0.4.2:
2801928107
version "0.4.4"
2802028108
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b"
@@ -28027,11 +28115,6 @@ source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.3, source-map@^0.5.6, sour
2802728115
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
2802828116
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
2802928117

28030-
source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1:
28031-
version "0.6.1"
28032-
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
28033-
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
28034-
2803528118
source-map@~0.1.30:
2803628119
version "0.1.43"
2803728120
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346"

0 commit comments

Comments
 (0)