diff --git a/.betterer.results b/.betterer.results
index a481f57acee..8631b85dee9 100644
--- a/.betterer.results
+++ b/.betterer.results
@@ -851,11 +851,6 @@ exports[`better eslint`] = {
"packages/grafana-ui/src/utils/useAsyncDependency.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
- "public/app/app.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/components/PanelDataErrorView\' import is restricted from being used by a pattern. Import from the public export instead.", "0"],
- [0, 0, 0, "\'@grafana/runtime/src/components/PanelRenderer\' import is restricted from being used by a pattern. Import from the public export instead.", "1"],
- [0, 0, 0, "\'@grafana/runtime/src/components/PluginPage\' import is restricted from being used by a pattern. Import from the public export instead.", "2"]
- ],
"public/app/core/TableModel.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
@@ -1056,12 +1051,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Do not re-export imported variable (\`profiler\`)", "6"],
[0, 0, 0, "Do not re-export imported variable (\`updateLegendValues\`)", "7"]
],
- "public/app/core/internationalization/index.test.tsx:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/unstable\' import is restricted from being used by a pattern. Import from the public export instead.", "0"]
- ],
- "public/app/core/internationalization/index.tsx:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/unstable\' import is restricted from being used by a pattern. Import from the public export instead.", "0"]
- ],
"public/app/core/navigation/GrafanaRouteError.tsx:5381": [
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"],
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "1"]
@@ -1972,9 +1961,6 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings. Wrap text with ", "5"],
[0, 0, 0, "No untranslated strings. Wrap text with ", "6"]
],
- "public/app/features/alerting/unified/components/rule-editor/dag.test.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/utils/DataSourceWithBackend\' import is restricted from being used by a pattern. Import from the public export instead.", "0"]
- ],
"public/app/features/alerting/unified/components/rule-editor/labels/LabelsButtons.tsx:5381": [
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"],
[0, 0, 0, "No untranslated strings. Wrap text with ", "1"]
@@ -2051,9 +2037,6 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings. Wrap text with ", "7"],
[0, 0, 0, "No untranslated strings. Wrap text with ", "8"]
],
- "public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/reducer.test.tsx:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/services/__mocks__/dataSourceSrv\' import is restricted from being used by a pattern. Import from the public export instead.", "0"]
- ],
"public/app/features/alerting/unified/components/rule-editor/rule-types/GrafanaManagedAlert.tsx:5381": [
[0, 0, 0, "No untranslated strings. Wrap text with ", "0"]
],
@@ -2066,9 +2049,6 @@ exports[`better eslint`] = {
"public/app/features/alerting/unified/components/rule-editor/rule-types/RuleTypePicker.tsx:5381": [
[0, 0, 0, "No untranslated strings. Wrap text with ", "0"]
],
- "public/app/features/alerting/unified/components/rule-editor/util.test.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/utils/DataSourceWithBackend\' import is restricted from being used by a pattern. Import from the public export instead.", "0"]
- ],
"public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx:5381": [
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"],
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "1"],
@@ -2173,9 +2153,6 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "2"],
[0, 0, 0, "No untranslated strings. Wrap text with ", "3"]
],
- "public/app/features/alerting/unified/components/rules/MultipleDataSourcePicker.tsx:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/utils/DataSourceWithBackend\' import is restricted from being used by a pattern. Import from the public export instead.", "0"]
- ],
"public/app/features/alerting/unified/components/rules/ReorderRuleGroupModal.tsx:5381": [
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"]
],
@@ -2404,9 +2381,6 @@ exports[`better eslint`] = {
"public/app/features/alerting/unified/home/PluginIntegrations.tsx:5381": [
[0, 0, 0, "No untranslated strings. Wrap text with ", "0"]
],
- "public/app/features/alerting/unified/hooks/useAlertQueriesStatus.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/utils/DataSourceWithBackend\' import is restricted from being used by a pattern. Import from the public export instead.", "0"]
- ],
"public/app/features/alerting/unified/hooks/useAlertmanagerConfig.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
],
@@ -2483,9 +2457,6 @@ exports[`better eslint`] = {
"public/app/features/alerting/unified/rule-list/components/RuleGroup.tsx:5381": [
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"]
],
- "public/app/features/alerting/unified/state/AlertingQueryRunner.test.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/utils/DataSourceWithBackend\' import is restricted from being used by a pattern. Import from the public export instead.", "0"]
- ],
"public/app/features/alerting/unified/types/receiver-form.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
@@ -2511,9 +2482,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
[0, 0, 0, "Unexpected any. Specify a different type.", "7"]
],
- "public/app/features/alerting/unified/utils/rule-form.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/utils/DataSourceWithBackend\' import is restricted from being used by a pattern. Import from the public export instead.", "0"]
- ],
"public/app/features/alerting/unified/utils/rules.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Do not use any type assertions.", "1"],
@@ -2580,9 +2548,6 @@ exports[`better eslint`] = {
"public/app/features/auth-config/utils/data.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
],
- "public/app/features/bookmarks/BookmarksPage.tsx:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/unstable\' import is restricted from being used by a pattern. Import from the public export instead.", "0"]
- ],
"public/app/features/browse-dashboards/api/browseDashboardsAPI.ts:5381": [
[0, 0, 0, "Do not re-export imported variable (\`@reduxjs/toolkit/query/react\`)", "0"]
],
@@ -4147,9 +4112,8 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "5"]
],
"public/app/features/expressions/ExpressionDatasource.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/utils/DataSourceWithBackend\' import is restricted from being used by a pattern. Import from the public export instead.", "0"],
- [0, 0, 0, "Do not use any type assertions.", "1"],
- [0, 0, 0, "Do not use any type assertions.", "2"]
+ [0, 0, 0, "Do not use any type assertions.", "0"],
+ [0, 0, 0, "Do not use any type assertions.", "1"]
],
"public/app/features/expressions/ExpressionQueryEditor.tsx:5381": [
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"]
@@ -4196,8 +4160,7 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"]
],
"public/app/features/expressions/guards.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/utils/DataSourceWithBackend\' import is restricted from being used by a pattern. Import from the public export instead.", "0"],
- [0, 0, 0, "Do not use any type assertions.", "1"]
+ [0, 0, 0, "Do not use any type assertions.", "0"]
],
"public/app/features/geo/editor/GazetteerPathEditor.tsx:5381": [
[0, 0, 0, "No untranslated strings. Wrap text with ", "0"],
@@ -4302,18 +4265,11 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"]
],
"public/app/features/live/centrifuge/LiveDataStream.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/services/live\' import is restricted from being used by a pattern. Import from the public export instead.", "0"],
- [0, 0, 0, "\'@grafana/runtime/src/utils/toDataQueryError\' import is restricted from being used by a pattern. Import from the public export instead.", "1"],
- [0, 0, 0, "Do not use any type assertions.", "2"]
+ [0, 0, 0, "Do not use any type assertions.", "0"]
],
"public/app/features/live/centrifuge/channel.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
- "public/app/features/live/centrifuge/service.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/services/backendSrv\' import is restricted from being used by a pattern. Import from the public export instead.", "0"],
- [0, 0, 0, "\'@grafana/runtime/src/services/live\' import is restricted from being used by a pattern. Import from the public export instead.", "1"],
- [0, 0, 0, "\'@grafana/runtime/src/utils/queryResponse\' import is restricted from being used by a pattern. Import from the public export instead.", "2"]
- ],
"public/app/features/live/centrifuge/serviceWorkerProxy.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
],
@@ -4323,9 +4279,6 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings. Wrap text with ", "2"],
[0, 0, 0, "No untranslated strings. Wrap text with ", "3"]
],
- "public/app/features/live/live.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/utils/DataSourceWithBackend\' import is restricted from being used by a pattern. Import from the public export instead.", "0"]
- ],
"public/app/features/logs/components/InfiniteScroll.tsx:5381": [
[0, 0, 0, "No untranslated strings. Wrap text with ", "0"]
],
@@ -4382,7 +4335,7 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings. Wrap text with ", "0"]
],
"public/app/features/manage-dashboards/components/ImportDashboardForm.tsx:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/utils/DataSourceWithBackend\' import is restricted from being used by a pattern. Import from the public export instead.", "0"],
+ [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"],
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "1"],
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "2"],
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "3"],
@@ -4390,10 +4343,9 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "5"],
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "6"],
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "7"],
- [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "8"],
+ [0, 0, 0, "No untranslated strings. Wrap text with ", "8"],
[0, 0, 0, "No untranslated strings. Wrap text with ", "9"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "10"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "11"]
+ [0, 0, 0, "No untranslated strings. Wrap text with ", "10"]
],
"public/app/features/manage-dashboards/components/ImportDashboardLibraryPanelsList.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
@@ -4577,10 +4529,9 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings. Wrap text with ", "1"]
],
"public/app/features/plugins/admin/components/PluginDetailsBody.tsx:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/components/PluginPage\' import is restricted from being used by a pattern. Import from the public export instead.", "0"],
- [0, 0, 0, "Do not use any type assertions.", "1"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "2"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "3"]
+ [0, 0, 0, "Do not use any type assertions.", "0"],
+ [0, 0, 0, "No untranslated strings. Wrap text with ", "1"],
+ [0, 0, 0, "No untranslated strings. Wrap text with ", "2"]
],
"public/app/features/plugins/admin/components/PluginDetailsDeprecatedWarning.tsx:5381": [
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"],
@@ -4595,8 +4546,7 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings. Wrap text with ", "2"]
],
"public/app/features/plugins/admin/components/PluginDetailsPanel.tsx:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/components/PluginPage\' import is restricted from being used by a pattern. Import from the public export instead.", "0"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "1"]
+ [0, 0, 0, "No untranslated strings. Wrap text with ", "0"]
],
"public/app/features/plugins/admin/components/PluginDetailsSignature.tsx:5381": [
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"],
@@ -4674,14 +4624,13 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings. Wrap text with ", "2"]
],
"public/app/features/plugins/datasource_srv.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/utils/DataSourceWithBackend\' import is restricted from being used by a pattern. Import from the public export instead.", "0"],
+ [0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Do not use any type assertions.", "1"],
[0, 0, 0, "Do not use any type assertions.", "2"],
[0, 0, 0, "Do not use any type assertions.", "3"],
- [0, 0, 0, "Do not use any type assertions.", "4"],
+ [0, 0, 0, "Unexpected any. Specify a different type.", "4"],
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
- [0, 0, 0, "Unexpected any. Specify a different type.", "6"],
- [0, 0, 0, "Unexpected any. Specify a different type.", "7"]
+ [0, 0, 0, "Unexpected any. Specify a different type.", "6"]
],
"public/app/features/plugins/extensions/logs/LogViewFilters.tsx:5381": [
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"],
@@ -4706,10 +4655,9 @@ exports[`better eslint`] = {
[0, 0, 0, "Do not use any type assertions.", "2"]
],
"public/app/features/plugins/tests/datasource_srv.test.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/utils/DataSourceWithBackend\' import is restricted from being used by a pattern. Import from the public export instead.", "0"],
+ [0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
- [0, 0, 0, "Unexpected any. Specify a different type.", "2"],
- [0, 0, 0, "Unexpected any. Specify a different type.", "3"]
+ [0, 0, 0, "Unexpected any. Specify a different type.", "2"]
],
"public/app/features/plugins/utils.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"],
@@ -4926,7 +4874,7 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings. Wrap text with ", "1"]
],
"public/app/features/provisioning/Shared/TokenPermissionsInfo.tsx:5381": [
- [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"],
+ [0, 0, 0, "No untranslated strings. Wrap text with ", "0"],
[0, 0, 0, "No untranslated strings. Wrap text with ", "1"],
[0, 0, 0, "No untranslated strings. Wrap text with ", "2"],
[0, 0, 0, "No untranslated strings. Wrap text with ", "3"],
@@ -4965,7 +4913,10 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "8"],
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "9"],
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "10"],
- [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "11"]
+ [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "11"],
+ [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "12"],
+ [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "13"],
+ [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "14"]
],
"public/app/features/provisioning/Wizard/FinishStep.tsx:5381": [
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"],
@@ -4977,20 +4928,7 @@ exports[`better eslint`] = {
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "6"],
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "7"],
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "8"],
- [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "9"],
- [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "10"],
- [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "11"],
- [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "12"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "13"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "14"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "15"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "16"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "17"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "18"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "19"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "20"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "21"],
- [0, 0, 0, "No untranslated strings. Wrap text with ", "22"]
+ [0, 0, 0, "No untranslated strings. Wrap text with ", "9"]
],
"public/app/features/provisioning/Wizard/MigrateStep.tsx:5381": [
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"]
@@ -5094,19 +5032,14 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
],
"public/app/features/query/state/PanelQueryRunner.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/utils/DataSourceWithBackend\' import is restricted from being used by a pattern. Import from the public export instead.", "0"],
- [0, 0, 0, "Do not use any type assertions.", "1"],
- [0, 0, 0, "Do not use any type assertions.", "2"]
- ],
- "public/app/features/query/state/runRequest.test.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/utils/DataSourceWithBackend\' import is restricted from being used by a pattern. Import from the public export instead.", "0"]
- ],
- "public/app/features/query/state/runRequest.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/utils/DataSourceWithBackend\' import is restricted from being used by a pattern. Import from the public export instead.", "0"],
+ [0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Do not use any type assertions.", "1"]
],
+ "public/app/features/query/state/runRequest.ts:5381": [
+ [0, 0, 0, "Do not use any type assertions.", "0"]
+ ],
"public/app/features/query/state/updateQueries.test.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/utils/DataSourceWithBackend\' import is restricted from being used by a pattern. Import from the public export instead.", "0"],
+ [0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
@@ -5114,11 +5047,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
[0, 0, 0, "Unexpected any. Specify a different type.", "7"],
- [0, 0, 0, "Unexpected any. Specify a different type.", "8"],
- [0, 0, 0, "Unexpected any. Specify a different type.", "9"]
- ],
- "public/app/features/query/state/updateQueries.ts:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/utils/DataSourceWithBackend\' import is restricted from being used by a pattern. Import from the public export instead.", "0"]
+ [0, 0, 0, "Unexpected any. Specify a different type.", "8"]
],
"public/app/features/sandbox/TestStuffPage.tsx:5381": [
[0, 0, 0, "No untranslated strings. Wrap text with ", "0"],
@@ -5363,9 +5292,6 @@ exports[`better eslint`] = {
"public/app/features/transformers/editors/EnumMappingRow.tsx:5381": [
[0, 0, 0, "\'HorizontalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"]
],
- "public/app/features/transformers/editors/FilterByNameTransformerEditor.tsx:5381": [
- [0, 0, 0, "\'@grafana/runtime/src/services\' import is restricted from being used by a pattern. Import from the public export instead.", "0"]
- ],
"public/app/features/transformers/editors/FormatStringTransformerEditor.tsx:5381": [
[0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"]
],
diff --git a/packages/README.md b/packages/README.md
index e7c9d6df315..b3797e69514 100644
--- a/packages/README.md
+++ b/packages/README.md
@@ -2,13 +2,13 @@
## Exporting code conventions
-`@grafana/ui` makes use of `exports` in package.json to define three entrypoints that Grafana core and Grafana plugins can access. Before exposing anything in this package please consider the table below.
+`@grafana/ui`, `@grafana/data` and `@grafana/runtime` makes use of `exports` in package.json to define three entrypoints that Grafana core and Grafana plugins can access. Before exposing anything in these packages please consider the table below to better understand the use case of each export.
-| Entrypoint Name | Import Path | Description | Available to Grafana | Available to plugins |
-| --------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | -------------------- |
-| `./` | `@grafana/ui` | The public API entrypoint. If the code is stable and you want to share it everywhere, this is the place to export it. | ✅ | ✅ |
-| `./unstable` | `@grafana/ui/unstable` | The public API entrypoint for all experimental code. If you want to iterate and test code from Grafana and plugins, this is the place to export it. | ✅ | ✅ |
-| `./internal` | `@grafana/ui/internal` | The private API entrypoint for internal code shared with Grafana. If you need to import code in Grafana but don't want to expose it to plugins, this is the place to export it. | ✅ | ❌ |
+| Export Name | Import Path | Description | Available to Grafana | Available to plugins |
+| ------------ | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | -------------------- |
+| `./` | `@grafana/ui` | The public API entrypoint. If the code is stable and you want to share it everywhere, this is the place to export it. | ✅ | ✅ |
+| `./unstable` | `@grafana/ui/unstable` | The public API entrypoint for all experimental code. If you want to iterate and test code from Grafana and plugins, this is the place to export it. | ✅ | ✅ |
+| `./internal` | `@grafana/ui/internal` | The private API entrypoint for internal code shared with Grafana. If you need to import code in Grafana but don't want to expose it to plugins, this is the place to export it. | ✅ | ❌ |
## Versioning
diff --git a/packages/grafana-runtime/package.json b/packages/grafana-runtime/package.json
index 3b0544d9ae5..a03d9fbc051 100644
--- a/packages/grafana-runtime/package.json
+++ b/packages/grafana-runtime/package.json
@@ -16,6 +16,22 @@
},
"main": "src/index.ts",
"types": "src/index.ts",
+ "module": "src/index.ts",
+ "exports": {
+ "./package.json": "./package.json",
+ ".": {
+ "import": "./src/index.ts",
+ "require": "./src/index.ts"
+ },
+ "./internal": {
+ "import": "./src/internal/index.ts",
+ "require": "./src/internal/index.ts"
+ },
+ "./unstable": {
+ "import": "./src/unstable.ts",
+ "require": "./src/unstable.ts"
+ }
+ },
"publishConfig": {
"main": "./dist/cjs/index.cjs",
"module": "./dist/esm/index.mjs",
diff --git a/packages/grafana-runtime/src/components/DataSourcePicker.test.tsx b/packages/grafana-runtime/src/components/DataSourcePicker.test.tsx
index 6f7ceb6da00..91e01047bdb 100644
--- a/packages/grafana-runtime/src/components/DataSourcePicker.test.tsx
+++ b/packages/grafana-runtime/src/components/DataSourcePicker.test.tsx
@@ -3,7 +3,13 @@ import userEvent from '@testing-library/user-event';
import { DataSourcePicker } from './DataSourcePicker';
-jest.mock('../services/dataSourceSrv');
+jest.mock('../services/dataSourceSrv', () => ({
+ getDataSourceSrv: () => ({
+ getList: () => [],
+ getInstanceSettings: () => undefined,
+ get: () => undefined,
+ }),
+}));
describe('DataSourcePicker', () => {
describe('onClear', () => {
diff --git a/packages/grafana-runtime/src/internal/index.ts b/packages/grafana-runtime/src/internal/index.ts
new file mode 100644
index 00000000000..4b085040190
--- /dev/null
+++ b/packages/grafana-runtime/src/internal/index.ts
@@ -0,0 +1,18 @@
+/**
+ * This file is used to share internal grafana/runtime code with Grafana core.
+ * Note that these exports are also used within Enterprise.
+ *
+ * Through the exports declared in package.json we can import this code in core Grafana and the grafana/runtime
+ * package will continue to be able to access all code when it's published to npm as it's private to the package.
+ *
+ * During the yarn pack lifecycle the exports[./internal] property is deleted from the package.json
+ * preventing the code from being importable by plugins or other npm packages making it truly "internal".
+ *
+ */
+
+export { setPanelDataErrorView } from '../components/PanelDataErrorView';
+export { setPanelRenderer } from '../components/PanelRenderer';
+export { type PageInfoItem, setPluginPage } from '../components/PluginPage';
+
+export { ExpressionDatasourceRef } from '../utils/DataSourceWithBackend';
+export { standardStreamOptionsProvider, toStreamingDataResponse } from '../utils/DataSourceWithBackend';
diff --git a/packages/grafana-runtime/src/services/__mocks__/dataSourceSrv.ts b/packages/grafana-runtime/src/services/__mocks__/dataSourceSrv.ts
deleted file mode 100644
index 61995de2b0a..00000000000
--- a/packages/grafana-runtime/src/services/__mocks__/dataSourceSrv.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-const ds1 = {
- id: 1,
- uid: 'c8eceabb-0275-4108-8f03-8f74faf4bf6d',
- type: 'prometheus',
- name: 'gdev-prometheus',
- meta: {
- alerting: true,
- info: {
- logos: {
- small: 'http://example.com/logo.png',
- },
- },
- },
- jsonData: {},
- access: 'proxy',
-};
-
-export function getDataSourceSrv() {
- return {
- getList: () => [ds1],
- getInstanceSettings: () => ds1,
- };
-}
diff --git a/public/app/app.ts b/public/app/app.ts
index f576ba415a0..aae4cd66c3d 100644
--- a/public/app/app.ts
+++ b/public/app/app.ts
@@ -42,9 +42,7 @@ import {
setCorrelationsService,
setPluginFunctionsHook,
} from '@grafana/runtime';
-import { setPanelDataErrorView } from '@grafana/runtime/src/components/PanelDataErrorView';
-import { setPanelRenderer } from '@grafana/runtime/src/components/PanelRenderer';
-import { setPluginPage } from '@grafana/runtime/src/components/PluginPage';
+import { setPanelDataErrorView, setPanelRenderer, setPluginPage } from '@grafana/runtime/internal';
import config, { updateConfig } from 'app/core/config';
import { getStandardTransformers } from 'app/features/transformers/standardTransformers';
diff --git a/public/app/core/components/Upgrade/UpgradeBox.tsx b/public/app/core/components/Upgrade/UpgradeBox.tsx
index 3d76687035d..96f0b0e99c9 100644
--- a/public/app/core/components/Upgrade/UpgradeBox.tsx
+++ b/public/app/core/components/Upgrade/UpgradeBox.tsx
@@ -2,7 +2,7 @@ import { css, cx } from '@emotion/css';
import { HTMLAttributes, useEffect } from 'react';
import { GrafanaTheme2 } from '@grafana/data';
-import { reportExperimentView } from '@grafana/runtime/src';
+import { reportExperimentView } from '@grafana/runtime';
import { Button, Icon, LinkButton, useStyles2 } from '@grafana/ui';
import { t, Trans } from 'app/core/internationalization';
diff --git a/public/app/core/internationalization/index.test.tsx b/public/app/core/internationalization/index.test.tsx
index 8dab4d6e250..cb894181d24 100644
--- a/public/app/core/internationalization/index.test.tsx
+++ b/public/app/core/internationalization/index.test.tsx
@@ -2,12 +2,7 @@ import { render } from '@testing-library/react';
import { I18nextProvider } from 'react-i18next';
import { PluginContextProvider, PluginMeta, PluginType } from '@grafana/data';
-import {
- Trans as PluginTrans,
- setTransComponent,
- setUseTranslateHook,
- useTranslate,
-} from '@grafana/runtime/src/unstable';
+import { Trans as PluginTrans, setTransComponent, setUseTranslateHook, useTranslate } from '@grafana/runtime/unstable';
import { getI18next, Trans, useTranslateInternal } from './index';
diff --git a/public/app/core/internationalization/index.tsx b/public/app/core/internationalization/index.tsx
index 73242d04728..ed10ecf3a8e 100644
--- a/public/app/core/internationalization/index.tsx
+++ b/public/app/core/internationalization/index.tsx
@@ -4,7 +4,7 @@ import { ReactElement, useMemo } from 'react';
import { Trans as I18NextTrans, initReactI18next } from 'react-i18next'; // eslint-disable-line no-restricted-imports
import { usePluginContext } from '@grafana/data';
-import { setTransComponent, setUseTranslateHook, TransProps } from '@grafana/runtime/src/unstable';
+import { setTransComponent, setUseTranslateHook, TransProps } from '@grafana/runtime/unstable';
import { DEFAULT_LANGUAGE, NAMESPACES, VALID_LANGUAGES } from './constants';
import { loadTranslations } from './loadTranslations';
diff --git a/public/app/features/admin/UserListPage.test.tsx b/public/app/features/admin/UserListPage.test.tsx
index a59246fca23..6601c06827d 100644
--- a/public/app/features/admin/UserListPage.test.tsx
+++ b/public/app/features/admin/UserListPage.test.tsx
@@ -2,7 +2,7 @@ import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { selectors as e2eSelectors } from '@grafana/e2e-selectors/src';
-import { GrafanaBootConfig } from '@grafana/runtime/src';
+import { GrafanaBootConfig } from '@grafana/runtime';
import config from 'app/core/config';
import { TestProvider } from '../../../test/helpers/TestProvider';
diff --git a/public/app/features/admin/utils.ts b/public/app/features/admin/utils.ts
index 246f1279433..fdeddef498b 100644
--- a/public/app/features/admin/utils.ts
+++ b/public/app/features/admin/utils.ts
@@ -1,4 +1,4 @@
-import { config } from '@grafana/runtime/src';
+import { config } from '@grafana/runtime';
// https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
export const w3cStandardEmailValidator =
diff --git a/public/app/features/alerting/unified/Analytics.ts b/public/app/features/alerting/unified/Analytics.ts
index 559e7808d96..c209ec34249 100644
--- a/public/app/features/alerting/unified/Analytics.ts
+++ b/public/app/features/alerting/unified/Analytics.ts
@@ -1,7 +1,6 @@
import { isEmpty } from 'lodash';
-import { createMonitoringLogger } from '@grafana/runtime';
-import { config, reportInteraction } from '@grafana/runtime/src';
+import { config, createMonitoringLogger, reportInteraction } from '@grafana/runtime';
import { contextSrv } from 'app/core/core';
import { RuleNamespace } from '../../../types/unified-alerting';
diff --git a/public/app/features/alerting/unified/components/rule-editor/dag.test.ts b/public/app/features/alerting/unified/components/rule-editor/dag.test.ts
index 052db896825..cb8dd7a56dc 100644
--- a/public/app/features/alerting/unified/components/rule-editor/dag.test.ts
+++ b/public/app/features/alerting/unified/components/rule-editor/dag.test.ts
@@ -1,4 +1,4 @@
-import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend';
+import { ExpressionDatasourceRef } from '@grafana/runtime/internal';
import { Graph } from 'app/core/utils/dag';
import { EvalFunction } from 'app/features/alerting/state/alertDef';
import { ExpressionQuery, ExpressionQueryType } from 'app/features/expressions/types';
diff --git a/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/reducer.test.tsx b/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/reducer.test.tsx
index 73372e12a57..31858408509 100644
--- a/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/reducer.test.tsx
+++ b/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/reducer.test.tsx
@@ -1,5 +1,4 @@
import { RelativeTimeRange, getDefaultRelativeTimeRange } from '@grafana/data';
-import { getDataSourceSrv } from '@grafana/runtime/src/services/__mocks__/dataSourceSrv';
import { dataSource as expressionDatasource } from 'app/features/expressions/ExpressionDatasource';
import {
ExpressionDatasourceUID,
@@ -47,9 +46,29 @@ const thresholdExpression: AlertQuery = {
},
};
+const ds1 = {
+ id: 1,
+ uid: 'c8eceabb-0275-4108-8f03-8f74faf4bf6d',
+ type: 'prometheus',
+ name: 'gdev-prometheus',
+ meta: {
+ alerting: true,
+ info: {
+ logos: {
+ small: 'http://example.com/logo.png',
+ },
+ },
+ },
+ jsonData: {},
+ access: 'proxy',
+};
+
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
- getDataSourceSrv: getDataSourceSrv,
+ getDataSourceSrv: () => ({
+ getList: () => [ds1],
+ getInstanceSettings: () => ds1,
+ }),
}));
const alertQuery: AlertQuery = {
diff --git a/public/app/features/alerting/unified/components/rule-editor/util.test.ts b/public/app/features/alerting/unified/components/rule-editor/util.test.ts
index 13a4a6480b5..534156ac1f4 100644
--- a/public/app/features/alerting/unified/components/rule-editor/util.test.ts
+++ b/public/app/features/alerting/unified/components/rule-editor/util.test.ts
@@ -1,4 +1,4 @@
-import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend';
+import { ExpressionDatasourceRef } from '@grafana/runtime/internal';
import { ClassicCondition, ExpressionQuery } from 'app/features/expressions/types';
import { AlertQuery } from 'app/types/unified-alerting-dto';
diff --git a/public/app/features/alerting/unified/components/rules/MultipleDataSourcePicker.tsx b/public/app/features/alerting/unified/components/rules/MultipleDataSourcePicker.tsx
index e631c1b3291..996bea7e4a5 100644
--- a/public/app/features/alerting/unified/components/rules/MultipleDataSourcePicker.tsx
+++ b/public/app/features/alerting/unified/components/rules/MultipleDataSourcePicker.tsx
@@ -9,7 +9,7 @@ import {
} from '@grafana/data';
import { selectors } from '@grafana/e2e-selectors';
import { DataSourcePickerProps, DataSourcePickerState, getDataSourceSrv } from '@grafana/runtime';
-import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend';
+import { ExpressionDatasourceRef } from '@grafana/runtime/internal';
import { ActionMeta, MultiSelect, PluginSignatureBadge, Stack } from '@grafana/ui';
import { isDataSourceManagingAlerts } from '../../utils/datasource';
diff --git a/public/app/features/alerting/unified/components/rules/RuleConfigStatus.tsx b/public/app/features/alerting/unified/components/rules/RuleConfigStatus.tsx
index ed3f96dc960..1cd7e69e7fc 100644
--- a/public/app/features/alerting/unified/components/rules/RuleConfigStatus.tsx
+++ b/public/app/features/alerting/unified/components/rules/RuleConfigStatus.tsx
@@ -2,7 +2,7 @@ import { css } from '@emotion/css';
import { useMemo } from 'react';
import { GrafanaTheme2 } from '@grafana/data';
-import { config } from '@grafana/runtime/src';
+import { config } from '@grafana/runtime';
import { Icon, Tooltip, useStyles2 } from '@grafana/ui';
import { CombinedRule } from '../../../../../types/unified-alerting';
diff --git a/public/app/features/alerting/unified/hooks/useAlertQueriesStatus.ts b/public/app/features/alerting/unified/hooks/useAlertQueriesStatus.ts
index af3b744ceaa..76f310a6a21 100644
--- a/public/app/features/alerting/unified/hooks/useAlertQueriesStatus.ts
+++ b/public/app/features/alerting/unified/hooks/useAlertQueriesStatus.ts
@@ -1,7 +1,6 @@
import { useMemo } from 'react';
-import { getDataSourceSrv } from '@grafana/runtime';
-import { isExpressionReference } from '@grafana/runtime/src/utils/DataSourceWithBackend';
+import { getDataSourceSrv, isExpressionReference } from '@grafana/runtime';
import { AlertQuery } from 'app/types/unified-alerting-dto';
export function useAlertQueriesStatus(queries: AlertQuery[]) {
diff --git a/public/app/features/alerting/unified/state/AlertingQueryRunner.test.ts b/public/app/features/alerting/unified/state/AlertingQueryRunner.test.ts
index 9f64cbdb08e..30fb633dbc4 100644
--- a/public/app/features/alerting/unified/state/AlertingQueryRunner.test.ts
+++ b/public/app/features/alerting/unified/state/AlertingQueryRunner.test.ts
@@ -14,7 +14,7 @@ import {
rangeUtil,
} from '@grafana/data';
import { DataSourceSrv, DataSourceWithBackend, FetchResponse } from '@grafana/runtime';
-import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend';
+import { ExpressionDatasourceRef } from '@grafana/runtime/internal';
import { DataQuery } from '@grafana/schema';
import { BackendSrv } from 'app/core/services/backend_srv';
import {
diff --git a/public/app/features/alerting/unified/utils/rule-form.ts b/public/app/features/alerting/unified/utils/rule-form.ts
index 7845c5e228f..fcf9ee3d77e 100644
--- a/public/app/features/alerting/unified/utils/rule-form.ts
+++ b/public/app/features/alerting/unified/utils/rule-form.ts
@@ -10,7 +10,7 @@ import {
} from '@grafana/data';
import { PromQuery } from '@grafana/prometheus';
import { config, getDataSourceSrv } from '@grafana/runtime';
-import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend';
+import { ExpressionDatasourceRef } from '@grafana/runtime/internal';
import { VizPanel, sceneGraph } from '@grafana/scenes';
import { DataQuery, DataSourceJsonData, DataSourceRef } from '@grafana/schema';
import { DashboardModel } from 'app/features/dashboard/state/DashboardModel';
diff --git a/public/app/features/bookmarks/BookmarksPage.tsx b/public/app/features/bookmarks/BookmarksPage.tsx
index 067b52e3d34..2e4bc821e95 100644
--- a/public/app/features/bookmarks/BookmarksPage.tsx
+++ b/public/app/features/bookmarks/BookmarksPage.tsx
@@ -1,7 +1,7 @@
import { css } from '@emotion/css';
import { GrafanaTheme2, NavModelItem } from '@grafana/data';
-import { useTranslate } from '@grafana/runtime/src/unstable';
+import { useTranslate } from '@grafana/runtime/unstable';
import { EmptyState, useStyles2 } from '@grafana/ui';
import { usePinnedItems } from 'app/core/components/AppChrome/MegaMenu/hooks';
import { findByUrl } from 'app/core/components/AppChrome/MegaMenu/utils';
diff --git a/public/app/features/canvas/runtime/scene.tsx b/public/app/features/canvas/runtime/scene.tsx
index d0fd1262aca..5be6001272d 100644
--- a/public/app/features/canvas/runtime/scene.tsx
+++ b/public/app/features/canvas/runtime/scene.tsx
@@ -6,7 +6,7 @@ import { BehaviorSubject, ReplaySubject, Subject, Subscription } from 'rxjs';
import Selecto from 'selecto';
import { AppEvents, PanelData } from '@grafana/data';
-import { locationService } from '@grafana/runtime/src';
+import { locationService } from '@grafana/runtime';
import {
ColorDimensionConfig,
ResourceDimensionConfig,
diff --git a/public/app/features/dashboard-scene/settings/VariablesEditView.test.tsx b/public/app/features/dashboard-scene/settings/VariablesEditView.test.tsx
index 8c5f690518e..d8a1945dc3c 100644
--- a/public/app/features/dashboard-scene/settings/VariablesEditView.test.tsx
+++ b/public/app/features/dashboard-scene/settings/VariablesEditView.test.tsx
@@ -42,8 +42,8 @@ const promDatasource = mockDataSource({
type: 'prometheus',
});
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => ({
- ...jest.requireActual('@grafana/runtime/src/services/dataSourceSrv'),
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
getDataSourceSrv: () => ({
get: async () => ({
...defaultDatasource,
diff --git a/public/app/features/dashboard-scene/settings/annotations/AnnotationSettingsEdit.test.tsx b/public/app/features/dashboard-scene/settings/annotations/AnnotationSettingsEdit.test.tsx
index 96f849bf01a..2207c0bb923 100644
--- a/public/app/features/dashboard-scene/settings/annotations/AnnotationSettingsEdit.test.tsx
+++ b/public/app/features/dashboard-scene/settings/annotations/AnnotationSettingsEdit.test.tsx
@@ -39,10 +39,6 @@ jest.mock('@grafana/runtime', () => ({
}),
}),
}),
-}));
-
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => ({
- ...jest.requireActual('@grafana/runtime/src/services/dataSourceSrv'),
getDataSourceSrv: () => ({
get: async () => ({
...defaultDatasource,
diff --git a/public/app/features/dashboard-scene/settings/annotations/AnnotationSettingsList.test.tsx b/public/app/features/dashboard-scene/settings/annotations/AnnotationSettingsList.test.tsx
index 9f379ef0dcd..fe073c09681 100644
--- a/public/app/features/dashboard-scene/settings/annotations/AnnotationSettingsList.test.tsx
+++ b/public/app/features/dashboard-scene/settings/annotations/AnnotationSettingsList.test.tsx
@@ -14,8 +14,8 @@ const defaultDatasource = mockDataSource({
type: 'test',
});
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => ({
- ...jest.requireActual('@grafana/runtime/src/services/dataSourceSrv'),
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
getDataSourceSrv: () => ({
getInstanceSettings: () => ({ ...defaultDatasource }),
}),
diff --git a/public/app/features/dashboard-scene/settings/variables/components/AdHocVariableForm.test.tsx b/public/app/features/dashboard-scene/settings/variables/components/AdHocVariableForm.test.tsx
index c07db30ba55..61e9ee8b835 100644
--- a/public/app/features/dashboard-scene/settings/variables/components/AdHocVariableForm.test.tsx
+++ b/public/app/features/dashboard-scene/settings/variables/components/AdHocVariableForm.test.tsx
@@ -19,8 +19,8 @@ const promDatasource = mockDataSource({
type: 'prometheus',
});
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => ({
- ...jest.requireActual('@grafana/runtime/src/services/dataSourceSrv'),
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
getDataSourceSrv: () => ({
get: async () => defaultDatasource,
getList: () => [defaultDatasource, promDatasource],
diff --git a/public/app/features/dashboard-scene/settings/variables/components/GroupByVariableForm.test.tsx b/public/app/features/dashboard-scene/settings/variables/components/GroupByVariableForm.test.tsx
index 81eda3d14fe..bca55beadec 100644
--- a/public/app/features/dashboard-scene/settings/variables/components/GroupByVariableForm.test.tsx
+++ b/public/app/features/dashboard-scene/settings/variables/components/GroupByVariableForm.test.tsx
@@ -19,8 +19,8 @@ const promDatasource = mockDataSource({
type: 'prometheus',
});
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => ({
- ...jest.requireActual('@grafana/runtime/src/services/dataSourceSrv'),
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
getDataSourceSrv: () => ({
get: async () => ({
...defaultDatasource,
diff --git a/public/app/features/dashboard-scene/settings/variables/components/QueryVariableForm.test.tsx b/public/app/features/dashboard-scene/settings/variables/components/QueryVariableForm.test.tsx
index 12fdb76f103..3b5fc70d2e9 100644
--- a/public/app/features/dashboard-scene/settings/variables/components/QueryVariableForm.test.tsx
+++ b/public/app/features/dashboard-scene/settings/variables/components/QueryVariableForm.test.tsx
@@ -31,8 +31,8 @@ const promDatasource = mockDataSource({
type: 'prometheus',
});
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => ({
- ...jest.requireActual('@grafana/runtime/src/services/dataSourceSrv'),
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
getDataSourceSrv: () => ({
get: async () => ({
...defaultDatasource,
diff --git a/public/app/features/dashboard-scene/settings/variables/editors/AdHocFiltersVariableEditor.test.tsx b/public/app/features/dashboard-scene/settings/variables/editors/AdHocFiltersVariableEditor.test.tsx
index 82d4fe3e23b..c686aa60b36 100644
--- a/public/app/features/dashboard-scene/settings/variables/editors/AdHocFiltersVariableEditor.test.tsx
+++ b/public/app/features/dashboard-scene/settings/variables/editors/AdHocFiltersVariableEditor.test.tsx
@@ -12,7 +12,7 @@ import {
toDataFrame,
} from '@grafana/data';
import { selectors } from '@grafana/e2e-selectors';
-import { setRunRequest } from '@grafana/runtime/src';
+import { setRunRequest } from '@grafana/runtime';
import { AdHocFiltersVariable } from '@grafana/scenes';
import { mockDataSource } from 'app/features/alerting/unified/mocks';
import { LegacyVariableQueryEditor } from 'app/features/variables/editor/LegacyVariableQueryEditor';
@@ -31,8 +31,8 @@ const promDatasource = mockDataSource({
type: 'prometheus',
});
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => ({
- ...jest.requireActual('@grafana/runtime/src/services/dataSourceSrv'),
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
getDataSourceSrv: () => ({
get: async () => ({
...defaultDatasource,
diff --git a/public/app/features/dashboard-scene/settings/variables/editors/GroupByVariableEditor.test.tsx b/public/app/features/dashboard-scene/settings/variables/editors/GroupByVariableEditor.test.tsx
index cbafdb5c7fc..7185d4bb00b 100644
--- a/public/app/features/dashboard-scene/settings/variables/editors/GroupByVariableEditor.test.tsx
+++ b/public/app/features/dashboard-scene/settings/variables/editors/GroupByVariableEditor.test.tsx
@@ -21,8 +21,8 @@ const promDatasource = mockDataSource({
type: 'prometheus',
});
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => ({
- ...jest.requireActual('@grafana/runtime/src/services/dataSourceSrv'),
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
getDataSourceSrv: () => ({
get: async () => ({
...defaultDatasource,
diff --git a/public/app/features/dashboard-scene/settings/variables/editors/QueryVariableEditor.test.tsx b/public/app/features/dashboard-scene/settings/variables/editors/QueryVariableEditor.test.tsx
index 5e1618cf529..9a4182e5429 100644
--- a/public/app/features/dashboard-scene/settings/variables/editors/QueryVariableEditor.test.tsx
+++ b/public/app/features/dashboard-scene/settings/variables/editors/QueryVariableEditor.test.tsx
@@ -30,8 +30,8 @@ const promDatasource = mockDataSource({
type: 'prometheus',
});
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => ({
- ...jest.requireActual('@grafana/runtime/src/services/dataSourceSrv'),
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
getDataSourceSrv: () => ({
get: async () => ({
...defaultDatasource,
diff --git a/public/app/features/dashboard/api/publicDashboardApi.ts b/public/app/features/dashboard/api/publicDashboardApi.ts
index 40bda98f4c5..045b4382adc 100644
--- a/public/app/features/dashboard/api/publicDashboardApi.ts
+++ b/public/app/features/dashboard/api/publicDashboardApi.ts
@@ -1,6 +1,6 @@
import { createApi } from '@reduxjs/toolkit/query/react';
-import { config, FetchError, isFetchError } from '@grafana/runtime/src';
+import { config, FetchError, isFetchError } from '@grafana/runtime';
import { createBaseQuery } from 'app/api/createBaseQuery';
import { notifyApp } from 'app/core/actions';
import { createErrorNotification, createSuccessNotification } from 'app/core/copy/appNotification';
diff --git a/public/app/features/dashboard/components/ShareModal/ShareEmbed.test.tsx b/public/app/features/dashboard/components/ShareModal/ShareEmbed.test.tsx
index dc0699ab6e6..3dd19e82a19 100644
--- a/public/app/features/dashboard/components/ShareModal/ShareEmbed.test.tsx
+++ b/public/app/features/dashboard/components/ShareModal/ShareEmbed.test.tsx
@@ -1,7 +1,7 @@
import { render, screen } from '@testing-library/react';
import { BootData } from '@grafana/data';
-import { setEchoSrv } from '@grafana/runtime/src';
+import { setEchoSrv } from '@grafana/runtime';
import config from 'app/core/config';
import { Echo } from '../../../../core/services/echo/Echo';
diff --git a/public/app/features/dashboard/components/ShareModal/ShareLibraryPanel.tsx b/public/app/features/dashboard/components/ShareModal/ShareLibraryPanel.tsx
index 1b4f57c6a0e..c4428cfae39 100644
--- a/public/app/features/dashboard/components/ShareModal/ShareLibraryPanel.tsx
+++ b/public/app/features/dashboard/components/ShareModal/ShareLibraryPanel.tsx
@@ -1,6 +1,6 @@
import { useEffect } from 'react';
-import { reportInteraction } from '@grafana/runtime/src';
+import { reportInteraction } from '@grafana/runtime';
import { Trans } from 'app/core/internationalization';
import { AddLibraryPanelContents } from 'app/features/library-panels/components/AddLibraryPanelModal/AddLibraryPanelModal';
diff --git a/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboardUtils.test.tsx b/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboardUtils.test.tsx
index 6ca108fc542..395161ff8f3 100644
--- a/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboardUtils.test.tsx
+++ b/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboardUtils.test.tsx
@@ -17,23 +17,22 @@ const mockDS = mockDataSource({
type: 'mock-ds-type',
});
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => {
- return {
- getDataSourceSrv: () => ({
- get: () =>
- Promise.resolve(
- new DataSourceWithBackend({
- ...mockDS,
- meta: {
- ...mockDS.meta,
- alerting: true,
- backend: true,
- },
- })
- ),
- }),
- };
-});
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
+ getDataSourceSrv: () => ({
+ get: () =>
+ Promise.resolve(
+ new DataSourceWithBackend({
+ ...mockDS,
+ meta: {
+ ...mockDS.meta,
+ alerting: true,
+ backend: true,
+ },
+ })
+ ),
+ }),
+}));
describe('dashboardHasTemplateVariables', () => {
it('false', () => {
diff --git a/public/app/features/datasources/components/picker/DataSourceModal.test.tsx b/public/app/features/datasources/components/picker/DataSourceModal.test.tsx
index f2b4dd0fdce..ad535127d3b 100644
--- a/public/app/features/datasources/components/picker/DataSourceModal.test.tsx
+++ b/public/app/features/datasources/components/picker/DataSourceModal.test.tsx
@@ -59,26 +59,18 @@ const setup = (partialProps: Partial = {}) => {
return render();
};
-jest.mock('@grafana/runtime', () => {
- const actual = jest.requireActual('@grafana/runtime');
- return {
- ...actual,
- getTemplateSrv: () => {
- return {
- getVariables: () => [],
- };
- },
- };
-});
-
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => {
- return {
- getDataSourceSrv: () => ({
- getList: getListMock,
- getInstanceSettings: getInstanceSettingsMock,
- }),
- };
-});
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
+ getTemplateSrv: () => {
+ return {
+ getVariables: () => [],
+ };
+ },
+ getDataSourceSrv: () => ({
+ getList: getListMock,
+ getInstanceSettings: getInstanceSettingsMock,
+ }),
+}));
locationUtil.initialize({
config: { appSubUrl: '/my-sub-path' } as GrafanaConfig,
diff --git a/public/app/features/datasources/components/picker/DataSourcePicker.test.tsx b/public/app/features/datasources/components/picker/DataSourcePicker.test.tsx
index 727cd1a2e59..75b238e76d7 100644
--- a/public/app/features/datasources/components/picker/DataSourcePicker.test.tsx
+++ b/public/app/features/datasources/components/picker/DataSourcePicker.test.tsx
@@ -63,26 +63,18 @@ locationUtil.initialize({
getTimeRangeForUrl: jest.fn(),
});
-jest.mock('@grafana/runtime', () => {
- const actual = jest.requireActual('@grafana/runtime');
- return {
- ...actual,
- getTemplateSrv: () => {
- return {
- getVariables: () => [{ id: 'foo', type: 'datasource' }],
- };
- },
- };
-});
-
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => {
- return {
- getDataSourceSrv: () => ({
- getList: getListMock,
- getInstanceSettings: getInstanceSettingsMock,
- }),
- };
-});
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
+ getTemplateSrv: () => {
+ return {
+ getVariables: () => [{ id: 'foo', type: 'datasource' }],
+ };
+ },
+ getDataSourceSrv: () => ({
+ getList: getListMock,
+ getInstanceSettings: getInstanceSettingsMock,
+ }),
+}));
const pushRecentlyUsedDataSourceMock = jest.fn();
jest.mock('../../hooks', () => {
diff --git a/public/app/features/explore/Explore.test.tsx b/public/app/features/explore/Explore.test.tsx
index 9fd5ba17ab8..c1bcd2a7d97 100644
--- a/public/app/features/explore/Explore.test.tsx
+++ b/public/app/features/explore/Explore.test.tsx
@@ -109,16 +109,15 @@ const dummyProps: Props = {
},
changeDatasource: jest.fn(),
};
-
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => {
- return {
- getDataSourceSrv: () => ({
- get: () => Promise.resolve({}),
- getList: () => [],
- getInstanceSettings: () => {},
- }),
- };
-});
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
+ getDataSourceSrv: () => ({
+ get: () => Promise.resolve({}),
+ getList: () => [],
+ getInstanceSettings: () => {},
+ }),
+ usePluginLinks: jest.fn(() => ({ links: [] })),
+}));
jest.mock('app/core/core', () => ({
contextSrv: {
@@ -127,11 +126,6 @@ jest.mock('app/core/core', () => ({
},
}));
-jest.mock('@grafana/runtime', () => ({
- ...jest.requireActual('@grafana/runtime'),
- usePluginLinks: jest.fn(() => ({ links: [] })),
-}));
-
// for the AutoSizer component to have a width
jest.mock('react-virtualized-auto-sizer', () => {
return ({ children }: AutoSizerProps) =>
diff --git a/public/app/features/explore/ExploreQueryInspector.tsx b/public/app/features/explore/ExploreQueryInspector.tsx
index a414197294a..11c49038273 100644
--- a/public/app/features/explore/ExploreQueryInspector.tsx
+++ b/public/app/features/explore/ExploreQueryInspector.tsx
@@ -3,7 +3,7 @@ import { useEffect, useState } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { CoreApp, GrafanaTheme2, LoadingState } from '@grafana/data';
-import { reportInteraction } from '@grafana/runtime/src';
+import { reportInteraction } from '@grafana/runtime';
import { defaultTimeZone, TimeZone } from '@grafana/schema';
import { TabbedContainer, TabConfig, useStyles2 } from '@grafana/ui';
import { requestIdGenerator } from 'app/core/utils/explore';
diff --git a/public/app/features/explore/Logs/LogsTableWrap.tsx b/public/app/features/explore/Logs/LogsTableWrap.tsx
index 50aa4fd6e8c..40eea0e97cd 100644
--- a/public/app/features/explore/Logs/LogsTableWrap.tsx
+++ b/public/app/features/explore/Logs/LogsTableWrap.tsx
@@ -13,7 +13,7 @@ import {
SplitOpen,
TimeRange,
} from '@grafana/data';
-import { reportInteraction } from '@grafana/runtime/src';
+import { reportInteraction } from '@grafana/runtime';
import { InlineField, Select, Themeable2 } from '@grafana/ui';
import { t } from 'app/core/internationalization';
diff --git a/public/app/features/explore/PrometheusListView/RawListContainer.tsx b/public/app/features/explore/PrometheusListView/RawListContainer.tsx
index eb0717b6c43..204e8091595 100644
--- a/public/app/features/explore/PrometheusListView/RawListContainer.tsx
+++ b/public/app/features/explore/PrometheusListView/RawListContainer.tsx
@@ -5,7 +5,7 @@ import { useWindowSize } from 'react-use';
import { VariableSizeList as List } from 'react-window';
import { DataFrame, Field as DataFrameField } from '@grafana/data';
-import { reportInteraction } from '@grafana/runtime/src';
+import { reportInteraction } from '@grafana/runtime';
import { Field, Switch } from '@grafana/ui';
import { ItemLabels } from './ItemLabels';
diff --git a/public/app/features/explore/PrometheusListView/RawListItem.tsx b/public/app/features/explore/PrometheusListView/RawListItem.tsx
index 9a5e84e318c..dae66707a97 100644
--- a/public/app/features/explore/PrometheusListView/RawListItem.tsx
+++ b/public/app/features/explore/PrometheusListView/RawListItem.tsx
@@ -3,7 +3,7 @@ import { useCopyToClipboard } from 'react-use';
import { Field, GrafanaTheme2 } from '@grafana/data';
import { isValidLegacyName, utf8Support } from '@grafana/prometheus/src/utf8_support';
-import { reportInteraction } from '@grafana/runtime/src';
+import { reportInteraction } from '@grafana/runtime';
import { IconButton, useStyles2 } from '@grafana/ui';
import { t } from 'app/core/internationalization';
diff --git a/public/app/features/explore/RichHistory/RichHistoryCard.test.tsx b/public/app/features/explore/RichHistory/RichHistoryCard.test.tsx
index c547dd1572f..f0a9d5410f3 100644
--- a/public/app/features/explore/RichHistory/RichHistoryCard.test.tsx
+++ b/public/app/features/explore/RichHistory/RichHistoryCard.test.tsx
@@ -71,24 +71,19 @@ jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
reportInteraction: jest.fn(),
getAppEvents: () => mockEventBus,
-}));
-
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => {
- return {
- getDataSourceSrv: () => ({
- get: (ref: DataSourceRef | string) => {
- const uid = typeof ref === 'string' ? ref : ref.uid;
- if (!uid) {
- return Promise.reject();
- }
- if (dsStore[uid]) {
- return Promise.resolve(dsStore[uid]);
- }
+ getDataSourceSrv: () => ({
+ get: (ref: DataSourceRef | string) => {
+ const uid = typeof ref === 'string' ? ref : ref.uid;
+ if (!uid) {
return Promise.reject();
- },
- }),
- };
-});
+ }
+ if (dsStore[uid]) {
+ return Promise.resolve(dsStore[uid]);
+ }
+ return Promise.reject();
+ },
+ }),
+}));
const copyStringToClipboard = jest.fn();
jest.mock('app/core/utils/explore', () => ({
diff --git a/public/app/features/explore/SecondaryActions.test.tsx b/public/app/features/explore/SecondaryActions.test.tsx
index 64a1fd2a172..0f9b016df7f 100644
--- a/public/app/features/explore/SecondaryActions.test.tsx
+++ b/public/app/features/explore/SecondaryActions.test.tsx
@@ -8,15 +8,14 @@ import { QueriesDrawerContextProviderMock } from './QueriesDrawer/mocks';
import { QueryLibraryContextProviderMock } from './QueryLibrary/mocks';
import { SecondaryActions } from './SecondaryActions';
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => {
- return {
- getDataSourceSrv: () => ({
- get: () => Promise.resolve({}),
- getList: () => [],
- getInstanceSettings: () => {},
- }),
- };
-});
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
+ getDataSourceSrv: () => ({
+ get: () => Promise.resolve({}),
+ getList: () => [],
+ getInstanceSettings: () => {},
+ }),
+}));
describe('SecondaryActions', () => {
it('should render component with two buttons', () => {
diff --git a/public/app/features/expressions/ExpressionDatasource.ts b/public/app/features/expressions/ExpressionDatasource.ts
index 06d31ca6757..18d43ba08b6 100644
--- a/public/app/features/expressions/ExpressionDatasource.ts
+++ b/public/app/features/expressions/ExpressionDatasource.ts
@@ -9,7 +9,7 @@ import {
ScopedVars,
} from '@grafana/data';
import { DataSourceWithBackend, getDataSourceSrv, getTemplateSrv } from '@grafana/runtime';
-import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend';
+import { ExpressionDatasourceRef } from '@grafana/runtime/internal';
import { ExpressionQueryEditor } from './ExpressionQueryEditor';
import { ExpressionDatasourceUID, ExpressionQuery, ExpressionQueryType } from './types';
diff --git a/public/app/features/expressions/guards.ts b/public/app/features/expressions/guards.ts
index 40a61add235..fe73cf4bb9a 100644
--- a/public/app/features/expressions/guards.ts
+++ b/public/app/features/expressions/guards.ts
@@ -1,4 +1,4 @@
-import { isExpressionReference } from '@grafana/runtime/src/utils/DataSourceWithBackend';
+import { isExpressionReference } from '@grafana/runtime';
import { DataQuery } from '@grafana/schema';
import { ExpressionQuery, ExpressionQueryType, ReducerType } from './types';
diff --git a/public/app/features/gops/configuration-tracker/Analytics.ts b/public/app/features/gops/configuration-tracker/Analytics.ts
index 901c2430fca..b8e7a8ce1a9 100644
--- a/public/app/features/gops/configuration-tracker/Analytics.ts
+++ b/public/app/features/gops/configuration-tracker/Analytics.ts
@@ -1,4 +1,4 @@
-import { reportInteraction } from '@grafana/runtime/src';
+import { reportInteraction } from '@grafana/runtime';
export enum IRMInteractionNames {
ViewIRMMainPage = 'grafana_irm_configuration_tracker_main_page_view',
diff --git a/public/app/features/live/centrifuge/LiveDataStream.ts b/public/app/features/live/centrifuge/LiveDataStream.ts
index 6d0787c205f..9e1705cc804 100644
--- a/public/app/features/live/centrifuge/LiveDataStream.ts
+++ b/public/app/features/live/centrifuge/LiveDataStream.ts
@@ -13,8 +13,7 @@ import {
StreamingDataFrame,
} from '@grafana/data';
import { getStreamingFrameOptions } from '@grafana/data/internal';
-import { LiveDataStreamOptions, StreamingFrameAction, StreamingFrameOptions } from '@grafana/runtime/src/services/live';
-import { toDataQueryError } from '@grafana/runtime/src/utils/toDataQueryError';
+import { LiveDataStreamOptions, StreamingFrameAction, StreamingFrameOptions, toDataQueryError } from '@grafana/runtime';
import { StreamingResponseDataType } from '../data/utils';
diff --git a/public/app/features/live/centrifuge/service.ts b/public/app/features/live/centrifuge/service.ts
index b99a78d2f10..52194e7a120 100644
--- a/public/app/features/live/centrifuge/service.ts
+++ b/public/app/features/live/centrifuge/service.ts
@@ -16,16 +16,16 @@ import {
LiveChannelId,
toLiveChannelId,
} from '@grafana/data';
-import { FetchResponse } from '@grafana/runtime/src/services/backendSrv';
import {
+ FetchResponse,
GrafanaLiveSrv,
LiveDataStreamOptions,
LivePublishOptions,
LiveQueryDataOptions,
StreamingFrameAction,
StreamingFrameOptions,
-} from '@grafana/runtime/src/services/live';
-import { BackendDataSourceResponse } from '@grafana/runtime/src/utils/queryResponse';
+ BackendDataSourceResponse,
+} from '@grafana/runtime';
import { StreamingResponseData } from '../data/utils';
diff --git a/public/app/features/live/live.ts b/public/app/features/live/live.ts
index 43f665f5276..61c2224ffef 100644
--- a/public/app/features/live/live.ts
+++ b/public/app/features/live/live.ts
@@ -2,10 +2,7 @@ import { from, map, of, switchMap } from 'rxjs';
import { DataFrame, toLiveChannelId, StreamingDataFrame } from '@grafana/data';
import { BackendSrv, GrafanaLiveSrv, toDataQueryResponse } from '@grafana/runtime';
-import {
- standardStreamOptionsProvider,
- toStreamingDataResponse,
-} from '@grafana/runtime/src/utils/DataSourceWithBackend';
+import { standardStreamOptionsProvider, toStreamingDataResponse } from '@grafana/runtime/internal';
import { CentrifugeSrv, StreamingDataQueryResponse } from './centrifuge/service';
import { isStreamingResponseData, StreamingResponseDataType } from './data/utils';
diff --git a/public/app/features/manage-dashboards/components/ImportDashboardForm.tsx b/public/app/features/manage-dashboards/components/ImportDashboardForm.tsx
index b4f8d041b82..975bc755543 100644
--- a/public/app/features/manage-dashboards/components/ImportDashboardForm.tsx
+++ b/public/app/features/manage-dashboards/components/ImportDashboardForm.tsx
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
import { Controller, FieldErrors, UseFormReturn } from 'react-hook-form';
import { selectors } from '@grafana/e2e-selectors';
-import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend';
+import { ExpressionDatasourceRef } from '@grafana/runtime/internal';
import { Button, Field, FormFieldErrors, FormsOnSubmit, Stack, Input, Legend } from '@grafana/ui';
import { FolderPicker } from 'app/core/components/Select/FolderPicker';
import { DataSourcePicker } from 'app/features/datasources/components/picker/DataSourcePicker';
diff --git a/public/app/features/plugins/admin/components/PluginDetailsBody.tsx b/public/app/features/plugins/admin/components/PluginDetailsBody.tsx
index 6a1c3259321..bd2999a6a0b 100644
--- a/public/app/features/plugins/admin/components/PluginDetailsBody.tsx
+++ b/public/app/features/plugins/admin/components/PluginDetailsBody.tsx
@@ -3,7 +3,7 @@ import { useMemo } from 'react';
import { AppPlugin, GrafanaTheme2, PluginContextProvider, UrlQueryMap, PluginType } from '@grafana/data';
import { config } from '@grafana/runtime';
-import { PageInfoItem } from '@grafana/runtime/src/components/PluginPage';
+import { PageInfoItem } from '@grafana/runtime/internal';
import { CellProps, Column, InteractiveTable, Stack, useStyles2 } from '@grafana/ui';
import { Changelog } from '../components/Changelog';
diff --git a/public/app/features/plugins/admin/components/PluginDetailsPanel.tsx b/public/app/features/plugins/admin/components/PluginDetailsPanel.tsx
index 1421245d721..da3cc58ddaf 100644
--- a/public/app/features/plugins/admin/components/PluginDetailsPanel.tsx
+++ b/public/app/features/plugins/admin/components/PluginDetailsPanel.tsx
@@ -3,7 +3,7 @@ import { useState } from 'react';
import { GrafanaTheme2 } from '@grafana/data';
import { reportInteraction } from '@grafana/runtime';
-import { PageInfoItem } from '@grafana/runtime/src/components/PluginPage';
+import { PageInfoItem } from '@grafana/runtime/internal';
import {
Stack,
Text,
diff --git a/public/app/features/plugins/datasource_srv.ts b/public/app/features/plugins/datasource_srv.ts
index 38af02e90d6..e2688f7d4c9 100644
--- a/public/app/features/plugins/datasource_srv.ts
+++ b/public/app/features/plugins/datasource_srv.ts
@@ -17,8 +17,9 @@ import {
RuntimeDataSourceRegistration,
RuntimeDataSource,
TemplateSrv,
+ isExpressionReference,
} from '@grafana/runtime';
-import { ExpressionDatasourceRef, isExpressionReference } from '@grafana/runtime/src/utils/DataSourceWithBackend';
+import { ExpressionDatasourceRef } from '@grafana/runtime/internal';
import appEvents from 'app/core/app_events';
import config from 'app/core/config';
import {
diff --git a/public/app/features/plugins/loader/sharedDependencies.ts b/public/app/features/plugins/loader/sharedDependencies.ts
index 0551cd8d170..1bb042f6530 100644
--- a/public/app/features/plugins/loader/sharedDependencies.ts
+++ b/public/app/features/plugins/loader/sharedDependencies.ts
@@ -51,7 +51,7 @@ export const sharedDependenciesMap = {
'@grafana/data': grafanaData,
'@grafana/data/unstable': () => import('@grafana/data/unstable'),
'@grafana/runtime': grafanaRuntime,
- '@grafana/runtime/unstable': () => import('@grafana/runtime/src/unstable'),
+ '@grafana/runtime/unstable': () => import('@grafana/runtime/unstable'),
'@grafana/slate-react': () => import('slate-react'),
'@grafana/ui': grafanaUI,
'@grafana/ui/unstable': () => import('@grafana/ui/unstable'),
diff --git a/public/app/features/plugins/tests/datasource_srv.test.ts b/public/app/features/plugins/tests/datasource_srv.test.ts
index cbd8ad0c662..c23f4d9cd6b 100644
--- a/public/app/features/plugins/tests/datasource_srv.test.ts
+++ b/public/app/features/plugins/tests/datasource_srv.test.ts
@@ -11,7 +11,7 @@ import {
ScopedVars,
} from '@grafana/data';
import { RuntimeDataSource, TemplateSrv } from '@grafana/runtime';
-import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend';
+import { ExpressionDatasourceRef } from '@grafana/runtime/internal';
import { DatasourceSrv, getNameOrUid } from 'app/features/plugins/datasource_srv';
// Datasource variable $datasource with current value 'BBB'
diff --git a/public/app/features/query/components/QueryEditorRow.test.tsx b/public/app/features/query/components/QueryEditorRow.test.tsx
index 350d98bf11d..fa833710a89 100644
--- a/public/app/features/query/components/QueryEditorRow.test.tsx
+++ b/public/app/features/query/components/QueryEditorRow.test.tsx
@@ -13,15 +13,16 @@ const mockDS = mockDataSource({
name: 'test',
type: DataSourceType.Alertmanager,
});
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => {
- return {
- getDataSourceSrv: () => ({
- get: () => Promise.resolve(mockDS),
- getList: () => {},
- getInstanceSettings: () => mockDS,
- }),
- };
-});
+
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
+ getDataSourceSrv: () => ({
+ get: () => Promise.resolve(mockDS),
+ getList: () => {},
+ getInstanceSettings: () => mockDS,
+ }),
+}));
+
// Draggable fails to render in tests, so we mock it out
jest.mock('app/core/components/QueryOperationRow/QueryOperationRow', () => ({
QueryOperationRow: (props: PropsWithChildren) => {props.children}
,
diff --git a/public/app/features/query/components/QueryEditorRowHeader.test.tsx b/public/app/features/query/components/QueryEditorRowHeader.test.tsx
index b41298548c6..809a39021b6 100644
--- a/public/app/features/query/components/QueryEditorRowHeader.test.tsx
+++ b/public/app/features/query/components/QueryEditorRowHeader.test.tsx
@@ -18,15 +18,14 @@ const mockVariable = mockDataSource({
type: 'datasource',
});
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => {
- return {
- getDataSourceSrv: () => ({
- get: () => Promise.resolve(mockDS),
- getList: ({ variables }: { variables: boolean }) => (variables ? [mockDS, mockVariable] : [mockDS]),
- getInstanceSettings: () => mockDS,
- }),
- };
-});
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
+ getDataSourceSrv: () => ({
+ get: () => Promise.resolve(mockDS),
+ getList: ({ variables }: { variables: boolean }) => (variables ? [mockDS, mockVariable] : [mockDS]),
+ getInstanceSettings: () => mockDS,
+ }),
+}));
describe('QueryEditorRowHeader', () => {
it('Can edit title', async () => {
diff --git a/public/app/features/query/components/QueryEditorRows.test.tsx b/public/app/features/query/components/QueryEditorRows.test.tsx
index 1724928aeee..ccd59519f3e 100644
--- a/public/app/features/query/components/QueryEditorRows.test.tsx
+++ b/public/app/features/query/components/QueryEditorRows.test.tsx
@@ -17,22 +17,21 @@ const mockVariable = mockDataSource({
type: 'datasource',
});
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => {
- return {
- getDataSourceSrv: () => ({
- get: () => Promise.resolve({ ...mockDS, getRef: () => {} }),
- getList: ({ variables }: { variables: boolean }) => (variables ? [mockDS, mockVariable] : [mockDS]),
- getInstanceSettings: () => ({
- ...mockDS,
- meta: {
- ...mockDS.meta,
- alerting: true,
- mixed: true,
- },
- }),
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
+ getDataSourceSrv: () => ({
+ get: () => Promise.resolve({ ...mockDS, getRef: () => {} }),
+ getList: ({ variables }: { variables: boolean }) => (variables ? [mockDS, mockVariable] : [mockDS]),
+ getInstanceSettings: () => ({
+ ...mockDS,
+ meta: {
+ ...mockDS.meta,
+ alerting: true,
+ mixed: true,
+ },
}),
- };
-});
+ }),
+}));
const props: Props = {
queries: [
@@ -58,15 +57,14 @@ const props: Props = {
data: createMockPanelData(),
};
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => {
- return {
- getDataSourceSrv: () => ({
- get: () => Promise.resolve(mockDS),
- getList: ({ variables }: { variables: boolean }) => (variables ? [mockDS, mockVariable] : [mockDS]),
- getInstanceSettings: () => mockDS,
- }),
- };
-});
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
+ getDataSourceSrv: () => ({
+ get: () => Promise.resolve(mockDS),
+ getList: ({ variables }: { variables: boolean }) => (variables ? [mockDS, mockVariable] : [mockDS]),
+ getInstanceSettings: () => mockDS,
+ }),
+}));
describe('QueryEditorRows', () => {
it('Should render queries', async () => {
diff --git a/public/app/features/query/components/QueryGroup.test.tsx b/public/app/features/query/components/QueryGroup.test.tsx
index 6d9423247b8..58e4d7e0420 100644
--- a/public/app/features/query/components/QueryGroup.test.tsx
+++ b/public/app/features/query/components/QueryGroup.test.tsx
@@ -19,22 +19,21 @@ const mockVariable = mockDataSource({
type: 'datasource',
});
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => {
- return {
- getDataSourceSrv: () => ({
- get: () => Promise.resolve({ ...mockDS, getRef: () => {} }),
- getList: ({ variables }: { variables: boolean }) => (variables ? [mockDS, mockVariable] : [mockDS]),
- getInstanceSettings: () => ({
- ...mockDS,
- meta: {
- ...mockDS.meta,
- alerting: true,
- mixed: true,
- },
- }),
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
+ getDataSourceSrv: () => ({
+ get: () => Promise.resolve({ ...mockDS, getRef: () => {} }),
+ getList: ({ variables }: { variables: boolean }) => (variables ? [mockDS, mockVariable] : [mockDS]),
+ getInstanceSettings: () => ({
+ ...mockDS,
+ meta: {
+ ...mockDS.meta,
+ alerting: true,
+ mixed: true,
+ },
}),
- };
-});
+ }),
+}));
describe('QueryGroup', () => {
// QueryGroup relies on this being present
diff --git a/public/app/features/query/state/PanelQueryRunner.ts b/public/app/features/query/state/PanelQueryRunner.ts
index 12a4613978c..9a4f70c0b99 100644
--- a/public/app/features/query/state/PanelQueryRunner.ts
+++ b/public/app/features/query/state/PanelQueryRunner.ts
@@ -31,7 +31,7 @@ import {
DataTopic,
} from '@grafana/data';
import { toDataQueryError } from '@grafana/runtime';
-import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend';
+import { ExpressionDatasourceRef } from '@grafana/runtime/internal';
import { isStreamingDataFrame } from 'app/features/live/data/utils';
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
import { getTemplateSrv } from 'app/features/templating/template_srv';
diff --git a/public/app/features/query/state/runRequest.test.ts b/public/app/features/query/state/runRequest.test.ts
index 753a219e432..f7620c9b965 100644
--- a/public/app/features/query/state/runRequest.test.ts
+++ b/public/app/features/query/state/runRequest.test.ts
@@ -12,7 +12,7 @@ import {
PanelData,
} from '@grafana/data';
import { setEchoSrv } from '@grafana/runtime';
-import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend';
+import { ExpressionDatasourceRef } from '@grafana/runtime/internal';
import { DataQuery } from '@grafana/schema';
import { deepFreeze } from '../../../../test/core/redux/reducerTester';
diff --git a/public/app/features/query/state/runRequest.ts b/public/app/features/query/state/runRequest.ts
index 7c366852c3d..4ad059433f4 100644
--- a/public/app/features/query/state/runRequest.ts
+++ b/public/app/features/query/state/runRequest.ts
@@ -18,8 +18,7 @@ import {
PanelData,
TimeRange,
} from '@grafana/data';
-import { config, isMigrationHandler, migrateRequest, toDataQueryError } from '@grafana/runtime';
-import { isExpressionReference } from '@grafana/runtime/src/utils/DataSourceWithBackend';
+import { config, isMigrationHandler, migrateRequest, toDataQueryError, isExpressionReference } from '@grafana/runtime';
import { backendSrv } from 'app/core/services/backend_srv';
import { queryIsEmpty } from 'app/core/utils/query';
import { dataSource as expressionDatasource } from 'app/features/expressions/ExpressionDatasource';
diff --git a/public/app/features/query/state/updateQueries.test.ts b/public/app/features/query/state/updateQueries.test.ts
index f213f75a420..b1a312f51ed 100644
--- a/public/app/features/query/state/updateQueries.test.ts
+++ b/public/app/features/query/state/updateQueries.test.ts
@@ -1,5 +1,5 @@
import { DataSourceApi, DataSourceWithQueryExportSupport, DataSourceWithQueryImportSupport } from '@grafana/data';
-import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend';
+import { ExpressionDatasourceRef } from '@grafana/runtime/internal';
import { DataQuery } from '@grafana/schema';
import { TestQuery } from 'app/core/utils/query.test';
import { TemplateSrv } from 'app/features/templating/template_srv';
diff --git a/public/app/features/query/state/updateQueries.ts b/public/app/features/query/state/updateQueries.ts
index f19030e6fd4..d06958a39b1 100644
--- a/public/app/features/query/state/updateQueries.ts
+++ b/public/app/features/query/state/updateQueries.ts
@@ -1,6 +1,5 @@
import { CoreApp, DataSourceApi, getNextRefId, hasQueryExportSupport, hasQueryImportSupport } from '@grafana/data';
-import { getTemplateSrv } from '@grafana/runtime';
-import { isExpressionReference } from '@grafana/runtime/src/utils/DataSourceWithBackend';
+import { getTemplateSrv, isExpressionReference } from '@grafana/runtime';
import { DataQuery } from '@grafana/schema';
export async function updateQueries(
diff --git a/public/app/features/transformers/editors/FilterByNameTransformerEditor.tsx b/public/app/features/transformers/editors/FilterByNameTransformerEditor.tsx
index 52df4e66431..797e0b4c0fa 100644
--- a/public/app/features/transformers/editors/FilterByNameTransformerEditor.tsx
+++ b/public/app/features/transformers/editors/FilterByNameTransformerEditor.tsx
@@ -12,7 +12,7 @@ import {
SelectableValue,
} from '@grafana/data';
import { FilterFieldsByNameTransformerOptions } from '@grafana/data/internal';
-import { getTemplateSrv } from '@grafana/runtime/src/services';
+import { getTemplateSrv } from '@grafana/runtime';
import { Input, FilterPill, InlineFieldRow, InlineField, InlineSwitch, Select } from '@grafana/ui';
import { t } from 'app/core/internationalization';
diff --git a/public/app/features/variables/query/QueryVariableEditor.test.tsx b/public/app/features/variables/query/QueryVariableEditor.test.tsx
index 01e51aaf132..0322a73b048 100644
--- a/public/app/features/variables/query/QueryVariableEditor.test.tsx
+++ b/public/app/features/variables/query/QueryVariableEditor.test.tsx
@@ -51,15 +51,14 @@ const setupTestContext = async (options: Partial) => {
return { rerender, props };
};
-jest.mock('@grafana/runtime/src/services/dataSourceSrv', () => {
- return {
- getDataSourceSrv: () => ({
- get: async () => ds,
- getList: () => [mockDS],
- getInstanceSettings: () => mockDS,
- }),
- };
-});
+jest.mock('@grafana/runtime', () => ({
+ ...jest.requireActual('@grafana/runtime'),
+ getDataSourceSrv: () => ({
+ get: async () => ds,
+ getList: () => [mockDS],
+ getInstanceSettings: () => mockDS,
+ }),
+}));
const defaultIdentifier: KeyedVariableIdentifier = { type: 'query', rootStateKey: 'key', id: NEW_VARIABLE_ID };
diff --git a/public/app/features/variables/state/initVariableTransaction.test.ts b/public/app/features/variables/state/initVariableTransaction.test.ts
index 0e9c0070023..572751a2fd0 100644
--- a/public/app/features/variables/state/initVariableTransaction.test.ts
+++ b/public/app/features/variables/state/initVariableTransaction.test.ts
@@ -1,5 +1,5 @@
import { DataSourceRef, LoadingState } from '@grafana/data';
-import { setDataSourceSrv } from '@grafana/runtime/src';
+import { setDataSourceSrv } from '@grafana/runtime';
import { DashboardModel } from 'app/features/dashboard/state/DashboardModel';
import { reduxTester } from '../../../../test/core/redux/reduxTester';
diff --git a/public/app/plugins/datasource/influxdb/components/editor/query/flux/FluxQueryEditor.tsx b/public/app/plugins/datasource/influxdb/components/editor/query/flux/FluxQueryEditor.tsx
index daedc65855e..7bf4a6be800 100644
--- a/public/app/plugins/datasource/influxdb/components/editor/query/flux/FluxQueryEditor.tsx
+++ b/public/app/plugins/datasource/influxdb/components/editor/query/flux/FluxQueryEditor.tsx
@@ -2,7 +2,7 @@ import { css, cx } from '@emotion/css';
import { PureComponent } from 'react';
import { GrafanaTheme2, SelectableValue } from '@grafana/data';
-import { getTemplateSrv } from '@grafana/runtime/src';
+import { getTemplateSrv } from '@grafana/runtime';
import {
CodeEditor,
CodeEditorSuggestionItem,
diff --git a/public/app/plugins/datasource/influxdb/components/editor/query/influxql/utils/getTemplateVariableOptions.ts b/public/app/plugins/datasource/influxdb/components/editor/query/influxql/utils/getTemplateVariableOptions.ts
index b3e9860798e..7648b5a9ee8 100644
--- a/public/app/plugins/datasource/influxdb/components/editor/query/influxql/utils/getTemplateVariableOptions.ts
+++ b/public/app/plugins/datasource/influxdb/components/editor/query/influxql/utils/getTemplateVariableOptions.ts
@@ -1,5 +1,5 @@
import { TypedVariableModel } from '@grafana/data';
-import { getTemplateSrv } from '@grafana/runtime/src';
+import { getTemplateSrv } from '@grafana/runtime';
export function getTemplateVariableOptions(wrapper: (v: TypedVariableModel) => string) {
return (
diff --git a/public/app/plugins/panel/canvas/CanvasPanel.tsx b/public/app/plugins/panel/canvas/CanvasPanel.tsx
index 4db38108706..10f43819839 100644
--- a/public/app/plugins/panel/canvas/CanvasPanel.tsx
+++ b/public/app/plugins/panel/canvas/CanvasPanel.tsx
@@ -3,7 +3,7 @@ import * as React from 'react';
import { ReplaySubject, Subscription } from 'rxjs';
import { PanelProps } from '@grafana/data';
-import { locationService } from '@grafana/runtime/src';
+import { locationService } from '@grafana/runtime';
import { PanelContext, PanelContextRoot } from '@grafana/ui';
import { CanvasFrameOptions } from 'app/features/canvas/frame';
import { ElementState } from 'app/features/canvas/runtime/element';
diff --git a/public/app/plugins/panel/geomap/utils/layers.ts b/public/app/plugins/panel/geomap/utils/layers.ts
index c1bf439f9d0..8c20a95ad0f 100644
--- a/public/app/plugins/panel/geomap/utils/layers.ts
+++ b/public/app/plugins/panel/geomap/utils/layers.ts
@@ -5,7 +5,7 @@ import WebGLPointsLayer from 'ol/layer/WebGLPoints';
import { Subject } from 'rxjs';
import { getFrameMatchers, MapLayerHandler, MapLayerOptions, PanelData, textUtil } from '@grafana/data';
-import { config } from '@grafana/runtime/src';
+import { config } from '@grafana/runtime';
import { GeomapPanel } from '../GeomapPanel';
import { MARKERS_LAYER_ID } from '../layers/data/markersLayer';
diff --git a/scripts/prepare-npm-package.js b/scripts/prepare-npm-package.js
index 212b4f89487..bfbdfcd20b2 100644
--- a/scripts/prepare-npm-package.js
+++ b/scripts/prepare-npm-package.js
@@ -57,7 +57,7 @@ try {
},
require: {
types: cjsTypes.replace('index', aliasName),
- default: cjsTypes.replace('index', aliasName),
+ default: cjsIndex.replace('index', aliasName),
},
},
},