From 8ea6e4fb225102187b17a470d50f621402831eeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Wed, 13 Nov 2024 09:00:50 +0800 Subject: [PATCH] fix(vue-vapor): remove compiler version --- package.json | 4 ++-- packages/vue-vapor/package.json | 12 ++++-------- packages/vue-vapor/src/dev.ts | 15 --------------- packages/vue-vapor/src/index.ts | 19 +++++++++++-------- packages/vue-vapor/src/runtime.ts | 26 -------------------------- pnpm-lock.yaml | 3 --- scripts/usage-size.js | 6 ++---- 7 files changed, 19 insertions(+), 66 deletions(-) delete mode 100644 packages/vue-vapor/src/dev.ts delete mode 100644 packages/vue-vapor/src/runtime.ts diff --git a/package.json b/package.json index d392d187e..b4859ab0b 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "clean": "rimraf --glob packages/*/dist temp .eslintcache", "size": "run-s \"size-*\" && node scripts/usage-size.js", "size-global": "node scripts/build.js vue vue-vapor runtime-dom runtime-vapor compiler-dom -f global -p --size", - "size-esm-runtime": "node scripts/build.js vue vue-vapor -f esm-bundler-runtime", - "size-esm": "node scripts/build.js runtime-shared runtime-dom runtime-vapor runtime-core reactivity shared -f esm-bundler", + "size-esm-runtime": "node scripts/build.js vue -f esm-bundler-runtime", + "size-esm": "node scripts/build.js runtime-shared runtime-dom runtime-vapor runtime-core reactivity shared vue-vapor -f esm-bundler", "check": "tsc --incremental --noEmit", "lint": "eslint --cache .", "format": "prettier --write --cache .", diff --git a/packages/vue-vapor/package.json b/packages/vue-vapor/package.json index c15528a2c..5f02fa53e 100644 --- a/packages/vue-vapor/package.json +++ b/packages/vue-vapor/package.json @@ -3,7 +3,7 @@ "version": "3.0.0-vapor", "description": "The progressive JavaScript framework for building modern web UI.", "main": "index.js", - "module": "dist/vue-vapor.runtime.esm-bundler.js", + "module": "dist/vue-vapor.esm-bundler.js", "types": "dist/vue-vapor.d.ts", "unpkg": "dist/vue-vapor.global.js", "jsdelivr": "dist/vue-vapor.global.js", @@ -17,7 +17,7 @@ "types": "./dist/vue-vapor.d.ts", "import": { "node": "./index.mjs", - "default": "./dist/vue-vapor.runtime.esm-bundler.js" + "default": "./dist/vue-vapor.esm-bundler.js" }, "require": { "node": { @@ -35,12 +35,9 @@ "name": "VueVapor", "formats": [ "esm-bundler", - "esm-bundler-runtime", "cjs", "global", - "global-runtime", - "esm-browser", - "esm-browser-runtime" + "esm-browser" ] }, "repository": { @@ -57,7 +54,6 @@ }, "homepage": "https://github.com/vuejs/vue-vapor/tree/main/packages/vapor#readme", "dependencies": { - "@vue/runtime-vapor": "workspace:*", - "@vue/compiler-vapor": "workspace:*" + "@vue/runtime-vapor": "workspace:*" } } diff --git a/packages/vue-vapor/src/dev.ts b/packages/vue-vapor/src/dev.ts deleted file mode 100644 index 42144dffd..000000000 --- a/packages/vue-vapor/src/dev.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { initCustomFormatter } from '@vue/runtime-dom' - -export function initDev(): void { - if (__BROWSER__) { - /* istanbul ignore if */ - if (!__ESM_BUNDLER__) { - console.info( - `You are running a development build of Vue.\n` + - `Make sure to use the production build (*.prod.js) when deploying for production.`, - ) - } - - initCustomFormatter() - } -} diff --git a/packages/vue-vapor/src/index.ts b/packages/vue-vapor/src/index.ts index 6c963db54..8231d9f8a 100644 --- a/packages/vue-vapor/src/index.ts +++ b/packages/vue-vapor/src/index.ts @@ -1,12 +1,15 @@ -// This entry is the "full-build" that includes both the runtime -// and the compiler, and supports on-the-fly compilation of the template option. -import { initDev } from './dev' +import { initCustomFormatter } from '@vue/runtime-dom' -if (__DEV__) { - initDev() -} +if (__DEV__ && __BROWSER__) { + /* istanbul ignore if */ + if (!__ESM_BUNDLER__) { + console.info( + `You are running a development build of Vue.\n` + + `Make sure to use the production build (*.prod.js) when deploying for production.`, + ) + } -// TODO register compiler + initCustomFormatter() +} -export { compile } from '@vue/compiler-vapor' export * from '@vue/runtime-vapor' diff --git a/packages/vue-vapor/src/runtime.ts b/packages/vue-vapor/src/runtime.ts deleted file mode 100644 index 205bdcc41..000000000 --- a/packages/vue-vapor/src/runtime.ts +++ /dev/null @@ -1,26 +0,0 @@ -// This entry exports the runtime only, and is built as -// `dist/vue.esm-bundler.js` which is used by default for bundlers. -import { initDev } from './dev' -// TODO implement warn -// import { warn } from '@vue/runtime-vapor' - -if (__DEV__) { - initDev() -} - -export * from '@vue/runtime-vapor' - -export const compile = (): void => { - if (__DEV__) { - console.warn( - `Runtime compilation is not supported in this build of Vue.` + - (__ESM_BUNDLER__ - ? ` Configure your bundler to alias "vue" to "vue/dist/vue-vapor.esm-bundler.js".` - : __ESM_BROWSER__ - ? ` Use "vue-vapor.esm-browser.js" instead.` - : __GLOBAL__ - ? ` Use "vue-vapor.global.js" instead.` - : ``) /* should not happen */, - ) - } -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0bad757cf..45a506eda 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -507,9 +507,6 @@ importers: packages/vue-vapor: dependencies: - '@vue/compiler-vapor': - specifier: workspace:* - version: link:../compiler-vapor '@vue/runtime-vapor': specifier: workspace:* version: link:../runtime-vapor diff --git a/scripts/usage-size.js b/scripts/usage-size.js index 01c6ff521..3d01fc828 100644 --- a/scripts/usage-size.js +++ b/scripts/usage-size.js @@ -23,9 +23,7 @@ const { const sizeDir = path.resolve('temp/size') const vue = path.resolve('./packages/vue/dist/vue.runtime.esm-bundler.js') -const vapor = path.resolve( - './packages/vue-vapor/dist/vue-vapor.runtime.esm-bundler.js', -) +const vapor = path.resolve('./packages/vue-vapor/dist/vue-vapor.esm-bundler.js') /** * @typedef {Object} Preset @@ -44,9 +42,9 @@ const presets = [ from: vue, }, { name: 'createApp', imports: ['createApp'], from: vue }, + { name: 'createVaporApp', imports: ['createVaporApp'], from: vapor }, { name: 'createSSRApp', imports: ['createSSRApp'], from: vue }, { name: 'defineCustomElement', imports: ['defineCustomElement'], from: vue }, - { name: 'vapor', imports: '*', from: vapor }, { name: 'overall', imports: [