Skip to content

Commit 8ea1dec

Browse files
Merge branch 'master' into elastic-prefix-for-eslint-config-kibana
2 parents 5b99fd0 + 9b59122 commit 8ea1dec

342 files changed

Lines changed: 7102 additions & 3671 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,7 @@ module.exports = {
296296
errorMessage: `Plugins may only import from src/core/server and src/core/public.`,
297297
},
298298
{
299-
target: [
300-
'(src|x-pack)/plugins/*/server/**/*',
301-
'!x-pack/plugins/apm/**/*', // https://github.com/elastic/kibana/issues/67210
302-
],
299+
target: ['(src|x-pack)/plugins/*/server/**/*'],
303300
from: ['(src|x-pack)/plugins/*/public/**/*'],
304301
errorMessage: `Server code can not import from public, use a common directory.`,
305302
},

docs/developer/getting-started/index.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ you can switch to the correct version when using nvm by running:
3030
nvm use
3131
----
3232

33-
Install the latest version of https://yarnpkg.com[yarn].
33+
Install the latest version of https://classic.yarnpkg.com/en/docs/install[yarn v1].
3434

3535
Bootstrap {kib} and install all the dependencies:
3636

docs/developer/plugin/external-plugin-functional-tests.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ To get started copy and paste this example to `test/functional/config.js`:
1313
["source","js"]
1414
-----------
1515
import { resolve } from 'path';
16-
import { resolveKibanaPath } from '@kbn/plugin-helpers';
16+
import { REPO_ROOT } from '@kbn/dev-utils';
1717
1818
import { MyServiceProvider } from './services/my_service';
1919
import { MyAppPageProvider } from './services/my_app_page';
@@ -24,7 +24,7 @@ export default async function ({ readConfigFile }) {
2424
2525
// read the {kib} config file so that we can utilize some of
2626
// its services and PageObjects
27-
const kibanaConfig = await readConfigFile(resolveKibanaPath('test/functional/config.js'));
27+
const kibanaConfig = await readConfigFile(resolve(REPO_ROOT, 'test/functional/config.js'));
2828
2929
return {
3030
// list paths to the files that contain your plugins tests
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [ACTION\_GLOBAL\_APPLY\_FILTER](./kibana-plugin-plugins-data-public.action_global_apply_filter.md)
4+
5+
## ACTION\_GLOBAL\_APPLY\_FILTER variable
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
ACTION_GLOBAL_APPLY_FILTER = "ACTION_GLOBAL_APPLY_FILTER"
11+
```

docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989

9090
| Variable | Description |
9191
| --- | --- |
92+
| [ACTION\_GLOBAL\_APPLY\_FILTER](./kibana-plugin-plugins-data-public.action_global_apply_filter.md) | |
9293
| [AggGroupLabels](./kibana-plugin-plugins-data-public.agggrouplabels.md) | |
9394
| [AggGroupNames](./kibana-plugin-plugins-data-public.agggroupnames.md) | |
9495
| [baseFormattersPublic](./kibana-plugin-plugins-data-public.baseformatterspublic.md) | |
Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
11
{
22
"name": "@kbn/dev-utils",
3-
"main": "./target/index.js",
43
"version": "1.0.0",
5-
"license": "Apache-2.0",
64
"private": true,
5+
"license": "Apache-2.0",
6+
"main": "./target/index.js",
77
"scripts": {
88
"build": "tsc",
99
"kbn:bootstrap": "yarn build",
1010
"kbn:watch": "yarn build --watch"
1111
},
1212
"dependencies": {
13+
"@babel/core": "^7.11.1",
1314
"axios": "^0.19.0",
1415
"chalk": "^4.1.0",
16+
"cheerio": "0.22.0",
1517
"dedent": "^0.7.0",
1618
"execa": "^4.0.2",
1719
"exit-hook": "^2.2.0",
1820
"getopts": "^2.2.5",
21+
"globby": "^8.0.1",
1922
"load-json-file": "^6.2.0",
20-
"normalize-path": "^3.0.0",
23+
"markdown-it": "^10.0.0",
2124
"moment": "^2.24.0",
25+
"normalize-path": "^3.0.0",
2226
"rxjs": "^6.5.5",
2327
"strip-ansi": "^6.0.0",
2428
"tree-kill": "^1.2.2",
25-
"tslib": "^2.0.0"
29+
"vinyl": "^2.2.0"
2630
},
2731
"devDependencies": {
28-
"typescript": "4.0.2",
32+
"@kbn/babel-preset": "1.0.0",
2933
"@kbn/expect": "1.0.0",
30-
"chance": "1.0.18"
34+
"@types/vinyl": "^2.0.4",
35+
"chance": "1.0.18",
36+
"typescript": "4.0.2"
3137
}
3238
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import File from 'vinyl';
21+
import * as Babel from '@babel/core';
22+
23+
const transformedFiles = new WeakSet<File>();
24+
25+
/**
26+
* Returns a promise that resolves when the file has been
27+
* mutated so the contents of the file are tranformed with
28+
* babel, include inline sourcemaps, and the filename has
29+
* been updated to use .js.
30+
*
31+
* If the file was previously transformed with this function
32+
* the promise will just resolve immediately.
33+
*/
34+
export async function transformFileWithBabel(file: File) {
35+
if (!(file.contents instanceof Buffer)) {
36+
throw new Error('file must be buffered');
37+
}
38+
39+
if (transformedFiles.has(file)) {
40+
return;
41+
}
42+
43+
const source = file.contents.toString('utf8');
44+
const result = await Babel.transformAsync(source, {
45+
babelrc: false,
46+
configFile: false,
47+
sourceMaps: 'inline',
48+
filename: file.path,
49+
presets: [require.resolve('@kbn/babel-preset/node_preset')],
50+
});
51+
52+
if (!result || typeof result.code !== 'string') {
53+
throw new Error('babel transformation failed without an error...');
54+
}
55+
56+
file.contents = Buffer.from(result.code);
57+
file.extname = '.js';
58+
transformedFiles.add(file);
59+
}

packages/kbn-dev-utils/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ export * from './stdio';
4141
export * from './ci_stats_reporter';
4242
export * from './plugin_list';
4343
export * from './simple_kibana_platform_plugin_discovery';
44+
export * from './streams';
45+
export * from './babel';
46+
export * from './parse_kibana_platform_plugin';
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import Path from 'path';
21+
import loadJsonFile from 'load-json-file';
22+
23+
export interface KibanaPlatformPlugin {
24+
readonly directory: string;
25+
readonly manifestPath: string;
26+
readonly manifest: {
27+
id: string;
28+
ui: boolean;
29+
server: boolean;
30+
[key: string]: unknown;
31+
};
32+
}
33+
34+
export function parseKibanaPlatformPlugin(manifestPath: string): KibanaPlatformPlugin {
35+
if (!Path.isAbsolute(manifestPath)) {
36+
throw new TypeError('expected new platform manifest path to be absolute');
37+
}
38+
39+
const manifest = loadJsonFile.sync(manifestPath);
40+
if (!manifest || typeof manifest !== 'object' || Array.isArray(manifest)) {
41+
throw new TypeError('expected new platform plugin manifest to be a JSON encoded object');
42+
}
43+
44+
if (typeof manifest.id !== 'string') {
45+
throw new TypeError('expected new platform plugin manifest to have a string id');
46+
}
47+
48+
return {
49+
directory: Path.dirname(manifestPath),
50+
manifestPath,
51+
manifest: {
52+
...manifest,
53+
54+
ui: !!manifest.ui,
55+
server: !!manifest.server,
56+
id: manifest.id,
57+
},
58+
};
59+
}

packages/kbn-dev-utils/src/run/flags.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ export function mergeFlagOptions(global: FlagOptions = {}, local: FlagOptions =
5252
boolean: [...(global.boolean || []), ...(local.boolean || [])],
5353
string: [...(global.string || []), ...(local.string || [])],
5454
default: {
55-
...global.alias,
56-
...local.alias,
55+
...global.default,
56+
...local.default,
5757
},
5858

5959
help: local.help,

0 commit comments

Comments
 (0)