Skip to content

Commit 1c06fe1

Browse files
committed
chore: improve sfc-playground typing + bump repl for 3.3 external type resolve support
close #8051
1 parent 5ff40bb commit 1c06fe1

File tree

6 files changed

+20
-21
lines changed

6 files changed

+20
-21
lines changed

packages/global.d.ts

-7
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,6 @@ declare module 'file-saver' {
3333
export function saveAs(blob: any, name: any): void
3434
}
3535

36-
declare module '@vue/repl' {
37-
import { ComponentOptions } from '@vue/runtime-core'
38-
const Repl: ComponentOptions
39-
const ReplStore: any
40-
export { Repl, ReplStore }
41-
}
42-
4336
declare interface String {
4437
/**
4538
* @deprecated Please use String.prototype.slice instead of String.prototype.substring in the repository.

packages/sfc-playground/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"vite": "^4.2.0"
1313
},
1414
"dependencies": {
15-
"@vue/repl": "^1.3.5",
15+
"@vue/repl": "^1.4.0",
1616
"file-saver": "^2.0.5",
1717
"jszip": "^3.6.0",
1818
"vue": "workspace:*"

packages/sfc-playground/src/App.vue

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
import Header from './Header.vue'
3-
import { Repl, ReplStore } from '@vue/repl'
3+
import { Repl, ReplStore, SFCOptions } from '@vue/repl'
44
import { ref, watchEffect } from 'vue'
55
66
const setVH = () => {
@@ -33,7 +33,7 @@ const store = new ReplStore({
3333
})
3434
3535
// enable experimental features
36-
const sfcOptions = {
36+
const sfcOptions: SFCOptions = {
3737
script: {
3838
inlineTemplate: !useDevMode.value,
3939
isProd: !useDevMode.value,
@@ -59,10 +59,10 @@ watchEffect(() => {
5959
6060
function toggleDevMode() {
6161
const dev = (useDevMode.value = !useDevMode.value)
62-
sfcOptions.script.inlineTemplate =
63-
sfcOptions.script.isProd =
64-
sfcOptions.template.isProd =
65-
sfcOptions.style.isProd =
62+
sfcOptions.script!.inlineTemplate =
63+
sfcOptions.script!.isProd =
64+
sfcOptions.template!.isProd =
65+
sfcOptions.style!.isProd =
6666
!dev
6767
store.setFiles(store.getFiles())
6868
}

packages/sfc-playground/src/Header.vue

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@ import Moon from './icons/Moon.vue'
66
import Share from './icons/Share.vue'
77
import Download from './icons/Download.vue'
88
import GitHub from './icons/GitHub.vue'
9+
import { ReplStore } from '@vue/repl'
10+
11+
const props = defineProps<{
12+
store: ReplStore
13+
dev: boolean
14+
ssr: boolean
15+
}>()
916
10-
// @ts-ignore
11-
const props = defineProps(['store', 'dev', 'ssr'])
1217
const { store } = props
1318
1419
const currentCommit = __COMMIT__

packages/sfc-playground/src/download/download.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import main from './template/main.js?raw'
55
import pkg from './template/package.json?raw'
66
import config from './template/vite.config.js?raw'
77
import readme from './template/README.md?raw'
8+
import { ReplStore } from '@vue/repl'
89

9-
export async function downloadProject(store: any) {
10+
export async function downloadProject(store: ReplStore) {
1011
if (!confirm('Download project files?')) {
1112
return
1213
}

pnpm-lock.yaml

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)