kibana/packages
Kibana Machine fe42d07b10
[8.6] [@kbn/handlebars] Refactor internal context handling (#148029) (#148035)
# Backport

This will backport the following commits from `main` to `8.6`:
- [[@kbn/handlebars] Refactor internal context handling
(#148029)](https://github.com/elastic/kibana/pull/148029)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Thomas
Watson","email":"watson@elastic.co"},"sourceCommit":{"committedDate":"2022-12-22T21:23:43Z","message":"[@kbn/handlebars]
Refactor internal context handling
(#148029)","sha":"0d2e8156bf8c0e5d38a40fb02f94662348e9377a","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:prev-minor","v8.7.0"],"number":148029,"url":"https://github.com/elastic/kibana/pull/148029","mergeCommit":{"message":"[@kbn/handlebars]
Refactor internal context handling
(#148029)","sha":"0d2e8156bf8c0e5d38a40fb02f94662348e9377a"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/148029","number":148029,"mergeCommit":{"message":"[@kbn/handlebars]
Refactor internal context handling
(#148029)","sha":"0d2e8156bf8c0e5d38a40fb02f94662348e9377a"}}]}]
BACKPORT-->

Co-authored-by: Thomas Watson <watson@elastic.co>
2022-12-22 15:28:02 -07:00
..
analytics [EBT] Add flush method and call it during stop (#144925) 2022-11-16 14:48:11 +01:00
content-management skip flaky suite. #145267 2022-11-15 16:08:03 -06:00
core [8.6] Do not skip UPDATE_TARGET_MAPPINGS if upgrading to a newer stack version (#147503) (#147522) 2022-12-14 07:45:35 -07:00
home Upgrade EUI to v67.1.9 (#145490) 2022-11-17 14:53:30 -08:00
kbn-ace fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-alerts Bumping EUI to version 67.1.8 (#141279) 2022-11-07 21:45:50 +00:00
kbn-ambient-storybook-types fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-ambient-ui-types fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-analytics Remove dependencies for empty @types/* packages (#144324) 2022-11-07 04:37:43 -07:00
kbn-apm-config-loader fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-apm-synthtrace [APM] Agent explorer (PoC) (#143844) 2022-11-14 15:40:49 +01:00
kbn-apm-utils [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-axe-config fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-babel-plugin-synthetic-packages [bazel] fix some BUILD.bazel file inconsistencies 2022-10-26 11:07:55 -05:00
kbn-babel-preset Update dependency core-js to ^3.26.0 (main) (#144211) 2022-10-31 10:46:49 -07:00
kbn-bazel-packages fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-bazel-runner fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-cases-components fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-chart-icons Rename all vis-editors and datavis to visualizations (#144589) 2022-11-05 19:16:20 -04:00
kbn-ci-stats-core fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-ci-stats-performance-metrics fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-ci-stats-reporter fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-cli-dev-mode fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-coloring Rename all vis-editors and datavis to visualizations (#144589) 2022-11-05 19:16:20 -04:00
kbn-config fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-config-mocks fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-config-schema Remove dependencies for empty @types/* packages (#144324) 2022-11-07 04:37:43 -07:00
kbn-crypto fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-crypto-browser fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-datemath [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-dev-cli-errors fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-dev-cli-runner fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-dev-proc-runner fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-dev-utils fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-doc-links [8.6] [RAM] Fix docLink for Connectors (#147395) (#147487) 2022-12-13 17:48:42 -07:00
kbn-docs-utils [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-ebt-tools remove unnecessary import aliases (#144250) 2022-10-31 17:56:59 +01:00
kbn-es fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-es-archiver fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-es-errors fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-es-query Remove dependencies for empty @types/* packages (#144324) 2022-11-07 04:37:43 -07:00
kbn-es-types fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-eslint-config [bazel] fix some BUILD.bazel file inconsistencies 2022-10-26 11:07:55 -05:00
kbn-eslint-plugin-disable fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-eslint-plugin-eslint [bazel] fix some BUILD.bazel file inconsistencies 2022-10-26 11:07:55 -05:00
kbn-eslint-plugin-imports fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-expect [bazel] fix some BUILD.bazel file inconsistencies 2022-10-26 11:07:55 -05:00
kbn-failed-test-reporter-cli Remove dependencies for empty @types/* packages (#144324) 2022-11-07 04:37:43 -07:00
kbn-field-types fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-find-used-node-modules fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-flot-charts [bazel] fix some BUILD.bazel file inconsistencies 2022-10-26 11:07:55 -05:00
kbn-ftr-common-functional-services fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-ftr-screenshot-filename fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-generate fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-get-repo-files fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-guided-onboarding [8.6] [Security solution] Guided onboarding, security tour copy changes (#146061) (#146600) 2022-11-29 12:21:31 -07:00
kbn-handlebars [8.6] [@kbn/handlebars] Refactor internal context handling (#148029) (#148035) 2022-12-22 15:28:02 -07:00
kbn-hapi-mocks fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-health-gateway-server Fix Health Gateway Checks (#144985) 2022-11-14 08:29:36 -05:00
kbn-i18n fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-i18n-react fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-import-resolver fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-interpreter Move appservices plugins to visualizations team (#144991) 2022-11-14 11:53:42 +02:00
kbn-io-ts-utils [8.6] [Infrastructure UI] Improve metrics settings error handling (#146272) (#146675) 2022-11-30 05:00:48 -07:00
kbn-jest-serializers fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-journeys [kbn-journeys] extend apm labels with branch, gitRev, ciBuildName (#144521) 2022-11-04 23:11:45 +01:00
kbn-kibana-manifest-schema fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-language-documentation-popover Rename all vis-editors and datavis to visualizations (#144589) 2022-11-05 19:16:20 -04:00
kbn-logging fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-logging-mocks fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-managed-vscode-config fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-managed-vscode-config-cli fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-mapbox-gl [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-monaco fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-optimizer [8.6] chore(NA): updates from lmdb-store to lmdb (#145891) (#146643) 2022-11-29 18:12:04 -07:00
kbn-optimizer-webpack-helpers fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-osquery-io-ts-types [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-performance-testing-dataset-extractor fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-plugin-discovery fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-plugin-generator [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-plugin-helpers [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-react-field fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-repo-source-classifier fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-repo-source-classifier-cli fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-rule-data-utils [ResponseOps][Rules] Adding rule.url variable (#145035) 2022-11-15 16:05:32 -07:00
kbn-safer-lodash-set [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-securitysolution-autocomplete [Security Solution] [Exceptions] Adds options to create a shared exception list and to create a single item from the manage exceptions view (#144575) 2022-11-09 09:54:45 -05:00
kbn-securitysolution-es-utils [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-securitysolution-exception-list-components [8.6] [Security Solution]: List details page fix Linked Rules max height (#147039) (#147054) 2022-12-05 15:37:45 -07:00
kbn-securitysolution-hook-utils [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-securitysolution-io-ts-alerting-types [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-securitysolution-io-ts-list-types Add sorting for exceptions cards (#145070) 2022-11-15 13:55:38 -07:00
kbn-securitysolution-io-ts-types [Security Solution] [Exceptions] Updates the exceptions list table to match mockups (#142289) 2022-11-02 08:41:48 -07:00
kbn-securitysolution-io-ts-utils [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-securitysolution-list-api Add sorting for exceptions cards (#145070) 2022-11-15 13:55:38 -07:00
kbn-securitysolution-list-constants [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-securitysolution-list-hooks [8.6] [Security Solution] [Exceptions] Fix edit the exception while adding new comment. (#145575) (#145724) 2022-11-18 08:11:25 -07:00
kbn-securitysolution-list-utils [Security Solution] [Exceptions] Adds a new react route for viewing details about an individual exception list (#144754) 2022-11-14 07:32:52 -05:00
kbn-securitysolution-rules [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-securitysolution-t-grid [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-securitysolution-utils [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-server-http-tools Remove dependencies for empty @types/* packages (#144324) 2022-11-07 04:37:43 -07:00
kbn-server-route-repository fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-shared-svg fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-shared-ux-utility rename codeowners from shared-ux to global-experience (#144746) 2022-11-08 09:13:16 -07:00
kbn-some-dev-log fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-sort-package-json fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-spec-to-console [bazel] fix some BUILD.bazel file inconsistencies 2022-10-26 11:07:55 -05:00
kbn-std fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-stdio-dev-helpers fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-storybook [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-synthetic-package-map fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-telemetry-tools [UsageCollection] Allow pass_through on Record<string, unknown> types (#144571) 2022-11-04 09:22:01 +01:00
kbn-test Remove dependencies for empty @types/* packages (#144324) 2022-11-07 04:37:43 -07:00
kbn-test-jest-helpers [ContentManagement] Inspector flyout (#144240) 2022-11-09 06:01:53 -07:00
kbn-test-subj-selector fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-timelion-grammar Rename all vis-editors and datavis to visualizations (#144589) 2022-11-05 19:16:20 -04:00
kbn-tinymath Rename all vis-editors and datavis to visualizations (#144589) 2022-11-05 19:16:20 -04:00
kbn-tooling-log fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-type-summarizer fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-type-summarizer-cli fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-type-summarizer-core fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-typed-react-router-config fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-ui-framework [bazel] fix some BUILD.bazel file inconsistencies 2022-10-26 11:07:55 -05:00
kbn-ui-shared-deps-npm fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-ui-shared-deps-src fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-ui-theme fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-user-profile-components Add the ability to limit the number of users you can select (#144618) 2022-11-07 12:39:30 +00:00
kbn-utility-types fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-utility-types-jest fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
kbn-utils [auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
kbn-yarn-lock-validator fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463) 2022-11-03 01:04:55 +00:00
shared-ux Upgrade EUI to v67.1.9 (#145490) 2022-11-17 14:53:30 -08:00
BUILD.bazel Migrate server-side Root and Server to packages (#144990) 2022-11-15 03:11:37 -07:00
README.md [kbn/pm] rewrite to avoid needing a build process (#136207) 2022-07-18 08:46:13 -07:00

Kibana-related packages

This folder contains packages that are intended for use in Kibana and Kibana plugins.

tl;dr:

  • Don't publish to npm registry
  • Always use the @kbn namespace
  • Always set "private": true in package.json

Using these packages

We no longer publish these packages to the npm registry. Now, instead of specifying a version when including these packages, we rely on yarn workspaces, which sets up a symlink to the package.

For example if you want to use the @kbn/i18n package in Kibana itself, you can specify the dependency like this:

"@kbn/i18n": "1.0.0"

However, if you want to use this from a Kibana plugin, you need to use a link: dependency and account for the relative location of the Kibana repo, so it would instead be:

"@kbn/i18n": "link:../../kibana/packages/kbn-i18n"

Creating a new package

Create a new sub-folder. The name of the folder should mirror the name in the package's package.json. E.g. if the name is @kbn/i18n the folder name should be kbn-i18n.

All new packages should use the @kbn namespace, and should be marked with "private": true.

Unit tests for a package

Currently there is only one tool being used in order to test packages which is Jest. Below we will explain how it should be done.

Jest

A package should follow the pattern of having .test.js files as siblings of the source code files, and these run by Jest.

A package using the .test.js naming convention will have those tests automatically picked up by Jest and run by the unit test runner, currently mapped to the Kibana test script in the root package.json.

  • yarn test runs all unit tests.
  • yarn jest runs all Jest tests in Kibana.

In order for the plugin or package to use Jest, a jest.config.js file must be present in it's root. However, there are safeguards for this in CI should a test file be added without a corresponding config file.


Each package can also specify its own test script in the package's package.json, for cases where you'd prefer to run the tests from the local package directory.