-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[optimizer] extract plugin discovery #14745
Changes from all commits
027a1c4
b1947e1
f1d01c3
b53526c
d97d0cc
76f8128
d77ced8
15f0a30
a054329
4d16a5f
ca727dc
1a01773
710254f
75fb29e
2220f43
100a306
eb9876c
604344a
6e7bef9
00c9020
78951ec
b37bc7c
eeb65ae
00cbaed
646d1d5
edd6a4d
b8bbb3a
5223b70
2e134f6
3dbf0f0
eda2690
1d8c9de
c7a4e5d
ff3b815
f30dba3
893cc4a
7a47910
5c9fdc0
0bae3bf
424eae5
5d16b95
e818704
8bd9c19
2cbf032
aff9921
cc3fc83
dee1198
b2dc37a
9204943
a6f1438
c9eff80
0606846
1898ae4
89efa7b
6d14b22
b8a95b7
4cda365
fc73f4b
70666a2
b5079a5
99c1ff1
88328a4
c586cf4
3091c0a
0e2f131
36dd268
c35ef96
0d870c5
75dbffe
b9b75d4
3dbe93e
17912cf
139e2b4
66e53df
03de191
1407640
bad97a8
a047981
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ export default function (kibana) { | |
title: 'Redirecting', | ||
id: 'stateSessionStorageRedirect', | ||
main: 'plugins/state_session_storage_redirect', | ||
listed: false, | ||
hidden: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, that makes sense. Thanks for clarifying. |
||
} | ||
} | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
import { union } from 'lodash'; | ||
import findSourceFiles from './find_source_files'; | ||
|
||
import { fromRoot } from '../../utils'; | ||
|
||
import findSourceFiles from './find_source_files'; | ||
import { createTestEntryTemplate } from './tests_entry_template'; | ||
|
||
export default (kibana) => { | ||
return new kibana.Plugin({ | ||
config: (Joi) => { | ||
|
@@ -13,9 +16,18 @@ export default (kibana) => { | |
}, | ||
|
||
uiExports: { | ||
bundle: async (UiBundle, env, apps, plugins) => { | ||
async __bundleProvider__(kbnServer) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this used? I see two other references to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The other references define the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe a README in src/ui/ui_exports would be a good idea There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ++ for a high-level readme in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
let modules = []; | ||
const config = kibana.config; | ||
|
||
const { | ||
config, | ||
uiApps, | ||
uiBundles, | ||
plugins, | ||
uiExports: { | ||
uiSettingDefaults = {} | ||
} | ||
} = kbnServer; | ||
|
||
const testGlobs = [ | ||
'src/ui/public/**/*.js', | ||
|
@@ -26,20 +38,25 @@ export default (kibana) => { | |
if (testingPluginIds) { | ||
testGlobs.push('!src/ui/public/**/__tests__/**/*'); | ||
testingPluginIds.split(',').forEach((pluginId) => { | ||
const plugin = plugins.byId[pluginId]; | ||
if (!plugin) throw new Error('Invalid testingPluginId :: unknown plugin ' + pluginId); | ||
const plugin = plugins | ||
.find(plugin => plugin.id === pluginId); | ||
|
||
if (!plugin) { | ||
throw new Error('Invalid testingPluginId :: unknown plugin ' + pluginId); | ||
} | ||
|
||
// add the modules from all of this plugins apps | ||
for (const app of plugin.apps) { | ||
modules = union(modules, app.getModules()); | ||
for (const app of uiApps) { | ||
if (app.getPluginId() === pluginId) { | ||
modules = union(modules, app.getModules()); | ||
} | ||
} | ||
|
||
testGlobs.push(`${plugin.publicDir}/**/__tests__/**/*.js`); | ||
}); | ||
} else { | ||
|
||
// add the modules from all of the apps | ||
for (const app of apps) { | ||
for (const app of uiApps) { | ||
modules = union(modules, app.getModules()); | ||
} | ||
|
||
|
@@ -52,24 +69,17 @@ export default (kibana) => { | |
for (const f of testFiles) modules.push(f); | ||
|
||
if (config.get('tests_bundle.instrument')) { | ||
env.addPostLoader({ | ||
uiBundles.addPostLoader({ | ||
test: /\.js$/, | ||
exclude: /[\/\\](__tests__|node_modules|bower_components|webpackShims)[\/\\]/, | ||
loader: 'istanbul-instrumenter' | ||
loader: 'istanbul-instrumenter-loader' | ||
}); | ||
} | ||
|
||
env.defaultUiSettings = plugins.kbnServer.uiExports.consumers | ||
// find the first uiExportsConsumer that has a getUiSettingDefaults method | ||
// See src/ui/ui_settings/ui_exports_consumer.js | ||
.find(consumer => typeof consumer.getUiSettingDefaults === 'function') | ||
.getUiSettingDefaults(); | ||
|
||
return new UiBundle({ | ||
uiBundles.add({ | ||
id: 'tests', | ||
modules: modules, | ||
template: require('./tests_entry_template'), | ||
env: env | ||
modules, | ||
template: createTestEntryTemplate(uiSettingDefaults), | ||
}); | ||
}, | ||
|
||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️