From dfdc877896bc86d3293cea6f769c534f324539c3 Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 21 Apr 2023 15:58:18 +0800 Subject: [PATCH 1/3] chore: avoid unwrapInjectedRefs deprecation warning --- src/output/Preview.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/output/Preview.vue b/src/output/Preview.vue index 4e72ff03..56cf4952 100644 --- a/src/output/Preview.vue +++ b/src/output/Preview.vue @@ -33,7 +33,7 @@ onMounted(createSandbox) // reset sandbox when import map changes watch( () => store.state.files['import-map.json'].code, - (raw) => { + raw => { try { const map = JSON.parse(raw) if (!map.imports) { @@ -189,7 +189,9 @@ async function updatePreview() { const AppComponent = __modules__["${mainFile}"].default AppComponent.name = 'Repl' const app = _createApp(AppComponent) - app.config.unwrapInjectedRef = true + if (!app.config.hasOwnProperty('unwrapInjectedRef')) { + app.config.unwrapInjectedRef = true + } app.config.warnHandler = () => {} window.__ssr_promise__ = _renderToString(app).then(html => { document.body.innerHTML = '
' + html + '
' @@ -226,7 +228,9 @@ async function updatePreview() { const AppComponent = __modules__["${mainFile}"].default AppComponent.name = 'Repl' const app = window.__app__ = _createApp(AppComponent) - app.config.unwrapInjectedRef = true + if (!app.config.hasOwnProperty('unwrapInjectedRef')) { + app.config.unwrapInjectedRef = true + } app.config.errorHandler = e => console.error(e) app.mount('#app') } From 5d3c4cc8b86f80b71cf8b65f2fe5b8e3f132b258 Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 21 Apr 2023 16:01:37 +0800 Subject: [PATCH 2/3] chore: fix ssr support version check --- src/output/Preview.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/output/Preview.vue b/src/output/Preview.vue index 56cf4952..a1cb3dcb 100644 --- a/src/output/Preview.vue +++ b/src/output/Preview.vue @@ -162,8 +162,10 @@ async function updatePreview() { let isSSR = props.ssr if (store.vueVersion) { - const [_, minor, patch] = store.vueVersion.split('.') - if (parseInt(minor, 10) < 2 || parseInt(patch, 10) < 27) { + const [major, minor, patch] = store.vueVersion + .split('.') + .map(v => parseInt(v, 10)) + if (major === 3 && (minor < 2 || (minor === 2 && patch < 27))) { alert( `The selected version of Vue (${store.vueVersion}) does not support in-browser SSR.` + ` Rendering in client mode instead.` From 516b3e154bb8c5f059d396364353ce5ad97a04a6 Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 21 Apr 2023 16:02:06 +0800 Subject: [PATCH 3/3] v1.4.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f5176b1b..a2f333de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vue/repl", - "version": "1.4.0", + "version": "1.4.1", "description": "Vue component for editing Vue components", "main": "dist/ssr-stub.js", "module": "dist/vue-repl.js",