support cross package import @mata-io/runtime

This commit is contained in:
Bowen Tan 2021-09-23 15:49:19 +08:00
parent 0546d60a2f
commit 92a11a1458
7 changed files with 25 additions and 10 deletions

View File

@ -6,7 +6,7 @@
"homepage": "https://github.com/webzard-io/meta-ui#readme",
"license": "MIT",
"module": "lib/index.js",
"typings": "typings/index.d.ts",
"types": "lib/index.d.ts",
"directories": {
"lib": "lib",
"test": "__tests__"
@ -20,7 +20,7 @@
},
"scripts": {
"build": "tsc -b .",
"typings": "tsc -d --emitDeclarationOnly --declarationDir typings",
"typings": "tsc -d",
"test": "jest",
"lint": "eslint src --ext .ts",
"prepublish": "npm run build && npm run typings"

View File

@ -1,6 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { App } from '@meta-ui/runtime';
import { App } from './metaUI';
import { DialogFormSchema } from './constants';
export default function renderApp() {

View File

@ -0,0 +1,7 @@
import { InitMetaUI } from '@meta-ui/runtime';
const metaUI = InitMetaUI();
export const App = metaUI.App;
export const registry = metaUI.registry;
export const stateStore = metaUI.stateStore;

View File

@ -5,7 +5,7 @@
"dev": "vite",
"test": "jest",
"build": "tsc -b .",
"typings": "tsc -d --emitDeclarationOnly --declarationDir typings",
"typings": "tsc -d",
"lint": "eslint src --ext .ts",
"prepublish": "npm run build && npm run typings"
},
@ -13,7 +13,7 @@
"lib"
],
"module": "lib/index.js",
"typings": "typings/index.d.ts",
"types": "lib/index.d.ts",
"dependencies": {
"@chakra-ui/react": "^1.6.5",
"@emotion/react": "^11",

View File

@ -1,3 +1,11 @@
export * from './App';
export * from './api-service';
export * from './store';
import { stateStore } from './store';
import { App } from './App';
import { registry } from './registry';
export function InitMetaUI() {
return {
App,
stateStore,
registry,
};
}

View File

@ -97,7 +97,7 @@ export type TraitImplementation<T = any> = (
}
) => TraitResult;
class Registry {
export class Registry {
components: Map<string, Map<string, ImplementedRuntimeComponent>> = new Map();
traits: Map<string, Map<string, ImplementedRuntimeTrait>> = new Map();

View File

@ -1,5 +1,5 @@
import { RuntimeApplication } from '@meta-ui/core';
import { TSchema } from '@sinclair/typebox';
import { RuntimeApplication } from '../../../core/typings';
import { registry } from '../registry';
import { stateStore } from '../store';
import { parseTypeBox } from './parseTypeBox';