Giter VIP home page Giter VIP logo

vue.ts's Introduction

Vue.ts - Enhance your Vue.js experience with TypeScript

This repo contains a set of unplugin plugins for Vue.js 3, including the following:

๐Ÿ“ License

MIT. Made with โค๏ธ by Ray

vue.ts's People

Contributors

autofix-ci[bot] avatar renovate[bot] avatar so1ve avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vue.ts's Issues

complex-types not working for vite build

Describe the bug

Hi, I can't seem to get complex-types working for my Vue/Vite/Typescript project build, am currently still noticing the error mentioned in the vue core #8286 issue during the vite build step. Wondering if it could be an issue with my vite configuration which you can see below.

One thing I'm a little confused about is which version of complex-types I should be using in my Vite config, since I'm expecting complex-types to be applied during the build step, and Vite uses rollup for the build step. I'm currently including complex-types as a rollup plugin in my vite.config.ts

Output

error during build:
Error: [vite:vue] [@vue/compiler-sfc] Failed to resolve extends base type.
If this previously worked in 3.2, you can instruct the compiler to ignore this extend by adding /* @vue-ignore */ before it, for example:

interface Props extends /* @vue-ignore */ Base {}

Note: both in 3.2 or with the ignore, the properties in the base type are treated as fallthrough attrs at runtime.

/workspace/src/Button/MyButton.vue
6  |  import { ButtonHTMLAttributes } from "vue";
7  |  
8  |  interface MyButtonProps extends ButtonHTMLAttributes {
   |                                  ^^^^^^^^^^^^^^^^^^^^
9  |    label: string;
10 |  }
file: /workspace/src/Button/MyButton.vue
    at ScriptCompileContext.error (/workspace/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:15575:11)
    at resolveInterfaceMembers (/workspace/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18036:13)
    at innerResolveTypeElements (/workspace/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17813:14)
    at resolveTypeElements (/workspace/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17799:20)
    at innerResolveTypeElements (/workspace/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17866:16)
    at resolveTypeElements (/workspace/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17799:20)
    at resolveRuntimePropsFromType (/workspace/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:19324:20)
    at extractRuntimeProps (/workspace/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:19300:17)
    at genRuntimeProps (/workspace/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:19288:18)
    at Object.compileScript (/workspace/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:20384:21)

package.json

{
  "name": "vue-vite-component-library",
  "version": "1.0.0",
  "description": "JavaScript and TypeScript example starter project",
  "type": "module",
  "scripts": {
    "build": "vue-tsc --p ./tsconfig.build.json && vite build"
  },
  "dependencies": {
    "vue": "^3.4.21"
  },
  "devDependencies": {
    "@types/node": "^20.11.30",
    "@vitejs/plugin-vue": "^5.0.4",
    "@vue.ts/complex-types": "^0.5.0",
    "sass": "^1.72.0",
    "sass-loader": "^14.1.1",
    "typescript": "^5.2.2",
    "vite": "^5.2.0",
    "vite-plugin-dts": "^3.7.3",
    "vue-tsc": "^2.0.6"
  }
}

vite.config.ts

import { defineConfig } from "vite";
import { resolve } from "path";
import complexTypesRollup from "@vue.ts/complex-types/rollup";
import vue from "@vitejs/plugin-vue";
import dts from "vite-plugin-dts";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), dts({ tsconfigPath: "tsconfig.build.json" })],
  build: {
    lib: {
      entry: resolve(__dirname, "src/index.ts"),
      formats: ["es"],
    },
    rollupOptions: {
      external: ["vue"],
      plugins: [
        complexTypesRollup({
          tsconfigPath: resolve(__dirname, "tsconfig.build.json"),
        }),
      ],
    },
  },
});

Reproduction

https://codesandbox.io/p/devbox/rrzs2y

System Info

N/A

Used Package Manager

[email protected]

ts.isIntersectionTypeNode is not a function

Describe the bug

13:36:08 [vite] Internal server error: ts.isIntersectionTypeNode is not a function
Plugin: unplugin-vue-complex-types
File: E:/git/vue3-modal-demo/src/components/CommandDialog.vue
at Printer.print (file:///E:/git/vue3-modal-demo/node_modules/unplugin-vue-complex-types/dist/index.mjs:224:12)
at transform (file:///E:/git/vue3-modal-demo/node_modules/unplugin-vue-complex-types/dist/index.mjs:254:31)
at TransformContext.transform (file:///E:/git/vue3-modal-demo/node_modules/unplugin-vue-complex-types/dist/index.mjs:272:12)
at Object.transform (file:///E:/git/vue3-modal-demo/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:44352:62)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async loadAndTransform (file:///E:/git/vue3-modal-demo/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:55026:29)
at async viteTransformMiddleware (file:///E:/git/vue3-modal-demo/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:64430:32)

Reproduction

only import

System Info

System:
    OS: Windows 10 10.0.19042
    CPU: (6) x64 Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
    Memory: 5.49 GB / 15.85 GB
  Binaries:
    Node: 16.14.0 
    Yarn: 1.22.19 
    npm: 9.7.1 
    pnpm: 8.6.1
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (114.0.1823.43)
    Internet Explorer: 11.0.19041.1202

Used Package Manager

yarn

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Complex types truncates large unions

I have a union with about 120 strings in it. Setting aside whether a 120 string union is a good idea or not. When it gets expanded by complex types it prints out truncated with ... 95 more ... inserted into the code handed to vue causing a syntax error.

 [vite] Internal server error: [vue/compiler-sfc] Unexpected token (8:200)
 
 D:/programming/streamstuff/castmate2/plugins/input/renderer/src/components/KeyboardKeyView.vue
13 |  const props = defineProps<
14 |    {
15 |  modelValue: "Space" | "Escape" | "Tab" | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | "F13" | "F14" | "F15" | "F16" | "F17" | "F18" | "F19" | "F20" | "F21" | ... 95 more ... | undefined    
   |                                                                                                                                                                                                          ^
16 |  schema: SchemaKeyboardKey
17 |  } & {

Poking through the typescript compiler I think NodeBuilderFlags.NoTruncation is the flag that stops this from happening. But I could be wrong.

Can't handle several types

interface Props {
  foo?: number // Optional
  bar: "a" | "b" // union types, should be converted to string
}

Cannot resolve type reference in `printByType`

Describe the bug

https://github.com/unplugin/unplugin-vue-complex-types/blob/main/test/__snapshots__/fixtures.test.ts.snap#L41

Reproduction

https://github.com/unplugin/unplugin-vue-complex-types/blob/main/test/__snapshots__/fixtures.test.ts.snap#L41

System Info

N/A

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Please release a new version?

Describe the bug

image

Reproduction

unnecessary

System Info

N/A

Used Package Manager

yarn

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

๐Ÿณ Renovate Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: File contents are invalid JSON but parse using JSON5. Support for this will be removed in a future release so please change to a support .json5 file name or ensure correct JSON syntax.

Pending Approval

These branches will be created by Renovate only once you click their checkbox below.

  • chore(deps): update actions/checkout action to v4
  • chore(deps): update actions/setup-node action to v4
  • chore(deps): update dependency eslint to v9
  • chore(deps): update dependency vitest to v1
  • chore(deps): update dessant/lock-threads action to v5
  • chore(deps): update pnpm to v9
  • ๐Ÿ” Create all pending approval PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/autofix-ci.yml
  • actions/checkout v3
  • actions/setup-node v3
  • autofix-ci/action ea32e3a12414e6d3183163c3424a7d7a8631ad84
.github/workflows/ci.yml
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
.github/workflows/lock.yml
  • dessant/lock-threads v4
.github/workflows/release.yml
  • actions/checkout v3
  • actions/setup-node v3
npm
package.json
  • @antfu/ni ^0.21.8
  • @so1ve/eslint-config ^2.0.0
  • @so1ve/prettier-config ^2.0.0
  • @types/node ^20.8.10
  • @vue-macros/test-utils ^1.4.0
  • bumpp ^9.2.0
  • eslint ^8.57.0
  • prettier ^3.2.5
  • typescript ^5.2.2
  • unbuild ^2.0.0
  • vite ^5.0.2
  • vite-tsconfig-paths ^4.2.1
  • vitest ^0.34.6
  • vue ^3.4.21
  • pnpm 8.15.6
packages/common/package.json
  • @rollup/pluginutils ^5.0.5
packages/complex-types/package.json
  • @nuxt/kit ^3.8.1
  • magic-string ^0.30.5
  • unplugin ^1.5.0
  • @nuxt/schema ^3.8.1
  • @vue-macros/better-define ^1.6.12
  • rollup ^4.3.0
  • unbuild ^2.0.0
  • vite ^5.0.2
  • webpack ^5.89.0
  • typescript ^5.2.2
  • vue ^3.3.7
packages/language/package.json
  • @volar/typescript ~2.1.6
  • @vue/language-core 2.0.7
packages/tsx-auto-props/package.json
  • @nuxt/kit ^3.8.1
  • magic-string ^0.30.5
  • unplugin ^1.5.0
  • @nuxt/schema ^3.8.1
  • rollup ^4.3.0
  • unbuild ^2.0.0
  • vite ^5.0.2
  • webpack ^5.89.0
  • typescript ^5.2.2
  • vue ^3.3.7

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.