[Screenshotting] Server package for stateless code (#188390)

## Summary

This PR moves code that is usually impacted by a Puppeteer/Chromium
upgrade to a package. The same work is happening to a lesser degree in
the 7.17 branch. Together, these changes will ease the manual labor of
backporting the upgrades from main to 7.17.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Tim Sullivan 2024-08-22 11:03:03 -07:00 committed by GitHub
parent 53b5d7c9aa
commit bf673d9c56
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 193 additions and 85 deletions

1
.github/CODEOWNERS vendored
View file

@ -732,6 +732,7 @@ examples/screenshot_mode_example @elastic/appex-sharedux
src/plugins/screenshot_mode @elastic/appex-sharedux
x-pack/examples/screenshotting_example @elastic/appex-sharedux
x-pack/plugins/screenshotting @elastic/kibana-reporting-services
packages/kbn-screenshotting-server @elastic/appex-sharedux
packages/kbn-search-api-panels @elastic/search-kibana
x-pack/plugins/search_assistant @elastic/search-kibana
packages/kbn-search-connectors @elastic/search-kibana

View file

@ -750,6 +750,7 @@
"@kbn/screenshot-mode-plugin": "link:src/plugins/screenshot_mode",
"@kbn/screenshotting-example-plugin": "link:x-pack/examples/screenshotting_example",
"@kbn/screenshotting-plugin": "link:x-pack/plugins/screenshotting",
"@kbn/screenshotting-server": "link:packages/kbn-screenshotting-server",
"@kbn/search-api-panels": "link:packages/kbn-search-api-panels",
"@kbn/search-assistant": "link:x-pack/plugins/search_assistant",
"@kbn/search-connectors": "link:packages/kbn-search-connectors",

View file

@ -0,0 +1,3 @@
# @kbn/screenshotting-server
Stateless code pertaining to the capture of screenshots for Kibana Reporting

View file

@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export { args } from './src/args';
export { ChromiumArchivePaths, type PackageInfo } from './src/paths';
export { getChromiumPackage } from './src/get_chromium_package';
export { type ConfigType, createConfig, config, durationToNumber } from './src/config';
export { ConfigSchema } from './src/config/schema';

View file

@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
module.exports = {
preset: '@kbn/test/jest_node',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-screenshotting-server'],
};

View file

@ -0,0 +1,5 @@
{
"type": "shared-server",
"id": "@kbn/screenshotting-server",
"owner": "@elastic/appex-sharedux"
}

View file

@ -0,0 +1,6 @@
{
"name": "@kbn/screenshotting-server",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
}

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import os from 'os';

View file

@ -1,12 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import os from 'os';
import type { ConfigType } from '../../../config';
import type { ConfigType } from './config';
interface WindowSize {
height: number;

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import type { Logger } from '@kbn/core/server';

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { set } from '@kbn/safer-lodash-set';

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
jest.mock('getos', () => jest.fn());

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import getOsSync from 'getos';

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import type { PluginConfigDescriptor } from '@kbn/core/server';

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { schema, TypeOf, offeringBasedSchema } from '@kbn/config-schema';

View file

@ -0,0 +1,23 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import os from 'os';
import { ChromiumArchivePaths } from './paths';
const paths = new ChromiumArchivePaths();
export const getChromiumPackage = () => {
const platform = process.platform;
const architecture = os.arch();
const chromiumPackageInfo = paths.find(process.platform, architecture);
if (!chromiumPackageInfo) {
throw new Error(`Unsupported platform: ${platform}-${architecture}`);
}
return chromiumPackageInfo;
};

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import path from 'path';

View file

@ -0,0 +1,21 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
"jest",
"node"
]
},
"include": [
"**/*.ts"
],
"exclude": [
"target/**/*"
],
"kbn_references": [
"@kbn/core",
"@kbn/safer-lodash-set",
"@kbn/config-schema"
]
}

View file

@ -1458,6 +1458,8 @@
"@kbn/screenshotting-example-plugin/*": ["x-pack/examples/screenshotting_example/*"],
"@kbn/screenshotting-plugin": ["x-pack/plugins/screenshotting"],
"@kbn/screenshotting-plugin/*": ["x-pack/plugins/screenshotting/*"],
"@kbn/screenshotting-server": ["packages/kbn-screenshotting-server"],
"@kbn/screenshotting-server/*": ["packages/kbn-screenshotting-server/*"],
"@kbn/search-api-panels": ["packages/kbn-search-api-panels"],
"@kbn/search-api-panels/*": ["packages/kbn-search-api-panels/*"],
"@kbn/search-assistant": ["x-pack/plugins/search_assistant"],

View file

@ -7,9 +7,9 @@
import type { Logger } from '@kbn/logging';
import { ScreenshotModePluginSetup } from '@kbn/screenshot-mode-plugin/server';
import { ConfigType } from '@kbn/screenshotting-server';
import * as puppeteer from 'puppeteer';
import { Size } from '../../../common/layout';
import { ConfigType } from '../../config';
import { PreserveLayout } from '../../layouts/preserve_layout';
import { HeadlessChromiumDriver } from './driver';

View file

@ -10,13 +10,13 @@ import {
KBN_SCREENSHOT_MODE_HEADER,
ScreenshotModePluginSetup,
} from '@kbn/screenshot-mode-plugin/server';
import { ConfigType } from '@kbn/screenshotting-server';
import { truncate } from 'lodash';
import open from 'opn';
import { ElementHandle, Page, EvaluateFunc, HTTPResponse } from 'puppeteer';
import { ElementHandle, EvaluateFunc, HTTPResponse, Page } from 'puppeteer';
import { Subject } from 'rxjs';
import { parse as parseUrl } from 'url';
import { getDisallowedOutgoingUrlError } from '.';
import { ConfigType } from '../../config';
import { Layout } from '../../layouts';
import { getPrintLayoutSelectors } from '../../layouts/print_layout';
import { allowRequest } from '../network_policy';

View file

@ -8,11 +8,11 @@
import type { Logger } from '@kbn/core/server';
import { loggerMock } from '@kbn/logging-mocks';
import type { ScreenshotModePluginSetup } from '@kbn/screenshot-mode-plugin/server';
import { ConfigType } from '@kbn/screenshotting-server';
import * as puppeteer from 'puppeteer';
import * as Rx from 'rxjs';
import { mergeMap, take } from 'rxjs';
import { DEFAULT_VIEWPORT, HeadlessChromiumDriverFactory } from '.';
import { ConfigType } from '../../../config';
jest.mock('puppeteer');

View file

@ -7,23 +7,22 @@
import type { Logger } from '@kbn/core/server';
import type { ScreenshotModePluginSetup } from '@kbn/screenshot-mode-plugin/server';
import { ConfigType, args } from '@kbn/screenshotting-server';
import { getDataPath } from '@kbn/utils';
import { spawn } from 'child_process';
import del from 'del';
import fs from 'fs';
import { uniq } from 'lodash';
import path from 'path';
import puppeteer, { Browser, ConsoleMessage, Page, Viewport, PageEvents } from 'puppeteer';
import puppeteer, { Browser, ConsoleMessage, Page, PageEvents, Viewport } from 'puppeteer';
import { createInterface } from 'readline';
import * as Rx from 'rxjs';
import { catchError, concatMap, ignoreElements, mergeMap, map, reduce, takeUntil, tap } from 'rxjs';
import { PerformanceMetrics } from '../../../../common/types';
import { catchError, concatMap, ignoreElements, map, mergeMap, reduce, takeUntil, tap } from 'rxjs';
import { getChromiumDisconnectedError } from '..';
import { errors } from '../../../../common';
import { ConfigType } from '../../../config';
import { PerformanceMetrics } from '../../../../common/types';
import { safeChildProcess } from '../../safe_child_process';
import { HeadlessChromiumDriver } from '../driver';
import { args } from './args';
import { getMetrics } from './metrics';
interface CreatePageOptions {

View file

@ -20,5 +20,3 @@ export const getDisallowedOutgoingUrlError = (interceptedUrl: string) =>
export { HeadlessChromiumDriver } from './driver';
export type { Context } from './driver';
export { DEFAULT_VIEWPORT, HeadlessChromiumDriverFactory } from './driver_factory';
export { ChromiumArchivePaths } from './paths';
export type { PackageInfo } from './paths';

View file

@ -6,10 +6,10 @@
*/
import { loggingSystemMock } from '@kbn/core-logging-server-mocks';
import { PackageInfo } from '@kbn/screenshotting-server';
import assert from 'assert';
import axios from 'axios';
import path from 'path';
import { PackageInfo } from '..';
import { paths as chromiumArchivePaths } from '../../../utils';
import { download } from '../../download';
import { install } from '../../install';

View file

@ -5,13 +5,13 @@
* 2.0.
*/
import path from 'path';
import mockFs from 'mock-fs';
import { ChromiumArchivePaths, PackageInfo } from '@kbn/screenshotting-server';
import { access, readdir } from 'fs/promises';
import { ChromiumArchivePaths, PackageInfo } from '../chromium';
import { fetch } from './fetch';
import { sha256 } from './checksum';
import mockFs from 'mock-fs';
import path from 'path';
import { download } from '.';
import { sha256 } from './checksum';
import { fetch } from './fetch';
jest.mock('./checksum');
jest.mock('./fetch');

View file

@ -5,10 +5,10 @@
* 2.0.
*/
import { access } from 'fs/promises';
import del from 'del';
import type { Logger } from '@kbn/core/server';
import type { ChromiumArchivePaths, PackageInfo } from '../chromium';
import type { ChromiumArchivePaths, PackageInfo } from '@kbn/screenshotting-server';
import del from 'del';
import { access } from 'fs/promises';
import { sha256 } from './checksum';
import { fetch } from './fetch';

View file

@ -10,7 +10,6 @@ export { install } from './install';
export type { Context } from './chromium';
export {
getChromiumDisconnectedError,
ChromiumArchivePaths,
DEFAULT_VIEWPORT,
HeadlessChromiumDriver,
HeadlessChromiumDriverFactory,

View file

@ -5,10 +5,10 @@
* 2.0.
*/
import type { Logger } from '@kbn/core/server';
import { ChromiumArchivePaths, PackageInfo } from '@kbn/screenshotting-server';
import del from 'del';
import path from 'path';
import type { Logger } from '@kbn/core/server';
import { ChromiumArchivePaths, PackageInfo } from './chromium';
import { download } from './download';
import { sha256 } from './download/checksum';
import { extract } from './extract';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { ConfigSchema } from './schema';
import { ConfigSchema } from '@kbn/screenshotting-server';
describe('ConfigSchema', () => {
it(`should produce correct config for context {"dev": false,"dist": false}`, () => {

View file

@ -15,7 +15,7 @@ export async function plugin(pluginInitializerContext: PluginInitializerContext)
return new ScreenshottingPlugin(pluginInitializerContext);
}
export { config } from './config';
export { config } from '@kbn/screenshotting-server';
export type {
PdfScreenshotOptions,
PdfScreenshotResult,

View file

@ -5,8 +5,7 @@
* 2.0.
*/
import { from } from 'rxjs';
import { switchMap } from 'rxjs';
import type { CloudSetup } from '@kbn/cloud-plugin/server';
import type {
CoreSetup,
CoreStart,
@ -16,11 +15,15 @@ import type {
PluginInitializerContext,
} from '@kbn/core/server';
import type { ScreenshotModePluginSetup } from '@kbn/screenshot-mode-plugin/server';
import type { CloudSetup } from '@kbn/cloud-plugin/server';
import { ChromiumArchivePaths, HeadlessChromiumDriverFactory, install } from './browsers';
import { ConfigType, createConfig } from './config';
import {
ChromiumArchivePaths,
ConfigType,
createConfig,
getChromiumPackage,
} from '@kbn/screenshotting-server';
import { from, switchMap } from 'rxjs';
import { HeadlessChromiumDriverFactory, install } from './browsers';
import { Screenshots } from './screenshots';
import { getChromiumPackage } from './utils';
interface SetupDeps {
screenshotMode: ScreenshotModePluginSetup;

View file

@ -5,11 +5,11 @@
* 2.0.
*/
import moment from 'moment';
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { ConfigType } from '@kbn/screenshotting-server';
import moment from 'moment';
import { Actions, EventLogger, ScreenshottingAction, Transactions } from '.';
import { ElementPosition } from '../get_element_position_data';
import { ConfigType } from '../../config';
jest.mock('uuid', () => ({
v4: () => 'NEW_UUID',

View file

@ -6,11 +6,11 @@
*/
import { Logger, LogMeta } from '@kbn/core/server';
import { ConfigType } from '@kbn/screenshotting-server';
import apm from 'elastic-apm-node';
import { v4 as uuidv4 } from 'uuid';
import { CaptureResult } from '..';
import { PLUGIN_ID } from '../../../common';
import { ConfigType } from '../../config';
import { ElementPosition } from '../get_element_position_data';
import type { Screenshot } from '../types';

View file

@ -6,8 +6,8 @@
*/
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { ConfigType } from '@kbn/screenshotting-server';
import { createMockBrowserDriver } from '../browsers/mock';
import { ConfigType } from '../config';
import { createMockLayout } from '../layouts/mock';
import { EventLogger } from './event_logger';
import { getElementPositionAndAttributes } from './get_element_position_data';

View file

@ -6,8 +6,8 @@
*/
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { ConfigType } from '@kbn/screenshotting-server';
import { createMockBrowserDriver } from '../browsers/mock';
import { ConfigType } from '../config';
import { createMockLayout } from '../layouts/mock';
import { EventLogger } from './event_logger';
import { getNumberOfItems } from './get_number_of_items';

View file

@ -6,8 +6,8 @@
*/
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { ConfigType } from '@kbn/screenshotting-server';
import { createMockBrowserDriver } from '../browsers/mock';
import { ConfigType } from '../config';
import { createMockLayout } from '../layouts/mock';
import { EventLogger } from './event_logger';
import { getRenderErrors } from './get_render_errors';

View file

@ -6,8 +6,8 @@
*/
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { ConfigType } from '@kbn/screenshotting-server';
import { createMockBrowserDriver } from '../browsers/mock';
import { ConfigType } from '../config';
import { Layout } from '../layouts';
import { createMockLayout } from '../layouts/mock';
import { EventLogger } from './event_logger';

View file

@ -6,8 +6,8 @@
*/
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { ConfigType } from '@kbn/screenshotting-server';
import { createMockBrowserDriver } from '../browsers/mock';
import { ConfigType } from '../config';
import { createMockLayout } from '../layouts/mock';
import { EventLogger } from './event_logger';
import { getTimeRange } from './get_time_range';

View file

@ -8,6 +8,7 @@
import type { CloudSetup } from '@kbn/cloud-plugin/server';
import type { Logger, PackageInfo } from '@kbn/core/server';
import { httpServiceMock, loggingSystemMock } from '@kbn/core/server/mocks';
import type { ConfigType } from '@kbn/screenshotting-server';
import { lastValueFrom, of, throwError } from 'rxjs';
import { ScreenshotOptions, Screenshots } from '.';
import {
@ -18,7 +19,6 @@ import {
import * as errors from '../../common/errors';
import type { HeadlessChromiumDriverFactory } from '../browsers';
import { createMockBrowserDriver, createMockBrowserDriverFactory } from '../browsers/mock';
import type { ConfigType } from '../config';
import type { PngScreenshotOptions } from '../formats';
import * as Layouts from '../layouts/create_layout';
import { createMockLayout } from '../layouts/mock';

View file

@ -6,10 +6,9 @@
*/
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { interval, lastValueFrom, of, throwError } from 'rxjs';
import { map } from 'rxjs';
import type { ConfigType } from '@kbn/screenshotting-server';
import { interval, lastValueFrom, map, of, throwError } from 'rxjs';
import { createMockBrowserDriver } from '../browsers/mock';
import type { ConfigType } from '../config';
import { createMockLayout } from '../layouts/mock';
import { EventLogger } from './event_logger';
import { ScreenshotObservableHandler, ScreenshotObservableOptions } from './observable';

View file

@ -6,8 +6,17 @@
*/
import type { Headers } from '@kbn/core/server';
import { defer, forkJoin, Observable, throwError } from 'rxjs';
import { catchError, mergeMap, switchMapTo, timeoutWith } from 'rxjs';
import { ConfigType, durationToNumber as toNumber } from '@kbn/screenshotting-server';
import {
catchError,
defer,
forkJoin,
mergeMap,
Observable,
switchMapTo,
throwError,
timeoutWith,
} from 'rxjs';
import { errors } from '../../common';
import {
Context,
@ -15,7 +24,6 @@ import {
getChromiumDisconnectedError,
HeadlessChromiumDriver,
} from '../browsers';
import { ConfigType, durationToNumber as toNumber } from '../config';
import type { PdfScreenshotOptions } from '../formats';
import { Layout } from '../layouts';
import { Actions, EventLogger } from './event_logger';

View file

@ -11,12 +11,12 @@ import type { PackageInfo } from '@kbn/core/server';
import type { Logger } from '@kbn/logging';
import { loggerMock } from '@kbn/logging-mocks';
import type { ScreenshotModePluginSetup } from '@kbn/screenshot-mode-plugin/server';
import type { ConfigType } from '@kbn/screenshotting-server';
import puppeteer from 'puppeteer';
import * as Rx from 'rxjs';
import { firstValueFrom } from 'rxjs';
import type { PngScreenshotOptions } from '..';
import { HeadlessChromiumDriverFactory } from '../browsers';
import type { ConfigType } from '../config';
import { Screenshots } from './screenshots';
jest.mock('puppeteer');

View file

@ -8,13 +8,28 @@
import ipaddr from 'ipaddr.js';
import { defaultsDeep, sum } from 'lodash';
import moment from 'moment';
import { Observable, from, of, throwError } from 'rxjs';
import { catchError, concatMap, first, map, mergeMap, take, takeUntil, tap, toArray } from 'rxjs';
import {
Observable,
catchError,
concatMap,
first,
from,
map,
mergeMap,
of,
take,
takeUntil,
tap,
throwError,
toArray,
} from 'rxjs';
import type { CloudSetup } from '@kbn/cloud-plugin/server';
import type { HttpServiceSetup, Logger, PackageInfo } from '@kbn/core/server';
import { Semaphore } from '@kbn/std';
import type { ConfigType } from '@kbn/screenshotting-server';
import { durationToNumber } from '@kbn/screenshotting-server';
import { CaptureResult, ScreenshotOptions, ScreenshotResult } from '.';
import {
SCREENSHOTTING_APP_ID,
@ -24,8 +39,6 @@ import {
} from '../../common';
import { HeadlessChromiumDriverFactory } from '../browsers';
import { systemHasInsufficientMemory } from '../cloud';
import type { ConfigType } from '../config';
import { durationToNumber } from '../config';
import {
PdfScreenshotOptions,
PdfScreenshotResult,

View file

@ -5,22 +5,11 @@
* 2.0.
*/
import os from 'os';
import { ChromiumArchivePaths, download as baseDownload, install as baseInstall } from './browsers';
import { ChromiumArchivePaths } from '@kbn/screenshotting-server';
import { download as baseDownload, install as baseInstall } from './browsers';
const paths = new ChromiumArchivePaths();
export const getChromiumPackage = () => {
const platform = process.platform;
const architecture = os.arch();
const chromiumPackageInfo = paths.find(process.platform, architecture);
if (!chromiumPackageInfo) {
throw new Error(`Unsupported platform: ${platform}-${architecture}`);
}
return chromiumPackageInfo;
};
export const download = baseDownload.bind(undefined, paths);
export const install = baseInstall.bind(undefined, paths);

View file

@ -16,17 +16,16 @@
"@kbn/screenshot-mode-plugin",
"@kbn/cloud-plugin",
"@kbn/utility-types",
"@kbn/config-schema",
"@kbn/logging",
"@kbn/std",
"@kbn/i18n",
"@kbn/utils",
"@kbn/safer-lodash-set",
"@kbn/core-logging-server-mocks",
"@kbn/logging-mocks",
"@kbn/core-http-server",
"@kbn/core-plugins-server",
"@kbn/task-manager-plugin",
"@kbn/screenshotting-server",
],
"exclude": [
"target/**/*",

View file

@ -6212,6 +6212,10 @@
version "0.0.0"
uid ""
"@kbn/screenshotting-server@link:packages/kbn-screenshotting-server":
version "0.0.0"
uid ""
"@kbn/search-api-panels@link:packages/kbn-search-api-panels":
version "0.0.0"
uid ""