Skip to content

Commit ab39ceb

Browse files
authored
Serve static assets from NP (#60490)
* add hapi.inert plugin to NP * update tests * move serving static assets * update tests * add functional tests * fix type errors. Hapi.Request doesn't support typings for payload * update docs * remove comment * move assets to NP * update all assets references * address Spencer's comments * move ui settings migration to migration examples * document legacy plugin spec * move platform assets test to integration_tests * address Spencer's comment p.2 * try to fix type errors * fix merge commit * update tests
1 parent 0145121 commit ab39ceb

File tree

128 files changed

+419
-187
lines changed

Some content is hidden

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

128 files changed

+419
-187
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"uiFramework:documentComponent": "cd packages/kbn-ui-framework && yarn documentComponent",
6666
"kbn:watch": "node scripts/kibana --dev --logging.json=false",
6767
"build:types": "tsc --p tsconfig.types.json",
68-
"docs:acceptApiChanges": "node scripts/check_published_api_changes.js --accept",
68+
"docs:acceptApiChanges": "node --max-old-space-size=6144 scripts/check_published_api_changes.js --accept",
6969
"kbn:bootstrap": "yarn build:types && node scripts/register_git_hook",
7070
"spec_to_console": "node scripts/spec_to_console",
7171
"backport-skip-ci": "backport --prDescription \"[skip-ci]\"",
@@ -330,11 +330,13 @@
330330
"@types/glob": "^7.1.1",
331331
"@types/globby": "^8.0.0",
332332
"@types/graphql": "^0.13.2",
333+
"@types/h2o2": "^8.1.1",
333334
"@types/hapi": "^17.0.18",
334335
"@types/hapi-auth-cookie": "^9.1.0",
335336
"@types/has-ansi": "^3.0.0",
336337
"@types/history": "^4.7.3",
337338
"@types/hoek": "^4.1.3",
339+
"@types/inert": "^5.1.2",
338340
"@types/jest": "24.0.19",
339341
"@types/joi": "^13.4.2",
340342
"@types/jquery": "^3.3.31",

packages/kbn-optimizer/src/worker/webpack.config.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,21 @@ export function getWebpackConfig(bundle: Bundle, worker: WorkerConfig) {
131131
loader: 'resolve-url-loader',
132132
options: {
133133
join: (_: string, __: any) => (uri: string, base?: string) => {
134-
if (!base) {
134+
// apply only to legacy platform styles
135+
if (!base || !parseDirPath(base).dirs.includes('legacy')) {
135136
return null;
136137
}
137138

139+
if (uri.startsWith('ui/assets')) {
140+
return Path.resolve(
141+
worker.repoRoot,
142+
'src/core/server/core_app/',
143+
uri.replace('ui/', '')
144+
);
145+
}
146+
138147
// manually force ui/* urls in legacy styles to resolve to ui/legacy/public
139-
if (uri.startsWith('ui/') && parseDirPath(base).dirs.includes('legacy')) {
148+
if (uri.startsWith('ui/')) {
140149
return Path.resolve(
141150
worker.repoRoot,
142151
'src/legacy/ui/public',

packages/kbn-storybook/storybook_config/middleware.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ const path = require('path');
2222

2323
// Extend the Storybook Middleware to include a route to access Legacy UI assets
2424
module.exports = function(router) {
25-
router.get('/ui', serve(path.resolve(__dirname, '../../../../src/legacy/ui/public/assets')));
25+
router.get('/ui', serve(path.resolve(__dirname, '../../../src/core/server/core_app/assets')));
2626
};

src/core/MIGRATION.md

Lines changed: 14 additions & 34 deletions

src/core/MIGRATION_EXAMPLES.md

Lines changed: 35 additions & 1 deletion

0 commit comments

Comments
 (0)