core-api: move extension and component data utils into extensions/
Co-authored-by: blam <ben@blam.sh>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2020 Spotify AB
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export { attachComponentData, getComponentData } from './componentData';
|
||||
export {
|
||||
createReactExtension,
|
||||
createRoutableExtension,
|
||||
createComponentExtension,
|
||||
} from './extensions';
|
||||
@@ -20,7 +20,7 @@ import { createPlugin } from '../plugin';
|
||||
import {
|
||||
createRoutableExtension,
|
||||
createComponentExtension,
|
||||
} from '../lib/extensions';
|
||||
} from '../extensions';
|
||||
import { MemoryRouter, Routes, Route } from 'react-router-dom';
|
||||
import { collectPlugins } from './collection';
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
import React, { isValidElement, ReactNode } from 'react';
|
||||
import { BackstagePlugin } from './types';
|
||||
import { getComponentData } from '../lib/componentData';
|
||||
import { getComponentData } from '../extensions';
|
||||
|
||||
export const collectPlugins = (tree: ReactNode) => {
|
||||
const plugins = new Set<BackstagePlugin>();
|
||||
|
||||
@@ -18,7 +18,7 @@ import React, { PropsWithChildren } from 'react';
|
||||
import { collectRoutes, collectRouteParents } from './discovery';
|
||||
import { createRouteRef } from './RouteRef';
|
||||
import { createPlugin } from '../plugin';
|
||||
import { createRoutableExtension } from '../lib/extensions';
|
||||
import { createRoutableExtension } from '../extensions';
|
||||
import { MemoryRouter, Routes, Route } from 'react-router-dom';
|
||||
|
||||
const mockConfig = () => ({ path: '/foo', title: 'Foo' });
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import React, { isValidElement, ReactNode } from 'react';
|
||||
import { RouteRef } from './types';
|
||||
import { getComponentData } from '../lib/componentData';
|
||||
import { getComponentData } from '../extensions';
|
||||
|
||||
export const collectRoutes = (tree: ReactNode) => {
|
||||
const treeMap = new Map<RouteRef, string>();
|
||||
|
||||
Reference in New Issue
Block a user