forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[kbn/optimizer] fix ui/* url rewrites in dist (elastic#58627)
* [kbn/optimizer] fix ui/* url rewrites in dist * add tests to verify styles are built correctly and ui-rewrites are happening * clarify change to dirs creation * create tested & shared parsePath helper * update renovate config * split implementation of parsePath for dir and file paths * switch to valid css property Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
b7c8e3a
commit bb6fd0b
Showing
14 changed files
with
299 additions
and
547 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/kbn-optimizer/src/__fixtures__/mock_repo/plugins/bar/public/legacy/styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
body { | ||
width: $globalStyleConstant; | ||
background-image: url("ui/icon.svg"); | ||
} |
1 change: 1 addition & 0 deletions
1
packages/kbn-optimizer/src/__fixtures__/mock_repo/src/legacy/ui/public/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
...-optimizer/src/__fixtures__/mock_repo/src/legacy/ui/public/styles/_styling_constants.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$globalStyleConstant: 10; |
527 changes: 15 additions & 512 deletions
527
packages/kbn-optimizer/src/integration_tests/__snapshots__/basic_optimization.test.ts.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
156 changes: 156 additions & 0 deletions
156
packages/kbn-optimizer/src/worker/__snapshots__/parse_path.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import normalizePath from 'normalize-path'; | ||
|
||
/** | ||
* Parse an absolute path, supporting normalized paths from webpack, | ||
* into a list of directories and root | ||
*/ | ||
export function parseDirPath(path: string) { | ||
const filePath = parseFilePath(path); | ||
return { | ||
...filePath, | ||
dirs: [...filePath.dirs, ...(filePath.filename ? [filePath.filename] : [])], | ||
filename: undefined, | ||
}; | ||
} | ||
|
||
export function parseFilePath(path: string) { | ||
const normalized = normalizePath(path); | ||
const [root, ...others] = normalized.split('/'); | ||
return { | ||
root: root === '' ? '/' : root, | ||
dirs: others.slice(0, -1), | ||
filename: others[others.length - 1] || undefined, | ||
}; | ||
} |
Oops, something went wrong.