diff --git a/examples/vue/simple/.gitignore b/examples/vue/simple/.gitignore new file mode 100644 index 000000000..449e8098b --- /dev/null +++ b/examples/vue/simple/.gitignore @@ -0,0 +1,9 @@ +node_modules +.DS_Store +dist +dist-ssr +*.local + +package-lock.json +yarn.lock +pnpm-lock.yaml diff --git a/examples/vue/simple/README.md b/examples/vue/simple/README.md new file mode 100644 index 000000000..28462a4ad --- /dev/null +++ b/examples/vue/simple/README.md @@ -0,0 +1,6 @@ +# Basic example + +To run this example: + +- `npm install` or `yarn` or `pnpm i` +- `npm run dev` or `yarn dev` or `pnpm dev` diff --git a/examples/vue/simple/index.html b/examples/vue/simple/index.html new file mode 100644 index 000000000..547b3c19e --- /dev/null +++ b/examples/vue/simple/index.html @@ -0,0 +1,12 @@ + + + + + + Vue Query Example + + +
+ + + diff --git a/examples/vue/simple/package.json b/examples/vue/simple/package.json new file mode 100644 index 000000000..4d71b3749 --- /dev/null +++ b/examples/vue/simple/package.json @@ -0,0 +1,19 @@ +{ + "name": "@tanstack/form-example-vue-simple", + "private": true, + "scripts": { + "dev": "vite", + "build": "vite build", + "build:dev": "vite build -m development", + "serve": "vite preview" + }, + "dependencies": { + "@tanstack/vue-form": "workspace:*", + "vue": "^3.2.47" + }, + "devDependencies": { + "@vitejs/plugin-vue": "^4.2.3", + "typescript": "^5.0.4", + "vite": "^4.4.4" + } +} diff --git a/examples/vue/simple/src/App.vue b/examples/vue/simple/src/App.vue new file mode 100644 index 000000000..6ef34adc6 --- /dev/null +++ b/examples/vue/simple/src/App.vue @@ -0,0 +1,10 @@ + + + diff --git a/examples/vue/simple/src/main.ts b/examples/vue/simple/src/main.ts new file mode 100644 index 000000000..912d54f8d --- /dev/null +++ b/examples/vue/simple/src/main.ts @@ -0,0 +1,5 @@ +import { createApp } from 'vue' + +import App from './App.vue' + +createApp(App).mount('#app') diff --git a/examples/vue/simple/src/shims-vue.d.ts b/examples/vue/simple/src/shims-vue.d.ts new file mode 100644 index 000000000..ac1ded792 --- /dev/null +++ b/examples/vue/simple/src/shims-vue.d.ts @@ -0,0 +1,5 @@ +declare module '*.vue' { + import { DefineComponent } from 'vue' + const component: DefineComponent<{}, {}, any> + export default component +} diff --git a/examples/vue/simple/src/types.d.ts b/examples/vue/simple/src/types.d.ts new file mode 100644 index 000000000..4851e8102 --- /dev/null +++ b/examples/vue/simple/src/types.d.ts @@ -0,0 +1,6 @@ +export interface Post { + userId: number + id: number + title: string + body: string +} diff --git a/examples/vue/simple/tsconfig.json b/examples/vue/simple/tsconfig.json new file mode 100644 index 000000000..7ca59bce5 --- /dev/null +++ b/examples/vue/simple/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "esnext", + "moduleResolution": "node", + "strict": true, + "jsx": "preserve", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "lib": ["esnext", "dom"], + "types": ["vite/client"] + }, + "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue"] +} diff --git a/examples/vue/simple/vite.config.ts b/examples/vue/simple/vite.config.ts new file mode 100644 index 000000000..e2529e6f2 --- /dev/null +++ b/examples/vue/simple/vite.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from 'vite' +import createVuePlugin from '@vitejs/plugin-vue' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [createVuePlugin()], + optimizeDeps: { + exclude: ['@tanstack/vue-query', 'vue-demi'], + }, +}) diff --git a/package.json b/package.json index 4a99fa3b4..d64355215 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "@types/testing-library__jest-dom": "^5.14.5", "@typescript-eslint/eslint-plugin": "^6.4.1", "@typescript-eslint/parser": "^6.4.1", + "@vitejs/plugin-vue": "^4.2.3", "@vitest/coverage-istanbul": "^0.34.3", "axios": "^0.26.1", "babel-eslint": "^10.1.0", @@ -84,6 +85,7 @@ "react-dom-17": "npm:react-dom@^17.0.2", "rimraf": "^5.0.1", "rollup": "^3.23.0", + "rollup-plugin-esbuild": "^5.0.0", "rollup-plugin-node-externals": "^6.1.0", "rollup-plugin-preserve-directives": "^0.2.0", "rollup-plugin-size": "^0.2.2", diff --git a/packages/vue-form/.eslintrc.cjs b/packages/vue-form/.eslintrc.cjs new file mode 100644 index 000000000..5dd105c9d --- /dev/null +++ b/packages/vue-form/.eslintrc.cjs @@ -0,0 +1,11 @@ +// @ts-check + +/** @type {import('eslint').Linter.Config} */ +const config = { + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json', + }, +} + +module.exports = config diff --git a/packages/vue-form/README.md b/packages/vue-form/README.md new file mode 100644 index 000000000..d5fd2fedb --- /dev/null +++ b/packages/vue-form/README.md @@ -0,0 +1,35 @@ + + +![TanStack Form Header](https://github.com/TanStack/form/raw/main/media/repo-header.png) + +Hooks for managing form state in Vue + + + #TanStack + + + + + + + + + + semantic-release + + Join the discussion on Github +Best of JS + + + + + Gitpod Ready-to-Code + + +Enjoy this library? Try the entire [TanStack](https://tanstack.com)! [TanStack Table](https://github.com/TanStack/table), [TanStack Router](https://github.com/tanstack/router), [TanStack Virtual](https://github.com/tanstack/virtual), [React Charts](https://github.com/TanStack/react-charts), [React Ranger](https://github.com/TanStack/ranger) + +## Visit [tanstack.com/form](https://tanstack.com/form) for docs, guides, API and more! + +### [Become a Sponsor!](https://github.com/sponsors/tannerlinsley/) + + diff --git a/packages/vue-form/package.json b/packages/vue-form/package.json new file mode 100644 index 000000000..8c268b9a2 --- /dev/null +++ b/packages/vue-form/package.json @@ -0,0 +1,66 @@ +{ + "name": "@tanstack/vue-form", + "version": "0.0.12", + "description": "Powerful, type-safe forms for Vue.", + "author": "tannerlinsley", + "license": "MIT", + "repository": "tanstack/form", + "homepage": "https://tanstack.com/form", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "type": "module", + "types": "build/lib/index.d.ts", + "main": "build/lib/index.legacy.cjs", + "module": "build/lib/index.legacy.js", + "exports": { + ".": { + "types": "./build/lib/index.d.ts", + "import": "./build/lib/index.js", + "require": "./build/lib/index.cjs", + "default": "./build/lib/index.cjs" + }, + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "clean": "rimraf ./build && rimraf ./coverage", + "test:eslint": "eslint --ext .ts,.tsx ./src", + "test:types": "tsc", + "test:lib": "pnpm run test:2 && pnpm run test:2.7 && pnpm run test:3", + "test:2": "vue-demi-switch 2 vue2 && vitest", + "test:2.7": "vue-demi-switch 2.7 vue2.7 && vitest", + "test:3": "vue-demi-switch 3 && vitest", + "test:lib:dev": "pnpm run test:lib --watch", + "test:build": "publint --strict", + "build": "pnpm build:rollup && pnpm build:codemods && pnpm build:types", + "build:rollup": "rollup --config rollup.config.js", + "build:codemods": "cpy ../codemods/src/**/* ./build/codemods", + "build:types": "tsc --emitDeclarationOnly" + }, + "files": [ + "build", + "src" + ], + "dependencies": { + "@tanstack/form-core": "workspace:*", + "@vue/devtools-api": "^6.5.0", + "vue-demi": "^0.13.11" + }, + "devDependencies": { + "@vue/composition-api": "1.7.1", + "vue": "^3.2.47", + "vue2": "npm:vue@2.6", + "vue2.7": "npm:vue@2.7" + }, + "peerDependencies": { + "@vue/composition-api": "^1.1.2", + "vue": "^2.5.0 || ^3.0.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } + } +} diff --git a/packages/vue-form/rollup.config.js b/packages/vue-form/rollup.config.js new file mode 100644 index 000000000..bccbf00ce --- /dev/null +++ b/packages/vue-form/rollup.config.js @@ -0,0 +1,12 @@ +// @ts-check + +import { defineConfig } from 'rollup' +import { buildConfigs } from '../../scripts/getRollupConfig.js' + +export default defineConfig( + buildConfigs({ + name: 'vue-form', + outputFile: 'index', + entryFile: './src/index.ts', + }), +) diff --git a/packages/vue-form/src/Test.vue b/packages/vue-form/src/Test.vue new file mode 100644 index 000000000..620d34edf --- /dev/null +++ b/packages/vue-form/src/Test.vue @@ -0,0 +1,7 @@ + + + diff --git a/packages/vue-form/src/index.ts b/packages/vue-form/src/index.ts new file mode 100644 index 000000000..fc246e56c --- /dev/null +++ b/packages/vue-form/src/index.ts @@ -0,0 +1,5 @@ +export * from '@tanstack/form-core' + +export { default as Test } from './Test.vue' + +export * from './useTest' diff --git a/packages/vue-form/src/sfc.d.ts b/packages/vue-form/src/sfc.d.ts new file mode 100644 index 000000000..01b57df84 --- /dev/null +++ b/packages/vue-form/src/sfc.d.ts @@ -0,0 +1 @@ +declare module '*.vue' diff --git a/packages/vue-form/src/useTest.ts b/packages/vue-form/src/useTest.ts new file mode 100644 index 000000000..43a1b493f --- /dev/null +++ b/packages/vue-form/src/useTest.ts @@ -0,0 +1,6 @@ +import { ref } from 'vue-demi' + +export const useTest = () => { + const test = ref(1) + return test +} diff --git a/packages/vue-form/test-setup.ts b/packages/vue-form/test-setup.ts new file mode 100644 index 000000000..bddfc7385 --- /dev/null +++ b/packages/vue-form/test-setup.ts @@ -0,0 +1,21 @@ +import { vi } from 'vitest' + +import Vue from 'vue2' +Vue.config.productionTip = false +Vue.config.devtools = false + +// Hide annoying console warnings for Vue2 +import Vue27 from 'vue2.7' +Vue27.config.productionTip = false +Vue27.config.devtools = false + +vi.mock('vue-demi', async () => { + const vue = await vi.importActual('vue-demi') + return { + ...(vue as any), + inject: vi.fn(), + provide: vi.fn(), + onScopeDispose: vi.fn(), + getCurrentInstance: vi.fn(() => ({ proxy: {} })), + } +}) diff --git a/packages/vue-form/tsconfig.json b/packages/vue-form/tsconfig.json new file mode 100644 index 000000000..55bb67e07 --- /dev/null +++ b/packages/vue-form/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "types": ["vitest/globals"], + "outDir": "./build/lib" + }, + "include": ["src"] +} diff --git a/packages/vue-form/vitest.config.ts b/packages/vue-form/vitest.config.ts new file mode 100644 index 000000000..77e3122c4 --- /dev/null +++ b/packages/vue-form/vitest.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + name: 'vue-query', + dir: './src', + watch: false, + environment: 'jsdom', + globals: true, + setupFiles: ['test-setup.ts'], + coverage: { provider: 'istanbul' }, + }, +}) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d92c397c8..0e681cf8c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -89,6 +89,9 @@ importers: '@typescript-eslint/parser': specifier: ^6.4.1 version: 6.4.1(eslint@8.48.0)(typescript@5.2.2) + '@vitejs/plugin-vue': + specifier: ^4.2.3 + version: 4.3.4(vite@4.4.9)(vue@3.2.47) '@vitest/coverage-istanbul': specifier: ^0.34.3 version: 0.34.3(vitest@0.34.3) @@ -182,6 +185,9 @@ importers: rollup: specifier: ^3.23.0 version: 3.23.0 + rollup-plugin-esbuild: + specifier: ^5.0.0 + version: 5.0.0(esbuild@0.18.20)(rollup@3.23.0) rollup-plugin-node-externals: specifier: ^6.1.0 version: 6.1.0(rollup@3.23.0) @@ -250,6 +256,25 @@ importers: specifier: ^3.0.0 version: 3.1.3 + examples/vue/basic: + dependencies: + '@tanstack/vue-form': + specifier: workspace:* + version: link:../../../packages/vue-form + vue: + specifier: ^3.2.47 + version: 3.2.47 + devDependencies: + '@vitejs/plugin-vue': + specifier: ^4.2.3 + version: 4.3.4(vite@4.4.9)(vue@3.2.47) + typescript: + specifier: ^5.0.4 + version: 5.2.2 + vite: + specifier: ^4.4.4 + version: 4.4.9(@types/node@17.0.45) + packages/form-core: dependencies: '@tanstack/store': @@ -290,6 +315,31 @@ importers: specifier: ^3.1.4 version: 3.1.4(react@18.2.0) + packages/vue-form: + dependencies: + '@tanstack/form-core': + specifier: workspace:* + version: link:../form-core + '@vue/devtools-api': + specifier: ^6.5.0 + version: 6.5.0 + vue-demi: + specifier: ^0.13.11 + version: 0.13.11(@vue/composition-api@1.7.1)(vue@3.2.47) + devDependencies: + '@vue/composition-api': + specifier: 1.7.1 + version: 1.7.1(vue@3.2.47) + vue: + specifier: ^3.2.47 + version: 3.2.47 + vue2: + specifier: npm:vue@2.6 + version: /vue@2.6.14 + vue2.7: + specifier: npm:vue@2.7 + version: /vue@2.7.14 + packages: /@aashutoshrathi/word-wrap@1.2.6: @@ -512,7 +562,7 @@ packages: resolution: {integrity: sha512-8Dl6+HD/cKifutF5qGd/8ZJi84QeAKh+CEe1sBzz8UayBBGg1dAIJrdHOcOM5b2MpzWL2yuotJTtGjETq0qjXg==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.22.10 + '@babel/types': 7.22.11 /@babel/helper-module-transforms@7.22.9(@babel/core@7.22.10): resolution: {integrity: sha512-t+WA2Xn5K+rTeGtC8jCsdAH52bjggG5TKRuRrAGNM/mjIbO4GxvlLMFOEz9wXY5I2XQ60PMFsAG2WIcG82dQMQ==} @@ -584,20 +634,10 @@ packages: dependencies: '@babel/types': 7.22.11 - /@babel/helper-string-parser@7.18.10: - resolution: {integrity: sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw==} - engines: {node: '>=6.9.0'} - dev: true - /@babel/helper-string-parser@7.22.5: resolution: {integrity: sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==} engines: {node: '>=6.9.0'} - /@babel/helper-validator-identifier@7.18.6: - resolution: {integrity: sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==} - engines: {node: '>=6.9.0'} - dev: true - /@babel/helper-validator-identifier@7.22.5: resolution: {integrity: sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==} engines: {node: '>=6.9.0'} @@ -658,13 +698,6 @@ packages: '@babel/types': 7.22.11 dev: true - /@babel/parser@7.22.10: - resolution: {integrity: sha512-lNbdGsQb9ekfsnjFGhEiF4hfFqGgfOP3H3d27re3n+CGhNuTSUEQdfWk556sTLNTloczcdM5TYF2LhzmDQKyvQ==} - engines: {node: '>=6.0.0'} - hasBin: true - dependencies: - '@babel/types': 7.22.11 - /@babel/parser@7.22.13: resolution: {integrity: sha512-3l6+4YOvc9wx7VlCSw4yQfcBo01ECA8TicQfbnCPuCEpRQrf+gTUyGdxNw+pyTUyywp6JRD1w0YQs9TpBXYlkw==} engines: {node: '>=6.0.0'} @@ -1356,7 +1389,7 @@ packages: '@babel/helper-module-imports': 7.22.5 '@babel/helper-plugin-utils': 7.22.5 '@babel/plugin-syntax-jsx': 7.22.5(@babel/core@7.22.10) - '@babel/types': 7.22.10 + '@babel/types': 7.22.11 /@babel/plugin-transform-react-pure-annotations@7.18.6(@babel/core@7.22.10): resolution: {integrity: sha512-I8VfEPg9r2TRDdvnHgPepTKvuRomzA8+u+nhY7qSI1fR2hRNebasZEETLyM5mAUr0Ku56OkXJ0I7NHJnO6cJiQ==} @@ -1589,7 +1622,7 @@ packages: '@babel/helper-plugin-utils': 7.22.5 '@babel/plugin-proposal-unicode-property-regex': 7.18.6(@babel/core@7.22.10) '@babel/plugin-transform-dotall-regex': 7.18.6(@babel/core@7.22.10) - '@babel/types': 7.22.10 + '@babel/types': 7.22.11 esutils: 2.0.3 /@babel/preset-react@7.18.6(@babel/core@7.22.10): @@ -1662,7 +1695,7 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.22.10 - '@babel/parser': 7.22.10 + '@babel/parser': 7.22.13 '@babel/types': 7.22.10 /@babel/traverse@7.19.1: @@ -1704,8 +1737,8 @@ packages: resolution: {integrity: sha512-YuGopBq3ke25BVSiS6fgF49Ul9gH1x70Bcr6bqRLjWCkcX8Hre1/5+z+IiWOIerRMSSEfGZVB9z9kyq7wVs9YA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/helper-string-parser': 7.18.10 - '@babel/helper-validator-identifier': 7.18.6 + '@babel/helper-string-parser': 7.22.5 + '@babel/helper-validator-identifier': 7.22.5 to-fast-properties: 2.0.0 dev: true @@ -2857,10 +2890,6 @@ packages: resolution: {integrity: sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng==} dev: true - /@types/estree@0.0.39: - resolution: {integrity: sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==} - dev: true - /@types/estree@1.0.1: resolution: {integrity: sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==} dev: true @@ -3138,6 +3167,17 @@ packages: - supports-color dev: true + /@vitejs/plugin-vue@4.3.4(vite@4.4.9)(vue@3.2.47): + resolution: {integrity: sha512-ciXNIHKPriERBisHFBvnTbfKa6r9SAesOYXeGDzgegcvy9Q4xdScSHAmKbNT0M3O0S9LKhIf5/G+UYG4NnnzYw==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + vite: ^4.0.0 + vue: ^3.2.25 + dependencies: + vite: 4.4.9(@types/node@17.0.45) + vue: 3.2.47 + dev: true + /@vitest/coverage-istanbul@0.34.3(vitest@0.34.3): resolution: {integrity: sha512-RdEGzydbbalyDLmmJ5Qm+T3Lrubw/U9iCnhzM2B1V57t4cVa1t6uyfIHdv68d1au4PRzkLhY7Xouwuhb7BeG+Q==} peerDependencies: @@ -3199,13 +3239,19 @@ packages: '@vue/shared': 3.2.47 estree-walker: 2.0.2 source-map: 0.6.1 - dev: true /@vue/compiler-dom@3.2.47: resolution: {integrity: sha512-dBBnEHEPoftUiS03a4ggEig74J2YBZ2UIeyfpcRM2tavgMWo4bsEfgCGsu+uJIL/vax9S+JztH8NmQerUo7shQ==} dependencies: '@vue/compiler-core': 3.2.47 '@vue/shared': 3.2.47 + + /@vue/compiler-sfc@2.7.14: + resolution: {integrity: sha512-aNmNHyLPsw+sVvlQFQ2/8sjNuLtK54TC6cuKnVzAY93ks4ZBrvwQSnkkIh7bsbNhum5hJBS00wSDipQ937f5DA==} + dependencies: + '@babel/parser': 7.22.13 + postcss: 8.4.28 + source-map: 0.6.1 dev: true /@vue/compiler-sfc@3.2.47: @@ -3221,14 +3267,23 @@ packages: magic-string: 0.25.9 postcss: 8.4.28 source-map: 0.6.1 - dev: true /@vue/compiler-ssr@3.2.47: resolution: {integrity: sha512-wVXC+gszhulcMD8wpxMsqSOpvDZ6xKXSVWkf50Guf/S+28hTAXPDYRTbLQ3EDkOP5Xz/+SY37YiwDquKbJOgZw==} dependencies: '@vue/compiler-dom': 3.2.47 '@vue/shared': 3.2.47 - dev: true + + /@vue/composition-api@1.7.1(vue@3.2.47): + resolution: {integrity: sha512-xDWoEtxGXhH9Ku3ROYX/rzhcpt4v31hpPU5zF3UeVC/qxA3dChmqU8zvTUYoKh3j7rzpNsoFOwqsWG7XPMlaFA==} + peerDependencies: + vue: '>= 2.5 < 2.7' + dependencies: + vue: 3.2.47 + + /@vue/devtools-api@6.5.0: + resolution: {integrity: sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==} + dev: false /@vue/reactivity-transform@3.2.47: resolution: {integrity: sha512-m8lGXw8rdnPVVIdIFhf0LeQ/ixyHkH5plYuS83yop5n7ggVJU+z5v0zecwEnX7fa7HNLBhh2qngJJkxpwEEmYA==} @@ -3238,20 +3293,17 @@ packages: '@vue/shared': 3.2.47 estree-walker: 2.0.2 magic-string: 0.25.9 - dev: true /@vue/reactivity@3.2.47: resolution: {integrity: sha512-7khqQ/75oyyg+N/e+iwV6lpy1f5wq759NdlS1fpAhFXa8VeAIKGgk2E/C4VF59lx5b+Ezs5fpp/5WsRYXQiKxQ==} dependencies: '@vue/shared': 3.2.47 - dev: true /@vue/runtime-core@3.2.47: resolution: {integrity: sha512-RZxbLQIRB/K0ev0K9FXhNbBzT32H9iRtYbaXb0ZIz2usLms/D55dJR2t6cIEUn6vyhS3ALNvNthI+Q95C+NOpA==} dependencies: '@vue/reactivity': 3.2.47 '@vue/shared': 3.2.47 - dev: true /@vue/runtime-dom@3.2.47: resolution: {integrity: sha512-ArXrFTjS6TsDei4qwNvgrdmHtD930KgSKGhS5M+j8QxXrDJYLqYw4RRcDy1bz1m1wMmb6j+zGLifdVHtkXA7gA==} @@ -3259,7 +3311,6 @@ packages: '@vue/runtime-core': 3.2.47 '@vue/shared': 3.2.47 csstype: 2.6.20 - dev: true /@vue/server-renderer@3.2.47(vue@3.2.47): resolution: {integrity: sha512-dN9gc1i8EvmP9RCzvneONXsKfBRgqFeFZLurmHOveL7oH6HiFXJw5OGu294n1nHc/HMgTy6LulU/tv5/A7f/LA==} @@ -3269,11 +3320,9 @@ packages: '@vue/compiler-ssr': 3.2.47 '@vue/shared': 3.2.47 vue: 3.2.47 - dev: true /@vue/shared@3.2.47: resolution: {integrity: sha512-BHGyyGN3Q97EZx0taMQ+OLNuZcW3d37ZEVmEAyeoA9ERdGvm9Irc/0Fua8SNyOtV1w6BS4q25wbMzJujO9HIfQ==} - dev: true /@yarnpkg/lockfile@1.1.0: resolution: {integrity: sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==} @@ -4454,7 +4503,6 @@ packages: /csstype@2.6.20: resolution: {integrity: sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA==} - dev: true /csstype@3.1.0: resolution: {integrity: sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==} @@ -4881,6 +4929,10 @@ packages: safe-array-concat: 1.0.0 dev: true + /es-module-lexer@1.3.0: + resolution: {integrity: sha512-vZK7T0N2CBmBOixhmjdqx2gWVbFZ4DXZ/NyRMZVlJXPa7CyFS+/a4QQsDGDQy9ZfEzxFuNEsMLeQJnKP2p5/JA==} + dev: true + /es-set-tostringtag@2.0.1: resolution: {integrity: sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==} engines: {node: '>= 0.4'} @@ -5639,7 +5691,6 @@ packages: /estree-walker@2.0.2: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} - dev: true /esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} @@ -6551,7 +6602,7 @@ packages: /is-reference@1.2.1: resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==} dependencies: - '@types/estree': 0.0.39 + '@types/estree': 1.0.1 dev: true /is-regex@1.1.4: @@ -7247,7 +7298,6 @@ packages: resolution: {integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==} dependencies: sourcemap-codec: 1.4.8 - dev: true /magic-string@0.26.4: resolution: {integrity: sha512-e5uXtVJ22aEpK9u1+eQf0fSxHeqwyV19K+uGnlROCxUhzwRip9tBsaMViK/0vC3viyPd5Gtucp3UmEp/Q2cPTQ==} @@ -7849,7 +7899,6 @@ packages: resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true - dev: true /natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} @@ -8484,7 +8533,6 @@ packages: nanoid: 3.3.6 picocolors: 1.0.0 source-map-js: 1.0.2 - dev: true /prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} @@ -9021,6 +9069,24 @@ packages: '@babel/code-frame': 7.22.13 dev: false + /rollup-plugin-esbuild@5.0.0(esbuild@0.18.20)(rollup@3.23.0): + resolution: {integrity: sha512-1cRIOHAPh8WQgdQQyyvFdeOdxuiyk+zB5zJ5+YOwrZP4cJ0MT3Fs48pQxrZeyZHcn+klFherytILVfE4aYrneg==} + engines: {node: '>=14.18.0', npm: '>=8.0.0'} + peerDependencies: + esbuild: '>=0.10.1' + rollup: ^1.20.0 || ^2.0.0 || ^3.0.0 + dependencies: + '@rollup/pluginutils': 5.0.3(rollup@3.23.0) + debug: 4.3.4 + es-module-lexer: 1.3.0 + esbuild: 0.18.20 + joycon: 3.1.1 + jsonc-parser: 3.2.0 + rollup: 3.23.0 + transitivePeerDependencies: + - supports-color + dev: true + /rollup-plugin-node-externals@6.1.0(rollup@3.23.0): resolution: {integrity: sha512-lFgwuW2zkHpoACW8afsjFUBxcBfAX8HMRkz9jyezsXLba5Ii46SxiJG3wGztFzL1QpQQaMoUnXdwz4YJScue7Q==} engines: {node: '>=16.0.0'} @@ -9387,7 +9453,6 @@ packages: /source-map-js@1.0.2: resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} engines: {node: '>=0.10.0'} - dev: true /source-map-support@0.5.21: resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} @@ -9418,7 +9483,6 @@ packages: /sourcemap-codec@1.4.8: resolution: {integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==} deprecated: Please use @jridgewell/sourcemap-codec instead - dev: true /spawn-command@0.0.2: resolution: {integrity: sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ==} @@ -10347,6 +10411,33 @@ packages: resolution: {integrity: sha512-gQpnTgkubC6hQgdIcRdYGDSDc+SaujOdyesZQMv6JlfQee/9Mp0Qhnys6WxDWvQnL5WZdT7o2Ul187aSt0Rq+w==} dev: false + /vue-demi@0.13.11(@vue/composition-api@1.7.1)(vue@3.2.47): + resolution: {integrity: sha512-IR8HoEEGM65YY3ZJYAjMlKygDQn25D5ajNFNoKh9RSDMQtlzCxtfQjdQgv9jjK+m3377SsJXY8ysq8kLCZL25A==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + peerDependencies: + '@vue/composition-api': ^1.0.0-rc.1 + vue: ^3.0.0-0 || ^2.6.0 + peerDependenciesMeta: + '@vue/composition-api': + optional: true + dependencies: + '@vue/composition-api': 1.7.1(vue@3.2.47) + vue: 3.2.47 + dev: false + + /vue@2.6.14: + resolution: {integrity: sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ==} + dev: true + + /vue@2.7.14: + resolution: {integrity: sha512-b2qkFyOM0kwqWFuQmgd4o+uHGU7T+2z3T+WQp8UBjADfEv2n4FEMffzBmCKNP0IGzOEEfYjvtcC62xaSKeQDrQ==} + dependencies: + '@vue/compiler-sfc': 2.7.14 + csstype: 3.1.0 + dev: true + /vue@3.2.47: resolution: {integrity: sha512-60188y/9Dc9WVrAZeUVSDxRQOZ+z+y5nO2ts9jWXSTkMvayiWxCWOWtBQoYjLeccfXkiiPZWAHcV+WTPhkqJHQ==} dependencies: @@ -10355,7 +10446,6 @@ packages: '@vue/runtime-dom': 3.2.47 '@vue/server-renderer': 3.2.47(vue@3.2.47) '@vue/shared': 3.2.47 - dev: true /w3c-xmlserializer@4.0.0: resolution: {integrity: sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==} diff --git a/scripts/getRollupConfig.js b/scripts/getRollupConfig.js index 88385ea03..476946c3a 100644 --- a/scripts/getRollupConfig.js +++ b/scripts/getRollupConfig.js @@ -9,6 +9,8 @@ import commonJS from '@rollup/plugin-commonjs' import externals from 'rollup-plugin-node-externals' import preserveDirectives from 'rollup-plugin-preserve-directives' import { rootDir } from './config.js' +import vue from '@vitejs/plugin-vue' +import esbuild from 'rollup-plugin-esbuild' /** @param {'development' | 'production'} type */ const forceEnvPlugin = (type) => @@ -106,7 +108,19 @@ function modernConfig(opts) { input: [opts.entryFile], output: forceBundle ? bundleOutput : normalOutput, plugins: [ + vue({ + isProduction: true, + }), commonJS(), + esbuild({ + exclude: [], + loaders: { + '.vue': 'ts', + }, + define: { + 'process.env.NODE_ENV': JSON.stringify('production'), + }, + }), babelPlugin('modern'), nodeResolve({ extensions: ['.ts', '.tsx'] }), forceDevEnv ? forceEnvPlugin('development') : undefined, @@ -181,7 +195,19 @@ function legacyConfig(opts) { input: [opts.entryFile], output: forceBundle ? bundleOutput : normalOutput, plugins: [ + vue({ + isProduction: true, + }), commonJS(), + esbuild({ + exclude: [], + loaders: { + '.vue': 'ts', + }, + define: { + 'process.env.NODE_ENV': JSON.stringify('production'), + }, + }), babelPlugin('legacy'), nodeResolve({ extensions: ['.ts', '.tsx'] }), forceDevEnv ? forceEnvPlugin('development') : undefined,