From: Evan You Date: Mon, 3 Feb 2025 04:22:45 +0000 (+0800) Subject: wip(vapor): per-file vapor support in sfc playground X-Git-Tag: v3.6.0-alpha.1~16^2~102 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa84afc199b29114fe809ed302f172036cd7ebc8;p=thirdparty%2Fvuejs%2Fcore.git wip(vapor): per-file vapor support in sfc playground --- diff --git a/packages-private/sfc-playground/package.json b/packages-private/sfc-playground/package.json index e7ea7f3702..486971ad58 100644 --- a/packages-private/sfc-playground/package.json +++ b/packages-private/sfc-playground/package.json @@ -13,7 +13,7 @@ "vite": "catalog:" }, "dependencies": { - "@vue/repl": "^4.4.3", + "@vue/repl": "^4.5.0", "file-saver": "^2.0.5", "jszip": "^3.10.1", "vue": "workspace:*" diff --git a/packages-private/sfc-playground/src/App.vue b/packages-private/sfc-playground/src/App.vue index 2d4069318a..c057386115 100644 --- a/packages-private/sfc-playground/src/App.vue +++ b/packages-private/sfc-playground/src/App.vue @@ -5,11 +5,10 @@ import { type SFCOptions, useStore, useVueImportMap, - File, StoreState, } from '@vue/repl' import Monaco from '@vue/repl/monaco-editor' -import { ref, watchEffect, onMounted, computed, watch } from 'vue' +import { ref, watchEffect, onMounted, computed } from 'vue' const replRef = ref>() @@ -20,7 +19,6 @@ window.addEventListener('resize', setVH) setVH() const useSSRMode = ref(false) -const useVaporMode = ref(true) const AUTO_SAVE_STORAGE_KEY = 'vue-sfc-playground-auto-save' const initAutoSave: boolean = JSON.parse( @@ -31,16 +29,12 @@ const autoSave = ref(initAutoSave) const { vueVersion, productionMode, importMap } = useVueImportMap({ runtimeDev: () => { return import.meta.env.PROD - ? useVaporMode.value - ? `${location.origin}/vue.runtime-with-vapor.esm-browser.js` - : `${location.origin}/vue.runtime.esm-browser.js` + ? `${location.origin}/vue.runtime-with-vapor.esm-browser.js` : `${location.origin}/src/vue-dev-proxy` }, runtimeProd: () => { return import.meta.env.PROD - ? useVaporMode.value - ? `${location.origin}/vue.runtime-with-vapor.esm-browser.prod.js` - : `${location.origin}/vue.runtime.esm-browser.prod.js` + ? `${location.origin}/vue.runtime-with-vapor.esm-browser.prod.js` : `${location.origin}/src/vue-dev-proxy-prod` }, serverRenderer: import.meta.env.PROD @@ -61,10 +55,6 @@ if (hash.startsWith('__SSR__')) { hash = hash.slice(7) useSSRMode.value = true } -if (hash.startsWith('__VAPOR__')) { - hash = hash.slice(9) - useVaporMode.value = true -} const files: StoreState['files'] = ref(Object.create(null)) @@ -75,13 +65,13 @@ const sfcOptions = computed( inlineTemplate: productionMode.value, isProd: productionMode.value, propsDestructure: true, - vapor: useVaporMode.value, + // vapor: useVaporMode.value, }, style: { isProd: productionMode.value, }, template: { - vapor: useVaporMode.value, + // vapor: useVaporMode.value, isProd: productionMode.value, compilerOptions: { isCustomElement: (tag: string) => @@ -103,38 +93,10 @@ const store = useStore( // @ts-expect-error globalThis.store = store -watch( - useVaporMode, - () => { - if (useVaporMode.value) { - files.value['src/index.html'] = new File( - 'src/index.html', - `