-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fc/fixing-misc-bugs
- Loading branch information
Showing
834 changed files
with
13,723 additions
and
4,604 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
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,15 @@ | ||
# Generated by FOSSA CLI (https://github.com/fossas/fossa-cli) | ||
# Visit https://fossa.com to learn more | ||
|
||
version: 2 | ||
cli: | ||
server: https://app.fossa.com | ||
fetcher: custom | ||
project: kibana | ||
analyze: | ||
modules: | ||
- name: kibana | ||
type: nodejs | ||
strategy: yarn.lock | ||
target: . | ||
path: . |
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
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
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
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
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...bn-optimizer/src/__fixtures__/mock_repo/src/legacy/ui/public/styles/_globals_v7light.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: 11; |
1 change: 1 addition & 0 deletions
1
...kbn-optimizer/src/__fixtures__/mock_repo/src/legacy/ui/public/styles/_globals_v8dark.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: 12; |
1 change: 1 addition & 0 deletions
1
...bn-optimizer/src/__fixtures__/mock_repo/src/legacy/ui/public/styles/_globals_v8light.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: 13; |
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,92 @@ | ||
/* | ||
* 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 { parseThemeTags } from './theme_tags'; | ||
|
||
it('returns default tags when passed undefined', () => { | ||
expect(parseThemeTags()).toMatchInlineSnapshot(` | ||
Array [ | ||
"v7dark", | ||
"v7light", | ||
] | ||
`); | ||
}); | ||
|
||
it('returns all tags when passed *', () => { | ||
expect(parseThemeTags('*')).toMatchInlineSnapshot(` | ||
Array [ | ||
"v7dark", | ||
"v7light", | ||
"v8dark", | ||
"v8light", | ||
] | ||
`); | ||
}); | ||
|
||
it('returns specific tag when passed a single value', () => { | ||
expect(parseThemeTags('v8light')).toMatchInlineSnapshot(` | ||
Array [ | ||
"v8light", | ||
] | ||
`); | ||
}); | ||
|
||
it('returns specific tags when passed a comma separated list', () => { | ||
expect(parseThemeTags('v8light, v7dark,v7light')).toMatchInlineSnapshot(` | ||
Array [ | ||
"v7dark", | ||
"v7light", | ||
"v8light", | ||
] | ||
`); | ||
}); | ||
|
||
it('returns specific tags when passed an array', () => { | ||
expect(parseThemeTags(['v8light', 'v7light'])).toMatchInlineSnapshot(` | ||
Array [ | ||
"v7light", | ||
"v8light", | ||
] | ||
`); | ||
}); | ||
|
||
it('throws when an invalid tag is in the array', () => { | ||
expect(() => parseThemeTags(['v8light', 'v7light', 'bar'])).toThrowErrorMatchingInlineSnapshot( | ||
`"Invalid theme tags [bar], options: [v7dark, v7light, v8dark, v8light]"` | ||
); | ||
}); | ||
|
||
it('throws when an invalid tags in comma separated list', () => { | ||
expect(() => parseThemeTags('v8light ,v7light,bar,box ')).toThrowErrorMatchingInlineSnapshot( | ||
`"Invalid theme tags [bar, box], options: [v7dark, v7light, v8dark, v8light]"` | ||
); | ||
}); | ||
|
||
it('returns tags in alphabetical order', () => { | ||
const tags = parseThemeTags(['v7light', 'v8light']); | ||
expect(tags).toEqual(tags.slice().sort((a, b) => a.localeCompare(b))); | ||
}); | ||
|
||
it('returns an immutable array', () => { | ||
expect(() => { | ||
const tags = parseThemeTags('v8light'); | ||
// @ts-expect-error | ||
tags.push('foo'); | ||
}).toThrowErrorMatchingInlineSnapshot(`"Cannot add property 1, object is not extensible"`); | ||
}); |
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,65 @@ | ||
/* | ||
* 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 { ascending } from './array_helpers'; | ||
|
||
const tags = (...themeTags: string[]) => | ||
Object.freeze(themeTags.sort(ascending((tag) => tag)) as ThemeTag[]); | ||
|
||
const validTag = (tag: any): tag is ThemeTag => ALL_THEMES.includes(tag); | ||
const isArrayOfStrings = (input: unknown): input is string[] => | ||
Array.isArray(input) && input.every((v) => typeof v === 'string'); | ||
|
||
export type ThemeTags = readonly ThemeTag[]; | ||
export type ThemeTag = 'v7light' | 'v7dark' | 'v8light' | 'v8dark'; | ||
export const DEFAULT_THEMES = tags('v7light', 'v7dark'); | ||
export const ALL_THEMES = tags('v7light', 'v7dark', 'v8light', 'v8dark'); | ||
|
||
export function parseThemeTags(input?: any): ThemeTags { | ||
if (!input) { | ||
return DEFAULT_THEMES; | ||
} | ||
|
||
if (input === '*') { | ||
return ALL_THEMES; | ||
} | ||
|
||
if (typeof input === 'string') { | ||
input = input.split(',').map((tag) => tag.trim()); | ||
} | ||
|
||
if (!isArrayOfStrings(input)) { | ||
throw new Error(`Invalid theme tags, must be an array of strings`); | ||
} | ||
|
||
if (!input.length) { | ||
throw new Error( | ||
`Invalid theme tags, you must specify at least one of [${ALL_THEMES.join(', ')}]` | ||
); | ||
} | ||
|
||
const invalidTags = input.filter((t) => !validTag(t)); | ||
if (invalidTags.length) { | ||
throw new Error( | ||
`Invalid theme tags [${invalidTags.join(', ')}], options: [${ALL_THEMES.join(', ')}]` | ||
); | ||
} | ||
|
||
return tags(...input); | ||
} |
Oops, something went wrong.