Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions .buildkite/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .buildkite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@types/jscodeshift": "^0.12.0",
"@types/minimatch": "^3.0.5",
"@types/minimist": "^1.2.5",
"@types/node": "22.19.0",
"@types/node": "24.10.13",
"jest": "^30.0.3",
"jscodeshift": "^17.1.2",
"nock": "^12.0.2",
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.22.0
24.14.1
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.22.0
24.14.1
4 changes: 4 additions & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ yarn-offline-mirror ".yarn-local-mirror"

# Install scripts are managed by `yarn kbn bootstrap` via @kbn/yarn-install-scripts
ignore-scripts true

# Temporary for Node 24 migration: @elastic/ems-client@8.6.3 declares `engines.node: >=18 <=22`
# even though Kibana supports Node 24.
--install.ignore-engines true
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"url": "https://github.com/elastic/kibana.git"
},
"engines": {
"node": "22.22.0",
"node": "24.14.1",
"yarn": "^1.22.19"
},
"resolutions": {
Expand All @@ -84,7 +84,7 @@
"**/@hello-pangea/dnd": "18.0.1",
"**/@langchain/core": "1.1.31",
"**/@langchain/google-common": "2.1.24",
"**/@types/node": "22.19.1",
"**/@types/node": "24.10.13",
"**/@types/prop-types": "15.7.5",
"**/@typescript-eslint/utils": "8.46.3",
"**/baseline-browser-mapping": "2.9.14",
Expand Down Expand Up @@ -1513,7 +1513,7 @@
"type-fest": "4.41.0",
"typescript-fsa": "3.0.0",
"typescript-fsa-reducers": "1.2.2",
"undici": "6.23.0",
"undici": "7.24.4",
"unidiff": "1.0.4",
"unified": "9.2.2",
"use-resize-observer": "9.1.0",
Expand Down Expand Up @@ -1930,7 +1930,7 @@
"@types/moment-duration-format": "2.2.7",
"@types/mustache": "4.2.5",
"@types/nock": "10.0.3",
"@types/node": "22.19.0",
"@types/node": "24.10.13",
"@types/node-fetch": "2.6.4",
"@types/node-forge": "1.3.14",
"@types/nodemailer": "7.0.6",
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-cli-dev-mode/src/base_path_proxy/http2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ export class Http2BasePathProxyServer implements BasePathProxyServer {

server.listen(this.httpConfig.port, this.httpConfig.host, () => {
server.on('request', (inboundRequest, inboundResponse) => {
const requestPath = Url.parse(inboundRequest.url).path ?? '/';
const parsedRequestUrl = new URL(inboundRequest.url ?? '/', 'http://localhost');
const requestPath = `${parsedRequestUrl.pathname}${parsedRequestUrl.search}` || '/';

if (requestPath === '/') {
// Always redirect from root URL to the URL with basepath.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import Url from 'url';

import type { AxiosRequestConfig, AxiosInstance, AxiosHeaderValue } from 'axios';
import Axios, { AxiosHeaders } from 'axios';
import { isAxiosResponseError, isAxiosRequestError } from '@kbn/dev-utils';
import type { ToolingLog } from '@kbn/tooling-log';

const BASE_URL = 'https://api.github.com/repos/elastic/kibana/';
const resolveGithubUrl = (path: string) => new URL(path, BASE_URL).toString();

export interface GithubIssue {
html_url: string;
Expand Down Expand Up @@ -81,7 +80,7 @@ export class GithubApi {
await this.request(
{
method: 'PATCH',
url: Url.resolve(BASE_URL, `issues/${encodeURIComponent(issueNumber)}`),
url: resolveGithubUrl(`issues/${encodeURIComponent(issueNumber)}`),
data: {
state: 'open', // Reopen issue if it was closed.
body: newBody,
Expand All @@ -95,7 +94,7 @@ export class GithubApi {
await this.request(
{
method: 'POST',
url: Url.resolve(BASE_URL, `issues/${encodeURIComponent(issueNumber)}/comments`),
url: resolveGithubUrl(`issues/${encodeURIComponent(issueNumber)}/comments`),
data: {
body: commentBody,
},
Expand All @@ -108,7 +107,7 @@ export class GithubApi {
const resp = await this.request<GithubIssueMini>(
{
method: 'POST',
url: Url.resolve(BASE_URL, 'issues'),
url: resolveGithubUrl('issues'),
data: {
title,
body,
Expand Down
35 changes: 22 additions & 13 deletions packages/kbn-plugin-helpers/src/tasks/optimize_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { WorkerConfig } from '@kbn/optimizer/src/common';
import { parseBundles, BundleRemotes } from '@kbn/optimizer/src/common';
import { getWebpackConfig } from '@kbn/optimizer/src/worker/webpack.config';

const send = process.send;
const send = process.send?.bind(process);
if (!send) {
throw new Error('must be run as a node.js fork');
}
Expand All @@ -36,25 +36,34 @@ process.on('message', (msg: any) => {
},
(error, stats) => {
if (error) {
send.call(process, {
success: false,
error: error.message,
});
send(
{
success: false,
error: error.message,
},
undefined
);
return;
}

if (stats?.hasErrors()) {
send.call(process, {
success: false,
error: `Failed to compile with webpack:\n${stats.toString()}`,
});
send(
{
success: false,
error: `Failed to compile with webpack:\n${stats.toString()}`,
},
undefined
);
return;
}

send.call(process, {
success: true,
warnings: stats?.hasWarnings() ? stats.toString() : '',
});
send(
{
success: true,
warnings: stats?.hasWarnings() ? stats.toString() : '',
},
undefined
);
}
);
});
27 changes: 12 additions & 15 deletions packages/kbn-relocate/healthcheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ const checkIfResourceExists = (baseDir: string, reference: string): boolean => {

const getAllFiles = (
dirPath: string,
arrayOfFiles: fs.Dirent[] = [],
arrayOfFiles: string[] = [],
extensions?: string[]
): fs.Dirent[] => {
): string[] => {
const files = fs.readdirSync(dirPath, { withFileTypes: true });

files.forEach((file) => {
Expand All @@ -77,12 +77,10 @@ const getAllFiles = (
!EXCLUDED_FOLDERS.some((folder) => filePath.startsWith(join(BASE_FOLDER, folder))) &&
!EXCLUDED_FOLDER_NAMES.includes(file.name)
) {
if (fs.statSync(filePath).isDirectory()) {
arrayOfFiles = getAllFiles(filePath, arrayOfFiles);
} else {
if (!extensions || extensions.find((ext) => file.name.endsWith(ext))) {
arrayOfFiles.push(file);
}
if (file.isDirectory()) {
arrayOfFiles = getAllFiles(filePath, arrayOfFiles, extensions);
} else if (!extensions || extensions.find((ext) => file.name.endsWith(ext))) {
arrayOfFiles.push(filePath);
}
}
});
Expand All @@ -95,14 +93,14 @@ export const findBrokenReferences = async (log: ToolingLog) => {
const moduleNames = packages.map((pkg) => pkg.directory.split('/').pop()!);
const files = getAllFiles(BASE_FOLDER, [], EXTENSIONS);

for (const file of files) {
const fileBrokenReferences = [];
const filePath = join(file.path, file.name);
for (const filePath of files) {
const fileBrokenReferences: string[] = [];
const baseDir = path.dirname(filePath);
const content = fs.readFileSync(filePath, 'utf-8');
const references = findPaths(content);

for (const ref of references) {
if (isModuleReference(moduleNames, ref) && !checkIfResourceExists(file.path, ref)) {
if (isModuleReference(moduleNames, ref) && !checkIfResourceExists(baseDir, ref)) {
fileBrokenReferences.push(ref);
}
}
Expand All @@ -116,9 +114,8 @@ export const findBrokenReferences = async (log: ToolingLog) => {
export const findBrokenLinks = async (log: ToolingLog) => {
const files = getAllFiles(BASE_FOLDER);

for (const file of files) {
const fileBrokenLinks = [];
const filePath = join(file.path, file.name);
for (const filePath of files) {
const fileBrokenLinks: string[] = [];
const content = fs.readFileSync(filePath, 'utf-8');
const references = findUrls(content);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const walkDirectory = async (dirPath: string): Promise<Meta> => {
let usesOnlyStyledComponents = true;

for (const file of await fs.readdir(dirPath, { withFileTypes: true })) {
const fullPath = path.join(file.path, file.name);
const fullPath = path.join(dirPath, file.name);

if (file.isDirectory()) {
const meta = await walkDirectory(fullPath);
Expand Down
15 changes: 10 additions & 5 deletions src/cli/plugin/install/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { parse } from 'url';

import { UnsupportedProtocolError } from '../lib/errors';
import { downloadHttpFile } from './downloaders/http';
import { downloadLocalFile } from './downloaders/file';
Expand All @@ -35,14 +33,14 @@ export function _checkFilePathDeprecation(sourceUrl, logger) {
}

export function _downloadSingle(settings, logger, sourceUrl) {
const urlInfo = parse(sourceUrl);
const urlInfo = new URL(sourceUrl);
let downloadPromise;

if (/^file/.test(urlInfo.protocol)) {
_checkFilePathDeprecation(sourceUrl, logger);
downloadPromise = downloadLocalFile(
logger,
_getFilePath(urlInfo.path),
_getFilePath(urlInfo.pathname),
settings.tempArchiveFile
);
} else if (/^https?/.test(urlInfo.protocol)) {
Expand Down Expand Up @@ -71,7 +69,14 @@ export function download(settings, logger) {

logger.log(`Attempting to transfer from ${sourceUrl}`);

return _downloadSingle(settings, logger, sourceUrl).catch((err) => {
let singleResult;
try {
singleResult = _downloadSingle(settings, logger, sourceUrl);
} catch (err) {
return tryNext();
}

return singleResult.catch((err) => {
const isUnsupportedProtocol = err instanceof UnsupportedProtocolError;
const isDownloadResourceNotFound = err.message === 'ENOTFOUND';
if (isUnsupportedProtocol || isDownloadResourceNotFound) {
Expand Down
9 changes: 3 additions & 6 deletions src/cli/plugin/install/download.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import globby from 'globby';
import del from 'del';

import { Logger } from '../../logger';
import { UnsupportedProtocolError } from '../lib/errors';
import { download, _downloadSingle, _getFilePath, _checkFilePathDeprecation } from './download';

describe('kibana cli', function () {
Expand Down Expand Up @@ -77,13 +76,11 @@ describe('kibana cli', function () {
});
});

it('should throw an UnsupportedProtocolError for an invalid url', function () {
it('should throw a TypeError for an invalid url', function () {
const sourceUrl = 'i am an invalid url';

return _downloadSingle(settings, logger, sourceUrl).then(shouldReject, function (err) {
expect(err).toBeInstanceOf(UnsupportedProtocolError);
expectWorkingPathEmpty();
});
expect(() => _downloadSingle(settings, logger, sourceUrl)).toThrow(/Invalid URL/);
expectWorkingPathEmpty();
});

it('should download a file from a valid http url', function () {
Expand Down
Loading
Loading