Skip to content

Commit

Permalink
feat: isolate packages
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoluoboding committed Apr 23, 2021
1 parent 9319393 commit 364bf9b
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 11 deletions.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions packages/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { App } from 'vue'

import SfcSandbox from './sandbox/index.vue'
import SplitPane from './components/SplitPane.vue'
import LoadingMask from './components/LoadingMask.vue'

export const install = (app: App): void => {
app.component('SfcSandbox', SfcSandbox)
app.component('SplitPane', SplitPane)
app.component('LoadingMask', LoadingMask)
}

export { SfcSandbox, SplitPane }

export default install
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ref, computed, defineProps, onMounted, inject, Ref } from 'vue'
// import FileSelector from './FileSelector.vue'
import CodeMirror from './codemirror/index.vue'
import Message from './Message.vue'
import { compileModules, store, addFile, changeFile } from '../../plugins/sfc2esm.esm'
import { compileModules, store, addFile, changeFile } from '../plugins/sfc2esm.esm'
import { debounce } from './utils'
import { ES_MODULES, IS_LOADING_PREVIEW } from './types'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { WatchStopHandle } from 'vue'
import srcdoc from './srcdoc.html'
import { ReplProxy } from './ReplProxy'
import { store, generateHashId } from '../../plugins/sfc2esm.esm'
import { store, generateHashId } from '../plugins/sfc2esm.esm'
import { IMPORT_MAPS_KEY, EXTERNALS_KEY, IS_LOADING_PREVIEW, ImportMaps, ES_MODULES } from './types'
const container = ref()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

<script setup lang="ts">
import { computed, defineProps, provide, ref, watch } from 'vue'
import SplitPane from '../splte-pane/index.vue'
import SplitPane from '../components/SplitPane.vue'
import SandboxEditor from './SandboxEditor.vue'
import SandboxPreview from './SandboxPreview.vue'
import LoadingMask from './LoadingMask.vue'
import LoadingMask from '../components/LoadingMask.vue'
import { IMPORT_MAPS_KEY, EXTERNALS_KEY, IS_LOADING_PREVIEW, ES_MODULES } from './types'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<template>
<div class="wrapper">
<!-- [ESM] default case -->
<sandbox v-bind="defaultAttrs" />
<sfc-sandbox v-bind="defaultAttrs" />

<!-- [CDN] echarts case -->
<sandbox v-bind="echartsAttrs" />
<sfc-sandbox v-bind="echartsAttrs" />

<!-- [ESM] ve-charts case -->
<!-- <sandbox v-bind="veChartsAttrs" /> -->

<!-- [ESM] Vue3 component case -->
<sandbox v-bind="digitAnimationAttrs" />
<sfc-sandbox v-bind="digitAnimationAttrs" />

<!-- [ESM] React component case -->
<!-- <sandbox v-bind="revueAttrs" /> -->
</div>
</template>

<script setup lang="ts">
import Sandbox from './components/sandbox/index.vue'
import SfcSandbox from '../packages/sandbox/index.vue'
import { SFC_CODE_ESM as defaultCode } from './constants/default.demo.js'
import { SFC_CODE_CDN as echartsCode } from './constants/echarts.demo.js'
import { SFC_CODE_ESM as veChartsCode } from './constants/ve-charts.demo.js'
Expand Down
13 changes: 13 additions & 0 deletions src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<div></div>
</template>

<script>
export default {
}
</script>

<style>
</style>
7 changes: 4 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
"tests/**/*.tsx",
"scripts/**/*.ts"
],
"exclude": [
"node_modules",
"src/components/sandbox/*.ts",
"src/components/sfc2esm/*.ts"
"packages/sandbox/*.ts",
"packages/plugins/*.ts"
]
}

0 comments on commit 364bf9b

Please sign in to comment.