build(editor): 由于生成.d文件无法将别名转化成真实路径,暂时将@editor改回相对路径

This commit is contained in:
roymondchen 2022-08-05 20:09:27 +08:00 committed by jia000
parent 5e36ca8e47
commit 08dae20aa0
35 changed files with 79 additions and 85 deletions

View File

@ -51,19 +51,19 @@ import type { MApp, MNode } from '@tmagic/schema';
import type StageCore from '@tmagic/stage';
import { CONTAINER_HIGHLIGHT_CLASS, MoveableOptions } from '@tmagic/stage';
import Framework from '@editor/layouts/Framework.vue';
import NavMenu from '@editor/layouts/NavMenu.vue';
import PropsPanel from '@editor/layouts/PropsPanel.vue';
import Sidebar from '@editor/layouts/sidebar/Sidebar.vue';
import Workspace from '@editor/layouts/workspace/Workspace.vue';
import componentListService from '@editor/services/componentList';
import editorService from '@editor/services/editor';
import eventsService from '@editor/services/events';
import historyService from '@editor/services/history';
import propsService from '@editor/services/props';
import storageService from '@editor/services/storage';
import uiService from '@editor/services/ui';
import type { ComponentGroup, MenuBarData, MenuItem, Services, SideBarData, StageRect } from '@editor/type';
import Framework from './layouts/Framework.vue';
import NavMenu from './layouts/NavMenu.vue';
import PropsPanel from './layouts/PropsPanel.vue';
import Sidebar from './layouts/sidebar/Sidebar.vue';
import Workspace from './layouts/workspace/Workspace.vue';
import componentListService from './services/componentList';
import editorService from './services/editor';
import eventsService from './services/events';
import historyService from './services/history';
import propsService from './services/props';
import storageService from './services/storage';
import uiService from './services/ui';
import type { ComponentGroup, MenuBarData, MenuItem, Services, SideBarData, StageRect } from './type';
export default defineComponent({
name: 'm-editor',

View File

@ -25,7 +25,7 @@
<script lang="ts" setup>
import { nextTick, onMounted, onUnmounted, ref } from 'vue';
import { MenuButton, MenuItem } from '@editor/type';
import { MenuButton, MenuItem } from '../type';
import ToolButton from './ToolButton.vue';

View File

@ -9,7 +9,7 @@
<script lang="ts">
import { computed, defineComponent, onMounted, onUnmounted, ref, watch } from 'vue';
import { ScrollViewer } from '@editor/utils/scroll-viewer';
import { ScrollViewer } from '../utils/scroll-viewer';
export default defineComponent({
name: 'm-editor-scroll-viewer',

View File

@ -56,8 +56,8 @@ import { ArrowDown, Back, Delete, Grid, Right, ScaleToOriginal, ZoomIn, ZoomOut
import { NodeType } from '@tmagic/schema';
import MIcon from '@editor/components/Icon.vue';
import type { MenuButton, MenuComponent, MenuItem, Services } from '@editor/type';
import MIcon from '../components/Icon.vue';
import type { MenuButton, MenuComponent, MenuItem, Services } from '../type';
const props = defineProps({
data: {

View File

@ -18,7 +18,7 @@ import { Close, Delete } from '@element-plus/icons-vue';
import { FormState } from '@tmagic/form';
import { Services } from '@editor/type';
import { Services } from '../type';
const props = defineProps<{
labelWidth: string;

View File

@ -17,8 +17,8 @@ import { Plus } from '@element-plus/icons-vue';
import { NodeType } from '@tmagic/schema';
import type { Services } from '@editor/type';
import { generatePageNameByApp } from '@editor/utils';
import type { Services } from '../type';
import { generatePageNameByApp } from '../utils';
export default defineComponent({
components: { Plus },

View File

@ -43,7 +43,7 @@ import { computed, defineComponent, inject } from 'vue';
import type { MApp } from '@tmagic/schema';
import { GetColumnWidth, Services } from '@editor/type';
import { GetColumnWidth, Services } from '../type';
import AddPageBox from './AddPageBox.vue';
import Resizer from './Resizer.vue';

View File

@ -9,8 +9,8 @@
<script lang="ts">
import { computed, defineComponent, inject, PropType } from 'vue';
import ToolButton from '@editor/components/ToolButton.vue';
import { GetColumnWidth, MenuBarData, Services } from '@editor/type';
import ToolButton from '../components/ToolButton.vue';
import { GetColumnWidth, MenuBarData, Services } from '../type';
export default defineComponent({
name: 'nav-menu',

View File

@ -20,7 +20,7 @@ import { ElMessage } from 'element-plus';
import type { FormValue, MForm } from '@tmagic/form';
import type { MNode } from '@tmagic/schema';
import type { Services } from '@editor/type';
import type { Services } from '../type';
export default defineComponent({
name: 'm-editor-props-panel',

View File

@ -8,7 +8,7 @@
import { defineComponent, inject, onMounted, onUnmounted, ref, toRaw } from 'vue';
import Gesto from 'gesto';
import { Services } from '@editor/type';
import { Services } from '../type';
export default defineComponent({
name: 'm-editor-resize',

View File

@ -43,8 +43,8 @@ import serialize from 'serialize-javascript';
import type StageCore from '@tmagic/stage';
import { removeClassNameByClassName } from '@tmagic/utils';
import MIcon from '@editor/components/Icon.vue';
import type { ComponentGroup, ComponentItem, Services, StageOptions } from '@editor/type';
import MIcon from '../../components/Icon.vue';
import type { ComponentGroup, ComponentItem, Services, StageOptions } from '../../type';
export default defineComponent({
name: 'ui-component-panel',

View File

@ -8,8 +8,8 @@ import { Delete, DocumentCopy, Files, Plus } from '@element-plus/icons-vue';
import { NodeType } from '@tmagic/schema';
import ContentMenu from '@editor/components/ContentMenu.vue';
import type { ComponentGroup, MenuButton, MenuItem, Services } from '@editor/type';
import ContentMenu from '../../components/ContentMenu.vue';
import type { ComponentGroup, MenuButton, MenuItem, Services } from '../../type';
export default defineComponent({
components: { ContentMenu },

View File

@ -64,9 +64,9 @@ import type { MNode, MPage } from '@tmagic/schema';
import { MContainer, NodeType } from '@tmagic/schema';
import StageCore from '@tmagic/stage';
import type { EditorService } from '@editor/services/editor';
import type { Services } from '@editor/type';
import { Layout } from '@editor/type';
import type { EditorService } from '../../services/editor';
import type { Services } from '../../type';
import { Layout } from '../../type';
import LayerMenu from './LayerMenu.vue';

View File

@ -21,7 +21,7 @@
<script lang="ts">
import { defineComponent, PropType, ref, watch } from 'vue';
import { SideBarData } from '@editor/type';
import { SideBarData } from '../../type';
import TabPane from './TabPane.vue';

View File

@ -29,8 +29,8 @@
import { computed, defineComponent, PropType } from 'vue';
import { Coin, Files } from '@element-plus/icons-vue';
import MIcon from '@editor/components/Icon.vue';
import { SideComponent, SideItem } from '@editor/type';
import MIcon from '../../components/Icon.vue';
import { SideComponent, SideItem } from '../../type';
import ComponentListPanel from './ComponentListPanel.vue';
import LayerPanel from './LayerPanel.vue';

View File

@ -77,9 +77,9 @@ import { ArrowLeftBold, ArrowRightBold, CaretBottom, Delete, DocumentCopy, Plus
import type { MApp, MPage } from '@tmagic/schema';
import { NodeType } from '@tmagic/schema';
import ToolButton from '@editor/components/ToolButton.vue';
import type { Services } from '@editor/type';
import { generatePageNameByApp } from '@editor/utils/editor';
import ToolButton from '../../components/ToolButton.vue';
import type { Services } from '../../type';
import { generatePageNameByApp } from '../../utils/editor';
const useScroll = (root: ComputedRef<MApp | undefined>) => {
const pageBar = ref<HTMLDivElement>();

View File

@ -34,7 +34,7 @@ import StageCore, {
UpdateEventData,
} from '@tmagic/stage';
import ScrollViewer from '@editor/components/ScrollViewer.vue';
import ScrollViewer from '../../components/ScrollViewer.vue';
import {
H_GUIDE_LINE_STORAGE_KEY,
Layout,
@ -42,8 +42,8 @@ import {
StageOptions,
StageRect,
V_GUIDE_LINE_STORAGE_KEY,
} from '@editor/type';
import { getGuideLineFromCache } from '@editor/utils';
} from '../../type';
import { getGuideLineFromCache } from '../../utils';
import ViewerMenu from './ViewerMenu.vue';

View File

@ -10,10 +10,10 @@ import { MNode, NodeType } from '@tmagic/schema';
import StageCore from '@tmagic/stage';
import { isPage } from '@tmagic/utils';
import ContentMenu from '@editor/components/ContentMenu.vue';
import storageService from '@editor/services/storage';
import { LayerOffset, Layout, MenuItem, Services } from '@editor/type';
import { COPY_STORAGE_KEY } from '@editor/utils/editor';
import ContentMenu from '../../components/ContentMenu.vue';
import storageService from '../../services/storage';
import { LayerOffset, Layout, MenuItem, Services } from '../../type';
import { COPY_STORAGE_KEY } from '../../utils/editor';
const props = withDefaults(defineProps<{ isMultiSelect?: boolean }>(), { isMultiSelect: false });

View File

@ -18,7 +18,7 @@ import KeyController from 'keycon';
import type { MNode, MPage } from '@tmagic/schema';
import { isPage } from '@tmagic/utils';
import type { Services } from '@editor/type';
import type { Services } from '../../type';
import PageBar from './PageBar.vue';
import MagicStage from './Stage.vue';

View File

@ -18,7 +18,7 @@
import { EventEmitter } from 'events';
import { compose } from '@editor/utils/compose';
import { compose } from '../utils/compose';
const methodName = (prefix: string, name: string) => `${prefix}${name[0].toUpperCase()}${name.substring(1)}`;

View File

@ -18,7 +18,7 @@
import { reactive } from 'vue';
import type { ComponentGroup, ComponentGroupState } from '@editor/type';
import type { ComponentGroup, ComponentGroupState } from '../type';
import BaseService from './BaseService';

View File

@ -24,10 +24,10 @@ import { NodeType } from '@tmagic/schema';
import StageCore from '@tmagic/stage';
import { getNodePath, isNumber, isPage, isPop } from '@tmagic/utils';
import historyService, { StepValue } from '@editor/services/history';
import storageService, { Protocol } from '@editor/services/storage';
import type { AddMNode, EditorNodeInfo, PastePosition, StoreState } from '@editor/type';
import { LayerOffset, Layout } from '@editor/type';
import historyService, { StepValue } from '../services/history';
import storageService, { Protocol } from '../services/storage';
import type { AddMNode, EditorNodeInfo, PastePosition, StoreState } from '../type';
import { LayerOffset, Layout } from '../type';
import {
change2Fixed,
COPY_STORAGE_KEY,
@ -36,8 +36,8 @@ import {
getNodeIndex,
isFixed,
setLayout,
} from '@editor/utils/editor';
import { beforeAdd, beforePaste, beforeRemove, notifyAddToStage } from '@editor/utils/operator';
} from '../utils/editor';
import { beforeAdd, beforePaste, beforeRemove, notifyAddToStage } from '../utils/operator';
import BaseService from './BaseService';

View File

@ -22,7 +22,7 @@ import { cloneDeep } from 'lodash-es';
import { DEFAULT_EVENTS, DEFAULT_METHODS, EventOption } from '@tmagic/core';
import { toLine } from '@tmagic/utils';
import type { ComponentGroup } from '@editor/type';
import type { ComponentGroup } from '../type';
import BaseService from './BaseService';

View File

@ -20,7 +20,7 @@ import { reactive } from 'vue';
import type { Id, MPage } from '@tmagic/schema';
import { UndoRedo } from '@editor/utils/undo-redo';
import { UndoRedo } from '../utils/undo-redo';
import BaseService from './BaseService';

View File

@ -24,8 +24,8 @@ import type { Id, MComponent, MNode, MPage } from '@tmagic/schema';
import { NodeType } from '@tmagic/schema';
import { isPop, toLine } from '@tmagic/utils';
import type { PropsState } from '@editor/type';
import { DEFAULT_CONFIG, fillConfig } from '@editor/utils/props';
import type { PropsState } from '../type';
import { DEFAULT_CONFIG, fillConfig } from '../utils/props';
import BaseService from './BaseService';

View File

@ -20,8 +20,8 @@ import { reactive, toRaw } from 'vue';
import type StageCore from '@tmagic/stage';
import editorService from '@editor/services/editor';
import type { GetColumnWidth, SetColumnWidth, StageRect, UiState } from '@editor/type';
import editorService from '../services/editor';
import type { GetColumnWidth, SetColumnWidth, StageRect, UiState } from '../type';
import BaseService from './BaseService';

View File

@ -23,13 +23,13 @@ import type { Id, MApp, MContainer, MNode, MPage } from '@tmagic/schema';
import type StageCore from '@tmagic/stage';
import type { MoveableOptions } from '@tmagic/stage';
import type { ComponentListService } from '@editor/services/componentList';
import type { EditorService } from '@editor/services/editor';
import type { EventsService } from '@editor/services/events';
import type { HistoryService } from '@editor/services/history';
import type { PropsService } from '@editor/services/props';
import type { StorageService } from '@editor/services/storage';
import type { UiService } from '@editor/services/ui';
import type { ComponentListService } from './services/componentList';
import type { EditorService } from './services/editor';
import type { EventsService } from './services/events';
import type { HistoryService } from './services/history';
import type { PropsService } from './services/props';
import type { StorageService } from './services/storage';
import type { UiService } from './services/ui';
export type BeforeAdd = (config: MNode, parent: MContainer) => Promise<MNode> | MNode;
export type GetConfig = (config: FormConfig) => Promise<FormConfig> | FormConfig;

View File

@ -16,7 +16,7 @@
* limitations under the License.
*/
import { InstallOptions } from '@editor/type';
import { InstallOptions } from '../type';
let $TMAGIC_EDITOR: InstallOptions = {} as any;

View File

@ -21,7 +21,7 @@ import { NodeType } from '@tmagic/schema';
import type StageCore from '@tmagic/stage';
import { getNodePath, isNumber, isPage, isPop } from '@tmagic/utils';
import { Layout } from '@editor/type';
import { Layout } from '../type';
export const COPY_STORAGE_KEY = '$MagicEditorCopyData';

View File

@ -5,11 +5,11 @@ import { Id, MApp, MContainer, MNode, NodeType } from '@tmagic/schema';
import StageCore from '@tmagic/stage';
import { isPage } from '@tmagic/utils';
import editorService from '@editor/services/editor';
import historyService from '@editor/services/history';
import propsService from '@editor/services/props';
import { AddMNode, Layout, PastePosition } from '@editor/type';
import { fixNodeLeft, generatePageNameByApp, getInitPositionStyle, getNodeIndex } from '@editor/utils/editor';
import editorService from '../services/editor';
import historyService from '../services/history';
import propsService from '../services/props';
import { AddMNode, Layout, PastePosition } from '../type';
import { fixNodeLeft, generatePageNameByApp, getInitPositionStyle, getNodeIndex } from '../utils/editor';
/**
* id以及校准了坐标的配置

View File

@ -18,8 +18,8 @@
import { FormConfig, FormState } from '@tmagic/form';
import editorService from '@editor/services/editor';
import eventsService from '@editor/services/events';
import editorService from '../services/editor';
import eventsService from '../services/events';
/**
*

View File

@ -1,4 +1,4 @@
import { Keys } from '@editor/type';
import { Keys } from '../type';
interface ScrollViewerOptions {
container: HTMLDivElement;

View File

@ -5,9 +5,7 @@
"declaration": true,
"declarationDir": "types",
"forceConsistentCasingInFileNames": true,
"paths": {
"@editor/*": ["src/*"],
},
"paths": {},
},
"include": [
"src"

View File

@ -23,17 +23,14 @@ import vue from '@vitejs/plugin-vue';
import pkg from './package.json';
const alias = [{ find: /@editor/, replacement: path.join(__dirname, './src') }];
export default defineConfig({
plugins: [vue()],
resolve: {
alias:
process.env.NODE_ENV === 'production'
? alias
? []
: [
...alias,
{ find: /^@tmagic\/schema/, replacement: path.join(__dirname, '../schema/src/index.ts') },
{ find: /^@tmagic\/utils/, replacement: path.join(__dirname, '../utils/src/index.ts') },
{ find: /^@tmagic\/core/, replacement: path.join(__dirname, '../core/src/index.ts') },

View File

@ -37,7 +37,6 @@ export default defineConfig({
resolve: {
alias: [
{ find: /@editor/, replacement: path.join(__dirname, '../packages/editor/src') },
{
find: /^@tmagic\/editor\/src\/theme\/index.scss/,
replacement: path.join(__dirname, '../packages/editor/src/theme/index.scss'),