From 2d21bc210ebbe0a6a5fbe76e080582e8686d5014 Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Sat, 21 Jan 2023 10:36:12 +0100 Subject: [PATCH] Vue 3: Disable compat mode --- changelog/unreleased/change-update-vue | 1 + packages/tsconfig/tsconfig.json | 8 +--- packages/web-runtime/src/compatConfig.ts | 48 ------------------------ packages/web-runtime/src/index.ts | 5 +-- tests/unit/config/jest.config.ts | 1 - tests/unit/config/jest.init.js | 5 --- vite.config.ts | 8 +--- web.d.ts | 11 ++---- 8 files changed, 8 insertions(+), 79 deletions(-) delete mode 100644 packages/web-runtime/src/compatConfig.ts diff --git a/changelog/unreleased/change-update-vue b/changelog/unreleased/change-update-vue index 077b533cbf5..705e373691e 100644 --- a/changelog/unreleased/change-update-vue +++ b/changelog/unreleased/change-update-vue @@ -19,3 +19,4 @@ https://github.com/owncloud/web/pull/8256 https://github.com/owncloud/web/pull/8257 https://github.com/owncloud/web/pull/8258 https://github.com/owncloud/web/pull/8282 +https://github.com/owncloud/web/pull/8288 diff --git a/packages/tsconfig/tsconfig.json b/packages/tsconfig/tsconfig.json index c6f3bdd6511..3a4bccd8bcf 100644 --- a/packages/tsconfig/tsconfig.json +++ b/packages/tsconfig/tsconfig.json @@ -84,12 +84,6 @@ "node_modules" ], "vueCompilerOptions": { - "experimentalCompatMode": 2, - "experimentalTemplateCompilerOptions": { - "compatConfig": { - "MODE": 2 - } // optional - }, - "target": 2.7 + "target": 3 } } diff --git a/packages/web-runtime/src/compatConfig.ts b/packages/web-runtime/src/compatConfig.ts deleted file mode 100644 index dcd9a3877ab..00000000000 --- a/packages/web-runtime/src/compatConfig.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { configureCompat } from 'vue' - -type CompatConfig = Parameters[0] -export const compatConfig: CompatConfig = { - MODE: 2 - // ATTR_ENUMERATED_COERCION: false, - // ATTR_FALSE_VALUE: false, - // COMPONENT_ASYNC: false, - // COMPONENT_FUNCTIONAL: false, - // COMPONENT_V_MODEL: false, - // CONFIG_DEVTOOLS: false, - // CONFIG_IGNORED_ELEMENTS: false, - // CONFIG_KEY_CODES: false, - // CONFIG_OPTION_MERGE_STRATS: false, - // CONFIG_PRODUCTION_TIP: false, - // CONFIG_SILENT: false, - // CONFIG_WHITESPACE: false, - // CUSTOM_DIR: false, - // FILTERS: false, - // GLOBAL_DELETE: false, - // GLOBAL_EXTEND: false, - // GLOBAL_MOUNT: false, - // GLOBAL_MOUNT_CONTAINER: false, - // GLOBAL_OBSERVABLE: false, - // GLOBAL_PRIVATE_UTIL: false, - // GLOBAL_PROTOTYPE: false, - // GLOBAL_SET: false, - // INSTANCE_ATTRS_CLASS_STYLE: false, - // INSTANCE_CHILDREN: false, - // INSTANCE_DELETE: false, - // INSTANCE_DESTROY: false, - // INSTANCE_EVENT_EMITTER: false, - // INSTANCE_EVENT_HOOKS: false, - // INSTANCE_LISTENERS: false, - // INSTANCE_SCOPED_SLOTS: false, - // INSTANCE_SET: false, - // OPTIONS_BEFORE_DESTROY: false, - // OPTIONS_DATA_FN: false, - // OPTIONS_DATA_MERGE: false, - // OPTIONS_DESTROYED: false, - // PRIVATE_APIS: false, - // PROPS_DEFAULT_THIS: false, - // RENDER_FUNCTION: false // comment in when vue-router, vue-gettext, ... are fixed/updated - // TRANSITION_CLASSES: false, - // TRANSITION_GROUP_ROOT: false, - // V_ON_KEYCODE_MODIFIER: false, - // WATCH_ARRAY: false, -} diff --git a/packages/web-runtime/src/index.ts b/packages/web-runtime/src/index.ts index ea1bd7f3d1e..ba49fd0906c 100644 --- a/packages/web-runtime/src/index.ts +++ b/packages/web-runtime/src/index.ts @@ -30,8 +30,7 @@ import { } from 'web-client/src/helpers' import { WebDAV } from 'web-client/src/webdav' import { DavProperty } from 'web-client/src/webdav/constants' -import { configureCompat, createApp } from 'vue' -import { compatConfig } from './compatConfig' +import { createApp } from 'vue' import PortalVue, { createWormhole } from 'portal-vue' import WebPlugin from './plugins/web' @@ -39,8 +38,6 @@ import Avatar from './components/Avatar.vue' import focusMixin from './mixins/focusMixin' import lifecycleMixin from './mixins/lifecycleMixin' -configureCompat(compatConfig) - export const bootstrapApp = async (configurationPath: string): Promise => { const app = createApp(pages.success) diff --git a/tests/unit/config/jest.config.ts b/tests/unit/config/jest.config.ts index 6b97e2ef691..454607059bc 100644 --- a/tests/unit/config/jest.config.ts +++ b/tests/unit/config/jest.config.ts @@ -23,7 +23,6 @@ module.exports = { '\\.(css|less|scss)$': '/tests/unit/stubs/empty.js', '^@/(.*)$': '/$1', '^core-js$': '/node_modules/core-js', - '^vue$': '@vue/compat', '^mark.js$': '/node_modules/mark.js/src/vanilla.js', '^fuse.js$': '/node_modules/fuse.js/dist/fuse.esm.js', '^filesize$': '/node_modules/filesize/lib/filesize.esm.js', diff --git a/tests/unit/config/jest.init.js b/tests/unit/config/jest.init.js index e93030d80e4..e856aa22d1e 100644 --- a/tests/unit/config/jest.init.js +++ b/tests/unit/config/jest.init.js @@ -1,10 +1,5 @@ -import { configureCompat } from 'vue' import fetchMock from 'jest-fetch-mock' -import { compatConfig } from '../../../packages/web-runtime/src/compatConfig' - -configureCompat(compatConfig) - window.define = jest.fn() window.IntersectionObserver = jest.fn(() => ({ diff --git a/vite.config.ts b/vite.config.ts index 670b1a0ca15..b5935f4286d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -18,11 +18,7 @@ import browserslistToEsbuild from 'browserslist-to-esbuild' import { CompilerOptions } from '@vue/compiler-sfc' export const compilerOptions: CompilerOptions = { - whitespace: 'preserve', - compatConfig: { - MODE: 2, - COMPILER_V_ON_NATIVE: false - } + whitespace: 'preserve' } const buildConfig = { @@ -134,8 +130,6 @@ export default defineConfig(({ mode, command }) => { }, resolve: { alias: { - vue: '@vue/compat', - crypto: join(projectRootDir, 'polyfills/crypto.js'), buffer: 'rollup-plugin-node-polyfills/polyfills/buffer-es6', path: 'rollup-plugin-node-polyfills/polyfills/path', diff --git a/web.d.ts b/web.d.ts index 72f253d842a..492b64b8dd7 100644 --- a/web.d.ts +++ b/web.d.ts @@ -1,12 +1,7 @@ /// declare module 'vue' { - import { CompatVue } from '@vue/runtime-dom' - const Vue: CompatVue - export default Vue export * from '@vue/runtime-dom' - const { configureCompat } = Vue - export { configureCompat } export interface GlobalComponents { Portal: typeof import('portal-vue')['Portal'] @@ -16,7 +11,9 @@ declare module 'vue' { RouterView: typeof import('vue-router')['RouterView'] } } + declare module '*.vue' { - import Vue from 'vue' - export default Vue + import { defineComponent } from 'vue' + const component: ReturnType + export default component }