Frontend: Expose unstable entrypoints for data and runtime (#101547)
* feat(grafana-data): introduce unstable entrypoint to package * feat(grafana-runtime): introduce unstable entrypoint to package * feat(plugins): expose unstable entrypoints for data and runtime to plugins * feat(packages): dummy exports so package verification and shared deps imports work
This commit is contained in:
@@ -29,10 +29,10 @@
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc -p ./tsconfig.build.json && rollup -c rollup.config.ts --configPlugin esbuild",
|
||||
"clean": "rimraf ./dist ./compiled ./package.tgz",
|
||||
"clean": "rimraf ./dist ./compiled ./unstable ./package.tgz",
|
||||
"typecheck": "tsc --emitDeclarationOnly false --noEmit",
|
||||
"prepack": "cp package.json package.json.bak && node ../../scripts/prepare-npm-package.js",
|
||||
"postpack": "mv package.json.bak package.json"
|
||||
"prepack": "cp package.json package.json.bak && ALIAS_PACKAGE_NAME=unstable node ../../scripts/prepare-npm-package.js",
|
||||
"postpack": "mv package.json.bak package.json && rimraf ./unstable"
|
||||
},
|
||||
"dependencies": {
|
||||
"@braintree/sanitize-url": "7.0.1",
|
||||
|
||||
@@ -11,5 +11,23 @@ export default [
|
||||
plugins,
|
||||
output: [cjsOutput(pkg), esmOutput(pkg, 'grafana-data')],
|
||||
},
|
||||
{
|
||||
input: 'src/unstable.ts',
|
||||
plugins,
|
||||
output: [cjsOutput(pkg), esmOutput(pkg, 'grafana-data')],
|
||||
},
|
||||
tsDeclarationOutput(pkg),
|
||||
tsDeclarationOutput(pkg, {
|
||||
input: './compiled/unstable.d.ts',
|
||||
output: [
|
||||
{
|
||||
file: './dist/cjs/unstable.d.cts',
|
||||
format: 'cjs',
|
||||
},
|
||||
{
|
||||
file: './dist/esm/unstable.d.mts',
|
||||
format: 'es',
|
||||
},
|
||||
],
|
||||
}),
|
||||
];
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* THESE APIS MUST NOT BE USED IN COMMUNITY PLUGINS.
|
||||
*
|
||||
* Unstable APIs are still in development and are subject to breaking changes
|
||||
* at any point, like feature flags but for APIS. They must only be used in
|
||||
* Grafana core and internal plugins where we can coordinate changes.
|
||||
*
|
||||
* Once mature, they will be moved to the main export, be available to plugins via the standard import path,
|
||||
* and be subject to the standard policies
|
||||
*/
|
||||
|
||||
// This is a dummy export so typescript doesn't error importing an "empty module"
|
||||
export const unstable = {};
|
||||
@@ -31,10 +31,10 @@
|
||||
"scripts": {
|
||||
"build": "tsc -p ./tsconfig.build.json && rollup -c rollup.config.ts --configPlugin esbuild",
|
||||
"bundle": "rollup -c rollup.config.ts --configPlugin esbuild",
|
||||
"clean": "rimraf ./dist ./compiled ./package.tgz",
|
||||
"clean": "rimraf ./dist ./compiled ./unstable ./package.tgz",
|
||||
"typecheck": "tsc --emitDeclarationOnly false --noEmit",
|
||||
"prepack": "cp package.json package.json.bak && node ../../scripts/prepare-npm-package.js",
|
||||
"postpack": "mv package.json.bak package.json"
|
||||
"prepack": "cp package.json package.json.bak && ALIAS_PACKAGE_NAME=unstable node ../../scripts/prepare-npm-package.js",
|
||||
"postpack": "mv package.json.bak package.json && rimraf ./unstable"
|
||||
},
|
||||
"dependencies": {
|
||||
"@grafana/data": "11.6.0-pre",
|
||||
|
||||
@@ -11,5 +11,23 @@ export default [
|
||||
plugins,
|
||||
output: [cjsOutput(pkg), esmOutput(pkg, 'grafana-runtime')],
|
||||
},
|
||||
{
|
||||
input: 'src/unstable.ts',
|
||||
plugins,
|
||||
output: [cjsOutput(pkg), esmOutput(pkg, 'grafana-runtime')],
|
||||
},
|
||||
tsDeclarationOutput(pkg),
|
||||
tsDeclarationOutput(pkg, {
|
||||
input: './compiled/unstable.d.ts',
|
||||
output: [
|
||||
{
|
||||
file: './dist/cjs/unstable.d.cts',
|
||||
format: 'cjs',
|
||||
},
|
||||
{
|
||||
file: './dist/esm/unstable.d.mts',
|
||||
format: 'es',
|
||||
},
|
||||
],
|
||||
}),
|
||||
];
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* THESE APIS MUST NOT BE USED IN COMMUNITY PLUGINS.
|
||||
*
|
||||
* Unstable APIs are still in development and are subject to breaking changes
|
||||
* at any point, like feature flags but for APIS. They must only be used in
|
||||
* Grafana core and internal plugins where we can coordinate changes.
|
||||
*
|
||||
* Once mature, they will be moved to the main export, be available to plugins via the standard import path,
|
||||
* and be subject to the standard policies
|
||||
*/
|
||||
|
||||
// This is a dummy export so typescript doesn't error importing an "empty module"
|
||||
export const unstable = {};
|
||||
@@ -49,7 +49,9 @@ export const sharedDependenciesMap = {
|
||||
'@emotion/css': () => import('@emotion/css'),
|
||||
'@emotion/react': () => import('@emotion/react'),
|
||||
'@grafana/data': grafanaData,
|
||||
'@grafana/data/unstable': () => import('@grafana/data/src/unstable'),
|
||||
'@grafana/runtime': grafanaRuntime,
|
||||
'@grafana/runtime/unstable': () => import('@grafana/runtime/src/unstable'),
|
||||
'@grafana/slate-react': () => import('slate-react'),
|
||||
'@grafana/ui': grafanaUI,
|
||||
'@grafana/ui/unstable': () => import('@grafana/ui/src/unstable'),
|
||||
|
||||
Reference in New Issue
Block a user