From ef11745c2fe612724daefbed36d8e6de4371b0c2 Mon Sep 17 00:00:00 2001 From: Josh Dover Date: Thu, 9 Apr 2020 14:58:26 -0600 Subject: [PATCH] Rename standalone to entry, fix bootstrap --- packages/kbn-optimizer/src/common/bundle.ts | 2 +- .../basic_optimization.test.ts.snap | 8 ++--- .../basic_optimization.test.ts | 2 +- .../src/optimizer/get_bundles.test.ts | 2 +- .../src/optimizer/get_bundles.ts | 2 +- .../ui/ui_render/bootstrap/template.js.hbs | 31 +++++++------------ 6 files changed, 17 insertions(+), 30 deletions(-) diff --git a/packages/kbn-optimizer/src/common/bundle.ts b/packages/kbn-optimizer/src/common/bundle.ts index 40f7aa600892b..7581b90d60af2 100644 --- a/packages/kbn-optimizer/src/common/bundle.ts +++ b/packages/kbn-optimizer/src/common/bundle.ts @@ -23,7 +23,7 @@ import { BundleCache } from './bundle_cache'; import { UnknownVals } from './ts_helpers'; import { includes, ascending, entriesToObject } from './array_helpers'; -const VALID_BUNDLE_TYPES = ['plugin' as const, 'standalone' as const]; +const VALID_BUNDLE_TYPES = ['plugin' as const, 'entry' as const]; export interface BundleSpec { readonly type: typeof VALID_BUNDLE_TYPES[0]; diff --git a/packages/kbn-optimizer/src/integration_tests/__snapshots__/basic_optimization.test.ts.snap b/packages/kbn-optimizer/src/integration_tests/__snapshots__/basic_optimization.test.ts.snap index fe9a699e37de1..85f1c29950f12 100644 --- a/packages/kbn-optimizer/src/integration_tests/__snapshots__/basic_optimization.test.ts.snap +++ b/packages/kbn-optimizer/src/integration_tests/__snapshots__/basic_optimization.test.ts.snap @@ -15,7 +15,7 @@ OptimizerConfig { "id": "core", "outputDir": /packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/src/core/public/target/public, "sourceRoot": /packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo, - "type": "standalone", + "type": "entry", }, Bundle { "cache": BundleCache { @@ -71,10 +71,6 @@ OptimizerConfig { exports[`builds expected bundles, saves bundle counts to metadata: bar bundle 1`] = `"var __kbnBundles__=typeof __kbnBundles__===\\"object\\"?__kbnBundles__:{};__kbnBundles__[\\"plugin/bar\\"]=function(modules){function webpackJsonpCallback(data){var chunkIds=data[0];var moreModules=data[1];var moduleId,chunkId,i=0,resolves=[];for(;i>>>>>> Update kbn-optimizer tests +exports[`builds expected bundles, saves bundle counts to metadata: foo bundle 1`] = `"var __kbnBundles__=typeof __kbnBundles__===\\"object\\"?__kbnBundles__:{};__kbnBundles__[\\"plugin/foo\\"]=function(modules){function webpackJsonpCallback(data){var chunkIds=data[0];var moreModules=data[1];var moduleId,chunkId,i=0,resolves=[];for(;i { expect( Fs.readFileSync( - Path.resolve(MOCK_REPO_DIR, 'src/core/public/target/public/core.standalone.js'), + Path.resolve(MOCK_REPO_DIR, 'src/core/public/target/public/core.entry.js'), 'utf8' ) ).toMatchSnapshot('core bundle'); diff --git a/packages/kbn-optimizer/src/optimizer/get_bundles.test.ts b/packages/kbn-optimizer/src/optimizer/get_bundles.test.ts index 879d33202f4ff..9bc51ad8d88e4 100644 --- a/packages/kbn-optimizer/src/optimizer/get_bundles.test.ts +++ b/packages/kbn-optimizer/src/optimizer/get_bundles.test.ts @@ -53,7 +53,7 @@ it('returns a bundle for core and each plugin', () => { "id": "core", "outputDir": /src/core/public/target/public, "sourceRoot": , - "type": "standalone", + "type": "entry", }, Object { "contextDir": /plugins/foo, diff --git a/packages/kbn-optimizer/src/optimizer/get_bundles.ts b/packages/kbn-optimizer/src/optimizer/get_bundles.ts index 364099102fa22..110891565c27a 100644 --- a/packages/kbn-optimizer/src/optimizer/get_bundles.ts +++ b/packages/kbn-optimizer/src/optimizer/get_bundles.ts @@ -25,7 +25,7 @@ import { KibanaPlatformPlugin } from './kibana_platform_plugins'; export function getBundles(plugins: KibanaPlatformPlugin[], repoRoot: string) { const coreBundle = new Bundle({ - type: 'standalone', + type: 'entry', id: 'core', entry: './public/entry_point', sourceRoot: repoRoot, diff --git a/src/legacy/ui/ui_render/bootstrap/template.js.hbs b/src/legacy/ui/ui_render/bootstrap/template.js.hbs index 5c98d70edee6c..66d86be41abdb 100644 --- a/src/legacy/ui/ui_render/bootstrap/template.js.hbs +++ b/src/legacy/ui/ui_render/bootstrap/template.js.hbs @@ -70,28 +70,23 @@ if (window.__kbnStrictCsp__ && window.__kbnCspNotEnforced__) { // When rendering in Kibana Platform mode, only serve the assets needed by Core. if ('{{appId}}' === 'core') { - return load({ - deps: [ + load([ {{#each sharedJsDepFilenames}} '{{../regularBundlePath}}/kbn-ui-shared-deps/{{this}}', {{/each}} '{{regularBundlePath}}/kbn-ui-shared-deps/{{sharedJsFilename}}', '{{regularBundlePath}}/plugin/kibanaUtils/kibanaUtils.plugin.js', '{{regularBundlePath}}/plugin/esUiShared/esUiShared.plugin.js', - '{{regularBundlePath}}/plugin/kibanaReact/kibanaReact.plugin.js' - ], function() { - load([ - '{{regularBundlePath}}/core/core.standalone.js', - {{#each styleSheetPaths}} - '{{this}}', - {{/each}} - ]) - }, - }); + '{{regularBundlePath}}/plugin/kibanaReact/kibanaReact.plugin.js', + '{{regularBundlePath}}/core/core.entry.js', + {{#each styleSheetPaths}} + '{{this}}', + {{/each}} + ]); + return; } - load({ - deps: [ + load([ {{#each sharedJsDepFilenames}} '{{../regularBundlePath}}/kbn-ui-shared-deps/{{this}}', {{/each}} @@ -101,17 +96,13 @@ if (window.__kbnStrictCsp__ && window.__kbnCspNotEnforced__) { '{{this}}', {{/each}} '{{regularBundlePath}}/commons.bundle.js', - {{!-- '{{regularBundlePath}}/plugin/data/data.plugin.js', --}} '{{regularBundlePath}}/plugin/kibanaUtils/kibanaUtils.plugin.js', '{{regularBundlePath}}/plugin/esUiShared/esUiShared.plugin.js', - '{{regularBundlePath}}/plugin/kibanaReact/kibanaReact.plugin.js' - ], function () { - load([ + '{{regularBundlePath}}/plugin/kibanaReact/kibanaReact.plugin.js', '{{regularBundlePath}}/{{appId}}.bundle.js', {{#each styleSheetPaths}} '{{this}}', {{/each}} - ]) - }); + ]); }; }